diff --git a/client/accessnodes.go b/client/accessnodes.go deleted file mode 100644 index e195878a7a..0000000000 --- a/client/accessnodes.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) AddAccessNode(chainID isc.ChainID, pubKey string) error { - return c.do(http.MethodPut, routes.AdmAccessNode(chainID.String(), pubKey), nil, nil) -} - -func (c *WaspClient) RemoveAccessNode(chainID isc.ChainID, pubKey string) error { - return c.do(http.MethodDelete, routes.AdmAccessNode(chainID.String(), pubKey), nil, nil) -} diff --git a/client/activatechain.go b/client/activatechain.go deleted file mode 100644 index a093dd8a46..0000000000 --- a/client/activatechain.go +++ /dev/null @@ -1,18 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// ActivateChain sends a request to activate a chain in the wasp node -func (c *WaspClient) ActivateChain(chainID isc.ChainID) error { - return c.do(http.MethodPost, routes.ActivateChain(chainID.String()), nil, nil) -} - -// DeactivateChain sends a request to deactivate a chain in the wasp node -func (c *WaspClient) DeactivateChain(chainID isc.ChainID) error { - return c.do(http.MethodPost, routes.DeactivateChain(chainID.String()), nil, nil) -} diff --git a/client/authentication.go b/client/authentication.go deleted file mode 100644 index d9cf650b54..0000000000 --- a/client/authentication.go +++ /dev/null @@ -1,34 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/authentication/shared" -) - -func (c *WaspClient) Login(username, password string) (string, error) { - loginRequest := shared.LoginRequest{ - Username: username, - Password: password, - } - - loginResponse := shared.LoginResponse{} - - err := c.do(http.MethodPost, shared.AuthRoute(), &loginRequest, &loginResponse) - if err != nil { - return "", err - } - - return loginResponse.JWT, nil -} - -func (c *WaspClient) AuthInfo() (*shared.AuthInfoModel, error) { - authInfoResponse := shared.AuthInfoModel{} - - err := c.do(http.MethodGet, shared.AuthInfoRoute(), nil, &authInfoResponse) - if err != nil { - return nil, err - } - - return &authInfoResponse, nil -} diff --git a/client/callview.go b/client/callview.go deleted file mode 100644 index 853b747d6c..0000000000 --- a/client/callview.go +++ /dev/null @@ -1,29 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) CallView(chainID isc.ChainID, hContract isc.Hname, functionName string, args dict.Dict) (dict.Dict, error) { - arguments := args - if arguments == nil { - arguments = dict.Dict(nil) - } - var res dict.Dict - err := c.do(http.MethodPost, routes.CallViewByName(chainID.String(), hContract.String(), functionName), arguments, &res) - return res, err -} - -func (c *WaspClient) CallViewByHname(chainID isc.ChainID, hContract, hFunction isc.Hname, args dict.Dict) (dict.Dict, error) { - arguments := args - if arguments == nil { - arguments = dict.Dict(nil) - } - var res dict.Dict - err := c.do(http.MethodPost, routes.CallViewByHname(chainID.String(), hContract.String(), hFunction.String()), arguments, &res) - return res, err -} diff --git a/client/chain_info.go b/client/chain_info.go deleted file mode 100644 index 6e45f57e37..0000000000 --- a/client/chain_info.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// GetChainRecord fetches ChainInfo by address -func (c *WaspClient) GetChainInfo(chainID isc.ChainID) (*model.ChainInfo, error) { - res := &model.ChainInfo{} - if err := c.do(http.MethodGet, routes.GetChainInfo(chainID.String()), nil, res); err != nil { - return nil, err - } - return res, nil -} diff --git a/client/chain_record.go b/client/chain_record.go deleted file mode 100644 index b26b667113..0000000000 --- a/client/chain_record.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// PutChainRecord sends a request to write a Record -func (c *WaspClient) PutChainRecord(rec *registry.ChainRecord) error { - return c.do(http.MethodPost, routes.PutChainRecord(), model.NewChainRecord(rec), nil) -} - -// GetChainRecord fetches a Record by address -func (c *WaspClient) GetChainRecord(chainID isc.ChainID) (*registry.ChainRecord, error) { - res := &model.ChainRecord{} - if err := c.do(http.MethodGet, routes.GetChainRecord(chainID.String()), nil, res); err != nil { - return nil, err - } - return res.Record() -} - -// GetChainRecordList fetches the list of all chains in the node -func (c *WaspClient) GetChainRecordList() ([]*registry.ChainRecord, error) { - var res []*model.ChainRecord - if err := c.do(http.MethodGet, routes.ListChainRecords(), nil, &res); err != nil { - return nil, err - } - list := make([]*registry.ChainRecord, len(res)) - for i, bd := range res { - rec, err := bd.Record() - if err != nil { - return nil, err - } - list[i] = rec - } - return list, nil -} diff --git a/client/chainclient/callview.go b/client/chainclient/callview.go deleted file mode 100644 index a6bdb1ee17..0000000000 --- a/client/chainclient/callview.go +++ /dev/null @@ -1,11 +0,0 @@ -package chainclient - -import ( - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/dict" -) - -// CallView sends a request to call a view function of a given contract, and returns the result of the call -func (c *Client) CallView(hContract isc.Hname, functionName string, args dict.Dict) (dict.Dict, error) { - return c.WaspClient.CallView(c.ChainID, hContract, functionName, args) -} diff --git a/client/chainclient/chainrecord.go b/client/chainclient/chainrecord.go deleted file mode 100644 index e2617144ca..0000000000 --- a/client/chainclient/chainrecord.go +++ /dev/null @@ -1,8 +0,0 @@ -package chainclient - -import "github.com/iotaledger/wasp/packages/registry" - -// GetChainRecord fetches the chain's Record -func (c *Client) GetChainRecord() (*registry.ChainRecord, error) { - return c.WaspClient.GetChainRecord(c.ChainID) -} diff --git a/client/chainclient/checkrequest.go b/client/chainclient/checkrequest.go deleted file mode 100644 index 71f279278b..0000000000 --- a/client/chainclient/checkrequest.go +++ /dev/null @@ -1,33 +0,0 @@ -package chainclient - -import ( - "errors" - "fmt" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" -) - -// CheckRequestResult fetches the receipt for the given request ID, and returns -// an error indicating whether the request was processed successfully. -func (c *Client) CheckRequestResult(reqID isc.RequestID) error { - ret, err := c.CallView(blocklog.Contract.Hname(), blocklog.ViewGetRequestReceipt.Name, dict.Dict{ - blocklog.ParamRequestID: codec.EncodeRequestID(reqID), - }) - if err != nil { - return fmt.Errorf("could not fetch receipt for request: %w", err) - } - if !ret.MustHas(blocklog.ParamRequestRecord) { - return errors.New("could not fetch receipt for request: not found in blocklog") - } - req, err := blocklog.RequestReceiptFromBytes(ret.MustGet(blocklog.ParamRequestRecord)) - if err != nil { - return fmt.Errorf("could not decode receipt for request: %w", err) - } - if req.Error != nil { - return fmt.Errorf("the request was rejected: %v", req.Error) - } - return nil -} diff --git a/client/chainclient/evm.go b/client/chainclient/evm.go deleted file mode 100644 index 3af043876a..0000000000 --- a/client/chainclient/evm.go +++ /dev/null @@ -1,11 +0,0 @@ -package chainclient - -import ( - "github.com/ethereum/go-ethereum/common" - - "github.com/iotaledger/wasp/packages/isc" -) - -func (c *Client) RequestIDByEVMTransactionHash(txHash common.Hash) (isc.RequestID, error) { - return c.WaspClient.RequestIDByEVMTransactionHash(c.ChainID, txHash) -} diff --git a/client/chainclient/stateget.go b/client/chainclient/stateget.go deleted file mode 100644 index 1efb985885..0000000000 --- a/client/chainclient/stateget.go +++ /dev/null @@ -1,6 +0,0 @@ -package chainclient - -// StateGet fetches the raw value associated with the given key in the chain state -func (c *Client) StateGet(key string) ([]byte, error) { - return c.WaspClient.StateGet(c.ChainID, key) -} diff --git a/client/client.go b/client/client.go deleted file mode 100644 index 03ed6c03fa..0000000000 --- a/client/client.go +++ /dev/null @@ -1,136 +0,0 @@ -package client - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "strings" - - "github.com/iotaledger/wasp/packages/webapi/v1/model" -) - -var ErrNotAuthorized = errors.New("unauthorized request rejected") - -// WaspClient allows to make requests to the Wasp web API. -type WaspClient struct { - httpClient http.Client - baseURL string - token string - logFunc func(msg string, args ...interface{}) -} - -// NewWaspClient returns a new *WaspClient with the given baseURL and httpClient. -func NewWaspClient(baseURL string, httpClient ...http.Client) *WaspClient { - if !strings.HasPrefix(baseURL, "http") { - baseURL = "http://" + baseURL - } - if len(httpClient) > 0 { - return &WaspClient{baseURL: baseURL, httpClient: httpClient[0]} - } - return &WaspClient{baseURL: baseURL} -} - -func (c *WaspClient) WithLogFunc(logFunc func(msg string, args ...interface{})) *WaspClient { - c.logFunc = logFunc - return c -} - -func (c *WaspClient) WithToken(token string) *WaspClient { - if len(token) > 0 { - c.token = token - } - - return c -} - -func (c *WaspClient) log(msg string, args ...interface{}) { - if c.logFunc == nil { - return - } - c.logFunc(msg, args...) -} - -func processResponse(res *http.Response, decodeTo interface{}) error { - if res == nil || res.Body == nil { - return errors.New("unable to read response body") - } - defer res.Body.Close() - - if res.StatusCode == http.StatusUnauthorized { - return ErrNotAuthorized - } - - resBody, err := io.ReadAll(res.Body) - if err != nil { - return fmt.Errorf("unable to read response body: %w", err) - } - - if res.StatusCode >= 200 && res.StatusCode < 300 { - if decodeTo != nil { - return json.Unmarshal(resBody, decodeTo) - } - return nil - } - - errRes := &model.HTTPError{} - if err := json.Unmarshal(resBody, errRes); err != nil { - errRes.Message = http.StatusText(res.StatusCode) - } - errRes.StatusCode = res.StatusCode - errRes.Message = string(resBody) - return errRes -} - -func (c *WaspClient) do(method, route string, reqObj, resObj interface{}) error { - // marshal request object - var data []byte - if reqObj != nil { - var err error - data, err = json.Marshal(reqObj) - if err != nil { - return fmt.Errorf("json.Marshal: %w", err) - } - } - - // construct request - url := fmt.Sprintf("%s/%s", strings.TrimRight(c.baseURL, "/"), strings.TrimLeft(route, "/")) - req, err := http.NewRequestWithContext(context.Background(), method, url, func() io.Reader { - if data == nil { - return nil - } - return bytes.NewReader(data) - }()) - if err != nil { - return fmt.Errorf("http.NewRequest [%s %s]: %w", method, url, err) - } - - if data != nil { - req.Header.Set("Content-Type", "application/json") - } - - if c.token != "" { - req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", c.token)) - } - - // make the request - res, err := c.httpClient.Do(req) - if err != nil { - return fmt.Errorf("%s %s: %w", method, url, err) - } - - // write response into response object - err = processResponse(res, resObj) - if err != nil { - return fmt.Errorf("%s %s: %w", method, url, err) - } - return nil -} - -// BaseURL returns the baseURL of the client. -func (c *WaspClient) BaseURL() string { - return c.baseURL -} diff --git a/client/dkshares.go b/client/dkshares.go deleted file mode 100644 index 8de51364fd..0000000000 --- a/client/dkshares.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -// This API is used to maintain the distributed key shares. -// The Golang API in this file tries to follow the REST conventions. - -import ( - "net/http" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// DKSharesPost creates a new DKShare and returns its state. -func (c *WaspClient) DKSharesPost(request *model.DKSharesPostRequest) (*model.DKSharesInfo, error) { - var response model.DKSharesInfo - err := c.do(http.MethodPost, routes.DKSharesPost(), request, &response) - return &response, err -} - -// DKSharesGet retrieves the representation of an existing DKShare. -func (c *WaspClient) DKSharesGet(addr iotago.Address) (*model.DKSharesInfo, error) { - var response model.DKSharesInfo - err := c.do(http.MethodGet, routes.DKSharesGet(addr.String()), nil, &response) - return &response, err -} diff --git a/client/evm.go b/client/evm.go deleted file mode 100644 index a545af583b..0000000000 --- a/client/evm.go +++ /dev/null @@ -1,19 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/ethereum/go-ethereum/common" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) RequestIDByEVMTransactionHash(chainID isc.ChainID, txHash common.Hash) (isc.RequestID, error) { - var res model.RequestID - if err := c.do(http.MethodGet, routes.RequestIDByEVMTransactionHash(chainID.String(), txHash.String()), nil, &res); err != nil { - return isc.RequestID{}, err - } - return res.RequestID(), nil -} diff --git a/client/gas.go b/client/gas.go deleted file mode 100644 index f5a9c9f1a9..0000000000 --- a/client/gas.go +++ /dev/null @@ -1,15 +0,0 @@ -package client - -import ( - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/vm/gas" -) - -func (c *WaspClient) GetGasFeePolicy(chainID isc.ChainID) (*gas.GasFeePolicy, error) { - res, err := c.CallViewByHname(chainID, governance.Contract.Hname(), governance.ViewGetFeePolicy.Hname(), nil) - if err != nil { - return nil, err - } - return gas.FeePolicyFromBytes(res.MustGet(governance.ParamFeePolicyBytes)) -} diff --git a/client/info.go b/client/info.go deleted file mode 100644 index 98f4a89d74..0000000000 --- a/client/info.go +++ /dev/null @@ -1,17 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// Info fetches general information about the node. -func (c *WaspClient) Info() (*model.InfoResponse, error) { - res := &model.InfoResponse{} - if err := c.do(http.MethodGet, routes.Info(), nil, res); err != nil { - return nil, err - } - return res, nil -} diff --git a/client/metrics.go b/client/metrics.go deleted file mode 100644 index 79098cbe7b..0000000000 --- a/client/metrics.go +++ /dev/null @@ -1,44 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// GetNodeConnectionMetrics fetches a connection to L1 metrics for all addresses -func (c *WaspClient) GetNodeConnectionMetrics() (*model.NodeConnectionMetrics, error) { - ncm := &model.NodeConnectionMetrics{} - if err := c.do(http.MethodGet, routes.GetChainsNodeConnectionMetrics(), nil, ncm); err != nil { - return nil, err - } - return ncm, nil -} - -// GetNodeConnectionMetrics fetches a connection to L1 metrics by address -func (c *WaspClient) GetChainNodeConnectionMetrics(chainID isc.ChainID) (*model.NodeConnectionMessagesMetrics, error) { - ncmm := &model.NodeConnectionMessagesMetrics{} - if err := c.do(http.MethodGet, routes.GetChainNodeConnectionMetrics(chainID.String()), nil, ncmm); err != nil { - return nil, err - } - return ncmm, nil -} - -// GetNodeConnectionMetrics fetches a consensus workflow status by address -func (c *WaspClient) GetChainConsensusWorkflowStatus(chainID isc.ChainID) (*model.ConsensusWorkflowStatus, error) { - ncmm := &model.ConsensusWorkflowStatus{} - if err := c.do(http.MethodGet, routes.GetChainConsensusWorkflowStatus(chainID.String()), nil, ncmm); err != nil { - return nil, err - } - return ncmm, nil -} - -func (c *WaspClient) GetChainConsensusPipeMetrics(chainID isc.ChainID) (*model.ConsensusPipeMetrics, error) { - ncmm := &model.ConsensusPipeMetrics{} - if err := c.do(http.MethodGet, routes.GetChainConsensusPipeMetrics(chainID.String()), nil, ncmm); err != nil { - return nil, err - } - return ncmm, nil -} diff --git a/client/multiclient/activate.go b/client/multiclient/activate.go deleted file mode 100644 index 5f68a8efc8..0000000000 --- a/client/multiclient/activate.go +++ /dev/null @@ -1,20 +0,0 @@ -package multiclient - -import ( - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/packages/isc" -) - -// ActivateChain sends a request to activate a chain in all wasp nodes -func (m *MultiClient) ActivateChain(chainID isc.ChainID) error { - return m.Do(func(i int, w *client.WaspClient) error { - return w.ActivateChain(chainID) - }) -} - -// DeactivateChain sends a request to deactivate a chain in all wasp nodes -func (m *MultiClient) DeactivateChain(chainID isc.ChainID) error { - return m.Do(func(i int, w *client.WaspClient) error { - return w.DeactivateChain(chainID) - }) -} diff --git a/client/multiclient/chain_record.go b/client/multiclient/chain_record.go deleted file mode 100644 index d2c2d34eb5..0000000000 --- a/client/multiclient/chain_record.go +++ /dev/null @@ -1,13 +0,0 @@ -package multiclient - -import ( - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/packages/registry" -) - -// PutChainRecord calls PutChainRecord in all wasp nodes -func (m *MultiClient) PutChainRecord(bd *registry.ChainRecord) error { - return m.Do(func(i int, w *client.WaspClient) error { - return w.PutChainRecord(bd) - }) -} diff --git a/client/multiclient/dkshares.go b/client/multiclient/dkshares.go deleted file mode 100644 index 58edd024e3..0000000000 --- a/client/multiclient/dkshares.go +++ /dev/null @@ -1,18 +0,0 @@ -package multiclient - -import ( - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/packages/webapi/v1/model" -) - -// DKSharesGet retrieves distributed key info with specific ChainID from multiple hosts. -func (m *MultiClient) DKSharesGet(sharedAddress iotago.Address) ([]*model.DKSharesInfo, error) { - ret := make([]*model.DKSharesInfo, len(m.nodes)) - err := m.Do(func(i int, w *client.WaspClient) error { - k, err := w.DKSharesGet(sharedAddress) - ret[i] = k - return err - }) - return ret, err -} diff --git a/client/node_ownership.go b/client/node_ownership.go deleted file mode 100644 index e36aeb2be9..0000000000 --- a/client/node_ownership.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -import ( - "net/http" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) NodeOwnershipCertificate(nodePubKey *cryptolib.PublicKey, ownerAddress iotago.Address) (governance.NodeOwnershipCertificate, error) { - req := model.NodeOwnerCertificateRequest{ - NodePubKey: model.NewBytes(nodePubKey.AsBytes()), - OwnerAddress: model.NewAddress(ownerAddress), - } - res := model.NodeOwnerCertificateResponse{} - if err := c.do(http.MethodPost, routes.AdmNodeOwnerCertificate(), req, &res); err != nil { - return nil, err - } - return governance.NewNodeOwnershipCertificateFromBytes(res.Certificate.Bytes()), nil -} diff --git a/client/offledger.go b/client/offledger.go deleted file mode 100644 index 109e049ee6..0000000000 --- a/client/offledger.go +++ /dev/null @@ -1,16 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) PostOffLedgerRequest(chainID isc.ChainID, req isc.OffLedgerRequest) error { - data := model.OffLedgerRequestBody{ - Request: model.NewBytes(req.Bytes()), - } - return c.do(http.MethodPost, routes.NewRequest(chainID.String()), data, nil) -} diff --git a/client/peering.go b/client/peering.go deleted file mode 100644 index 47955d124a..0000000000 --- a/client/peering.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func (c *WaspClient) GetPeeringSelf() (*model.PeeringTrustedNode, error) { - var response *model.PeeringTrustedNode - err := c.do(http.MethodGet, routes.PeeringSelfGet(), nil, &response) - return response, err -} - -func (c *WaspClient) GetPeeringTrustedList() ([]*model.PeeringTrustedNode, error) { - var response []*model.PeeringTrustedNode - err := c.do(http.MethodGet, routes.PeeringTrustedList(), nil, &response) - return response, err -} - -func (c *WaspClient) GetPeeringTrusted(pubKey string) (*model.PeeringTrustedNode, error) { - var response *model.PeeringTrustedNode - err := c.do(http.MethodGet, routes.PeeringTrustedGet(pubKey), nil, &response) - return response, err -} - -func (c *WaspClient) PutPeeringTrusted(pubKey, netID string) (*model.PeeringTrustedNode, error) { - request := model.PeeringTrustedNode{ - PubKey: pubKey, - NetID: netID, - } - var response model.PeeringTrustedNode - err := c.do(http.MethodPut, routes.PeeringTrustedPut(pubKey), request, &response) - return &response, err -} - -func (c *WaspClient) PostPeeringTrusted(pubKey, netID string) (*model.PeeringTrustedNode, error) { - request := model.PeeringTrustedNode{ - PubKey: pubKey, - NetID: netID, - } - var response model.PeeringTrustedNode - err := c.do(http.MethodPost, routes.PeeringTrustedPost(), request, &response) - return &response, err -} - -func (c *WaspClient) DeletePeeringTrusted(pubKey string) error { - err := c.do(http.MethodDelete, routes.PeeringTrustedDelete(pubKey), nil, nil) - return err -} diff --git a/client/reqstatus.go b/client/reqstatus.go deleted file mode 100644 index 095815adfb..0000000000 --- a/client/reqstatus.go +++ /dev/null @@ -1,85 +0,0 @@ -package client - -import ( - "encoding/json" - "net/http" - "time" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// RequestReceipt fetches the processing status of a request. -func (c *WaspClient) RequestReceipt(chainID isc.ChainID, reqID isc.RequestID) (*isc.Receipt, error) { - var res model.RequestReceiptResponse - if err := c.do(http.MethodGet, routes.RequestReceipt(chainID.String(), reqID.String()), nil, &res); err != nil { - return nil, err - } - if res.Receipt == "" { - return nil, nil - } - var receipt isc.Receipt - err := json.Unmarshal([]byte(res.Receipt), &receipt) - if err != nil { - return nil, err - } - return &receipt, nil -} - -const waitRequestProcessedDefaultTimeout = 30 * time.Second - -// WaitUntilRequestProcessed blocks until the request has been processed by the node -func (c *WaspClient) WaitUntilRequestProcessed(chainID isc.ChainID, reqID isc.RequestID, timeout time.Duration) (*isc.Receipt, error) { - now := time.Now() - if timeout == 0 { - timeout = waitRequestProcessedDefaultTimeout - } - var res model.RequestReceiptResponse - err := c.do( - http.MethodGet, - routes.WaitRequestProcessed(chainID.String(), reqID.String()), - &model.WaitRequestProcessedParams{Timeout: timeout}, - &res, - ) - if err != nil { - c.log("WaitUntilRequestProcessed, chainID=%v, reqID=%v failed in %v with: %v", chainID, reqID, time.Since(now), err) - return nil, err - } - var receipt isc.Receipt - err = json.Unmarshal([]byte(res.Receipt), &receipt) - if err != nil { - c.log("WaitUntilRequestProcessed, chainID=%v, reqID=%v failed in %v with: %v", chainID, reqID, time.Since(now), err) - return nil, err - } - c.log("WaitUntilRequestProcessed, chainID=%v, reqID=%v done in %v", chainID, reqID, time.Since(now)) - return &receipt, nil -} - -// WaitUntilAllRequestsProcessed blocks until all requests in the given transaction have been processed -// by the node -func (c *WaspClient) WaitUntilAllRequestsProcessed(chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*isc.Receipt, error) { - now := time.Now() - txID, err := tx.ID() - if err != nil { - c.log("WaitUntilAllRequestsProcessed, chainID=%v, tx=? failed in %v with: %v", chainID, time.Since(now), err) - return nil, err - } - reqs, err := isc.RequestsInTransaction(tx) - if err != nil { - c.log("WaitUntilAllRequestsProcessed, chainID=%v, tx=%v failed in %v with: %v", chainID, txID.ToHex(), time.Since(now), err) - return nil, err - } - ret := make([]*isc.Receipt, len(reqs)) - for i, req := range reqs[chainID] { - receipt, err := c.WaitUntilRequestProcessed(chainID, req.ID(), timeout) - if err != nil { - c.log("WaitUntilAllRequestsProcessed, chainID=%v, tx=%v failed in %v with: %v", chainID, txID.ToHex(), time.Since(now), err) - return nil, err - } - ret[i] = receipt - } - c.log("WaitUntilAllRequestsProcessed, chainID=%v, tx=%v done in %v", chainID, txID.ToHex(), time.Since(now)) - return ret, nil -} diff --git a/client/scclient/callview.go b/client/scclient/callview.go deleted file mode 100644 index 42993803ca..0000000000 --- a/client/scclient/callview.go +++ /dev/null @@ -1,9 +0,0 @@ -package scclient - -import ( - "github.com/iotaledger/wasp/packages/kv/dict" -) - -func (c *SCClient) CallView(functionName string, args dict.Dict) (dict.Dict, error) { - return c.ChainClient.CallView(c.ContractHname, functionName, args) -} diff --git a/client/scclient/stateget.go b/client/scclient/stateget.go deleted file mode 100644 index 666bc943dd..0000000000 --- a/client/scclient/stateget.go +++ /dev/null @@ -1,6 +0,0 @@ -package scclient - -// StateGet fetches the raw value associated with the given key in the smart contract state -func (c *SCClient) StateGet(key string) ([]byte, error) { - return c.ChainClient.StateGet(string(c.ContractHname.Bytes()) + key) -} diff --git a/client/shutdown.go b/client/shutdown.go deleted file mode 100644 index 54f97c04f0..0000000000 --- a/client/shutdown.go +++ /dev/null @@ -1,12 +0,0 @@ -package client - -import ( - "net/http" - - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// Shutdown shuts down the node -func (c *WaspClient) Shutdown() error { - return c.do(http.MethodGet, routes.Shutdown(), nil, nil) -} diff --git a/client/stateget.go b/client/stateget.go deleted file mode 100644 index a278034bf4..0000000000 --- a/client/stateget.go +++ /dev/null @@ -1,18 +0,0 @@ -package client - -import ( - "net/http" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -// StateGet fetches the raw value associated with the given key in the chain state -func (c *WaspClient) StateGet(chainID isc.ChainID, key string) ([]byte, error) { - var res []byte - if err := c.do(http.MethodGet, routes.StateGet(chainID.String(), iotago.EncodeHex([]byte(key))), nil, &res); err != nil { - return nil, err - } - return res, nil -} diff --git a/clients/apiclient/.gitignore b/clients/apiclient/.gitignore new file mode 100644 index 0000000000..daf913b1b3 --- /dev/null +++ b/clients/apiclient/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/clients/apiclient/.openapi-generator-ignore b/clients/apiclient/.openapi-generator-ignore new file mode 100644 index 0000000000..880b759c42 --- /dev/null +++ b/clients/apiclient/.openapi-generator-ignore @@ -0,0 +1,28 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md + +README.md +generate_client.sh +go.mod +test \ No newline at end of file diff --git a/clients/apiclient/.openapi-generator/FILES b/clients/apiclient/.openapi-generator/FILES new file mode 100644 index 0000000000..074e4295be --- /dev/null +++ b/clients/apiclient/.openapi-generator/FILES @@ -0,0 +1,197 @@ +.gitignore +.travis.yml +api/openapi.yaml +api_auth.go +api_chains.go +api_corecontracts.go +api_metrics.go +api_node.go +api_requests.go +api_users.go +client.go +configuration.go +docs/AccountListResponse.md +docs/AccountNFTsResponse.md +docs/AccountNonceResponse.md +docs/AddUserRequest.md +docs/AliasOutputMetricItem.md +docs/Assets.md +docs/AssetsResponse.md +docs/AuthApi.md +docs/AuthInfoModel.md +docs/BaseToken.md +docs/Blob.md +docs/BlobInfoResponse.md +docs/BlobListResponse.md +docs/BlobValueResponse.md +docs/BlockInfoResponse.md +docs/BlockReceiptError.md +docs/BlockReceiptsResponse.md +docs/BurnLog.md +docs/BurnRecord.md +docs/CallTarget.md +docs/ChainInfoResponse.md +docs/ChainMetrics.md +docs/ChainRecord.md +docs/ChainsApi.md +docs/CommitteeInfoResponse.md +docs/CommitteeNode.md +docs/ConsensusPipeMetrics.md +docs/ConsensusWorkflowMetrics.md +docs/ContractCallViewRequest.md +docs/ContractInfoResponse.md +docs/ControlAddressesResponse.md +docs/CorecontractsApi.md +docs/DKSharesInfo.md +docs/DKSharesPostRequest.md +docs/ErrorMessageFormatResponse.md +docs/EventsResponse.md +docs/FoundryOutputResponse.md +docs/GasFeePolicy.md +docs/GovAllowedStateControllerAddressesResponse.md +docs/GovChainInfoResponse.md +docs/GovChainOwnerResponse.md +docs/InOutput.md +docs/InOutputMetricItem.md +docs/InStateOutput.md +docs/InStateOutputMetricItem.md +docs/InfoResponse.md +docs/InterfaceMetricItem.md +docs/Item.md +docs/JSONDict.md +docs/L1Params.md +docs/LoginRequest.md +docs/LoginResponse.md +docs/MetricsApi.md +docs/MilestoneInfo.md +docs/MilestoneMetricItem.md +docs/NFTDataResponse.md +docs/NativeToken.md +docs/NativeTokenIDRegistryResponse.md +docs/NodeApi.md +docs/NodeOwnerCertificateRequest.md +docs/NodeOwnerCertificateResponse.md +docs/OffLedgerRequest.md +docs/OnLedgerRequest.md +docs/OnLedgerRequestMetricItem.md +docs/Output.md +docs/OutputID.md +docs/PeeringNodeIdentityResponse.md +docs/PeeringNodeStatusResponse.md +docs/PeeringTrustRequest.md +docs/ProtocolParameters.md +docs/PublisherStateTransactionItem.md +docs/ReceiptError.md +docs/ReceiptResponse.md +docs/RentStructure.md +docs/RequestDetail.md +docs/RequestIDResponse.md +docs/RequestIDsResponse.md +docs/RequestProcessedResponse.md +docs/RequestReceiptResponse.md +docs/RequestsApi.md +docs/StateResponse.md +docs/StateTransaction.md +docs/Transaction.md +docs/TransactionIDMetricItem.md +docs/TransactionMetricItem.md +docs/TxInclusionStateMsg.md +docs/TxInclusionStateMsgMetricItem.md +docs/UTXOInputMetricItem.md +docs/UpdateUserPasswordRequest.md +docs/UpdateUserPermissionsRequest.md +docs/User.md +docs/UsersApi.md +docs/ValidationError.md +docs/VersionResponse.md +git_push.sh +go.sum +model_account_list_response.go +model_account_nfts_response.go +model_account_nonce_response.go +model_add_user_request.go +model_alias_output_metric_item.go +model_assets.go +model_assets_response.go +model_auth_info_model.go +model_base_token.go +model_blob.go +model_blob_info_response.go +model_blob_list_response.go +model_blob_value_response.go +model_block_info_response.go +model_block_receipt_error.go +model_block_receipts_response.go +model_burn_log.go +model_burn_record.go +model_call_target.go +model_chain_info_response.go +model_chain_metrics.go +model_chain_record.go +model_committee_info_response.go +model_committee_node.go +model_consensus_pipe_metrics.go +model_consensus_workflow_metrics.go +model_contract_call_view_request.go +model_contract_info_response.go +model_control_addresses_response.go +model_dk_shares_info.go +model_dk_shares_post_request.go +model_error_message_format_response.go +model_events_response.go +model_foundry_output_response.go +model_gas_fee_policy.go +model_gov_allowed_state_controller_addresses_response.go +model_gov_chain_info_response.go +model_gov_chain_owner_response.go +model_in_output.go +model_in_output_metric_item.go +model_in_state_output.go +model_in_state_output_metric_item.go +model_info_response.go +model_interface_metric_item.go +model_item.go +model_json_dict.go +model_l1_params.go +model_login_request.go +model_login_response.go +model_milestone_info.go +model_milestone_metric_item.go +model_native_token.go +model_native_token_id_registry_response.go +model_nft_data_response.go +model_node_owner_certificate_request.go +model_node_owner_certificate_response.go +model_off_ledger_request.go +model_on_ledger_request.go +model_on_ledger_request_metric_item.go +model_output.go +model_output_id.go +model_peering_node_identity_response.go +model_peering_node_status_response.go +model_peering_trust_request.go +model_protocol_parameters.go +model_publisher_state_transaction_item.go +model_receipt_error.go +model_receipt_response.go +model_rent_structure.go +model_request_detail.go +model_request_id_response.go +model_request_ids_response.go +model_request_processed_response.go +model_request_receipt_response.go +model_state_response.go +model_state_transaction.go +model_transaction.go +model_transaction_id_metric_item.go +model_transaction_metric_item.go +model_tx_inclusion_state_msg.go +model_tx_inclusion_state_msg_metric_item.go +model_update_user_password_request.go +model_update_user_permissions_request.go +model_user.go +model_utxo_input_metric_item.go +model_validation_error.go +model_version_response.go +response.go +utils.go diff --git a/clients/apiclient/.openapi-generator/VERSION b/clients/apiclient/.openapi-generator/VERSION new file mode 100644 index 0000000000..d6b4ec4aa7 --- /dev/null +++ b/clients/apiclient/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.3.0-SNAPSHOT \ No newline at end of file diff --git a/clients/apiclient/.travis.yml b/clients/apiclient/.travis.yml new file mode 100644 index 0000000000..f5cb2ce9a5 --- /dev/null +++ b/clients/apiclient/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/clients/apiclient/README.md b/clients/apiclient/README.md new file mode 100644 index 0000000000..e08d37c56c --- /dev/null +++ b/clients/apiclient/README.md @@ -0,0 +1,261 @@ +# Go API client for client + +REST API for the Wasp node + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.4.0-alpha.2-402-g2adcf666b +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Generation +- Install newest OpenAPI Generator binary +- Run an up to date Wasp node +- Execute `openapi-generator-cli generate -i http://localhost:9090/doc/swagger.json -g go --package-name=client` + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import client "github.com/GIT_USER_ID/GIT_REPO_ID" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), client.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +```golang +ctx := context.WithValue(context.Background(), client.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), client.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:9090* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ChainsApi* | [**ActivateChain**](docs/ChainsApi.md#activatechain) | **Post** /chains/{chainID}/activate | Activate a chain +*ChainsApi* | [**AddAccessNode**](docs/ChainsApi.md#addaccessnode) | **Put** /chains/{chainID}/access-node/{publicKey} | Configure a trusted node to be an access node. +*ChainsApi* | [**AttachToWebsocket**](docs/ChainsApi.md#attachtowebsocket) | **Get** /v2/chains/{chainID}/ws | +*ChainsApi* | [**DeactivateChain**](docs/ChainsApi.md#deactivatechain) | **Post** /chains/{chainID}/deactivate | Deactivate a chain +*ChainsApi* | [**GetChainInfo**](docs/ChainsApi.md#getchaininfo) | **Get** /chains/{chainID} | Get information about a specific chain +*ChainsApi* | [**GetChains**](docs/ChainsApi.md#getchains) | **Get** /chains | Get a list of all chains +*ChainsApi* | [**GetCommitteeInfo**](docs/ChainsApi.md#getcommitteeinfo) | **Get** /chains/{chainID}/committee | Get information about the deployed committee +*ChainsApi* | [**GetContracts**](docs/ChainsApi.md#getcontracts) | **Get** /chains/{chainID}/contracts | Get all available chain contracts +*ChainsApi* | [**GetRequestIDFromEVMTransactionID**](docs/ChainsApi.md#getrequestidfromevmtransactionid) | **Get** /v2/chains/{chainID}/evm/tx/{txHash} | Get the ISC request ID for the given Ethereum transaction hash +*ChainsApi* | [**GetStateValue**](docs/ChainsApi.md#getstatevalue) | **Get** /v2/chains/{chainID}/state/{stateKey} | Fetch the raw value associated with the given key in the chain state +*ChainsApi* | [**RemoveAccessNode**](docs/ChainsApi.md#removeaccessnode) | **Delete** /chains/{chainID}/access-node/{publicKey} | Remove an access node. +*CorecontractsApi* | [**AccountsGetAccountBalance**](docs/CorecontractsApi.md#accountsgetaccountbalance) | **Get** /v2/chains/{chainID}/core/accounts/account/{agentID}/balance | Get all assets belonging to an account +*CorecontractsApi* | [**AccountsGetAccountNFTIDs**](docs/CorecontractsApi.md#accountsgetaccountnftids) | **Get** /v2/chains/{chainID}/core/accounts/account/{agentID}/nfts | Get all NFT ids belonging to an account +*CorecontractsApi* | [**AccountsGetAccountNonce**](docs/CorecontractsApi.md#accountsgetaccountnonce) | **Get** /v2/chains/{chainID}/core/accounts/account/{agentID}/nonce | Get the current nonce of an account +*CorecontractsApi* | [**AccountsGetAccounts**](docs/CorecontractsApi.md#accountsgetaccounts) | **Get** /v2/chains/{chainID}/core/accounts | Get a list of all accounts +*CorecontractsApi* | [**AccountsGetFoundryOutput**](docs/CorecontractsApi.md#accountsgetfoundryoutput) | **Get** /v2/chains/{chainID}/core/accounts/foundry_output | Get the foundry output +*CorecontractsApi* | [**AccountsGetNFTData**](docs/CorecontractsApi.md#accountsgetnftdata) | **Get** /v2/chains/{chainID}/core/accounts/nftdata | Get the NFT data by an ID +*CorecontractsApi* | [**AccountsGetNativeTokenIDRegistry**](docs/CorecontractsApi.md#accountsgetnativetokenidregistry) | **Get** /v2/chains/{chainID}/core/accounts/token_registry | Get a list of all registries +*CorecontractsApi* | [**AccountsGetTotalAssets**](docs/CorecontractsApi.md#accountsgettotalassets) | **Get** /v2/chains/{chainID}/core/accounts/total_assets | Get all stored assets +*CorecontractsApi* | [**BlobsGetAllBlobs**](docs/CorecontractsApi.md#blobsgetallblobs) | **Get** /v2/chains/{chainID}/core/blobs | Get all stored blobs +*CorecontractsApi* | [**BlobsGetBlobInfo**](docs/CorecontractsApi.md#blobsgetblobinfo) | **Get** /v2/chains/{chainID}/core/blobs/{blobHash} | Get all fields of a blob +*CorecontractsApi* | [**BlobsGetBlobValue**](docs/CorecontractsApi.md#blobsgetblobvalue) | **Get** /v2/chains/{chainID}/core/blobs/{blobHash}/data/{fieldKey} | Get the value of the supplied field (key) +*CorecontractsApi* | [**BlocklogGetBlockInfo**](docs/CorecontractsApi.md#blockloggetblockinfo) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/{blockIndex} | Get the block info of a certain block index +*CorecontractsApi* | [**BlocklogGetControlAddresses**](docs/CorecontractsApi.md#blockloggetcontroladdresses) | **Get** /v2/chains/{chainID}/core/blocklog/controladdresses | Get the control addresses +*CorecontractsApi* | [**BlocklogGetEventsOfBlock**](docs/CorecontractsApi.md#blockloggeteventsofblock) | **Get** /v2/chains/{chainID}/core/blocklog/events/block/{blockIndex} | Get events of a block +*CorecontractsApi* | [**BlocklogGetEventsOfContract**](docs/CorecontractsApi.md#blockloggeteventsofcontract) | **Get** /v2/chains/{chainID}/core/blocklog/events/contract/{contractHname} | Get events of a contract +*CorecontractsApi* | [**BlocklogGetEventsOfLatestBlock**](docs/CorecontractsApi.md#blockloggeteventsoflatestblock) | **Get** /v2/chains/{chainID}/core/blocklog/events/block/latest | Get events of the latest block +*CorecontractsApi* | [**BlocklogGetEventsOfRequest**](docs/CorecontractsApi.md#blockloggeteventsofrequest) | **Get** /v2/chains/{chainID}/core/blocklog/events/request/{requestID} | Get events of a request +*CorecontractsApi* | [**BlocklogGetLatestBlockInfo**](docs/CorecontractsApi.md#blockloggetlatestblockinfo) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/latest | Get the block info of the latest block +*CorecontractsApi* | [**BlocklogGetRequestIDsForBlock**](docs/CorecontractsApi.md#blockloggetrequestidsforblock) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/{blockIndex}/requestids | Get the request ids for a certain block index +*CorecontractsApi* | [**BlocklogGetRequestIDsForLatestBlock**](docs/CorecontractsApi.md#blockloggetrequestidsforlatestblock) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/latest/requestids | Get the request ids for the latest block +*CorecontractsApi* | [**BlocklogGetRequestIsProcessed**](docs/CorecontractsApi.md#blockloggetrequestisprocessed) | **Get** /v2/chains/{chainID}/core/blocklog/requests/{requestID}/is_processed | Get the request processing status +*CorecontractsApi* | [**BlocklogGetRequestReceipt**](docs/CorecontractsApi.md#blockloggetrequestreceipt) | **Get** /v2/chains/{chainID}/core/blocklog/requests/{requestID} | Get the receipt of a certain request id +*CorecontractsApi* | [**BlocklogGetRequestReceiptsOfBlock**](docs/CorecontractsApi.md#blockloggetrequestreceiptsofblock) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/{blockIndex}/receipts | Get all receipts of a certain block +*CorecontractsApi* | [**BlocklogGetRequestReceiptsOfLatestBlock**](docs/CorecontractsApi.md#blockloggetrequestreceiptsoflatestblock) | **Get** /v2/chains/{chainID}/core/blocklog/blocks/latest/receipts | Get all receipts of the latest block +*CorecontractsApi* | [**ErrorsGetErrorMessageFormat**](docs/CorecontractsApi.md#errorsgeterrormessageformat) | **Get** /v2/chains/{chainID}/core/errors/{contractHname}/message/{errorID} | Get the error message format of a specific error id +*CorecontractsApi* | [**GovernanceGetChainInfo**](docs/CorecontractsApi.md#governancegetchaininfo) | **Get** /v2/chains/{chainID}/core/governance/chaininfo | Get the chain info +*MetricsApi* | [**GetChainMetrics**](docs/MetricsApi.md#getchainmetrics) | **Get** /metrics/chain/{chainID} | Get chain specific metrics. +*MetricsApi* | [**GetChainPipeMetrics**](docs/MetricsApi.md#getchainpipemetrics) | **Get** /metrics/chain/{chainID}/pipe | Get chain pipe event metrics. +*MetricsApi* | [**GetChainWorkflowMetrics**](docs/MetricsApi.md#getchainworkflowmetrics) | **Get** /metrics/chain/{chainID}/workflow | Get chain workflow metrics. +*MetricsApi* | [**GetL1Metrics**](docs/MetricsApi.md#getl1metrics) | **Get** /metrics/l1 | Get accumulated metrics. +*NodeApi* | [**DistrustPeer**](docs/NodeApi.md#distrustpeer) | **Delete** /node/peers/trusted | Distrust a peering node +*NodeApi* | [**GenerateDKS**](docs/NodeApi.md#generatedks) | **Post** /node/dks | Generate a new distributed key +*NodeApi* | [**GetAllPeers**](docs/NodeApi.md#getallpeers) | **Get** /node/peers | Get basic information about all configured peers +*NodeApi* | [**GetConfiguration**](docs/NodeApi.md#getconfiguration) | **Get** /node/config | Return the Wasp configuration +*NodeApi* | [**GetDKSInfo**](docs/NodeApi.md#getdksinfo) | **Get** /node/dks/{sharedAddress} | Get information about the shared address DKS configuration +*NodeApi* | [**GetInfo**](docs/NodeApi.md#getinfo) | **Get** /node/info | Returns private information about this node. +*NodeApi* | [**GetPeeringIdentity**](docs/NodeApi.md#getpeeringidentity) | **Get** /node/peers/identity | Get basic peer info of the current node +*NodeApi* | [**GetTrustedPeers**](docs/NodeApi.md#gettrustedpeers) | **Get** /node/peers/trusted | Get trusted peers +*NodeApi* | [**GetVersion**](docs/NodeApi.md#getversion) | **Get** /v2/node/version | Returns the node version. +*NodeApi* | [**SetNodeOwner**](docs/NodeApi.md#setnodeowner) | **Post** /node/owner/certificate | Sets the node owner +*NodeApi* | [**ShutdownNode**](docs/NodeApi.md#shutdownnode) | **Post** /node/shutdown | Shut down the node +*NodeApi* | [**TrustPeer**](docs/NodeApi.md#trustpeer) | **Post** /node/peers/trusted | Trust a peering node +*RequestsApi* | [**CallView**](docs/RequestsApi.md#callview) | **Post** /v2/requests/callview | Call a view function on a contract by Hname +*RequestsApi* | [**GetReceipt**](docs/RequestsApi.md#getreceipt) | **Get** /v2/chains/{chainID}/receipts/{requestID} | Get a receipt from a request ID +*RequestsApi* | [**OffLedger**](docs/RequestsApi.md#offledger) | **Post** /v2/requests/offledger | Post an off-ledger request +*RequestsApi* | [**WaitForTransaction**](docs/RequestsApi.md#waitfortransaction) | **Get** /v2/chains/{chainID}/requests/{requestID}/wait | Wait until the given request has been processed by the node +*UsersApi* | [**AddUser**](docs/UsersApi.md#adduser) | **Post** /users | Add a user +*UsersApi* | [**ChangeUserPassword**](docs/UsersApi.md#changeuserpassword) | **Put** /users/{username}/password | Change user password +*UsersApi* | [**ChangeUserPermissions**](docs/UsersApi.md#changeuserpermissions) | **Put** /users/{username}/permissions | Change user permissions +*UsersApi* | [**DeleteUser**](docs/UsersApi.md#deleteuser) | **Delete** /users/{username} | Deletes a user +*UsersApi* | [**GetUser**](docs/UsersApi.md#getuser) | **Get** /users/{username} | Get a user +*UsersApi* | [**GetUsers**](docs/UsersApi.md#getusers) | **Get** /users | Get a list of all users + + +## Documentation For Models + + - [AccountListResponse](docs/AccountListResponse.md) + - [AccountNFTsResponse](docs/AccountNFTsResponse.md) + - [AccountNonceResponse](docs/AccountNonceResponse.md) + - [AddUserRequest](docs/AddUserRequest.md) + - [AliasOutputMetricItem](docs/AliasOutputMetricItem.md) + - [Allowance](docs/Allowance.md) + - [AssetsResponse](docs/AssetsResponse.md) + - [BaseToken](docs/BaseToken.md) + - [Blob](docs/Blob.md) + - [BlobInfoResponse](docs/BlobInfoResponse.md) + - [BlobListResponse](docs/BlobListResponse.md) + - [BlobValueResponse](docs/BlobValueResponse.md) + - [BlockInfoResponse](docs/BlockInfoResponse.md) + - [BlockReceiptError](docs/BlockReceiptError.md) + - [BlockReceiptsResponse](docs/BlockReceiptsResponse.md) + - [BurnLog](docs/BurnLog.md) + - [BurnRecord](docs/BurnRecord.md) + - [CallTarget](docs/CallTarget.md) + - [ChainInfoResponse](docs/ChainInfoResponse.md) + - [ChainMetrics](docs/ChainMetrics.md) + - [CommitteeInfoResponse](docs/CommitteeInfoResponse.md) + - [CommitteeNode](docs/CommitteeNode.md) + - [ConsensusPipeMetrics](docs/ConsensusPipeMetrics.md) + - [ConsensusWorkflowMetrics](docs/ConsensusWorkflowMetrics.md) + - [ContractCallViewRequest](docs/ContractCallViewRequest.md) + - [ContractInfoResponse](docs/ContractInfoResponse.md) + - [ControlAddressesResponse](docs/ControlAddressesResponse.md) + - [DKSharesInfo](docs/DKSharesInfo.md) + - [DKSharesPostRequest](docs/DKSharesPostRequest.md) + - [ErrorMessageFormatResponse](docs/ErrorMessageFormatResponse.md) + - [EventsResponse](docs/EventsResponse.md) + - [FoundryOutputResponse](docs/FoundryOutputResponse.md) + - [FungibleTokens](docs/FungibleTokens.md) + - [GasFeePolicy](docs/GasFeePolicy.md) + - [GovChainInfoResponse](docs/GovChainInfoResponse.md) + - [InOutput](docs/InOutput.md) + - [InOutputMetricItem](docs/InOutputMetricItem.md) + - [InStateOutput](docs/InStateOutput.md) + - [InStateOutputMetricItem](docs/InStateOutputMetricItem.md) + - [InfoResponse](docs/InfoResponse.md) + - [InterfaceMetricItem](docs/InterfaceMetricItem.md) + - [Item](docs/Item.md) + - [JSONDict](docs/JSONDict.md) + - [L1Params](docs/L1Params.md) + - [NFTDataResponse](docs/NFTDataResponse.md) + - [NativeToken](docs/NativeToken.md) + - [NativeTokenIDRegistryResponse](docs/NativeTokenIDRegistryResponse.md) + - [NodeOwnerCertificateRequest](docs/NodeOwnerCertificateRequest.md) + - [OffLedgerRequest](docs/OffLedgerRequest.md) + - [OnLedgerRequest](docs/OnLedgerRequest.md) + - [OnLedgerRequestMetricItem](docs/OnLedgerRequestMetricItem.md) + - [Output](docs/Output.md) + - [OutputID](docs/OutputID.md) + - [PeeringNodeIdentityResponse](docs/PeeringNodeIdentityResponse.md) + - [PeeringNodeStatusResponse](docs/PeeringNodeStatusResponse.md) + - [PeeringTrustRequest](docs/PeeringTrustRequest.md) + - [ProtocolParameters](docs/ProtocolParameters.md) + - [ReceiptError](docs/ReceiptError.md) + - [ReceiptResponse](docs/ReceiptResponse.md) + - [RentStructure](docs/RentStructure.md) + - [RequestDetail](docs/RequestDetail.md) + - [RequestIDsResponse](docs/RequestIDsResponse.md) + - [RequestProcessedResponse](docs/RequestProcessedResponse.md) + - [RequestReceiptResponse](docs/RequestReceiptResponse.md) + - [Transaction](docs/Transaction.md) + - [TransactionIDMetricItem](docs/TransactionIDMetricItem.md) + - [TransactionMetricItem](docs/TransactionMetricItem.md) + - [TxInclusionStateMsg](docs/TxInclusionStateMsg.md) + - [TxInclusionStateMsgMetricItem](docs/TxInclusionStateMsgMetricItem.md) + - [UTXOInputMetricItem](docs/UTXOInputMetricItem.md) + - [UpdateUserPasswordRequest](docs/UpdateUserPasswordRequest.md) + - [UpdateUserPermissionsRequest](docs/UpdateUserPermissionsRequest.md) + - [User](docs/User.md) + - [ValidationError](docs/ValidationError.md) + + +## Documentation For Authorization + + + +### Authorization + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/clients/apiclient/api/openapi.yaml b/clients/apiclient/api/openapi.yaml new file mode 100644 index 0000000000..b49d860b5d --- /dev/null +++ b/clients/apiclient/api/openapi.yaml @@ -0,0 +1,5401 @@ +openapi: 3.0.1 +info: + description: REST API for the Wasp node + title: Wasp API + version: "0" +externalDocs: + description: Find out more about Wasp + url: https://wiki.iota.org/smart-contracts/overview +servers: +- url: / +tags: +- name: auth +- name: chains +- name: metrics +- name: node +- name: requests +- name: users +- name: corecontracts +paths: + /auth: + post: + operationId: authenticate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/LoginRequest' + description: The login request + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/LoginResponse' + description: Login was successful + "401": + content: {} + description: "Unauthorized (Wrong permissions, missing token)" + summary: Authenticate towards the node + tags: + - auth + x-codegen-request-body-name: "" + /auth/info: + get: + operationId: authInfo + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AuthInfoModel' + description: Login was successful + summary: Get information about the current authentication mode + tags: + - auth + /chains: + get: + operationId: getChains + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ChainInfoResponse' + type: array + description: A list of all available chains + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get a list of all chains + tags: + - chains + /chains/{chainID}: + get: + operationId: getChainInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ChainInfoResponse' + description: Information about a specific chain + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get information about a specific chain + tags: + - chains + /chains/{chainID}/access-node/{publicKey}: + delete: + operationId: removeAccessNode + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Nodes public key (Hex) + in: path + name: publicKey + required: true + schema: + format: string + type: string + responses: + "200": + content: {} + description: Access node was successfully removed + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Remove an access node. + tags: + - chains + put: + operationId: addAccessNode + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Nodes public key (Hex) + in: path + name: publicKey + required: true + schema: + format: string + type: string + responses: + "201": + content: {} + description: Access node was successfully added + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Configure a trusted node to be an access node. + tags: + - chains + /chains/{chainID}/activate: + post: + operationId: activateChain + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: {} + description: Chain was successfully activated + "304": + content: {} + description: Chain was not activated + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Activate a chain + tags: + - chains + /chains/{chainID}/chainrecord: + post: + operationId: setChainRecord + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChainRecord' + description: Chain Record + required: true + responses: + "201": + content: {} + description: Chain record was saved + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Sets the chain record. + tags: + - chains + x-codegen-request-body-name: ChainRecord + /chains/{chainID}/committee: + get: + operationId: getCommitteeInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CommitteeInfoResponse' + description: A list of all nodes tied to the chain + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get information about the deployed committee + tags: + - chains + /chains/{chainID}/contracts: + get: + operationId: getContracts + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ContractInfoResponse' + type: array + description: A list of all available contracts + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all available chain contracts + tags: + - chains + /chains/{chainID}/core/accounts: + get: + operationId: accountsGetAccounts + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountListResponse' + description: A list of all accounts + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get a list of all accounts + tags: + - corecontracts + /chains/{chainID}/core/accounts/account/{agentID}/balance: + get: + operationId: accountsGetAccountBalance + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: AgentID (Bech32 for WasmVM | Hex for EVM) + in: path + name: agentID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AssetsResponse' + description: All assets belonging to an account + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all assets belonging to an account + tags: + - corecontracts + /chains/{chainID}/core/accounts/account/{agentID}/nfts: + get: + operationId: accountsGetAccountNFTIDs + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: AgentID (Bech32 for WasmVM | Hex for EVM) + in: path + name: agentID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountNFTsResponse' + description: All NFT ids belonging to an account + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all NFT ids belonging to an account + tags: + - corecontracts + /chains/{chainID}/core/accounts/account/{agentID}/nonce: + get: + operationId: accountsGetAccountNonce + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: AgentID (Bech32 for WasmVM | Hex for EVM | '000000@Bech32' Addresses + require urlencode) + in: path + name: agentID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AccountNonceResponse' + description: The current nonce of an account + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the current nonce of an account + tags: + - corecontracts + /chains/{chainID}/core/accounts/foundry_output/{serialNumber}: + get: + operationId: accountsGetFoundryOutput + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Serial Number (uint32) + in: path + name: serialNumber + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/FoundryOutputResponse' + description: The foundry output + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the foundry output + tags: + - corecontracts + /chains/{chainID}/core/accounts/nftdata: + get: + operationId: accountsGetNFTData + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: NFT ID (Hex) + in: path + name: nftID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NFTDataResponse' + description: The NFT data + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the NFT data by an ID + tags: + - corecontracts + /chains/{chainID}/core/accounts/token_registry: + get: + operationId: accountsGetNativeTokenIDRegistry + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NativeTokenIDRegistryResponse' + description: A list of all registries + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get a list of all registries + tags: + - corecontracts + /chains/{chainID}/core/accounts/total_assets: + get: + operationId: accountsGetTotalAssets + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AssetsResponse' + description: All stored assets + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all stored assets + tags: + - corecontracts + /chains/{chainID}/core/blobs: + get: + operationId: blobsGetAllBlobs + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlobListResponse' + description: All stored blobs + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all stored blobs + tags: + - corecontracts + /chains/{chainID}/core/blobs/{blobHash}: + get: + operationId: blobsGetBlobInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlobHash (Hex) + in: path + name: blobHash + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlobInfoResponse' + description: All blob fields and their values + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all fields of a blob + tags: + - corecontracts + /chains/{chainID}/core/blobs/{blobHash}/data/{fieldKey}: + get: + operationId: blobsGetBlobValue + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlobHash (Hex) + in: path + name: blobHash + required: true + schema: + format: string + type: string + - description: FieldKey (String) + in: path + name: fieldKey + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlobValueResponse' + description: The value of the supplied field (key) + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the value of the supplied field (key) + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/latest: + get: + operationId: blocklogGetLatestBlockInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlockInfoResponse' + description: The block info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the block info of the latest block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/latest/receipts: + get: + operationId: blocklogGetRequestReceiptsOfLatestBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlockReceiptsResponse' + description: The receipts + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all receipts of the latest block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/latest/requestids: + get: + operationId: blocklogGetRequestIDsForLatestBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RequestIDsResponse' + description: "A list of request ids (ISCRequestID[])" + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the request ids for the latest block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/{blockIndex}: + get: + operationId: blocklogGetBlockInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlockIndex (uint32) + in: path + name: blockIndex + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlockInfoResponse' + description: The block info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the block info of a certain block index + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/{blockIndex}/receipts: + get: + operationId: blocklogGetRequestReceiptsOfBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlockIndex (uint32) + in: path + name: blockIndex + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BlockReceiptsResponse' + description: The receipts + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get all receipts of a certain block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/blocks/{blockIndex}/requestids: + get: + operationId: blocklogGetRequestIDsForBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlockIndex (uint32) + in: path + name: blockIndex + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RequestIDsResponse' + description: "A list of request ids (ISCRequestID[])" + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the request ids for a certain block index + tags: + - corecontracts + /chains/{chainID}/core/blocklog/controladdresses: + get: + operationId: blocklogGetControlAddresses + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ControlAddressesResponse' + description: The chain info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the control addresses + tags: + - corecontracts + /chains/{chainID}/core/blocklog/events/block/latest: + get: + operationId: blocklogGetEventsOfLatestBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EventsResponse' + description: The receipts + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get events of the latest block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/events/block/{blockIndex}: + get: + operationId: blocklogGetEventsOfBlock + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: BlockIndex (uint32) + in: path + name: blockIndex + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EventsResponse' + description: The events + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get events of a block + tags: + - corecontracts + /chains/{chainID}/core/blocklog/events/contract/{contractHname}: + get: + operationId: blocklogGetEventsOfContract + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Contract (Hname) + in: path + name: contractHname + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EventsResponse' + description: The events + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get events of a contract + tags: + - corecontracts + /chains/{chainID}/core/blocklog/events/request/{requestID}: + get: + operationId: blocklogGetEventsOfRequest + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Request ID (ISCRequestID) + in: path + name: requestID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EventsResponse' + description: The events + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get events of a request + tags: + - corecontracts + /chains/{chainID}/core/blocklog/requests/{requestID}: + get: + operationId: blocklogGetRequestReceipt + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Request ID (ISCRequestID) + in: path + name: requestID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RequestReceiptResponse' + description: The receipt + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the receipt of a certain request id + tags: + - corecontracts + /chains/{chainID}/core/blocklog/requests/{requestID}/is_processed: + get: + operationId: blocklogGetRequestIsProcessed + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Request ID (ISCRequestID) + in: path + name: requestID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RequestProcessedResponse' + description: The processing result + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the request processing status + tags: + - corecontracts + /chains/{chainID}/core/errors/{contractHname}/message/{errorID}: + get: + operationId: errorsGetErrorMessageFormat + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Contract (Hname as Hex) + in: path + name: contractHname + required: true + schema: + format: string + type: string + - description: Error Id (uint16) + in: path + name: errorID + required: true + schema: + format: int32 + minimum: 1 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessageFormatResponse' + description: The error message format + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the error message format of a specific error id + tags: + - corecontracts + /chains/{chainID}/core/governance/allowedstatecontrollers: + get: + description: Returns the allowed state controller addresses + operationId: governanceGetAllowedStateControllerAddresses + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GovAllowedStateControllerAddressesResponse' + description: The state controller addresses + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the allowed state controller addresses + tags: + - corecontracts + /chains/{chainID}/core/governance/chaininfo: + get: + description: "If you are using the common API functions, you most likely rather\ + \ want to use '/chains/:chainID' to get information about a chain." + operationId: governanceGetChainInfo + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GovChainInfoResponse' + description: The chain info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the chain info + tags: + - corecontracts + /chains/{chainID}/core/governance/chainowner: + get: + description: Returns the chain owner + operationId: governanceGetChainOwner + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GovChainOwnerResponse' + description: The chain owner + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get the chain owner + tags: + - corecontracts + /chains/{chainID}/deactivate: + post: + operationId: deactivateChain + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: {} + description: Chain was successfully deactivated + "304": + content: {} + description: Chain was not deactivated + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Deactivate a chain + tags: + - chains + /chains/{chainID}/evm: + get: + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + format: string + type: string + description: The evm json RPC + "404": + content: + application/json: + schema: + format: string + type: string + description: The evm json RPC failure + security: + - Authorization: [] + tags: + - chains + /chains/{chainID}/evm/tx/{txHash}: + get: + operationId: getRequestIDFromEVMTransactionID + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Transaction hash (Hex-encoded) + in: path + name: txHash + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RequestIDResponse' + description: Request ID + "404": + content: + application/json: + schema: + format: string + type: string + description: Request ID not found + security: + - Authorization: [] + summary: Get the ISC request ID for the given Ethereum transaction hash + tags: + - chains + /chains/{chainID}/receipts/{requestID}: + get: + operationId: getReceipt + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: RequestID (Hex) + in: path + name: requestID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReceiptResponse' + description: ReceiptResponse + security: + - Authorization: [] + summary: Get a receipt from a request ID + tags: + - requests + /chains/{chainID}/requests/{requestID}/wait: + get: + operationId: waitForRequest + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: RequestID (Hex) + in: path + name: requestID + required: true + schema: + format: string + type: string + - description: The timeout in seconds + in: query + name: timeoutSeconds + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReceiptResponse' + description: The request receipt + "404": + content: {} + description: The chain or request id is invalid + "408": + content: {} + description: The waiting time has reached the defined limit + security: + - Authorization: [] + summary: Wait until the given request has been processed by the node + tags: + - requests + /chains/{chainID}/state/{stateKey}: + get: + operationId: getStateValue + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + - description: Key (Hex-encoded) + in: path + name: stateKey + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/StateResponse' + description: Result + security: + - Authorization: [] + summary: Fetch the raw value associated with the given key in the chain state + tags: + - chains + /chains/{chainID}/ws: + get: + operationId: attachToWebsocket + parameters: + - description: ChainID (Bech32-encoded) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + default: + content: {} + description: successful operation + security: + - Authorization: [] + tags: + - chains + /metrics/chain/{chainID}: + get: + operationId: getChainMetrics + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ChainMetrics' + description: A list of all available metrics. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get chain specific metrics. + tags: + - metrics + /metrics/chain/{chainID}/pipe: + get: + operationId: getChainPipeMetrics + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ConsensusPipeMetrics' + description: A list of all available metrics. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get chain pipe event metrics. + tags: + - metrics + /metrics/chain/{chainID}/workflow: + get: + operationId: getChainWorkflowMetrics + parameters: + - description: ChainID (Bech32) + in: path + name: chainID + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ConsensusWorkflowMetrics' + description: A list of all available metrics. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get chain workflow metrics. + tags: + - metrics + /metrics/l1: + get: + operationId: getL1Metrics + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ChainMetrics' + description: A list of all available metrics. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get accumulated metrics. + tags: + - metrics + /node/config: + get: + operationId: getConfiguration + responses: + "200": + content: + application/json: + schema: + additionalProperties: + example: "true" + format: string + type: string + type: object + description: Dumped configuration + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Return the Wasp configuration + tags: + - node + /node/dks: + post: + operationId: generateDKS + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DKSharesPostRequest' + description: Request parameters + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DKSharesInfo' + description: DK shares info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Generate a new distributed key + tags: + - node + x-codegen-request-body-name: DKSharesPostRequest + /node/dks/{sharedAddress}: + get: + operationId: getDKSInfo + parameters: + - description: SharedAddress (Bech32) + in: path + name: sharedAddress + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DKSharesInfo' + description: DK shares info + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get information about the shared address DKS configuration + tags: + - node + /node/info: + get: + operationId: getInfo + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/InfoResponse' + description: Returns information about this node. + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Returns private information about this node. + tags: + - node + /node/owner/certificate: + post: + operationId: setNodeOwner + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NodeOwnerCertificateRequest' + description: The node owner certificate + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/NodeOwnerCertificateResponse' + description: Node owner was successfully changed + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Sets the node owner + tags: + - node + x-codegen-request-body-name: "" + /node/peers: + get: + operationId: getAllPeers + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/PeeringNodeStatusResponse_' + type: array + description: A list of all peers + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get basic information about all configured peers + tags: + - node + /node/peers/identity: + get: + operationId: getPeeringIdentity + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/PeeringNodeIdentityResponse' + description: This node peering identity + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get basic peer info of the current node + tags: + - node + /node/peers/trusted: + delete: + operationId: distrustPeer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PeeringTrustRequest' + description: Info of the peer to distrust + required: true + responses: + "200": + content: {} + description: Peer was successfully distrusted + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Distrust a peering node + tags: + - node + x-codegen-request-body-name: "" + get: + operationId: getTrustedPeers + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/PeeringNodeIdentityResponse' + type: array + description: A list of trusted peers + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get trusted peers + tags: + - node + post: + operationId: trustPeer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PeeringTrustRequest' + description: Info of the peer to trust + required: true + responses: + "200": + content: {} + description: Peer was successfully trusted + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Trust a peering node + tags: + - node + x-codegen-request-body-name: "" + /node/shutdown: + post: + operationId: shutdownNode + responses: + "200": + content: {} + description: The node has been shut down + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Shut down the node + tags: + - node + /node/version: + get: + operationId: getVersion + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VersionResponse' + description: Returns the version of the node. + security: + - Authorization: [] + summary: Returns the node version. + tags: + - node + /requests/callview: + post: + description: "Execute a view call. Either use HName or Name properties. If both\ + \ are supplied, HName are used." + operationId: callView + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ContractCallViewRequest' + description: Parameters + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/JSONDict_' + description: Result + security: + - Authorization: [] + summary: Call a view function on a contract by Hname + tags: + - requests + x-codegen-request-body-name: "" + /requests/offledger: + post: + operationId: offLedger + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OffLedgerRequest' + description: Offledger request as JSON. Request encoded in Hex + required: true + responses: + "202": + content: {} + description: Request submitted + security: + - Authorization: [] + summary: Post an off-ledger request + tags: + - requests + x-codegen-request-body-name: "" + /users: + get: + operationId: getUsers + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: A list of all users + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Get a list of all users + tags: + - users + post: + operationId: addUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddUserRequest' + description: The user data + required: true + responses: + "201": + content: {} + description: User successfully added + "400": + content: {} + description: Invalid request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Add a user + tags: + - users + x-codegen-request-body-name: "" + /users/{username}: + delete: + operationId: deleteUser + parameters: + - description: The username + in: path + name: username + required: true + schema: + format: string + type: string + responses: + "200": + content: {} + description: Deletes a specific user + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + "404": + content: {} + description: User not found + security: + - Authorization: [] + summary: Deletes a user + tags: + - users + get: + operationId: getUser + parameters: + - description: The username + in: path + name: username + required: true + schema: + format: string + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Returns a specific user + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + "404": + content: {} + description: User not found + security: + - Authorization: [] + summary: Get a user + tags: + - users + /users/{username}/password: + put: + operationId: changeUserPassword + parameters: + - description: The username. + in: path + name: username + required: true + schema: + format: string + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserPasswordRequest' + description: The users new password + required: true + responses: + "200": + content: {} + description: User successfully updated + "400": + content: {} + description: Invalid request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Change user password + tags: + - users + x-codegen-request-body-name: "" + /users/{username}/permissions: + put: + operationId: changeUserPermissions + parameters: + - description: The username. + in: path + name: username + required: true + schema: + format: string + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateUserPermissionsRequest' + description: The users new permissions + required: true + responses: + "200": + content: {} + description: User successfully updated + "400": + content: {} + description: Invalid request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' + description: "Unauthorized (Wrong permissions, missing token)" + security: + - Authorization: [] + summary: Change user permissions + tags: + - users + x-codegen-request-body-name: "" +components: + schemas: + AccountListResponse: + example: + accounts: + - accounts + - accounts + properties: + accounts: + items: + format: string + type: string + type: array + xml: + name: Accounts + wrapped: true + required: + - accounts + type: object + xml: + name: AccountListResponse + AccountNFTsResponse: + example: + nftIds: + - nftIds + - nftIds + properties: + nftIds: + items: + format: string + type: string + type: array + xml: + name: NFTIDs + wrapped: true + required: + - nftIds + type: object + xml: + name: AccountNFTsResponse + AccountNonceResponse: + example: + nonce: nonce + properties: + nonce: + description: The nonce (uint64 as string) + format: string + type: string + xml: + name: Nonce + required: + - nonce + type: object + xml: + name: AccountNonceResponse + AddUserRequest: + example: + password: password + permissions: + - permissions + - permissions + username: username + properties: + password: + format: string + type: string + xml: + name: Password + permissions: + items: + format: string + type: string + type: array + xml: + name: Permissions + wrapped: true + username: + format: string + type: string + xml: + name: Username + required: + - password + - permissions + - username + type: object + xml: + name: AddUserRequest + AliasOutputMetricItem: + example: + lastMessage: + outputType: 0 + raw: raw + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/Output' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: AliasOutputMetricItem + Assets: + example: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + properties: + baseTokens: + description: The base tokens (uint64 as string) + format: string + type: string + xml: + name: BaseTokens + nativeTokens: + items: + $ref: '#/components/schemas/NativeToken' + type: array + xml: + name: NativeTokens + wrapped: true + nfts: + items: + format: string + type: string + type: array + xml: + name: NFTs + wrapped: true + required: + - baseTokens + - nativeTokens + - nfts + type: object + xml: + name: Assets + AssetsResponse: + example: + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + properties: + baseTokens: + description: The base tokens (uint64 as string) + format: string + type: string + xml: + name: BaseTokens + nativeTokens: + items: + $ref: '#/components/schemas/NativeToken' + type: array + xml: + name: NativeTokens + wrapped: true + required: + - baseTokens + - nativeTokens + type: object + xml: + name: AssetsResponse + AuthInfoModel: + example: + authURL: authURL + scheme: scheme + properties: + authURL: + description: JWT only + format: string + type: string + xml: + name: AuthURL + scheme: + format: string + type: string + xml: + name: Scheme + required: + - authURL + - scheme + type: object + xml: + name: AuthInfoModel + BaseToken: + example: + unit: TEST + decimals: 6 + name: TestCoin + tickerSymbol: TEST + subunit: testies + useMetricPrefix: true + properties: + decimals: + description: The token decimals + example: 6 + format: int32 + type: integer + xml: + name: Decimals + name: + description: The base token name + example: TestCoin + format: string + type: string + xml: + name: Name + subunit: + description: The token subunit + example: testies + format: string + type: string + xml: + name: Subunit + tickerSymbol: + description: The ticker symbol + example: TEST + format: string + type: string + xml: + name: TickerSymbol + unit: + description: The token unit + example: TEST + format: string + type: string + xml: + name: Unit + useMetricPrefix: + description: Whether or not the token uses a metric prefix + format: boolean + type: boolean + xml: + name: UseMetricPrefix + required: + - decimals + - name + - subunit + - tickerSymbol + - unit + - useMetricPrefix + type: object + xml: + name: BaseToken + Blob: + example: + size: 1 + hash: hash + properties: + hash: + format: string + type: string + xml: + name: Hash + size: + format: int32 + minimum: 1 + type: integer + xml: + name: Size + required: + - hash + - size + type: object + xml: + name: Blob + BlobInfoResponse: + example: + fields: + key: 0 + properties: + fields: + additionalProperties: + format: int32 + type: integer + type: object + xml: + name: Fields + required: + - fields + type: object + xml: + name: BlobInfoResponse + BlobListResponse: + example: + Blobs: + - size: 1 + hash: hash + - size: 1 + hash: hash + properties: + Blobs: + items: + $ref: '#/components/schemas/Blob' + type: array + xml: + name: Blobs + wrapped: true + type: object + xml: + name: BlobListResponse + BlobValueResponse: + example: + valueData: valueData + properties: + valueData: + description: The blob data (Hex) + format: string + type: string + xml: + name: ValueData + required: + - valueData + type: object + xml: + name: BlobValueResponse + BlockInfoResponse: + example: + anchorTransactionId: anchorTransactionId + gasBurned: gasBurned + totalRequests: 1 + l1CommitmentHash: l1CommitmentHash + blockIndex: 1 + numSuccessfulRequests: 1 + gasFeeCharged: gasFeeCharged + totalStorageDeposit: totalStorageDeposit + transactionSubEssenceHash: transactionSubEssenceHash + numOffLedgerRequests: 1 + previousL1CommitmentHash: previousL1CommitmentHash + timestamp: 2000-01-23T04:56:07.000+00:00 + totalBaseTokensInL2Accounts: totalBaseTokensInL2Accounts + properties: + anchorTransactionId: + format: string + type: string + xml: + name: AnchorTransactionID + blockIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: BlockIndex + gasBurned: + description: The burned gas (uint64 as string) + format: string + type: string + xml: + name: GasBurned + gasFeeCharged: + description: The charged gas fee (uint64 as string) + format: string + type: string + xml: + name: GasFeeCharged + l1CommitmentHash: + format: string + type: string + xml: + name: L1CommitmentHash + numOffLedgerRequests: + format: int32 + minimum: 1 + type: integer + xml: + name: NumOffLedgerRequests + numSuccessfulRequests: + format: int32 + minimum: 1 + type: integer + xml: + name: NumSuccessfulRequests + previousL1CommitmentHash: + format: string + type: string + xml: + name: PreviousL1CommitmentHash + timestamp: + format: date-time + type: string + xml: + name: Timestamp + totalBaseTokensInL2Accounts: + description: The total L2 base tokens (uint64 as string) + format: string + type: string + xml: + name: TotalBaseTokensInL2Accounts + totalRequests: + format: int32 + minimum: 1 + type: integer + xml: + name: TotalRequests + totalStorageDeposit: + description: The total storage deposit (uint64 as string) + format: string + type: string + xml: + name: TotalStorageDeposit + transactionSubEssenceHash: + format: string + type: string + xml: + name: TransactionSubEssenceHash + required: + - anchorTransactionId + - blockIndex + - gasBurned + - gasFeeCharged + - l1CommitmentHash + - numOffLedgerRequests + - numSuccessfulRequests + - previousL1CommitmentHash + - timestamp + - totalBaseTokensInL2Accounts + - totalRequests + - totalStorageDeposit + - transactionSubEssenceHash + type: object + xml: + name: BlockInfoResponse + BlockReceiptError: + example: + errorMessage: errorMessage + hash: hash + properties: + errorMessage: + format: string + type: string + xml: + name: ErrorMessage + hash: + format: string + type: string + xml: + name: Hash + required: + - errorMessage + - hash + type: object + xml: + name: BlockReceiptError + BlockReceiptsResponse: + example: + receipts: + - gasBurnLog: + records: + - code: 6 + gasBurned: 1 + - code: 6 + gasBurned: 1 + request: + fungibleTokens: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + senderAccount: senderAccount + isOffLedger: true + gasGudget: gasGudget + requestId: requestId + callTarget: + contractHName: contractHName + functionHName: functionHName + targetAddress: targetAddress + allowance: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + params: + Items: + - value: value + key: key + - value: value + key: key + nft: + owner: owner + metadata: metadata + id: id + issuer: issuer + isEVM: true + blockIndex: 1 + requestIndex: 1 + gasFeeCharged: gasFeeCharged + gasBudget: gasBudget + gasBurned: gasBurned + error: + errorMessage: errorMessage + hash: hash + - gasBurnLog: + records: + - code: 6 + gasBurned: 1 + - code: 6 + gasBurned: 1 + request: + fungibleTokens: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + senderAccount: senderAccount + isOffLedger: true + gasGudget: gasGudget + requestId: requestId + callTarget: + contractHName: contractHName + functionHName: functionHName + targetAddress: targetAddress + allowance: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + params: + Items: + - value: value + key: key + - value: value + key: key + nft: + owner: owner + metadata: metadata + id: id + issuer: issuer + isEVM: true + blockIndex: 1 + requestIndex: 1 + gasFeeCharged: gasFeeCharged + gasBudget: gasBudget + gasBurned: gasBurned + error: + errorMessage: errorMessage + hash: hash + properties: + receipts: + items: + $ref: '#/components/schemas/RequestReceiptResponse' + type: array + xml: + name: Receipts + wrapped: true + required: + - receipts + type: object + xml: + name: BlockReceiptsResponse + BurnLog: + example: + records: + - code: 6 + gasBurned: 1 + - code: 6 + gasBurned: 1 + properties: + records: + items: + $ref: '#/components/schemas/BurnRecord' + type: array + xml: + name: Records + wrapped: true + required: + - records + type: object + xml: + name: BurnLog + BurnRecord: + example: + code: 6 + gasBurned: 1 + properties: + code: + format: int32 + type: integer + xml: + name: Code + gasBurned: + format: int64 + type: integer + xml: + name: GasBurned + required: + - code + - gasBurned + type: object + xml: + name: BurnRecord + CallTarget: + example: + contractHName: contractHName + functionHName: functionHName + properties: + contractHName: + description: The contract name as HName (Hex) + format: string + type: string + xml: + name: ContractHName + functionHName: + description: The function name as HName (Hex) + format: string + type: string + xml: + name: FunctionHName + required: + - contractHName + - functionHName + type: object + xml: + name: CallTarget + ChainInfoResponse: + example: + chainOwnerId: tst1qzjsxstc0k850jevpqu08tj0suql9u7hvh3vq3eaaem3gkx7r646zqpdn6e + maxEventsPerReq: 50 + chainID: tst1prcw42l5u4g24tqg628d7qzh7n6m4k4ktvgayh44dyt68y930qzy2lr054v + evmChainId: 1074 + description: description + gasFeePolicy: + gasFeeTokenId: gasFeeTokenId + gasPerToken: "100" + validatorFeeShare: 1 + isActive: true + maxBlobSize: 2000000 + maxEventSize: 2000 + properties: + chainID: + description: ChainID (Bech32-encoded). + example: tst1prcw42l5u4g24tqg628d7qzh7n6m4k4ktvgayh44dyt68y930qzy2lr054v + format: string + type: string + xml: + name: ChainID + chainOwnerId: + description: The chain owner address (Bech32-encoded). + example: tst1qzjsxstc0k850jevpqu08tj0suql9u7hvh3vq3eaaem3gkx7r646zqpdn6e + format: string + type: string + xml: + name: ChainOwnerID + description: + description: The description of the chain. + format: string + type: string + xml: + name: Description + evmChainId: + description: The EVM chain ID + example: 1074 + format: int32 + minimum: 1 + type: integer + xml: + name: EVMChainID + gasFeePolicy: + $ref: '#/components/schemas/gasFeePolicy' + isActive: + description: Whether or not the chain is active. + format: boolean + type: boolean + xml: + name: IsActive + maxBlobSize: + description: The maximum contract blob size. + example: 2000000 + format: int32 + minimum: 1 + type: integer + xml: + name: MaxBlobSize + maxEventSize: + description: The maximum event size. + example: 2000 + format: int32 + minimum: 1 + type: integer + xml: + name: MaxEventSize + maxEventsPerReq: + description: The maximum amount of events per request. + example: 50 + format: int32 + minimum: 1 + type: integer + xml: + name: MaxEventsPerReq + required: + - chainID + - chainOwnerId + - description + - evmChainId + - isActive + - maxBlobSize + - maxEventSize + - maxEventsPerReq + type: object + xml: + name: ChainInfoResponse + ChainMetrics: + example: + outPublishGovernanceTransaction: + lastMessage: + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + outPublisherStateTransaction: + lastMessage: + stateIndex: 1 + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inTxInclusionState: + lastMessage: + txId: txId + state: state + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inOnLedgerRequest: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + raw: raw + id: id + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inOutput: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inMilestone: + lastMessage: + milestoneId: milestoneId + index: 0 + timestamp: 0 + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inAliasOutput: + lastMessage: + outputType: 0 + raw: raw + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + inStateOutput: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + outPullTxInclusionState: + lastMessage: + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + registeredChainIDs: + - registeredChainIDs + - registeredChainIDs + outPullLatestOutput: + lastMessage: lastMessage + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + outPullOutputByID: + lastMessage: + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + inAliasOutput: + $ref: '#/components/schemas/AliasOutputMetricItem' + inMilestone: + $ref: '#/components/schemas/MilestoneMetricItem' + inOnLedgerRequest: + $ref: '#/components/schemas/OnLedgerRequestMetricItem' + inOutput: + $ref: '#/components/schemas/InOutputMetricItem' + inStateOutput: + $ref: '#/components/schemas/InStateOutputMetricItem' + inTxInclusionState: + $ref: '#/components/schemas/TxInclusionStateMsgMetricItem' + outPublishGovernanceTransaction: + $ref: '#/components/schemas/TransactionMetricItem' + outPublisherStateTransaction: + $ref: '#/components/schemas/PublisherStateTransactionItem' + outPullLatestOutput: + $ref: '#/components/schemas/InterfaceMetricItem' + outPullOutputByID: + $ref: '#/components/schemas/UTXOInputMetricItem' + outPullTxInclusionState: + $ref: '#/components/schemas/TransactionIDMetricItem' + registeredChainIDs: + items: + format: string + type: string + type: array + xml: + name: RegisteredChainIDs + wrapped: true + required: + - inAliasOutput + - inMilestone + - inOnLedgerRequest + - inOutput + - inStateOutput + - inTxInclusionState + - outPublishGovernanceTransaction + - outPublisherStateTransaction + - outPullLatestOutput + - outPullOutputByID + - outPullTxInclusionState + - registeredChainIDs + type: object + xml: + name: ChainMetrics + ChainRecord: + example: + accessNodes: + - accessNodes + - accessNodes + isActive: true + properties: + accessNodes: + items: + format: string + type: string + type: array + xml: + name: AccessNodes + wrapped: true + isActive: + format: boolean + type: boolean + xml: + name: IsActive + required: + - accessNodes + - isActive + type: object + xml: + name: ChainRecord + CommitteeInfoResponse: + example: + candidateNodes: + - node: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + accessAPI: accessAPI + - node: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + accessAPI: accessAPI + committeeNodes: + - node: + isAlive: true + netId: localhost:4000 + publicKey: 0x0000 + numUsers: 1 + isTrusted: true + accessAPI: accessAPI + - node: + isAlive: true + netId: localhost:4000 + publicKey: 0x0000 + numUsers: 1 + isTrusted: true + accessAPI: accessAPI + chainId: tst1pqm5ckama06xhkl080mmvz6l3xy8c8lulrwy7mx4ll0fc69krxfgka70j0e + accessNodes: + - node: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + accessAPI: accessAPI + - node: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + accessAPI: accessAPI + stateAddress: 0xff97a3eb5c56f6a3bc4fb729dedff9bffe37583d81d6c72ac12f2438cc94fb43 + active: true + properties: + accessNodes: + description: A list of all access nodes and their peering info. + items: + $ref: '#/components/schemas/CommitteeNode' + type: array + xml: + name: AccessNodes + wrapped: true + active: + description: Whether or not the chain is active. + example: true + format: boolean + type: boolean + xml: + name: Active + candidateNodes: + description: A list of all candidate nodes and their peering info. + items: + $ref: '#/components/schemas/CommitteeNode' + type: array + xml: + name: CandidateNodes + wrapped: true + chainId: + description: ChainID (Bech32-encoded). + example: tst1pqm5ckama06xhkl080mmvz6l3xy8c8lulrwy7mx4ll0fc69krxfgka70j0e + format: string + type: string + xml: + name: ChainID + committeeNodes: + description: A list of all committee nodes and their peering info. + items: + $ref: '#/components/schemas/CommitteeNode_' + type: array + xml: + name: CommitteeNodes + wrapped: true + stateAddress: + example: 0xff97a3eb5c56f6a3bc4fb729dedff9bffe37583d81d6c72ac12f2438cc94fb43 + format: string + type: string + xml: + name: StateAddress + required: + - accessNodes + - active + - candidateNodes + - chainId + - committeeNodes + - stateAddress + type: object + xml: + name: CommitteeInfoResponse + CommitteeNode: + example: + node: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + accessAPI: accessAPI + properties: + accessAPI: + format: string + type: string + xml: + name: AccessAPI + node: + $ref: '#/components/schemas/PeeringNodeStatusResponse' + required: + - accessAPI + - node + type: object + xml: + name: CommitteeNode + CommitteeNode_: + example: + node: + isAlive: true + netId: localhost:4000 + publicKey: 0x0000 + numUsers: 1 + isTrusted: true + accessAPI: accessAPI + properties: + accessAPI: + format: string + type: string + xml: + name: AccessAPI + node: + $ref: '#/components/schemas/PeeringNodeStatusResponse_' + required: + - accessAPI + - node + type: object + xml: + name: CommitteeNode + ConsensusPipeMetrics: + example: + eventACSMsgPipeSize: 0 + eventPeerLogIndexMsgPipeSize: 6 + eventVMResultMsgPipeSize: 5 + eventStateTransitionMsgPipeSize: 1 + eventTimerMsgPipeSize: 5 + properties: + eventACSMsgPipeSize: + format: int32 + type: integer + xml: + name: EventACSMsgPipeSize + eventPeerLogIndexMsgPipeSize: + format: int32 + type: integer + xml: + name: EventPeerLogIndexMsgPipeSize + eventStateTransitionMsgPipeSize: + format: int32 + type: integer + xml: + name: EventStateTransitionMsgPipeSize + eventTimerMsgPipeSize: + format: int32 + type: integer + xml: + name: EventTimerMsgPipeSize + eventVMResultMsgPipeSize: + format: int32 + type: integer + xml: + name: EventVMResultMsgPipeSize + required: + - eventACSMsgPipeSize + - eventPeerLogIndexMsgPipeSize + - eventStateTransitionMsgPipeSize + - eventTimerMsgPipeSize + - eventVMResultMsgPipeSize + type: object + xml: + name: ConsensusPipeMetrics + ConsensusWorkflowMetrics: + example: + flagStateReceived: true + flagTransactionPosted: true + flagVMStarted: true + timeTransactionSeen: 2000-01-23T04:56:07.000+00:00 + flagConsensusBatchKnown: true + timeTransactionFinalized: 2000-01-23T04:56:07.000+00:00 + timeVMStarted: 2000-01-23T04:56:07.000+00:00 + flagVMResultSigned: true + timeBatchProposalSent: 2000-01-23T04:56:07.000+00:00 + timeVMResultSigned: 2000-01-23T04:56:07.000+00:00 + timeCompleted: 2000-01-23T04:56:07.000+00:00 + timeTransactionPosted: 2000-01-23T04:56:07.000+00:00 + flagTransactionSeen: true + timeConsensusBatchKnown: 2000-01-23T04:56:07.000+00:00 + currentStateIndex: 1 + flagInProgress: true + flagBatchProposalSent: true + flagTransactionFinalized: true + properties: + currentStateIndex: + description: Shows current state index of the consensus + format: int32 + minimum: 1 + type: integer + xml: + name: CurrentStateIndex + flagBatchProposalSent: + description: Shows if batch proposal is sent out in current consensus iteration + format: boolean + type: boolean + xml: + name: FlagBatchProposalSent + flagConsensusBatchKnown: + description: Shows if consensus on batch is reached and known in current + consensus iteration + format: boolean + type: boolean + xml: + name: FlagConsensusBatchKnown + flagInProgress: + description: Shows if consensus algorithm is still not completed in current + consensus iteration + format: boolean + type: boolean + xml: + name: FlagInProgress + flagStateReceived: + description: Shows if state output is received in current consensus iteration + format: boolean + type: boolean + xml: + name: FlagStateReceived + flagTransactionFinalized: + description: Shows if consensus on transaction is reached in current consensus + iteration + format: boolean + type: boolean + xml: + name: FlagTransactionFinalized + flagTransactionPosted: + description: Shows if transaction is posted to L1 in current consensus iteration + format: boolean + type: boolean + xml: + name: FlagTransactionPosted + flagTransactionSeen: + description: Shows if L1 reported that it has seen the transaction of current + consensus iteration + format: boolean + type: boolean + xml: + name: FlagTransactionSeen + flagVMResultSigned: + description: Shows if virtual machine has returned its results in current + consensus iteration + format: boolean + type: boolean + xml: + name: FlagVMResultSigned + flagVMStarted: + description: Shows if virtual machine is started in current consensus iteration + format: boolean + type: boolean + xml: + name: FlagVMStarted + timeBatchProposalSent: + description: Shows when batch proposal was last sent out in current consensus + iteration + format: date-time + type: string + xml: + name: TimeBatchProposalSent + timeCompleted: + description: Shows when algorithm was last completed in current consensus + iteration + format: date-time + type: string + xml: + name: TimeCompleted + timeConsensusBatchKnown: + description: Shows when ACS results of consensus on batch was last received + in current consensus iteration + format: date-time + type: string + xml: + name: TimeConsensusBatchKnown + timeTransactionFinalized: + description: Shows when algorithm last noted that all the data for consensus + on transaction had been received in current consensus iteration + format: date-time + type: string + xml: + name: TimeTransactionFinalized + timeTransactionPosted: + description: Shows when transaction was last posted to L1 in current consensus + iteration + format: date-time + type: string + xml: + name: TimeTransactionPosted + timeTransactionSeen: + description: Shows when algorithm last noted that transaction had been seen + by L1 in current consensus iteration + format: date-time + type: string + xml: + name: TimeTransactionSeen + timeVMResultSigned: + description: Shows when virtual machine results were last received and signed + in current consensus iteration + format: date-time + type: string + xml: + name: TimeVMResultSigned + timeVMStarted: + description: Shows when virtual machine was last started in current consensus + iteration + format: date-time + type: string + xml: + name: TimeVMStarted + required: + - flagBatchProposalSent + - flagConsensusBatchKnown + - flagInProgress + - flagStateReceived + - flagTransactionFinalized + - flagTransactionPosted + - flagTransactionSeen + - flagVMResultSigned + - flagVMStarted + - timeBatchProposalSent + - timeCompleted + - timeConsensusBatchKnown + - timeTransactionFinalized + - timeTransactionPosted + - timeTransactionSeen + - timeVMResultSigned + - timeVMStarted + type: object + xml: + name: ConsensusWorkflowMetrics + ContractCallViewRequest: + example: + contractHName: contractHName + chainId: chainId + functionName: functionName + functionHName: functionHName + arguments: + Items: + - value: value + key: key + - value: value + key: key + contractName: contractName + properties: + arguments: + $ref: '#/components/schemas/JSONDict' + chainId: + description: The chain id + format: string + type: string + xml: + name: ChainID + contractHName: + description: The contract name as HName (Hex) + format: string + type: string + xml: + name: ContractHName + contractName: + description: The contract name + format: string + type: string + xml: + name: ContractName + functionHName: + description: The function name as HName (Hex) + format: string + type: string + xml: + name: FunctionHName + functionName: + description: The function name + format: string + type: string + xml: + name: FunctionName + required: + - arguments + - chainId + - contractHName + - contractName + - functionHName + - functionName + type: object + xml: + name: ContractCallViewRequest + ContractInfoResponse: + example: + programHash: 0xc102cb078eb7a8c59b65c3682c878e3189cc696b86098d8c5883d08d0d215a87 + name: evm + description: EVM contract + hName: 07cb02c1 + properties: + description: + description: The description of the contract. + example: EVM contract + format: string + type: string + xml: + name: Description + hName: + description: The id (HName as Hex)) of the contract. + example: 07cb02c1 + format: string + type: string + xml: + name: HName + name: + description: The name of the contract. + example: evm + format: string + type: string + xml: + name: Name + programHash: + description: The hash of the contract. (Hex encoded) + example: 0xc102cb078eb7a8c59b65c3682c878e3189cc696b86098d8c5883d08d0d215a87 + format: string + type: string + xml: + name: ProgramHash + required: + - description + - hName + - name + - programHash + type: object + xml: + name: ContractInfoResponse + ControlAddressesResponse: + example: + governingAddress: governingAddress + sinceBlockIndex: 1 + stateAddress: stateAddress + properties: + governingAddress: + description: The governing address (Bech32) + format: string + type: string + xml: + name: GoverningAddress + sinceBlockIndex: + description: The block index (uint32 + format: int32 + minimum: 1 + type: integer + xml: + name: SinceBlockIndex + stateAddress: + description: The state address (Bech32) + format: string + type: string + xml: + name: StateAddress + required: + - governingAddress + - sinceBlockIndex + - stateAddress + type: object + xml: + name: ControlAddressesResponse + DKSharesInfo: + example: + publicKeyShares: + - publicKeyShares + - publicKeyShares + address: address + peerIdentities: + - peerIdentities + - peerIdentities + threshold: 1 + publicKey: publicKey + peerIndex: 1 + properties: + address: + description: New generated shared address. + format: string + type: string + xml: + name: Address + peerIdentities: + description: Identities of the nodes sharing the key. (Hex) + items: + format: string + type: string + type: array + xml: + name: PeerIdentities + wrapped: true + peerIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: PeerIndex + publicKey: + description: Used public key. (Hex) + format: string + type: string + xml: + name: PublicKey + publicKeyShares: + description: Public key shares for all the peers. (Hex) + items: + format: string + type: string + type: array + xml: + name: PublicKeyShares + wrapped: true + threshold: + format: int32 + minimum: 1 + type: integer + xml: + name: Threshold + required: + - address + - peerIdentities + - peerIndex + - publicKey + - publicKeyShares + - threshold + type: object + xml: + name: DKSharesInfo + DKSharesPostRequest: + example: + peerIdentities: + - peerIdentities + - peerIdentities + timeoutMS: 1 + threshold: 1 + properties: + peerIdentities: + items: + format: string + type: string + type: array + xml: + name: PeerIdentities + wrapped: true + threshold: + description: Should be =< len(PeerPublicIdentities) + format: int32 + minimum: 1 + type: integer + xml: + name: Threshold + timeoutMS: + description: Timeout in milliseconds. + format: int32 + minimum: 1 + type: integer + xml: + name: TimeoutMS + required: + - peerIdentities + - threshold + - timeoutMS + type: object + xml: + name: DKSharesPostRequest + ErrorMessageFormatResponse: + example: + messageFormat: messageFormat + properties: + messageFormat: + format: string + type: string + xml: + name: MessageFormat + required: + - messageFormat + type: object + xml: + name: ErrorMessageFormatResponse + EventsResponse: + example: + events: + - events + - events + properties: + events: + items: + format: string + type: string + type: array + xml: + name: Events + wrapped: true + required: + - events + type: object + xml: + name: EventsResponse + FoundryOutputResponse: + example: + assets: + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + foundryId: foundryId + properties: + assets: + $ref: '#/components/schemas/AssetsResponse' + foundryId: + format: string + type: string + xml: + name: FoundryID + required: + - assets + - foundryId + type: object + xml: + name: FoundryOutputResponse + GovAllowedStateControllerAddressesResponse: + example: + addresses: + - addresses + - addresses + properties: + addresses: + description: The allowed state controller addresses (Bech32-encoded) + items: + format: string + type: string + type: array + xml: + name: Addresses + wrapped: true + type: object + xml: + name: GovAllowedStateControllerAddressesResponse + GovChainInfoResponse: + example: + chainOwnerId: chainOwnerId + maxEventsPerReq: 5 + chainID: chainID + description: description + gasFeePolicy: + gasFeeTokenId: gasFeeTokenId + gasPerToken: gasPerToken + validatorFeeShare: 0 + maxBlobSize: 6 + maxEventSize: 1 + properties: + chainID: + description: ChainID (Bech32-encoded). + format: string + type: string + xml: + name: ChainID + chainOwnerId: + description: The chain owner address (Bech32-encoded). + format: string + type: string + xml: + name: ChainOwnerID + description: + description: The description of the chain. + format: string + type: string + xml: + name: Description + gasFeePolicy: + $ref: '#/components/schemas/gasFeePolicy_' + maxBlobSize: + description: The maximum contract blob size. + format: int32 + type: integer + xml: + name: MaxBlobSize + maxEventSize: + description: The maximum event size. + format: int32 + type: integer + xml: + name: MaxEventSize + maxEventsPerReq: + description: The maximum amount of events per request. + format: int32 + type: integer + xml: + name: MaxEventsPerReq + required: + - chainID + - chainOwnerId + - description + - gasFeePolicy + - maxBlobSize + - maxEventSize + - maxEventsPerReq + type: object + xml: + name: GovChainInfoResponse + GovChainOwnerResponse: + example: + chainOwner: chainOwner + properties: + chainOwner: + description: The chain owner (Bech32-encoded) + format: string + type: string + xml: + name: ChainOwner + type: object + xml: + name: GovChainOwnerResponse + InOutput: + example: + output: + outputType: 0 + raw: raw + outputId: outputId + properties: + output: + $ref: '#/components/schemas/Output' + outputId: + description: The output ID + format: string + type: string + xml: + name: OutputID + required: + - output + - outputId + type: object + xml: + name: InOutput + InOutputMetricItem: + example: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/InOutput' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: InOutputMetricItem + InStateOutput: + example: + output: + outputType: 0 + raw: raw + outputId: outputId + properties: + output: + $ref: '#/components/schemas/Output' + outputId: + description: The output ID + format: string + type: string + xml: + name: OutputID + required: + - output + - outputId + type: object + xml: + name: InStateOutput + InStateOutputMetricItem: + example: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/InStateOutput' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: InStateOutputMetricItem + InfoResponse: + example: + netID: 0.0.0.0:4000 + l1Params: + protocol: + rentStructure: + vByteFactorData: 1 + vByteCost: 500 + vByteFactorKey: 10 + minPowScore: 1 + tokenSupply: "2779530283277761" + networkName: private_tangle1 + belowMaxDepth: 15 + version: 2 + bech32Hrp: tst + maxPayloadSize: 32498 + baseToken: + unit: TEST + decimals: 6 + name: TestCoin + tickerSymbol: TEST + subunit: testies + useMetricPrefix: true + publicKey: 0x8fb9555a17393f0e01aadd90f8b6bc8a64b1c5c37c99915942e40b2af99e72d6 + version: 0.4.0-alpha.2-390-g5470f1925 + properties: + l1Params: + $ref: '#/components/schemas/L1Params' + netID: + description: The net id of the node + example: 0.0.0.0:4000 + format: string + type: string + xml: + name: NetID + publicKey: + description: The public key of the node (Hex) + example: 0x8fb9555a17393f0e01aadd90f8b6bc8a64b1c5c37c99915942e40b2af99e72d6 + format: string + type: string + xml: + name: PublicKey + version: + description: The version of the node + example: 0.4.0-alpha.2-390-g5470f1925 + format: string + type: string + xml: + name: Version + required: + - l1Params + - netID + - publicKey + - version + type: object + xml: + name: InfoResponse + InterfaceMetricItem: + example: + lastMessage: lastMessage + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + format: string + type: string + xml: + name: LastMessage + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: InterfaceMetricItem + Item: + example: + value: value + key: key + properties: + key: + description: key (hex-encoded) + format: string + type: string + xml: + name: Key + value: + description: value (hex-encoded) + format: string + type: string + xml: + name: Value + required: + - key + - value + type: object + xml: + name: Item + Item_: + example: + value: 0x76616c756531 + key: 0x6b657931 + properties: + key: + description: key (hex-encoded) + example: 0x6b657931 + format: string + type: string + xml: + name: Key + value: + description: value (hex-encoded) + example: 0x76616c756531 + format: string + type: string + xml: + name: Value + required: + - key + - value + type: object + xml: + name: Item + JSONDict: + example: + Items: + - value: value + key: key + - value: value + key: key + properties: + Items: + items: + $ref: '#/components/schemas/Item' + type: array + xml: + name: Items + wrapped: true + type: object + xml: + name: JSONDict + JSONDict_: + example: + Items: + - value: 0x76616c756531 + key: 0x6b657931 + - value: 0x76616c756531 + key: 0x6b657931 + properties: + Items: + items: + $ref: '#/components/schemas/Item_' + type: array + xml: + name: Items + wrapped: true + type: object + xml: + name: JSONDict + L1Params: + example: + protocol: + rentStructure: + vByteFactorData: 1 + vByteCost: 500 + vByteFactorKey: 10 + minPowScore: 1 + tokenSupply: "2779530283277761" + networkName: private_tangle1 + belowMaxDepth: 15 + version: 2 + bech32Hrp: tst + maxPayloadSize: 32498 + baseToken: + unit: TEST + decimals: 6 + name: TestCoin + tickerSymbol: TEST + subunit: testies + useMetricPrefix: true + properties: + baseToken: + $ref: '#/components/schemas/BaseToken' + maxPayloadSize: + description: The max payload size + example: 32498 + format: int32 + type: integer + xml: + name: MaxPayloadSize + protocol: + $ref: '#/components/schemas/ProtocolParameters' + required: + - baseToken + - maxPayloadSize + - protocol + type: object + xml: + name: L1Params + LoginRequest: + example: + password: password + username: username + properties: + password: + format: string + type: string + xml: + name: Password + username: + format: string + type: string + xml: + name: Username + required: + - password + - username + type: object + xml: + name: LoginRequest + LoginResponse: + example: + jwt: jwt + error: error + properties: + error: + format: string + type: string + xml: + name: Error + jwt: + format: string + type: string + xml: + name: JWT + required: + - error + - jwt + type: object + xml: + name: LoginResponse + MilestoneInfo: + example: + milestoneId: milestoneId + index: 0 + timestamp: 0 + properties: + index: + format: int32 + minimum: 0 + type: integer + xml: + name: Index + milestoneId: + format: string + type: string + xml: + name: MilestoneID + timestamp: + format: int32 + minimum: 0 + type: integer + xml: + name: Timestamp + type: object + xml: + name: MilestoneInfo + MilestoneMetricItem: + example: + lastMessage: + milestoneId: milestoneId + index: 0 + timestamp: 0 + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/MilestoneInfo' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: MilestoneMetricItem + NFTDataResponse: + example: + owner: owner + metadata: metadata + id: id + issuer: issuer + properties: + id: + format: string + type: string + xml: + name: ID + issuer: + format: string + type: string + xml: + name: Issuer + metadata: + format: string + type: string + xml: + name: Metadata + owner: + format: string + type: string + xml: + name: Owner + required: + - id + - issuer + - metadata + - owner + type: object + xml: + name: NFTDataResponse + NativeToken: + example: + amount: amount + id: id + properties: + amount: + format: string + type: string + xml: + name: Amount + id: + format: string + type: string + xml: + name: ID + required: + - amount + - id + type: object + xml: + name: NativeToken + NativeTokenIDRegistryResponse: + example: + nativeTokenRegistryIds: + - nativeTokenRegistryIds + - nativeTokenRegistryIds + properties: + nativeTokenRegistryIds: + items: + format: string + type: string + type: array + xml: + name: NativeTokenRegistryIDs + wrapped: true + required: + - nativeTokenRegistryIds + type: object + xml: + name: NativeTokenIDRegistryResponse + NodeOwnerCertificateRequest: + example: + ownerAddress: ownerAddress + publicKey: publicKey + properties: + ownerAddress: + description: Node owner address. (Bech32) + format: string + type: string + xml: + name: OwnerAddress + publicKey: + description: The public key of the node (Hex) + format: string + type: string + xml: + name: PublicKey + required: + - ownerAddress + - publicKey + type: object + xml: + name: NodeOwnerCertificateRequest + NodeOwnerCertificateResponse: + example: + certificate: certificate + properties: + certificate: + description: Certificate stating the ownership. (Hex) + format: string + type: string + xml: + name: Certificate + required: + - certificate + type: object + xml: + name: NodeOwnerCertificateResponse + OffLedgerRequest: + example: + request: Hex string + chainId: chainId + properties: + chainId: + description: The chain id + format: string + type: string + xml: + name: ChainID + request: + description: Offledger Request (Hex) + example: Hex string + format: string + type: string + xml: + name: Request + required: + - chainId + - request + type: object + xml: + name: OffLedgerRequest + OnLedgerRequest: + example: + output: + outputType: 0 + raw: raw + outputId: outputId + raw: raw + id: id + properties: + id: + description: The request ID + format: string + type: string + xml: + name: ID + output: + $ref: '#/components/schemas/Output' + outputId: + description: The output ID + format: string + type: string + xml: + name: OutputID + raw: + description: The raw data of the request (Hex) + format: string + type: string + xml: + name: Raw + required: + - id + - output + - outputId + - raw + type: object + xml: + name: OnLedgerRequest + OnLedgerRequestMetricItem: + example: + lastMessage: + output: + outputType: 0 + raw: raw + outputId: outputId + raw: raw + id: id + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/OnLedgerRequest' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: OnLedgerRequestMetricItem + Output: + example: + outputType: 0 + raw: raw + properties: + outputType: + description: The output type + format: int32 + type: integer + xml: + name: OutputType + raw: + description: The raw data of the output (Hex) + format: string + type: string + xml: + name: Raw + required: + - outputType + - raw + type: object + xml: + name: Output + OutputID: + example: + outputId: outputId + properties: + outputId: + description: The output ID + format: string + type: string + xml: + name: OutputID + required: + - outputId + type: object + xml: + name: OutputID + PeeringNodeIdentityResponse: + example: + netId: localhost:4000 + publicKey: 0x0000 + isTrusted: true + properties: + isTrusted: + example: true + format: boolean + type: boolean + xml: + name: IsTrusted + netId: + description: The NetID of the peer + example: localhost:4000 + format: string + type: string + xml: + name: NetID + publicKey: + description: The peers public key encoded in Hex + example: 0x0000 + format: string + type: string + xml: + name: PublicKey + required: + - isTrusted + - netId + - publicKey + type: object + xml: + name: PeeringNodeIdentityResponse + PeeringNodeStatusResponse: + example: + isAlive: true + netId: netId + publicKey: publicKey + numUsers: 0 + isTrusted: true + properties: + isAlive: + description: Whether or not the peer is activated + format: boolean + type: boolean + xml: + name: IsAlive + isTrusted: + format: boolean + type: boolean + xml: + name: IsTrusted + netId: + description: The NetID of the peer + format: string + type: string + xml: + name: NetID + numUsers: + description: The amount of users attached to the peer + format: int32 + type: integer + xml: + name: NumUsers + publicKey: + description: The peers public key encoded in Hex + format: string + type: string + xml: + name: PublicKey + required: + - isAlive + - isTrusted + - netId + - numUsers + - publicKey + type: object + xml: + name: PeeringNodeStatusResponse + PeeringNodeStatusResponse_: + example: + isAlive: true + netId: localhost:4000 + publicKey: 0x0000 + numUsers: 1 + isTrusted: true + properties: + isAlive: + description: Whether or not the peer is activated + example: true + format: boolean + type: boolean + xml: + name: IsAlive + isTrusted: + example: true + format: boolean + type: boolean + xml: + name: IsTrusted + netId: + description: The NetID of the peer + example: localhost:4000 + format: string + type: string + xml: + name: NetID + numUsers: + description: The amount of users attached to the peer + example: 1 + format: int32 + type: integer + xml: + name: NumUsers + publicKey: + description: The peers public key encoded in Hex + example: 0x0000 + format: string + type: string + xml: + name: PublicKey + required: + - isAlive + - isTrusted + - netId + - numUsers + - publicKey + type: object + xml: + name: PeeringNodeStatusResponse + PeeringTrustRequest: + example: + netId: localhost:4000 + publicKey: 0x0000 + properties: + netId: + description: The NetID of the peer + example: localhost:4000 + format: string + type: string + xml: + name: NetID + publicKey: + description: The peers public key encoded in Hex + example: 0x0000 + format: string + type: string + xml: + name: PublicKey + required: + - netId + - publicKey + type: object + xml: + name: PeeringTrustRequest + ProtocolParameters: + example: + rentStructure: + vByteFactorData: 1 + vByteCost: 500 + vByteFactorKey: 10 + minPowScore: 1 + tokenSupply: "2779530283277761" + networkName: private_tangle1 + belowMaxDepth: 15 + version: 2 + bech32Hrp: tst + properties: + bech32Hrp: + description: The human readable network prefix + example: tst + format: string + type: string + xml: + name: Bech32HRP + belowMaxDepth: + description: The networks max depth + example: 15 + format: int32 + minimum: 1 + type: integer + xml: + name: BelowMaxDepth + minPowScore: + description: The minimal PoW score + format: int32 + minimum: 1 + type: integer + xml: + name: MinPoWScore + networkName: + description: The network name + example: private_tangle1 + format: string + type: string + xml: + name: NetworkName + rentStructure: + $ref: '#/components/schemas/RentStructure' + tokenSupply: + description: The token supply + example: "2779530283277761" + format: string + type: string + xml: + name: TokenSupply + version: + description: The protocol version + example: 2 + format: int32 + type: integer + xml: + name: Version + required: + - bech32Hrp + - belowMaxDepth + - minPowScore + - networkName + - rentStructure + - tokenSupply + - version + type: object + xml: + name: ProtocolParameters + PublisherStateTransactionItem: + example: + lastMessage: + stateIndex: 1 + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/StateTransaction' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: PublisherStateTransactionItem + ReceiptError: + example: + contractHName: contractHName + messageFormat: messageFormat + errorCode: errorCode + errorId: 1 + message: message + parameters: + - parameters + - parameters + properties: + contractHName: + description: The contract hname (Hex) + format: string + type: string + xml: + name: ContractHName + errorCode: + format: string + type: string + xml: + name: ErrorCode + errorId: + format: int32 + minimum: 1 + type: integer + xml: + name: ErrorID + message: + format: string + type: string + xml: + name: Message + messageFormat: + format: string + type: string + xml: + name: MessageFormat + parameters: + items: + format: string + type: string + type: array + xml: + name: Parameters + wrapped: true + required: + - contractHName + - errorCode + - errorId + - message + - messageFormat + - parameters + type: object + xml: + name: ReceiptError + ReceiptResponse: + example: + gasBurnLog: + - code: 6 + gasBurned: 1 + - code: 6 + gasBurned: 1 + request: request + blockIndex: 1 + requestIndex: 1 + gasFeeCharged: gasFeeCharged + gasBudget: gasBudget + gasBurned: gasBurned + error: + contractHName: contractHName + messageFormat: messageFormat + errorCode: errorCode + errorId: 1 + message: message + parameters: + - parameters + - parameters + properties: + blockIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: BlockIndex + error: + $ref: '#/components/schemas/ReceiptError' + gasBudget: + description: The gas budget (uint64 as string) + format: string + type: string + xml: + name: GasBudget + gasBurnLog: + items: + $ref: '#/components/schemas/BurnRecord' + type: array + xml: + name: GasBurnLog + wrapped: true + gasBurned: + description: The burned gas (uint64 as string) + format: string + type: string + xml: + name: GasBurned + gasFeeCharged: + description: The charged gas fee (uint64 as string) + format: string + type: string + xml: + name: GasFeeCharged + request: + format: string + type: string + xml: + name: Request + requestIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: RequestIndex + required: + - blockIndex + - gasBudget + - gasBurnLog + - gasBurned + - gasFeeCharged + - request + - requestIndex + type: object + xml: + name: ReceiptResponse + RentStructure: + example: + vByteFactorData: 1 + vByteCost: 500 + vByteFactorKey: 10 + properties: + vByteCost: + description: The virtual byte cost + example: 500 + format: int32 + minimum: 1 + type: integer + xml: + name: VByteCost + vByteFactorData: + description: The virtual byte factor for data fields + example: 1 + format: int32 + type: integer + xml: + name: VBFactorData + vByteFactorKey: + description: The virtual byte factor for key/lookup generating fields + example: 10 + format: int32 + type: integer + xml: + name: VBFactorKey + required: + - vByteCost + - vByteFactorData + - vByteFactorKey + type: object + xml: + name: RentStructure + RequestDetail: + example: + fungibleTokens: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + senderAccount: senderAccount + isOffLedger: true + gasGudget: gasGudget + requestId: requestId + callTarget: + contractHName: contractHName + functionHName: functionHName + targetAddress: targetAddress + allowance: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + params: + Items: + - value: value + key: key + - value: value + key: key + nft: + owner: owner + metadata: metadata + id: id + issuer: issuer + isEVM: true + properties: + allowance: + $ref: '#/components/schemas/Assets' + callTarget: + $ref: '#/components/schemas/CallTarget' + fungibleTokens: + $ref: '#/components/schemas/Assets' + gasGudget: + description: The gas budget (uint64 as string) + format: string + type: string + xml: + name: GasGudget + isEVM: + format: boolean + type: boolean + xml: + name: IsEVM + isOffLedger: + format: boolean + type: boolean + xml: + name: IsOffLedger + nft: + $ref: '#/components/schemas/NFTDataResponse' + params: + $ref: '#/components/schemas/JSONDict' + requestId: + format: string + type: string + xml: + name: RequestID + senderAccount: + format: string + type: string + xml: + name: SenderAccount + targetAddress: + format: string + type: string + xml: + name: TargetAddress + required: + - allowance + - callTarget + - fungibleTokens + - gasGudget + - isEVM + - isOffLedger + - nft + - params + - requestId + - senderAccount + - targetAddress + type: object + xml: + name: RequestDetail + RequestIDResponse: + example: + requestId: requestId + properties: + requestId: + description: The request ID of the given transaction ID. (Hex) + format: string + type: string + xml: + name: RequestID + required: + - requestId + type: object + xml: + name: RequestIDResponse + RequestIDsResponse: + example: + requestIds: + - requestIds + - requestIds + properties: + requestIds: + items: + format: string + type: string + type: array + xml: + name: RequestIDs + wrapped: true + required: + - requestIds + type: object + xml: + name: RequestIDsResponse + RequestProcessedResponse: + example: + chainId: chainId + requestId: requestId + isProcessed: true + properties: + chainId: + format: string + type: string + xml: + name: ChainID + isProcessed: + format: boolean + type: boolean + xml: + name: IsProcessed + requestId: + format: string + type: string + xml: + name: RequestID + required: + - chainId + - isProcessed + - requestId + type: object + xml: + name: RequestProcessedResponse + RequestReceiptResponse: + example: + gasBurnLog: + records: + - code: 6 + gasBurned: 1 + - code: 6 + gasBurned: 1 + request: + fungibleTokens: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + senderAccount: senderAccount + isOffLedger: true + gasGudget: gasGudget + requestId: requestId + callTarget: + contractHName: contractHName + functionHName: functionHName + targetAddress: targetAddress + allowance: + nfts: + - nfts + - nfts + baseTokens: baseTokens + nativeTokens: + - amount: amount + id: id + - amount: amount + id: id + params: + Items: + - value: value + key: key + - value: value + key: key + nft: + owner: owner + metadata: metadata + id: id + issuer: issuer + isEVM: true + blockIndex: 1 + requestIndex: 1 + gasFeeCharged: gasFeeCharged + gasBudget: gasBudget + gasBurned: gasBurned + error: + errorMessage: errorMessage + hash: hash + properties: + blockIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: BlockIndex + error: + $ref: '#/components/schemas/BlockReceiptError' + gasBudget: + description: The gas budget (uint64 as string) + format: string + type: string + xml: + name: GasBudget + gasBurnLog: + $ref: '#/components/schemas/BurnLog' + gasBurned: + description: The burned gas (uint64 as string) + format: string + type: string + xml: + name: GasBurned + gasFeeCharged: + description: The charged gas fee (uint64 as string) + format: string + type: string + xml: + name: GasFeeCharged + request: + $ref: '#/components/schemas/RequestDetail' + requestIndex: + format: int32 + minimum: 1 + type: integer + xml: + name: RequestIndex + required: + - blockIndex + - gasBudget + - gasBurnLog + - gasBurned + - gasFeeCharged + - request + - requestIndex + type: object + xml: + name: RequestReceiptResponse + StateResponse: + example: + state: state + properties: + state: + description: The state of the requested key (Hex-encoded) + format: string + type: string + xml: + name: State + required: + - state + type: object + xml: + name: StateResponse + StateTransaction: + example: + stateIndex: 1 + txId: txId + properties: + stateIndex: + description: The state index + format: int32 + minimum: 1 + type: integer + xml: + name: StateIndex + txId: + description: The transaction ID + format: string + type: string + xml: + name: TransactionID + required: + - stateIndex + - txId + type: object + xml: + name: StateTransaction + Transaction: + example: + txId: txId + properties: + txId: + description: The transaction ID + format: string + type: string + xml: + name: TransactionID + required: + - txId + type: object + xml: + name: Transaction + TransactionIDMetricItem: + example: + lastMessage: + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/Transaction' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: TransactionIDMetricItem + TransactionMetricItem: + example: + lastMessage: + txId: txId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/Transaction' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: TransactionMetricItem + TxInclusionStateMsg: + example: + txId: txId + state: state + properties: + state: + description: The inclusion state + format: string + type: string + xml: + name: State + txId: + description: The transaction ID + format: string + type: string + xml: + name: TransactionID + required: + - state + - txId + type: object + xml: + name: TxInclusionStateMsg + TxInclusionStateMsgMetricItem: + example: + lastMessage: + txId: txId + state: state + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/TxInclusionStateMsg' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: TxInclusionStateMsgMetricItem + UTXOInputMetricItem: + example: + lastMessage: + outputId: outputId + messages: 1 + timestamp: 2000-01-23T04:56:07.000+00:00 + properties: + lastMessage: + $ref: '#/components/schemas/OutputID' + messages: + format: int32 + minimum: 1 + type: integer + xml: + name: Messages + timestamp: + format: date-time + type: string + xml: + name: Timestamp + required: + - lastMessage + - messages + - timestamp + type: object + xml: + name: UTXOInputMetricItem + UpdateUserPasswordRequest: + example: + password: password + properties: + password: + format: string + type: string + xml: + name: Password + required: + - password + type: object + xml: + name: UpdateUserPasswordRequest + UpdateUserPermissionsRequest: + example: + permissions: + - permissions + - permissions + properties: + permissions: + items: + format: string + type: string + type: array + xml: + name: Permissions + wrapped: true + required: + - permissions + type: object + xml: + name: UpdateUserPermissionsRequest + User: + example: + permissions: + - permissions + - permissions + username: username + properties: + permissions: + items: + format: string + type: string + type: array + xml: + name: Permissions + wrapped: true + username: + format: string + type: string + xml: + name: Username + required: + - permissions + - username + type: object + xml: + name: User + ValidationError: + properties: + error: + format: string + type: string + xml: + name: Error + missingPermission: + format: string + type: string + xml: + name: MissingPermission + required: + - error + - missingPermission + type: object + xml: + name: ValidationError + VersionResponse: + example: + version: version + properties: + version: + description: The version of the node + format: string + type: string + xml: + name: Version + required: + - version + type: object + xml: + name: VersionResponse + gasFeePolicy: + example: + gasFeeTokenId: gasFeeTokenId + gasPerToken: "100" + validatorFeeShare: 1 + properties: + gasFeeTokenId: + description: The gas fee token id. Empty if base token. + format: string + type: string + xml: + name: GasFeeTokenID + gasPerToken: + description: The amount of gas per token. (uint64 as string) + example: "100" + format: string + type: string + xml: + name: GasPerToken + validatorFeeShare: + description: The validator fee share. + format: int32 + minimum: 1 + type: integer + xml: + name: ValidatorFeeShare + required: + - gasFeeTokenId + - gasPerToken + - validatorFeeShare + type: object + xml: + name: gasFeePolicy + gasFeePolicy_: + example: + gasFeeTokenId: gasFeeTokenId + gasPerToken: gasPerToken + validatorFeeShare: 0 + properties: + gasFeeTokenId: + description: The gas fee token id. Empty if base token. + format: string + type: string + xml: + name: GasFeeTokenID + gasPerToken: + description: The amount of gas per token. (uint64 as string) + format: string + type: string + xml: + name: GasPerToken + validatorFeeShare: + description: The validator fee share. + format: int32 + type: integer + xml: + name: ValidatorFeeShare + required: + - gasFeeTokenId + - gasPerToken + - validatorFeeShare + type: object + xml: + name: gasFeePolicy + securitySchemes: + Authorization: + description: JWT Token + in: header + name: Authorization + type: apiKey +x-original-swagger-version: "2.0" diff --git a/clients/apiclient/api_auth.go b/clients/apiclient/api_auth.go new file mode 100644 index 0000000000..fbb50d3ec0 --- /dev/null +++ b/clients/apiclient/api_auth.go @@ -0,0 +1,229 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" +) + + +// AuthApiService AuthApi service +type AuthApiService service + +type ApiAuthInfoRequest struct { + ctx context.Context + ApiService *AuthApiService +} + +func (r ApiAuthInfoRequest) Execute() (*AuthInfoModel, *http.Response, error) { + return r.ApiService.AuthInfoExecute(r) +} + +/* +AuthInfo Get information about the current authentication mode + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAuthInfoRequest +*/ +func (a *AuthApiService) AuthInfo(ctx context.Context) ApiAuthInfoRequest { + return ApiAuthInfoRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return AuthInfoModel +func (a *AuthApiService) AuthInfoExecute(r ApiAuthInfoRequest) (*AuthInfoModel, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AuthInfoModel + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthApiService.AuthInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/auth/info" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAuthenticateRequest struct { + ctx context.Context + ApiService *AuthApiService + loginRequest *LoginRequest +} + +// The login request +func (r ApiAuthenticateRequest) LoginRequest(loginRequest LoginRequest) ApiAuthenticateRequest { + r.loginRequest = &loginRequest + return r +} + +func (r ApiAuthenticateRequest) Execute() (*LoginResponse, *http.Response, error) { + return r.ApiService.AuthenticateExecute(r) +} + +/* +Authenticate Authenticate towards the node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAuthenticateRequest +*/ +func (a *AuthApiService) Authenticate(ctx context.Context) ApiAuthenticateRequest { + return ApiAuthenticateRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return LoginResponse +func (a *AuthApiService) AuthenticateExecute(r ApiAuthenticateRequest) (*LoginResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LoginResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AuthApiService.Authenticate") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/auth" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.loginRequest == nil { + return localVarReturnValue, nil, reportError("loginRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.loginRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_chains.go b/clients/apiclient/api_chains.go new file mode 100644 index 0000000000..0df11ef9b1 --- /dev/null +++ b/clients/apiclient/api_chains.go @@ -0,0 +1,1587 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// ChainsApiService ChainsApi service +type ChainsApiService service + +type ApiActivateChainRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiActivateChainRequest) Execute() (*http.Response, error) { + return r.ApiService.ActivateChainExecute(r) +} + +/* +ActivateChain Activate a chain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiActivateChainRequest +*/ +func (a *ChainsApiService) ActivateChain(ctx context.Context, chainID string) ApiActivateChainRequest { + return ApiActivateChainRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +func (a *ChainsApiService) ActivateChainExecute(r ApiActivateChainRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.ActivateChain") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/activate" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiAddAccessNodeRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string + publicKey string +} + +func (r ApiAddAccessNodeRequest) Execute() (*http.Response, error) { + return r.ApiService.AddAccessNodeExecute(r) +} + +/* +AddAccessNode Configure a trusted node to be an access node. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param publicKey Nodes public key (Hex) + @return ApiAddAccessNodeRequest +*/ +func (a *ChainsApiService) AddAccessNode(ctx context.Context, chainID string, publicKey string) ApiAddAccessNodeRequest { + return ApiAddAccessNodeRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + publicKey: publicKey, + } +} + +// Execute executes the request +func (a *ChainsApiService) AddAccessNodeExecute(r ApiAddAccessNodeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.AddAccessNode") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/access-node/{publicKey}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicKey"+"}", url.PathEscape(parameterValueToString(r.publicKey, "publicKey")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiAttachToWebsocketRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiAttachToWebsocketRequest) Execute() (*http.Response, error) { + return r.ApiService.AttachToWebsocketExecute(r) +} + +/* +AttachToWebsocket Method for AttachToWebsocket + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32-encoded) + @return ApiAttachToWebsocketRequest +*/ +func (a *ChainsApiService) AttachToWebsocket(ctx context.Context, chainID string) ApiAttachToWebsocketRequest { + return ApiAttachToWebsocketRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +func (a *ChainsApiService) AttachToWebsocketExecute(r ApiAttachToWebsocketRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.AttachToWebsocket") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/ws" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiChainsChainIDEvmGetRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiChainsChainIDEvmGetRequest) Execute() (string, *http.Response, error) { + return r.ApiService.ChainsChainIDEvmGetExecute(r) +} + +/* +ChainsChainIDEvmGet Method for ChainsChainIDEvmGet + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiChainsChainIDEvmGetRequest +*/ +func (a *ChainsApiService) ChainsChainIDEvmGet(ctx context.Context, chainID string) ApiChainsChainIDEvmGetRequest { + return ApiChainsChainIDEvmGetRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return string +func (a *ChainsApiService) ChainsChainIDEvmGetExecute(r ApiChainsChainIDEvmGetRequest) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.ChainsChainIDEvmGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/evm" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeactivateChainRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiDeactivateChainRequest) Execute() (*http.Response, error) { + return r.ApiService.DeactivateChainExecute(r) +} + +/* +DeactivateChain Deactivate a chain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiDeactivateChainRequest +*/ +func (a *ChainsApiService) DeactivateChain(ctx context.Context, chainID string) ApiDeactivateChainRequest { + return ApiDeactivateChainRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +func (a *ChainsApiService) DeactivateChainExecute(r ApiDeactivateChainRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.DeactivateChain") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/deactivate" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetChainInfoRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiGetChainInfoRequest) Execute() (*ChainInfoResponse, *http.Response, error) { + return r.ApiService.GetChainInfoExecute(r) +} + +/* +GetChainInfo Get information about a specific chain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetChainInfoRequest +*/ +func (a *ChainsApiService) GetChainInfo(ctx context.Context, chainID string) ApiGetChainInfoRequest { + return ApiGetChainInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return ChainInfoResponse +func (a *ChainsApiService) GetChainInfoExecute(r ApiGetChainInfoRequest) (*ChainInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ChainInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetChainInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetChainsRequest struct { + ctx context.Context + ApiService *ChainsApiService +} + +func (r ApiGetChainsRequest) Execute() ([]ChainInfoResponse, *http.Response, error) { + return r.ApiService.GetChainsExecute(r) +} + +/* +GetChains Get a list of all chains + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetChainsRequest +*/ +func (a *ChainsApiService) GetChains(ctx context.Context) ApiGetChainsRequest { + return ApiGetChainsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []ChainInfoResponse +func (a *ChainsApiService) GetChainsExecute(r ApiGetChainsRequest) ([]ChainInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ChainInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetChains") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetCommitteeInfoRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiGetCommitteeInfoRequest) Execute() (*CommitteeInfoResponse, *http.Response, error) { + return r.ApiService.GetCommitteeInfoExecute(r) +} + +/* +GetCommitteeInfo Get information about the deployed committee + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetCommitteeInfoRequest +*/ +func (a *ChainsApiService) GetCommitteeInfo(ctx context.Context, chainID string) ApiGetCommitteeInfoRequest { + return ApiGetCommitteeInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return CommitteeInfoResponse +func (a *ChainsApiService) GetCommitteeInfoExecute(r ApiGetCommitteeInfoRequest) (*CommitteeInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CommitteeInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetCommitteeInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/committee" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetContractsRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string +} + +func (r ApiGetContractsRequest) Execute() ([]ContractInfoResponse, *http.Response, error) { + return r.ApiService.GetContractsExecute(r) +} + +/* +GetContracts Get all available chain contracts + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetContractsRequest +*/ +func (a *ChainsApiService) GetContracts(ctx context.Context, chainID string) ApiGetContractsRequest { + return ApiGetContractsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return []ContractInfoResponse +func (a *ChainsApiService) GetContractsExecute(r ApiGetContractsRequest) ([]ContractInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []ContractInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetContracts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/contracts" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetRequestIDFromEVMTransactionIDRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string + txHash string +} + +func (r ApiGetRequestIDFromEVMTransactionIDRequest) Execute() (*RequestIDResponse, *http.Response, error) { + return r.ApiService.GetRequestIDFromEVMTransactionIDExecute(r) +} + +/* +GetRequestIDFromEVMTransactionID Get the ISC request ID for the given Ethereum transaction hash + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param txHash Transaction hash (Hex-encoded) + @return ApiGetRequestIDFromEVMTransactionIDRequest +*/ +func (a *ChainsApiService) GetRequestIDFromEVMTransactionID(ctx context.Context, chainID string, txHash string) ApiGetRequestIDFromEVMTransactionIDRequest { + return ApiGetRequestIDFromEVMTransactionIDRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + txHash: txHash, + } +} + +// Execute executes the request +// @return RequestIDResponse +func (a *ChainsApiService) GetRequestIDFromEVMTransactionIDExecute(r ApiGetRequestIDFromEVMTransactionIDRequest) (*RequestIDResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestIDResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetRequestIDFromEVMTransactionID") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/evm/tx/{txHash}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"txHash"+"}", url.PathEscape(parameterValueToString(r.txHash, "txHash")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 404 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetStateValueRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string + stateKey string +} + +func (r ApiGetStateValueRequest) Execute() (*StateResponse, *http.Response, error) { + return r.ApiService.GetStateValueExecute(r) +} + +/* +GetStateValue Fetch the raw value associated with the given key in the chain state + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param stateKey Key (Hex-encoded) + @return ApiGetStateValueRequest +*/ +func (a *ChainsApiService) GetStateValue(ctx context.Context, chainID string, stateKey string) ApiGetStateValueRequest { + return ApiGetStateValueRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + stateKey: stateKey, + } +} + +// Execute executes the request +// @return StateResponse +func (a *ChainsApiService) GetStateValueExecute(r ApiGetStateValueRequest) (*StateResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *StateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.GetStateValue") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/state/{stateKey}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"stateKey"+"}", url.PathEscape(parameterValueToString(r.stateKey, "stateKey")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRemoveAccessNodeRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string + publicKey string +} + +func (r ApiRemoveAccessNodeRequest) Execute() (*http.Response, error) { + return r.ApiService.RemoveAccessNodeExecute(r) +} + +/* +RemoveAccessNode Remove an access node. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param publicKey Nodes public key (Hex) + @return ApiRemoveAccessNodeRequest +*/ +func (a *ChainsApiService) RemoveAccessNode(ctx context.Context, chainID string, publicKey string) ApiRemoveAccessNodeRequest { + return ApiRemoveAccessNodeRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + publicKey: publicKey, + } +} + +// Execute executes the request +func (a *ChainsApiService) RemoveAccessNodeExecute(r ApiRemoveAccessNodeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.RemoveAccessNode") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/access-node/{publicKey}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicKey"+"}", url.PathEscape(parameterValueToString(r.publicKey, "publicKey")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiSetChainRecordRequest struct { + ctx context.Context + ApiService *ChainsApiService + chainID string + chainRecord *ChainRecord +} + +// Chain Record +func (r ApiSetChainRecordRequest) ChainRecord(chainRecord ChainRecord) ApiSetChainRecordRequest { + r.chainRecord = &chainRecord + return r +} + +func (r ApiSetChainRecordRequest) Execute() (*http.Response, error) { + return r.ApiService.SetChainRecordExecute(r) +} + +/* +SetChainRecord Sets the chain record. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiSetChainRecordRequest +*/ +func (a *ChainsApiService) SetChainRecord(ctx context.Context, chainID string) ApiSetChainRecordRequest { + return ApiSetChainRecordRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +func (a *ChainsApiService) SetChainRecordExecute(r ApiSetChainRecordRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ChainsApiService.SetChainRecord") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/chainrecord" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.chainRecord == nil { + return nil, reportError("chainRecord is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.chainRecord + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_corecontracts.go b/clients/apiclient/api_corecontracts.go new file mode 100644 index 0000000000..b278982f4b --- /dev/null +++ b/clients/apiclient/api_corecontracts.go @@ -0,0 +1,3620 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// CorecontractsApiService CorecontractsApi service +type CorecontractsApiService service + +type ApiAccountsGetAccountBalanceRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + agentID string +} + +func (r ApiAccountsGetAccountBalanceRequest) Execute() (*AssetsResponse, *http.Response, error) { + return r.ApiService.AccountsGetAccountBalanceExecute(r) +} + +/* +AccountsGetAccountBalance Get all assets belonging to an account + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param agentID AgentID (Bech32 for WasmVM | Hex for EVM) + @return ApiAccountsGetAccountBalanceRequest +*/ +func (a *CorecontractsApiService) AccountsGetAccountBalance(ctx context.Context, chainID string, agentID string) ApiAccountsGetAccountBalanceRequest { + return ApiAccountsGetAccountBalanceRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + agentID: agentID, + } +} + +// Execute executes the request +// @return AssetsResponse +func (a *CorecontractsApiService) AccountsGetAccountBalanceExecute(r ApiAccountsGetAccountBalanceRequest) (*AssetsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AssetsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetAccountBalance") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/account/{agentID}/balance" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agentID"+"}", url.PathEscape(parameterValueToString(r.agentID, "agentID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetAccountNFTIDsRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + agentID string +} + +func (r ApiAccountsGetAccountNFTIDsRequest) Execute() (*AccountNFTsResponse, *http.Response, error) { + return r.ApiService.AccountsGetAccountNFTIDsExecute(r) +} + +/* +AccountsGetAccountNFTIDs Get all NFT ids belonging to an account + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param agentID AgentID (Bech32 for WasmVM | Hex for EVM) + @return ApiAccountsGetAccountNFTIDsRequest +*/ +func (a *CorecontractsApiService) AccountsGetAccountNFTIDs(ctx context.Context, chainID string, agentID string) ApiAccountsGetAccountNFTIDsRequest { + return ApiAccountsGetAccountNFTIDsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + agentID: agentID, + } +} + +// Execute executes the request +// @return AccountNFTsResponse +func (a *CorecontractsApiService) AccountsGetAccountNFTIDsExecute(r ApiAccountsGetAccountNFTIDsRequest) (*AccountNFTsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccountNFTsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetAccountNFTIDs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/account/{agentID}/nfts" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agentID"+"}", url.PathEscape(parameterValueToString(r.agentID, "agentID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetAccountNonceRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + agentID string +} + +func (r ApiAccountsGetAccountNonceRequest) Execute() (*AccountNonceResponse, *http.Response, error) { + return r.ApiService.AccountsGetAccountNonceExecute(r) +} + +/* +AccountsGetAccountNonce Get the current nonce of an account + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param agentID AgentID (Bech32 for WasmVM | Hex for EVM | '000000@Bech32' Addresses require urlencode) + @return ApiAccountsGetAccountNonceRequest +*/ +func (a *CorecontractsApiService) AccountsGetAccountNonce(ctx context.Context, chainID string, agentID string) ApiAccountsGetAccountNonceRequest { + return ApiAccountsGetAccountNonceRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + agentID: agentID, + } +} + +// Execute executes the request +// @return AccountNonceResponse +func (a *CorecontractsApiService) AccountsGetAccountNonceExecute(r ApiAccountsGetAccountNonceRequest) (*AccountNonceResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccountNonceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetAccountNonce") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/account/{agentID}/nonce" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"agentID"+"}", url.PathEscape(parameterValueToString(r.agentID, "agentID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetAccountsRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiAccountsGetAccountsRequest) Execute() (*AccountListResponse, *http.Response, error) { + return r.ApiService.AccountsGetAccountsExecute(r) +} + +/* +AccountsGetAccounts Get a list of all accounts + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiAccountsGetAccountsRequest +*/ +func (a *CorecontractsApiService) AccountsGetAccounts(ctx context.Context, chainID string) ApiAccountsGetAccountsRequest { + return ApiAccountsGetAccountsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return AccountListResponse +func (a *CorecontractsApiService) AccountsGetAccountsExecute(r ApiAccountsGetAccountsRequest) (*AccountListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccountListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetAccounts") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetFoundryOutputRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + serialNumber uint32 +} + +func (r ApiAccountsGetFoundryOutputRequest) Execute() (*FoundryOutputResponse, *http.Response, error) { + return r.ApiService.AccountsGetFoundryOutputExecute(r) +} + +/* +AccountsGetFoundryOutput Get the foundry output + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param serialNumber Serial Number (uint32) + @return ApiAccountsGetFoundryOutputRequest +*/ +func (a *CorecontractsApiService) AccountsGetFoundryOutput(ctx context.Context, chainID string, serialNumber uint32) ApiAccountsGetFoundryOutputRequest { + return ApiAccountsGetFoundryOutputRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + serialNumber: serialNumber, + } +} + +// Execute executes the request +// @return FoundryOutputResponse +func (a *CorecontractsApiService) AccountsGetFoundryOutputExecute(r ApiAccountsGetFoundryOutputRequest) (*FoundryOutputResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FoundryOutputResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetFoundryOutput") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/foundry_output/{serialNumber}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serialNumber"+"}", url.PathEscape(parameterValueToString(r.serialNumber, "serialNumber")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.serialNumber < 1 { + return localVarReturnValue, nil, reportError("serialNumber must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetNFTDataRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + nftID string +} + +func (r ApiAccountsGetNFTDataRequest) Execute() (*NFTDataResponse, *http.Response, error) { + return r.ApiService.AccountsGetNFTDataExecute(r) +} + +/* +AccountsGetNFTData Get the NFT data by an ID + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param nftID NFT ID (Hex) + @return ApiAccountsGetNFTDataRequest +*/ +func (a *CorecontractsApiService) AccountsGetNFTData(ctx context.Context, chainID string, nftID string) ApiAccountsGetNFTDataRequest { + return ApiAccountsGetNFTDataRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + nftID: nftID, + } +} + +// Execute executes the request +// @return NFTDataResponse +func (a *CorecontractsApiService) AccountsGetNFTDataExecute(r ApiAccountsGetNFTDataRequest) (*NFTDataResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NFTDataResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetNFTData") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/nftdata" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nftID"+"}", url.PathEscape(parameterValueToString(r.nftID, "nftID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetNativeTokenIDRegistryRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiAccountsGetNativeTokenIDRegistryRequest) Execute() (*NativeTokenIDRegistryResponse, *http.Response, error) { + return r.ApiService.AccountsGetNativeTokenIDRegistryExecute(r) +} + +/* +AccountsGetNativeTokenIDRegistry Get a list of all registries + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiAccountsGetNativeTokenIDRegistryRequest +*/ +func (a *CorecontractsApiService) AccountsGetNativeTokenIDRegistry(ctx context.Context, chainID string) ApiAccountsGetNativeTokenIDRegistryRequest { + return ApiAccountsGetNativeTokenIDRegistryRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return NativeTokenIDRegistryResponse +func (a *CorecontractsApiService) AccountsGetNativeTokenIDRegistryExecute(r ApiAccountsGetNativeTokenIDRegistryRequest) (*NativeTokenIDRegistryResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NativeTokenIDRegistryResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetNativeTokenIDRegistry") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/token_registry" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiAccountsGetTotalAssetsRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiAccountsGetTotalAssetsRequest) Execute() (*AssetsResponse, *http.Response, error) { + return r.ApiService.AccountsGetTotalAssetsExecute(r) +} + +/* +AccountsGetTotalAssets Get all stored assets + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiAccountsGetTotalAssetsRequest +*/ +func (a *CorecontractsApiService) AccountsGetTotalAssets(ctx context.Context, chainID string) ApiAccountsGetTotalAssetsRequest { + return ApiAccountsGetTotalAssetsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return AssetsResponse +func (a *CorecontractsApiService) AccountsGetTotalAssetsExecute(r ApiAccountsGetTotalAssetsRequest) (*AssetsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AssetsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.AccountsGetTotalAssets") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/accounts/total_assets" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlobsGetAllBlobsRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlobsGetAllBlobsRequest) Execute() (*BlobListResponse, *http.Response, error) { + return r.ApiService.BlobsGetAllBlobsExecute(r) +} + +/* +BlobsGetAllBlobs Get all stored blobs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlobsGetAllBlobsRequest +*/ +func (a *CorecontractsApiService) BlobsGetAllBlobs(ctx context.Context, chainID string) ApiBlobsGetAllBlobsRequest { + return ApiBlobsGetAllBlobsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return BlobListResponse +func (a *CorecontractsApiService) BlobsGetAllBlobsExecute(r ApiBlobsGetAllBlobsRequest) (*BlobListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlobListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlobsGetAllBlobs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blobs" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlobsGetBlobInfoRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blobHash string +} + +func (r ApiBlobsGetBlobInfoRequest) Execute() (*BlobInfoResponse, *http.Response, error) { + return r.ApiService.BlobsGetBlobInfoExecute(r) +} + +/* +BlobsGetBlobInfo Get all fields of a blob + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blobHash BlobHash (Hex) + @return ApiBlobsGetBlobInfoRequest +*/ +func (a *CorecontractsApiService) BlobsGetBlobInfo(ctx context.Context, chainID string, blobHash string) ApiBlobsGetBlobInfoRequest { + return ApiBlobsGetBlobInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blobHash: blobHash, + } +} + +// Execute executes the request +// @return BlobInfoResponse +func (a *CorecontractsApiService) BlobsGetBlobInfoExecute(r ApiBlobsGetBlobInfoRequest) (*BlobInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlobInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlobsGetBlobInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blobs/{blobHash}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blobHash"+"}", url.PathEscape(parameterValueToString(r.blobHash, "blobHash")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlobsGetBlobValueRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blobHash string + fieldKey string +} + +func (r ApiBlobsGetBlobValueRequest) Execute() (*BlobValueResponse, *http.Response, error) { + return r.ApiService.BlobsGetBlobValueExecute(r) +} + +/* +BlobsGetBlobValue Get the value of the supplied field (key) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blobHash BlobHash (Hex) + @param fieldKey FieldKey (String) + @return ApiBlobsGetBlobValueRequest +*/ +func (a *CorecontractsApiService) BlobsGetBlobValue(ctx context.Context, chainID string, blobHash string, fieldKey string) ApiBlobsGetBlobValueRequest { + return ApiBlobsGetBlobValueRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blobHash: blobHash, + fieldKey: fieldKey, + } +} + +// Execute executes the request +// @return BlobValueResponse +func (a *CorecontractsApiService) BlobsGetBlobValueExecute(r ApiBlobsGetBlobValueRequest) (*BlobValueResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlobValueResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlobsGetBlobValue") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blobs/{blobHash}/data/{fieldKey}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blobHash"+"}", url.PathEscape(parameterValueToString(r.blobHash, "blobHash")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fieldKey"+"}", url.PathEscape(parameterValueToString(r.fieldKey, "fieldKey")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetBlockInfoRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blockIndex uint32 +} + +func (r ApiBlocklogGetBlockInfoRequest) Execute() (*BlockInfoResponse, *http.Response, error) { + return r.ApiService.BlocklogGetBlockInfoExecute(r) +} + +/* +BlocklogGetBlockInfo Get the block info of a certain block index + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blockIndex BlockIndex (uint32) + @return ApiBlocklogGetBlockInfoRequest +*/ +func (a *CorecontractsApiService) BlocklogGetBlockInfo(ctx context.Context, chainID string, blockIndex uint32) ApiBlocklogGetBlockInfoRequest { + return ApiBlocklogGetBlockInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blockIndex: blockIndex, + } +} + +// Execute executes the request +// @return BlockInfoResponse +func (a *CorecontractsApiService) BlocklogGetBlockInfoExecute(r ApiBlocklogGetBlockInfoRequest) (*BlockInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlockInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetBlockInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/{blockIndex}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blockIndex"+"}", url.PathEscape(parameterValueToString(r.blockIndex, "blockIndex")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.blockIndex < 1 { + return localVarReturnValue, nil, reportError("blockIndex must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetControlAddressesRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlocklogGetControlAddressesRequest) Execute() (*ControlAddressesResponse, *http.Response, error) { + return r.ApiService.BlocklogGetControlAddressesExecute(r) +} + +/* +BlocklogGetControlAddresses Get the control addresses + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlocklogGetControlAddressesRequest +*/ +func (a *CorecontractsApiService) BlocklogGetControlAddresses(ctx context.Context, chainID string) ApiBlocklogGetControlAddressesRequest { + return ApiBlocklogGetControlAddressesRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return ControlAddressesResponse +func (a *CorecontractsApiService) BlocklogGetControlAddressesExecute(r ApiBlocklogGetControlAddressesRequest) (*ControlAddressesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ControlAddressesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetControlAddresses") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/controladdresses" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetEventsOfBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blockIndex uint32 +} + +func (r ApiBlocklogGetEventsOfBlockRequest) Execute() (*EventsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetEventsOfBlockExecute(r) +} + +/* +BlocklogGetEventsOfBlock Get events of a block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blockIndex BlockIndex (uint32) + @return ApiBlocklogGetEventsOfBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetEventsOfBlock(ctx context.Context, chainID string, blockIndex uint32) ApiBlocklogGetEventsOfBlockRequest { + return ApiBlocklogGetEventsOfBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blockIndex: blockIndex, + } +} + +// Execute executes the request +// @return EventsResponse +func (a *CorecontractsApiService) BlocklogGetEventsOfBlockExecute(r ApiBlocklogGetEventsOfBlockRequest) (*EventsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetEventsOfBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/events/block/{blockIndex}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blockIndex"+"}", url.PathEscape(parameterValueToString(r.blockIndex, "blockIndex")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.blockIndex < 1 { + return localVarReturnValue, nil, reportError("blockIndex must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetEventsOfContractRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + contractHname string +} + +func (r ApiBlocklogGetEventsOfContractRequest) Execute() (*EventsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetEventsOfContractExecute(r) +} + +/* +BlocklogGetEventsOfContract Get events of a contract + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param contractHname Contract (Hname) + @return ApiBlocklogGetEventsOfContractRequest +*/ +func (a *CorecontractsApiService) BlocklogGetEventsOfContract(ctx context.Context, chainID string, contractHname string) ApiBlocklogGetEventsOfContractRequest { + return ApiBlocklogGetEventsOfContractRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + contractHname: contractHname, + } +} + +// Execute executes the request +// @return EventsResponse +func (a *CorecontractsApiService) BlocklogGetEventsOfContractExecute(r ApiBlocklogGetEventsOfContractRequest) (*EventsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetEventsOfContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/events/contract/{contractHname}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"contractHname"+"}", url.PathEscape(parameterValueToString(r.contractHname, "contractHname")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetEventsOfLatestBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlocklogGetEventsOfLatestBlockRequest) Execute() (*EventsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetEventsOfLatestBlockExecute(r) +} + +/* +BlocklogGetEventsOfLatestBlock Get events of the latest block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlocklogGetEventsOfLatestBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetEventsOfLatestBlock(ctx context.Context, chainID string) ApiBlocklogGetEventsOfLatestBlockRequest { + return ApiBlocklogGetEventsOfLatestBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return EventsResponse +func (a *CorecontractsApiService) BlocklogGetEventsOfLatestBlockExecute(r ApiBlocklogGetEventsOfLatestBlockRequest) (*EventsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetEventsOfLatestBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/events/block/latest" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetEventsOfRequestRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + requestID string +} + +func (r ApiBlocklogGetEventsOfRequestRequest) Execute() (*EventsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetEventsOfRequestExecute(r) +} + +/* +BlocklogGetEventsOfRequest Get events of a request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param requestID Request ID (ISCRequestID) + @return ApiBlocklogGetEventsOfRequestRequest +*/ +func (a *CorecontractsApiService) BlocklogGetEventsOfRequest(ctx context.Context, chainID string, requestID string) ApiBlocklogGetEventsOfRequestRequest { + return ApiBlocklogGetEventsOfRequestRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + requestID: requestID, + } +} + +// Execute executes the request +// @return EventsResponse +func (a *CorecontractsApiService) BlocklogGetEventsOfRequestExecute(r ApiBlocklogGetEventsOfRequestRequest) (*EventsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EventsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetEventsOfRequest") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/events/request/{requestID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestID"+"}", url.PathEscape(parameterValueToString(r.requestID, "requestID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetLatestBlockInfoRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlocklogGetLatestBlockInfoRequest) Execute() (*BlockInfoResponse, *http.Response, error) { + return r.ApiService.BlocklogGetLatestBlockInfoExecute(r) +} + +/* +BlocklogGetLatestBlockInfo Get the block info of the latest block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlocklogGetLatestBlockInfoRequest +*/ +func (a *CorecontractsApiService) BlocklogGetLatestBlockInfo(ctx context.Context, chainID string) ApiBlocklogGetLatestBlockInfoRequest { + return ApiBlocklogGetLatestBlockInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return BlockInfoResponse +func (a *CorecontractsApiService) BlocklogGetLatestBlockInfoExecute(r ApiBlocklogGetLatestBlockInfoRequest) (*BlockInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlockInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetLatestBlockInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/latest" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestIDsForBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blockIndex uint32 +} + +func (r ApiBlocklogGetRequestIDsForBlockRequest) Execute() (*RequestIDsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestIDsForBlockExecute(r) +} + +/* +BlocklogGetRequestIDsForBlock Get the request ids for a certain block index + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blockIndex BlockIndex (uint32) + @return ApiBlocklogGetRequestIDsForBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestIDsForBlock(ctx context.Context, chainID string, blockIndex uint32) ApiBlocklogGetRequestIDsForBlockRequest { + return ApiBlocklogGetRequestIDsForBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blockIndex: blockIndex, + } +} + +// Execute executes the request +// @return RequestIDsResponse +func (a *CorecontractsApiService) BlocklogGetRequestIDsForBlockExecute(r ApiBlocklogGetRequestIDsForBlockRequest) (*RequestIDsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestIDsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestIDsForBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/{blockIndex}/requestids" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blockIndex"+"}", url.PathEscape(parameterValueToString(r.blockIndex, "blockIndex")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.blockIndex < 1 { + return localVarReturnValue, nil, reportError("blockIndex must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestIDsForLatestBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlocklogGetRequestIDsForLatestBlockRequest) Execute() (*RequestIDsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestIDsForLatestBlockExecute(r) +} + +/* +BlocklogGetRequestIDsForLatestBlock Get the request ids for the latest block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlocklogGetRequestIDsForLatestBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestIDsForLatestBlock(ctx context.Context, chainID string) ApiBlocklogGetRequestIDsForLatestBlockRequest { + return ApiBlocklogGetRequestIDsForLatestBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return RequestIDsResponse +func (a *CorecontractsApiService) BlocklogGetRequestIDsForLatestBlockExecute(r ApiBlocklogGetRequestIDsForLatestBlockRequest) (*RequestIDsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestIDsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestIDsForLatestBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/latest/requestids" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestIsProcessedRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + requestID string +} + +func (r ApiBlocklogGetRequestIsProcessedRequest) Execute() (*RequestProcessedResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestIsProcessedExecute(r) +} + +/* +BlocklogGetRequestIsProcessed Get the request processing status + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param requestID Request ID (ISCRequestID) + @return ApiBlocklogGetRequestIsProcessedRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestIsProcessed(ctx context.Context, chainID string, requestID string) ApiBlocklogGetRequestIsProcessedRequest { + return ApiBlocklogGetRequestIsProcessedRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + requestID: requestID, + } +} + +// Execute executes the request +// @return RequestProcessedResponse +func (a *CorecontractsApiService) BlocklogGetRequestIsProcessedExecute(r ApiBlocklogGetRequestIsProcessedRequest) (*RequestProcessedResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestProcessedResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestIsProcessed") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/requests/{requestID}/is_processed" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestID"+"}", url.PathEscape(parameterValueToString(r.requestID, "requestID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestReceiptRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + requestID string +} + +func (r ApiBlocklogGetRequestReceiptRequest) Execute() (*RequestReceiptResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestReceiptExecute(r) +} + +/* +BlocklogGetRequestReceipt Get the receipt of a certain request id + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param requestID Request ID (ISCRequestID) + @return ApiBlocklogGetRequestReceiptRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestReceipt(ctx context.Context, chainID string, requestID string) ApiBlocklogGetRequestReceiptRequest { + return ApiBlocklogGetRequestReceiptRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + requestID: requestID, + } +} + +// Execute executes the request +// @return RequestReceiptResponse +func (a *CorecontractsApiService) BlocklogGetRequestReceiptExecute(r ApiBlocklogGetRequestReceiptRequest) (*RequestReceiptResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RequestReceiptResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestReceipt") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/requests/{requestID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestID"+"}", url.PathEscape(parameterValueToString(r.requestID, "requestID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestReceiptsOfBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + blockIndex uint32 +} + +func (r ApiBlocklogGetRequestReceiptsOfBlockRequest) Execute() (*BlockReceiptsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestReceiptsOfBlockExecute(r) +} + +/* +BlocklogGetRequestReceiptsOfBlock Get all receipts of a certain block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param blockIndex BlockIndex (uint32) + @return ApiBlocklogGetRequestReceiptsOfBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestReceiptsOfBlock(ctx context.Context, chainID string, blockIndex uint32) ApiBlocklogGetRequestReceiptsOfBlockRequest { + return ApiBlocklogGetRequestReceiptsOfBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + blockIndex: blockIndex, + } +} + +// Execute executes the request +// @return BlockReceiptsResponse +func (a *CorecontractsApiService) BlocklogGetRequestReceiptsOfBlockExecute(r ApiBlocklogGetRequestReceiptsOfBlockRequest) (*BlockReceiptsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlockReceiptsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestReceiptsOfBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/{blockIndex}/receipts" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"blockIndex"+"}", url.PathEscape(parameterValueToString(r.blockIndex, "blockIndex")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.blockIndex < 1 { + return localVarReturnValue, nil, reportError("blockIndex must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiBlocklogGetRequestReceiptsOfLatestBlockRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiBlocklogGetRequestReceiptsOfLatestBlockRequest) Execute() (*BlockReceiptsResponse, *http.Response, error) { + return r.ApiService.BlocklogGetRequestReceiptsOfLatestBlockExecute(r) +} + +/* +BlocklogGetRequestReceiptsOfLatestBlock Get all receipts of the latest block + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiBlocklogGetRequestReceiptsOfLatestBlockRequest +*/ +func (a *CorecontractsApiService) BlocklogGetRequestReceiptsOfLatestBlock(ctx context.Context, chainID string) ApiBlocklogGetRequestReceiptsOfLatestBlockRequest { + return ApiBlocklogGetRequestReceiptsOfLatestBlockRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return BlockReceiptsResponse +func (a *CorecontractsApiService) BlocklogGetRequestReceiptsOfLatestBlockExecute(r ApiBlocklogGetRequestReceiptsOfLatestBlockRequest) (*BlockReceiptsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BlockReceiptsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.BlocklogGetRequestReceiptsOfLatestBlock") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/blocklog/blocks/latest/receipts" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiErrorsGetErrorMessageFormatRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string + contractHname string + errorID uint32 +} + +func (r ApiErrorsGetErrorMessageFormatRequest) Execute() (*ErrorMessageFormatResponse, *http.Response, error) { + return r.ApiService.ErrorsGetErrorMessageFormatExecute(r) +} + +/* +ErrorsGetErrorMessageFormat Get the error message format of a specific error id + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param contractHname Contract (Hname as Hex) + @param errorID Error Id (uint16) + @return ApiErrorsGetErrorMessageFormatRequest +*/ +func (a *CorecontractsApiService) ErrorsGetErrorMessageFormat(ctx context.Context, chainID string, contractHname string, errorID uint32) ApiErrorsGetErrorMessageFormatRequest { + return ApiErrorsGetErrorMessageFormatRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + contractHname: contractHname, + errorID: errorID, + } +} + +// Execute executes the request +// @return ErrorMessageFormatResponse +func (a *CorecontractsApiService) ErrorsGetErrorMessageFormatExecute(r ApiErrorsGetErrorMessageFormatRequest) (*ErrorMessageFormatResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ErrorMessageFormatResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.ErrorsGetErrorMessageFormat") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/errors/{contractHname}/message/{errorID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"contractHname"+"}", url.PathEscape(parameterValueToString(r.contractHname, "contractHname")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"errorID"+"}", url.PathEscape(parameterValueToString(r.errorID, "errorID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.errorID < 1 { + return localVarReturnValue, nil, reportError("errorID must be greater than 1") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGovernanceGetAllowedStateControllerAddressesRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiGovernanceGetAllowedStateControllerAddressesRequest) Execute() (*GovAllowedStateControllerAddressesResponse, *http.Response, error) { + return r.ApiService.GovernanceGetAllowedStateControllerAddressesExecute(r) +} + +/* +GovernanceGetAllowedStateControllerAddresses Get the allowed state controller addresses + +Returns the allowed state controller addresses + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGovernanceGetAllowedStateControllerAddressesRequest +*/ +func (a *CorecontractsApiService) GovernanceGetAllowedStateControllerAddresses(ctx context.Context, chainID string) ApiGovernanceGetAllowedStateControllerAddressesRequest { + return ApiGovernanceGetAllowedStateControllerAddressesRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return GovAllowedStateControllerAddressesResponse +func (a *CorecontractsApiService) GovernanceGetAllowedStateControllerAddressesExecute(r ApiGovernanceGetAllowedStateControllerAddressesRequest) (*GovAllowedStateControllerAddressesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GovAllowedStateControllerAddressesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.GovernanceGetAllowedStateControllerAddresses") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/governance/allowedstatecontrollers" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGovernanceGetChainInfoRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiGovernanceGetChainInfoRequest) Execute() (*GovChainInfoResponse, *http.Response, error) { + return r.ApiService.GovernanceGetChainInfoExecute(r) +} + +/* +GovernanceGetChainInfo Get the chain info + +If you are using the common API functions, you most likely rather want to use '/chains/:chainID' to get information about a chain. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGovernanceGetChainInfoRequest +*/ +func (a *CorecontractsApiService) GovernanceGetChainInfo(ctx context.Context, chainID string) ApiGovernanceGetChainInfoRequest { + return ApiGovernanceGetChainInfoRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return GovChainInfoResponse +func (a *CorecontractsApiService) GovernanceGetChainInfoExecute(r ApiGovernanceGetChainInfoRequest) (*GovChainInfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GovChainInfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.GovernanceGetChainInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/governance/chaininfo" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGovernanceGetChainOwnerRequest struct { + ctx context.Context + ApiService *CorecontractsApiService + chainID string +} + +func (r ApiGovernanceGetChainOwnerRequest) Execute() (*GovChainOwnerResponse, *http.Response, error) { + return r.ApiService.GovernanceGetChainOwnerExecute(r) +} + +/* +GovernanceGetChainOwner Get the chain owner + +Returns the chain owner + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGovernanceGetChainOwnerRequest +*/ +func (a *CorecontractsApiService) GovernanceGetChainOwner(ctx context.Context, chainID string) ApiGovernanceGetChainOwnerRequest { + return ApiGovernanceGetChainOwnerRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return GovChainOwnerResponse +func (a *CorecontractsApiService) GovernanceGetChainOwnerExecute(r ApiGovernanceGetChainOwnerRequest) (*GovChainOwnerResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GovChainOwnerResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CorecontractsApiService.GovernanceGetChainOwner") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/core/governance/chainowner" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_metrics.go b/clients/apiclient/api_metrics.go new file mode 100644 index 0000000000..3579e08e27 --- /dev/null +++ b/clients/apiclient/api_metrics.go @@ -0,0 +1,520 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// MetricsApiService MetricsApi service +type MetricsApiService service + +type ApiGetChainMetricsRequest struct { + ctx context.Context + ApiService *MetricsApiService + chainID string +} + +func (r ApiGetChainMetricsRequest) Execute() (*ChainMetrics, *http.Response, error) { + return r.ApiService.GetChainMetricsExecute(r) +} + +/* +GetChainMetrics Get chain specific metrics. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetChainMetricsRequest +*/ +func (a *MetricsApiService) GetChainMetrics(ctx context.Context, chainID string) ApiGetChainMetricsRequest { + return ApiGetChainMetricsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return ChainMetrics +func (a *MetricsApiService) GetChainMetricsExecute(r ApiGetChainMetricsRequest) (*ChainMetrics, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ChainMetrics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetricsApiService.GetChainMetrics") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metrics/chain/{chainID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetChainPipeMetricsRequest struct { + ctx context.Context + ApiService *MetricsApiService + chainID string +} + +func (r ApiGetChainPipeMetricsRequest) Execute() (*ConsensusPipeMetrics, *http.Response, error) { + return r.ApiService.GetChainPipeMetricsExecute(r) +} + +/* +GetChainPipeMetrics Get chain pipe event metrics. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetChainPipeMetricsRequest +*/ +func (a *MetricsApiService) GetChainPipeMetrics(ctx context.Context, chainID string) ApiGetChainPipeMetricsRequest { + return ApiGetChainPipeMetricsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return ConsensusPipeMetrics +func (a *MetricsApiService) GetChainPipeMetricsExecute(r ApiGetChainPipeMetricsRequest) (*ConsensusPipeMetrics, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConsensusPipeMetrics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetricsApiService.GetChainPipeMetrics") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metrics/chain/{chainID}/pipe" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetChainWorkflowMetricsRequest struct { + ctx context.Context + ApiService *MetricsApiService + chainID string +} + +func (r ApiGetChainWorkflowMetricsRequest) Execute() (*ConsensusWorkflowMetrics, *http.Response, error) { + return r.ApiService.GetChainWorkflowMetricsExecute(r) +} + +/* +GetChainWorkflowMetrics Get chain workflow metrics. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @return ApiGetChainWorkflowMetricsRequest +*/ +func (a *MetricsApiService) GetChainWorkflowMetrics(ctx context.Context, chainID string) ApiGetChainWorkflowMetricsRequest { + return ApiGetChainWorkflowMetricsRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + } +} + +// Execute executes the request +// @return ConsensusWorkflowMetrics +func (a *MetricsApiService) GetChainWorkflowMetricsExecute(r ApiGetChainWorkflowMetricsRequest) (*ConsensusWorkflowMetrics, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConsensusWorkflowMetrics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetricsApiService.GetChainWorkflowMetrics") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metrics/chain/{chainID}/workflow" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetL1MetricsRequest struct { + ctx context.Context + ApiService *MetricsApiService +} + +func (r ApiGetL1MetricsRequest) Execute() (*ChainMetrics, *http.Response, error) { + return r.ApiService.GetL1MetricsExecute(r) +} + +/* +GetL1Metrics Get accumulated metrics. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetL1MetricsRequest +*/ +func (a *MetricsApiService) GetL1Metrics(ctx context.Context) ApiGetL1MetricsRequest { + return ApiGetL1MetricsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ChainMetrics +func (a *MetricsApiService) GetL1MetricsExecute(r ApiGetL1MetricsRequest) (*ChainMetrics, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ChainMetrics + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MetricsApiService.GetL1Metrics") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metrics/l1" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_node.go b/clients/apiclient/api_node.go new file mode 100644 index 0000000000..86de06825a --- /dev/null +++ b/clients/apiclient/api_node.go @@ -0,0 +1,1485 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// NodeApiService NodeApi service +type NodeApiService service + +type ApiDistrustPeerRequest struct { + ctx context.Context + ApiService *NodeApiService + peeringTrustRequest *PeeringTrustRequest +} + +// Info of the peer to distrust +func (r ApiDistrustPeerRequest) PeeringTrustRequest(peeringTrustRequest PeeringTrustRequest) ApiDistrustPeerRequest { + r.peeringTrustRequest = &peeringTrustRequest + return r +} + +func (r ApiDistrustPeerRequest) Execute() (*http.Response, error) { + return r.ApiService.DistrustPeerExecute(r) +} + +/* +DistrustPeer Distrust a peering node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDistrustPeerRequest +*/ +func (a *NodeApiService) DistrustPeer(ctx context.Context) ApiDistrustPeerRequest { + return ApiDistrustPeerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *NodeApiService) DistrustPeerExecute(r ApiDistrustPeerRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.DistrustPeer") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/peers/trusted" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.peeringTrustRequest == nil { + return nil, reportError("peeringTrustRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.peeringTrustRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGenerateDKSRequest struct { + ctx context.Context + ApiService *NodeApiService + dKSharesPostRequest *DKSharesPostRequest +} + +// Request parameters +func (r ApiGenerateDKSRequest) DKSharesPostRequest(dKSharesPostRequest DKSharesPostRequest) ApiGenerateDKSRequest { + r.dKSharesPostRequest = &dKSharesPostRequest + return r +} + +func (r ApiGenerateDKSRequest) Execute() (*DKSharesInfo, *http.Response, error) { + return r.ApiService.GenerateDKSExecute(r) +} + +/* +GenerateDKS Generate a new distributed key + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGenerateDKSRequest +*/ +func (a *NodeApiService) GenerateDKS(ctx context.Context) ApiGenerateDKSRequest { + return ApiGenerateDKSRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return DKSharesInfo +func (a *NodeApiService) GenerateDKSExecute(r ApiGenerateDKSRequest) (*DKSharesInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DKSharesInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GenerateDKS") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/dks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.dKSharesPostRequest == nil { + return localVarReturnValue, nil, reportError("dKSharesPostRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.dKSharesPostRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetAllPeersRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetAllPeersRequest) Execute() ([]PeeringNodeStatusResponse, *http.Response, error) { + return r.ApiService.GetAllPeersExecute(r) +} + +/* +GetAllPeers Get basic information about all configured peers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetAllPeersRequest +*/ +func (a *NodeApiService) GetAllPeers(ctx context.Context) ApiGetAllPeersRequest { + return ApiGetAllPeersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []PeeringNodeStatusResponse +func (a *NodeApiService) GetAllPeersExecute(r ApiGetAllPeersRequest) ([]PeeringNodeStatusResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []PeeringNodeStatusResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetAllPeers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/peers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetConfigurationRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetConfigurationRequest) Execute() (map[string]string, *http.Response, error) { + return r.ApiService.GetConfigurationExecute(r) +} + +/* +GetConfiguration Return the Wasp configuration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetConfigurationRequest +*/ +func (a *NodeApiService) GetConfiguration(ctx context.Context) ApiGetConfigurationRequest { + return ApiGetConfigurationRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return map[string]string +func (a *NodeApiService) GetConfigurationExecute(r ApiGetConfigurationRequest) (map[string]string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetConfiguration") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/config" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDKSInfoRequest struct { + ctx context.Context + ApiService *NodeApiService + sharedAddress string +} + +func (r ApiGetDKSInfoRequest) Execute() (*DKSharesInfo, *http.Response, error) { + return r.ApiService.GetDKSInfoExecute(r) +} + +/* +GetDKSInfo Get information about the shared address DKS configuration + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param sharedAddress SharedAddress (Bech32) + @return ApiGetDKSInfoRequest +*/ +func (a *NodeApiService) GetDKSInfo(ctx context.Context, sharedAddress string) ApiGetDKSInfoRequest { + return ApiGetDKSInfoRequest{ + ApiService: a, + ctx: ctx, + sharedAddress: sharedAddress, + } +} + +// Execute executes the request +// @return DKSharesInfo +func (a *NodeApiService) GetDKSInfoExecute(r ApiGetDKSInfoRequest) (*DKSharesInfo, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DKSharesInfo + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetDKSInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/dks/{sharedAddress}" + localVarPath = strings.Replace(localVarPath, "{"+"sharedAddress"+"}", url.PathEscape(parameterValueToString(r.sharedAddress, "sharedAddress")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetInfoRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetInfoRequest) Execute() (*InfoResponse, *http.Response, error) { + return r.ApiService.GetInfoExecute(r) +} + +/* +GetInfo Returns private information about this node. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetInfoRequest +*/ +func (a *NodeApiService) GetInfo(ctx context.Context) ApiGetInfoRequest { + return ApiGetInfoRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return InfoResponse +func (a *NodeApiService) GetInfoExecute(r ApiGetInfoRequest) (*InfoResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *InfoResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetInfo") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/info" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetPeeringIdentityRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetPeeringIdentityRequest) Execute() (*PeeringNodeIdentityResponse, *http.Response, error) { + return r.ApiService.GetPeeringIdentityExecute(r) +} + +/* +GetPeeringIdentity Get basic peer info of the current node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetPeeringIdentityRequest +*/ +func (a *NodeApiService) GetPeeringIdentity(ctx context.Context) ApiGetPeeringIdentityRequest { + return ApiGetPeeringIdentityRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return PeeringNodeIdentityResponse +func (a *NodeApiService) GetPeeringIdentityExecute(r ApiGetPeeringIdentityRequest) (*PeeringNodeIdentityResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PeeringNodeIdentityResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetPeeringIdentity") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/peers/identity" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetTrustedPeersRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetTrustedPeersRequest) Execute() ([]PeeringNodeIdentityResponse, *http.Response, error) { + return r.ApiService.GetTrustedPeersExecute(r) +} + +/* +GetTrustedPeers Get trusted peers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetTrustedPeersRequest +*/ +func (a *NodeApiService) GetTrustedPeers(ctx context.Context) ApiGetTrustedPeersRequest { + return ApiGetTrustedPeersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []PeeringNodeIdentityResponse +func (a *NodeApiService) GetTrustedPeersExecute(r ApiGetTrustedPeersRequest) ([]PeeringNodeIdentityResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []PeeringNodeIdentityResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetTrustedPeers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/peers/trusted" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetVersionRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiGetVersionRequest) Execute() (*VersionResponse, *http.Response, error) { + return r.ApiService.GetVersionExecute(r) +} + +/* +GetVersion Returns the node version. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetVersionRequest +*/ +func (a *NodeApiService) GetVersion(ctx context.Context) ApiGetVersionRequest { + return ApiGetVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return VersionResponse +func (a *NodeApiService) GetVersionExecute(r ApiGetVersionRequest) (*VersionResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VersionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.GetVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/version" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiSetNodeOwnerRequest struct { + ctx context.Context + ApiService *NodeApiService + nodeOwnerCertificateRequest *NodeOwnerCertificateRequest +} + +// The node owner certificate +func (r ApiSetNodeOwnerRequest) NodeOwnerCertificateRequest(nodeOwnerCertificateRequest NodeOwnerCertificateRequest) ApiSetNodeOwnerRequest { + r.nodeOwnerCertificateRequest = &nodeOwnerCertificateRequest + return r +} + +func (r ApiSetNodeOwnerRequest) Execute() (*NodeOwnerCertificateResponse, *http.Response, error) { + return r.ApiService.SetNodeOwnerExecute(r) +} + +/* +SetNodeOwner Sets the node owner + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiSetNodeOwnerRequest +*/ +func (a *NodeApiService) SetNodeOwner(ctx context.Context) ApiSetNodeOwnerRequest { + return ApiSetNodeOwnerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return NodeOwnerCertificateResponse +func (a *NodeApiService) SetNodeOwnerExecute(r ApiSetNodeOwnerRequest) (*NodeOwnerCertificateResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NodeOwnerCertificateResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.SetNodeOwner") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/owner/certificate" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.nodeOwnerCertificateRequest == nil { + return localVarReturnValue, nil, reportError("nodeOwnerCertificateRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.nodeOwnerCertificateRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiShutdownNodeRequest struct { + ctx context.Context + ApiService *NodeApiService +} + +func (r ApiShutdownNodeRequest) Execute() (*http.Response, error) { + return r.ApiService.ShutdownNodeExecute(r) +} + +/* +ShutdownNode Shut down the node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiShutdownNodeRequest +*/ +func (a *NodeApiService) ShutdownNode(ctx context.Context) ApiShutdownNodeRequest { + return ApiShutdownNodeRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *NodeApiService) ShutdownNodeExecute(r ApiShutdownNodeRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.ShutdownNode") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/shutdown" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiTrustPeerRequest struct { + ctx context.Context + ApiService *NodeApiService + peeringTrustRequest *PeeringTrustRequest +} + +// Info of the peer to trust +func (r ApiTrustPeerRequest) PeeringTrustRequest(peeringTrustRequest PeeringTrustRequest) ApiTrustPeerRequest { + r.peeringTrustRequest = &peeringTrustRequest + return r +} + +func (r ApiTrustPeerRequest) Execute() (*http.Response, error) { + return r.ApiService.TrustPeerExecute(r) +} + +/* +TrustPeer Trust a peering node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiTrustPeerRequest +*/ +func (a *NodeApiService) TrustPeer(ctx context.Context) ApiTrustPeerRequest { + return ApiTrustPeerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *NodeApiService) TrustPeerExecute(r ApiTrustPeerRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NodeApiService.TrustPeer") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/node/peers/trusted" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.peeringTrustRequest == nil { + return nil, reportError("peeringTrustRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.peeringTrustRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_requests.go b/clients/apiclient/api_requests.go new file mode 100644 index 0000000000..47e6563f9f --- /dev/null +++ b/clients/apiclient/api_requests.go @@ -0,0 +1,509 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// RequestsApiService RequestsApi service +type RequestsApiService service + +type ApiCallViewRequest struct { + ctx context.Context + ApiService *RequestsApiService + contractCallViewRequest *ContractCallViewRequest +} + +// Parameters +func (r ApiCallViewRequest) ContractCallViewRequest(contractCallViewRequest ContractCallViewRequest) ApiCallViewRequest { + r.contractCallViewRequest = &contractCallViewRequest + return r +} + +func (r ApiCallViewRequest) Execute() (*JSONDict, *http.Response, error) { + return r.ApiService.CallViewExecute(r) +} + +/* +CallView Call a view function on a contract by Hname + +Execute a view call. Either use HName or Name properties. If both are supplied, HName are used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCallViewRequest +*/ +func (a *RequestsApiService) CallView(ctx context.Context) ApiCallViewRequest { + return ApiCallViewRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return JSONDict +func (a *RequestsApiService) CallViewExecute(r ApiCallViewRequest) (*JSONDict, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *JSONDict + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.CallView") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/requests/callview" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.contractCallViewRequest == nil { + return localVarReturnValue, nil, reportError("contractCallViewRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.contractCallViewRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetReceiptRequest struct { + ctx context.Context + ApiService *RequestsApiService + chainID string + requestID string +} + +func (r ApiGetReceiptRequest) Execute() (*ReceiptResponse, *http.Response, error) { + return r.ApiService.GetReceiptExecute(r) +} + +/* +GetReceipt Get a receipt from a request ID + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param requestID RequestID (Hex) + @return ApiGetReceiptRequest +*/ +func (a *RequestsApiService) GetReceipt(ctx context.Context, chainID string, requestID string) ApiGetReceiptRequest { + return ApiGetReceiptRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + requestID: requestID, + } +} + +// Execute executes the request +// @return ReceiptResponse +func (a *RequestsApiService) GetReceiptExecute(r ApiGetReceiptRequest) (*ReceiptResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ReceiptResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.GetReceipt") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/receipts/{requestID}" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestID"+"}", url.PathEscape(parameterValueToString(r.requestID, "requestID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiOffLedgerRequest struct { + ctx context.Context + ApiService *RequestsApiService + offLedgerRequest *OffLedgerRequest +} + +// Offledger request as JSON. Request encoded in Hex +func (r ApiOffLedgerRequest) OffLedgerRequest(offLedgerRequest OffLedgerRequest) ApiOffLedgerRequest { + r.offLedgerRequest = &offLedgerRequest + return r +} + +func (r ApiOffLedgerRequest) Execute() (*http.Response, error) { + return r.ApiService.OffLedgerExecute(r) +} + +/* +OffLedger Post an off-ledger request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiOffLedgerRequest +*/ +func (a *RequestsApiService) OffLedger(ctx context.Context) ApiOffLedgerRequest { + return ApiOffLedgerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *RequestsApiService) OffLedgerExecute(r ApiOffLedgerRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.OffLedger") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/requests/offledger" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.offLedgerRequest == nil { + return nil, reportError("offLedgerRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.offLedgerRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiWaitForRequestRequest struct { + ctx context.Context + ApiService *RequestsApiService + chainID string + requestID string + timeoutSeconds *int32 +} + +// The timeout in seconds +func (r ApiWaitForRequestRequest) TimeoutSeconds(timeoutSeconds int32) ApiWaitForRequestRequest { + r.timeoutSeconds = &timeoutSeconds + return r +} + +func (r ApiWaitForRequestRequest) Execute() (*ReceiptResponse, *http.Response, error) { + return r.ApiService.WaitForRequestExecute(r) +} + +/* +WaitForRequest Wait until the given request has been processed by the node + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chainID ChainID (Bech32) + @param requestID RequestID (Hex) + @return ApiWaitForRequestRequest +*/ +func (a *RequestsApiService) WaitForRequest(ctx context.Context, chainID string, requestID string) ApiWaitForRequestRequest { + return ApiWaitForRequestRequest{ + ApiService: a, + ctx: ctx, + chainID: chainID, + requestID: requestID, + } +} + +// Execute executes the request +// @return ReceiptResponse +func (a *RequestsApiService) WaitForRequestExecute(r ApiWaitForRequestRequest) (*ReceiptResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ReceiptResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.WaitForRequest") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/chains/{chainID}/requests/{requestID}/wait" + localVarPath = strings.Replace(localVarPath, "{"+"chainID"+"}", url.PathEscape(parameterValueToString(r.chainID, "chainID")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestID"+"}", url.PathEscape(parameterValueToString(r.requestID, "requestID")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.timeoutSeconds != nil { + parameterAddToQuery(localVarQueryParams, "timeoutSeconds", r.timeoutSeconds, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/clients/apiclient/api_users.go b/clients/apiclient/api_users.go new file mode 100644 index 0000000000..7957d7844f --- /dev/null +++ b/clients/apiclient/api_users.go @@ -0,0 +1,760 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "io/ioutil" + "net/http" + "net/url" + "strings" +) + + +// UsersApiService UsersApi service +type UsersApiService service + +type ApiAddUserRequest struct { + ctx context.Context + ApiService *UsersApiService + addUserRequest *AddUserRequest +} + +// The user data +func (r ApiAddUserRequest) AddUserRequest(addUserRequest AddUserRequest) ApiAddUserRequest { + r.addUserRequest = &addUserRequest + return r +} + +func (r ApiAddUserRequest) Execute() (*http.Response, error) { + return r.ApiService.AddUserExecute(r) +} + +/* +AddUser Add a user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiAddUserRequest +*/ +func (a *UsersApiService) AddUser(ctx context.Context) ApiAddUserRequest { + return ApiAddUserRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *UsersApiService) AddUserExecute(r ApiAddUserRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.AddUser") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.addUserRequest == nil { + return nil, reportError("addUserRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addUserRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiChangeUserPasswordRequest struct { + ctx context.Context + ApiService *UsersApiService + username string + updateUserPasswordRequest *UpdateUserPasswordRequest +} + +// The users new password +func (r ApiChangeUserPasswordRequest) UpdateUserPasswordRequest(updateUserPasswordRequest UpdateUserPasswordRequest) ApiChangeUserPasswordRequest { + r.updateUserPasswordRequest = &updateUserPasswordRequest + return r +} + +func (r ApiChangeUserPasswordRequest) Execute() (*http.Response, error) { + return r.ApiService.ChangeUserPasswordExecute(r) +} + +/* +ChangeUserPassword Change user password + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username The username. + @return ApiChangeUserPasswordRequest +*/ +func (a *UsersApiService) ChangeUserPassword(ctx context.Context, username string) ApiChangeUserPasswordRequest { + return ApiChangeUserPasswordRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +func (a *UsersApiService) ChangeUserPasswordExecute(r ApiChangeUserPasswordRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.ChangeUserPassword") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}/password" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateUserPasswordRequest == nil { + return nil, reportError("updateUserPasswordRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateUserPasswordRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiChangeUserPermissionsRequest struct { + ctx context.Context + ApiService *UsersApiService + username string + updateUserPermissionsRequest *UpdateUserPermissionsRequest +} + +// The users new permissions +func (r ApiChangeUserPermissionsRequest) UpdateUserPermissionsRequest(updateUserPermissionsRequest UpdateUserPermissionsRequest) ApiChangeUserPermissionsRequest { + r.updateUserPermissionsRequest = &updateUserPermissionsRequest + return r +} + +func (r ApiChangeUserPermissionsRequest) Execute() (*http.Response, error) { + return r.ApiService.ChangeUserPermissionsExecute(r) +} + +/* +ChangeUserPermissions Change user permissions + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username The username. + @return ApiChangeUserPermissionsRequest +*/ +func (a *UsersApiService) ChangeUserPermissions(ctx context.Context, username string) ApiChangeUserPermissionsRequest { + return ApiChangeUserPermissionsRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +func (a *UsersApiService) ChangeUserPermissionsExecute(r ApiChangeUserPermissionsRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.ChangeUserPermissions") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}/permissions" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateUserPermissionsRequest == nil { + return nil, reportError("updateUserPermissionsRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateUserPermissionsRequest + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteUserRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + +func (r ApiDeleteUserRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteUserExecute(r) +} + +/* +DeleteUser Deletes a user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username The username + @return ApiDeleteUserRequest +*/ +func (a *UsersApiService) DeleteUser(ctx context.Context, username string) ApiDeleteUserRequest { + return ApiDeleteUserRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +func (a *UsersApiService) DeleteUserExecute(r ApiDeleteUserRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.DeleteUser") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetUserRequest struct { + ctx context.Context + ApiService *UsersApiService + username string +} + +func (r ApiGetUserRequest) Execute() (*User, *http.Response, error) { + return r.ApiService.GetUserExecute(r) +} + +/* +GetUser Get a user + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param username The username + @return ApiGetUserRequest +*/ +func (a *UsersApiService) GetUser(ctx context.Context, username string) ApiGetUserRequest { + return ApiGetUserRequest{ + ApiService: a, + ctx: ctx, + username: username, + } +} + +// Execute executes the request +// @return User +func (a *UsersApiService) GetUserExecute(r ApiGetUserRequest) (*User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.GetUser") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users/{username}" + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(parameterValueToString(r.username, "username")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetUsersRequest struct { + ctx context.Context + ApiService *UsersApiService +} + +func (r ApiGetUsersRequest) Execute() ([]User, *http.Response, error) { + return r.ApiService.GetUsersExecute(r) +} + +/* +GetUsers Get a list of all users + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetUsersRequest +*/ +func (a *UsersApiService) GetUsers(ctx context.Context) ApiGetUsersRequest { + return ApiGetUsersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return []User +func (a *UsersApiService) GetUsersExecute(r ApiGetUsersRequest) ([]User, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue []User + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UsersApiService.GetUsers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/users" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Authorization"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["Authorization"] = key + } + } + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/clients/apiclient/client.go b/clients/apiclient/client.go new file mode 100644 index 0000000000..e716d4aaab --- /dev/null +++ b/clients/apiclient/client.go @@ -0,0 +1,673 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Wasp API API v0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AuthApi *AuthApiService + + ChainsApi *ChainsApiService + + CorecontractsApi *CorecontractsApiService + + MetricsApi *MetricsApiService + + NodeApi *NodeApiService + + RequestsApi *RequestsApiService + + UsersApi *UsersApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AuthApi = (*AuthApiService)(&c.common) + c.ChainsApi = (*ChainsApiService)(&c.common) + c.CorecontractsApi = (*CorecontractsApiService)(&c.common) + c.MetricsApi = (*MetricsApiService)(&c.common) + c.NodeApi = (*NodeApiService)(&c.common) + c.RequestsApi = (*RequestsApiService)(&c.common) + c.UsersApi = (*UsersApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToQuery adds the provided object to the url query supporting deep object syntax +func parameterAddToQuery(queryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToQuery(queryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToQuery(queryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + + // status title (detail) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/clients/apiclient/configuration.go b/clients/apiclient/configuration.go new file mode 100644 index 0000000000..0498237422 --- /dev/null +++ b/clients/apiclient/configuration.go @@ -0,0 +1,218 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/clients/apiclient/docs/AccountListResponse.md b/clients/apiclient/docs/AccountListResponse.md new file mode 100644 index 0000000000..66097fb424 --- /dev/null +++ b/clients/apiclient/docs/AccountListResponse.md @@ -0,0 +1,51 @@ +# AccountListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Accounts** | **[]string** | | + +## Methods + +### NewAccountListResponse + +`func NewAccountListResponse(accounts []string, ) *AccountListResponse` + +NewAccountListResponse instantiates a new AccountListResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAccountListResponseWithDefaults + +`func NewAccountListResponseWithDefaults() *AccountListResponse` + +NewAccountListResponseWithDefaults instantiates a new AccountListResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAccounts + +`func (o *AccountListResponse) GetAccounts() []string` + +GetAccounts returns the Accounts field if non-nil, zero value otherwise. + +### GetAccountsOk + +`func (o *AccountListResponse) GetAccountsOk() (*[]string, bool)` + +GetAccountsOk returns a tuple with the Accounts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccounts + +`func (o *AccountListResponse) SetAccounts(v []string)` + +SetAccounts sets Accounts field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AccountNFTsResponse.md b/clients/apiclient/docs/AccountNFTsResponse.md new file mode 100644 index 0000000000..7453d48a7f --- /dev/null +++ b/clients/apiclient/docs/AccountNFTsResponse.md @@ -0,0 +1,51 @@ +# AccountNFTsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NftIds** | **[]string** | | + +## Methods + +### NewAccountNFTsResponse + +`func NewAccountNFTsResponse(nftIds []string, ) *AccountNFTsResponse` + +NewAccountNFTsResponse instantiates a new AccountNFTsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAccountNFTsResponseWithDefaults + +`func NewAccountNFTsResponseWithDefaults() *AccountNFTsResponse` + +NewAccountNFTsResponseWithDefaults instantiates a new AccountNFTsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNftIds + +`func (o *AccountNFTsResponse) GetNftIds() []string` + +GetNftIds returns the NftIds field if non-nil, zero value otherwise. + +### GetNftIdsOk + +`func (o *AccountNFTsResponse) GetNftIdsOk() (*[]string, bool)` + +GetNftIdsOk returns a tuple with the NftIds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNftIds + +`func (o *AccountNFTsResponse) SetNftIds(v []string)` + +SetNftIds sets NftIds field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AccountNonceResponse.md b/clients/apiclient/docs/AccountNonceResponse.md new file mode 100644 index 0000000000..7ce2c2cec9 --- /dev/null +++ b/clients/apiclient/docs/AccountNonceResponse.md @@ -0,0 +1,51 @@ +# AccountNonceResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Nonce** | **string** | The nonce (uint64 as string) | + +## Methods + +### NewAccountNonceResponse + +`func NewAccountNonceResponse(nonce string, ) *AccountNonceResponse` + +NewAccountNonceResponse instantiates a new AccountNonceResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAccountNonceResponseWithDefaults + +`func NewAccountNonceResponseWithDefaults() *AccountNonceResponse` + +NewAccountNonceResponseWithDefaults instantiates a new AccountNonceResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNonce + +`func (o *AccountNonceResponse) GetNonce() string` + +GetNonce returns the Nonce field if non-nil, zero value otherwise. + +### GetNonceOk + +`func (o *AccountNonceResponse) GetNonceOk() (*string, bool)` + +GetNonceOk returns a tuple with the Nonce field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNonce + +`func (o *AccountNonceResponse) SetNonce(v string)` + +SetNonce sets Nonce field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AddUserRequest.md b/clients/apiclient/docs/AddUserRequest.md new file mode 100644 index 0000000000..41fe61baeb --- /dev/null +++ b/clients/apiclient/docs/AddUserRequest.md @@ -0,0 +1,93 @@ +# AddUserRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Password** | **string** | | +**Permissions** | **[]string** | | +**Username** | **string** | | + +## Methods + +### NewAddUserRequest + +`func NewAddUserRequest(password string, permissions []string, username string, ) *AddUserRequest` + +NewAddUserRequest instantiates a new AddUserRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAddUserRequestWithDefaults + +`func NewAddUserRequestWithDefaults() *AddUserRequest` + +NewAddUserRequestWithDefaults instantiates a new AddUserRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPassword + +`func (o *AddUserRequest) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *AddUserRequest) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *AddUserRequest) SetPassword(v string)` + +SetPassword sets Password field to given value. + + +### GetPermissions + +`func (o *AddUserRequest) GetPermissions() []string` + +GetPermissions returns the Permissions field if non-nil, zero value otherwise. + +### GetPermissionsOk + +`func (o *AddUserRequest) GetPermissionsOk() (*[]string, bool)` + +GetPermissionsOk returns a tuple with the Permissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPermissions + +`func (o *AddUserRequest) SetPermissions(v []string)` + +SetPermissions sets Permissions field to given value. + + +### GetUsername + +`func (o *AddUserRequest) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *AddUserRequest) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *AddUserRequest) SetUsername(v string)` + +SetUsername sets Username field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AliasOutputMetricItem.md b/clients/apiclient/docs/AliasOutputMetricItem.md new file mode 100644 index 0000000000..2f5093a32a --- /dev/null +++ b/clients/apiclient/docs/AliasOutputMetricItem.md @@ -0,0 +1,93 @@ +# AliasOutputMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**Output**](Output.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewAliasOutputMetricItem + +`func NewAliasOutputMetricItem(lastMessage Output, messages uint32, timestamp time.Time, ) *AliasOutputMetricItem` + +NewAliasOutputMetricItem instantiates a new AliasOutputMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAliasOutputMetricItemWithDefaults + +`func NewAliasOutputMetricItemWithDefaults() *AliasOutputMetricItem` + +NewAliasOutputMetricItemWithDefaults instantiates a new AliasOutputMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *AliasOutputMetricItem) GetLastMessage() Output` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *AliasOutputMetricItem) GetLastMessageOk() (*Output, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *AliasOutputMetricItem) SetLastMessage(v Output)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *AliasOutputMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *AliasOutputMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *AliasOutputMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *AliasOutputMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *AliasOutputMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *AliasOutputMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/Assets.md b/clients/apiclient/docs/Assets.md new file mode 100644 index 0000000000..633404e1cc --- /dev/null +++ b/clients/apiclient/docs/Assets.md @@ -0,0 +1,93 @@ +# Assets + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BaseTokens** | **string** | The base tokens (uint64 as string) | +**NativeTokens** | [**[]NativeToken**](NativeToken.md) | | +**Nfts** | **[]string** | | + +## Methods + +### NewAssets + +`func NewAssets(baseTokens string, nativeTokens []NativeToken, nfts []string, ) *Assets` + +NewAssets instantiates a new Assets object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAssetsWithDefaults + +`func NewAssetsWithDefaults() *Assets` + +NewAssetsWithDefaults instantiates a new Assets object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBaseTokens + +`func (o *Assets) GetBaseTokens() string` + +GetBaseTokens returns the BaseTokens field if non-nil, zero value otherwise. + +### GetBaseTokensOk + +`func (o *Assets) GetBaseTokensOk() (*string, bool)` + +GetBaseTokensOk returns a tuple with the BaseTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBaseTokens + +`func (o *Assets) SetBaseTokens(v string)` + +SetBaseTokens sets BaseTokens field to given value. + + +### GetNativeTokens + +`func (o *Assets) GetNativeTokens() []NativeToken` + +GetNativeTokens returns the NativeTokens field if non-nil, zero value otherwise. + +### GetNativeTokensOk + +`func (o *Assets) GetNativeTokensOk() (*[]NativeToken, bool)` + +GetNativeTokensOk returns a tuple with the NativeTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNativeTokens + +`func (o *Assets) SetNativeTokens(v []NativeToken)` + +SetNativeTokens sets NativeTokens field to given value. + + +### GetNfts + +`func (o *Assets) GetNfts() []string` + +GetNfts returns the Nfts field if non-nil, zero value otherwise. + +### GetNftsOk + +`func (o *Assets) GetNftsOk() (*[]string, bool)` + +GetNftsOk returns a tuple with the Nfts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNfts + +`func (o *Assets) SetNfts(v []string)` + +SetNfts sets Nfts field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AssetsResponse.md b/clients/apiclient/docs/AssetsResponse.md new file mode 100644 index 0000000000..1b86213ae0 --- /dev/null +++ b/clients/apiclient/docs/AssetsResponse.md @@ -0,0 +1,72 @@ +# AssetsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BaseTokens** | **string** | The base tokens (uint64 as string) | +**NativeTokens** | [**[]NativeToken**](NativeToken.md) | | + +## Methods + +### NewAssetsResponse + +`func NewAssetsResponse(baseTokens string, nativeTokens []NativeToken, ) *AssetsResponse` + +NewAssetsResponse instantiates a new AssetsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAssetsResponseWithDefaults + +`func NewAssetsResponseWithDefaults() *AssetsResponse` + +NewAssetsResponseWithDefaults instantiates a new AssetsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBaseTokens + +`func (o *AssetsResponse) GetBaseTokens() string` + +GetBaseTokens returns the BaseTokens field if non-nil, zero value otherwise. + +### GetBaseTokensOk + +`func (o *AssetsResponse) GetBaseTokensOk() (*string, bool)` + +GetBaseTokensOk returns a tuple with the BaseTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBaseTokens + +`func (o *AssetsResponse) SetBaseTokens(v string)` + +SetBaseTokens sets BaseTokens field to given value. + + +### GetNativeTokens + +`func (o *AssetsResponse) GetNativeTokens() []NativeToken` + +GetNativeTokens returns the NativeTokens field if non-nil, zero value otherwise. + +### GetNativeTokensOk + +`func (o *AssetsResponse) GetNativeTokensOk() (*[]NativeToken, bool)` + +GetNativeTokensOk returns a tuple with the NativeTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNativeTokens + +`func (o *AssetsResponse) SetNativeTokens(v []NativeToken)` + +SetNativeTokens sets NativeTokens field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/AuthApi.md b/clients/apiclient/docs/AuthApi.md new file mode 100644 index 0000000000..af8de4c9a7 --- /dev/null +++ b/clients/apiclient/docs/AuthApi.md @@ -0,0 +1,133 @@ +# \AuthApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AuthInfo**](AuthApi.md#AuthInfo) | **Get** /auth/info | Get information about the current authentication mode +[**Authenticate**](AuthApi.md#Authenticate) | **Post** /auth | Authenticate towards the node + + + +## AuthInfo + +> AuthInfoModel AuthInfo(ctx).Execute() + +Get information about the current authentication mode + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthApi.AuthInfo(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.AuthInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AuthInfo`: AuthInfoModel + fmt.Fprintf(os.Stdout, "Response from `AuthApi.AuthInfo`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiAuthInfoRequest struct via the builder pattern + + +### Return type + +[**AuthInfoModel**](AuthInfoModel.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## Authenticate + +> LoginResponse Authenticate(ctx).LoginRequest(loginRequest).Execute() + +Authenticate towards the node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + loginRequest := *openapiclient.NewLoginRequest("Password_example", "Username_example") // LoginRequest | The login request + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.AuthApi.Authenticate(context.Background()).LoginRequest(loginRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `AuthApi.Authenticate``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `Authenticate`: LoginResponse + fmt.Fprintf(os.Stdout, "Response from `AuthApi.Authenticate`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAuthenticateRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **loginRequest** | [**LoginRequest**](LoginRequest.md) | The login request | + +### Return type + +[**LoginResponse**](LoginResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/AuthInfoModel.md b/clients/apiclient/docs/AuthInfoModel.md new file mode 100644 index 0000000000..30106979e1 --- /dev/null +++ b/clients/apiclient/docs/AuthInfoModel.md @@ -0,0 +1,72 @@ +# AuthInfoModel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AuthURL** | **string** | JWT only | +**Scheme** | **string** | | + +## Methods + +### NewAuthInfoModel + +`func NewAuthInfoModel(authURL string, scheme string, ) *AuthInfoModel` + +NewAuthInfoModel instantiates a new AuthInfoModel object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewAuthInfoModelWithDefaults + +`func NewAuthInfoModelWithDefaults() *AuthInfoModel` + +NewAuthInfoModelWithDefaults instantiates a new AuthInfoModel object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAuthURL + +`func (o *AuthInfoModel) GetAuthURL() string` + +GetAuthURL returns the AuthURL field if non-nil, zero value otherwise. + +### GetAuthURLOk + +`func (o *AuthInfoModel) GetAuthURLOk() (*string, bool)` + +GetAuthURLOk returns a tuple with the AuthURL field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAuthURL + +`func (o *AuthInfoModel) SetAuthURL(v string)` + +SetAuthURL sets AuthURL field to given value. + + +### GetScheme + +`func (o *AuthInfoModel) GetScheme() string` + +GetScheme returns the Scheme field if non-nil, zero value otherwise. + +### GetSchemeOk + +`func (o *AuthInfoModel) GetSchemeOk() (*string, bool)` + +GetSchemeOk returns a tuple with the Scheme field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetScheme + +`func (o *AuthInfoModel) SetScheme(v string)` + +SetScheme sets Scheme field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BaseToken.md b/clients/apiclient/docs/BaseToken.md new file mode 100644 index 0000000000..dddf71612e --- /dev/null +++ b/clients/apiclient/docs/BaseToken.md @@ -0,0 +1,156 @@ +# BaseToken + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Decimals** | **int32** | The token decimals | +**Name** | **string** | The base token name | +**Subunit** | **string** | The token subunit | +**TickerSymbol** | **string** | The ticker symbol | +**Unit** | **string** | The token unit | +**UseMetricPrefix** | **bool** | Whether or not the token uses a metric prefix | + +## Methods + +### NewBaseToken + +`func NewBaseToken(decimals int32, name string, subunit string, tickerSymbol string, unit string, useMetricPrefix bool, ) *BaseToken` + +NewBaseToken instantiates a new BaseToken object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBaseTokenWithDefaults + +`func NewBaseTokenWithDefaults() *BaseToken` + +NewBaseTokenWithDefaults instantiates a new BaseToken object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDecimals + +`func (o *BaseToken) GetDecimals() int32` + +GetDecimals returns the Decimals field if non-nil, zero value otherwise. + +### GetDecimalsOk + +`func (o *BaseToken) GetDecimalsOk() (*int32, bool)` + +GetDecimalsOk returns a tuple with the Decimals field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDecimals + +`func (o *BaseToken) SetDecimals(v int32)` + +SetDecimals sets Decimals field to given value. + + +### GetName + +`func (o *BaseToken) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *BaseToken) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *BaseToken) SetName(v string)` + +SetName sets Name field to given value. + + +### GetSubunit + +`func (o *BaseToken) GetSubunit() string` + +GetSubunit returns the Subunit field if non-nil, zero value otherwise. + +### GetSubunitOk + +`func (o *BaseToken) GetSubunitOk() (*string, bool)` + +GetSubunitOk returns a tuple with the Subunit field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSubunit + +`func (o *BaseToken) SetSubunit(v string)` + +SetSubunit sets Subunit field to given value. + + +### GetTickerSymbol + +`func (o *BaseToken) GetTickerSymbol() string` + +GetTickerSymbol returns the TickerSymbol field if non-nil, zero value otherwise. + +### GetTickerSymbolOk + +`func (o *BaseToken) GetTickerSymbolOk() (*string, bool)` + +GetTickerSymbolOk returns a tuple with the TickerSymbol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTickerSymbol + +`func (o *BaseToken) SetTickerSymbol(v string)` + +SetTickerSymbol sets TickerSymbol field to given value. + + +### GetUnit + +`func (o *BaseToken) GetUnit() string` + +GetUnit returns the Unit field if non-nil, zero value otherwise. + +### GetUnitOk + +`func (o *BaseToken) GetUnitOk() (*string, bool)` + +GetUnitOk returns a tuple with the Unit field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUnit + +`func (o *BaseToken) SetUnit(v string)` + +SetUnit sets Unit field to given value. + + +### GetUseMetricPrefix + +`func (o *BaseToken) GetUseMetricPrefix() bool` + +GetUseMetricPrefix returns the UseMetricPrefix field if non-nil, zero value otherwise. + +### GetUseMetricPrefixOk + +`func (o *BaseToken) GetUseMetricPrefixOk() (*bool, bool)` + +GetUseMetricPrefixOk returns a tuple with the UseMetricPrefix field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUseMetricPrefix + +`func (o *BaseToken) SetUseMetricPrefix(v bool)` + +SetUseMetricPrefix sets UseMetricPrefix field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/Blob.md b/clients/apiclient/docs/Blob.md new file mode 100644 index 0000000000..9c8f28c2a6 --- /dev/null +++ b/clients/apiclient/docs/Blob.md @@ -0,0 +1,72 @@ +# Blob + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Hash** | **string** | | +**Size** | **uint32** | | + +## Methods + +### NewBlob + +`func NewBlob(hash string, size uint32, ) *Blob` + +NewBlob instantiates a new Blob object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlobWithDefaults + +`func NewBlobWithDefaults() *Blob` + +NewBlobWithDefaults instantiates a new Blob object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetHash + +`func (o *Blob) GetHash() string` + +GetHash returns the Hash field if non-nil, zero value otherwise. + +### GetHashOk + +`func (o *Blob) GetHashOk() (*string, bool)` + +GetHashOk returns a tuple with the Hash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHash + +`func (o *Blob) SetHash(v string)` + +SetHash sets Hash field to given value. + + +### GetSize + +`func (o *Blob) GetSize() uint32` + +GetSize returns the Size field if non-nil, zero value otherwise. + +### GetSizeOk + +`func (o *Blob) GetSizeOk() (*uint32, bool)` + +GetSizeOk returns a tuple with the Size field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSize + +`func (o *Blob) SetSize(v uint32)` + +SetSize sets Size field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlobInfoResponse.md b/clients/apiclient/docs/BlobInfoResponse.md new file mode 100644 index 0000000000..b2521b6511 --- /dev/null +++ b/clients/apiclient/docs/BlobInfoResponse.md @@ -0,0 +1,51 @@ +# BlobInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Fields** | **map[string]uint32** | | + +## Methods + +### NewBlobInfoResponse + +`func NewBlobInfoResponse(fields map[string]uint32, ) *BlobInfoResponse` + +NewBlobInfoResponse instantiates a new BlobInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlobInfoResponseWithDefaults + +`func NewBlobInfoResponseWithDefaults() *BlobInfoResponse` + +NewBlobInfoResponseWithDefaults instantiates a new BlobInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetFields + +`func (o *BlobInfoResponse) GetFields() map[string]uint32` + +GetFields returns the Fields field if non-nil, zero value otherwise. + +### GetFieldsOk + +`func (o *BlobInfoResponse) GetFieldsOk() (*map[string]uint32, bool)` + +GetFieldsOk returns a tuple with the Fields field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFields + +`func (o *BlobInfoResponse) SetFields(v map[string]uint32)` + +SetFields sets Fields field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlobListResponse.md b/clients/apiclient/docs/BlobListResponse.md new file mode 100644 index 0000000000..2069af6e33 --- /dev/null +++ b/clients/apiclient/docs/BlobListResponse.md @@ -0,0 +1,56 @@ +# BlobListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Blobs** | Pointer to [**[]Blob**](Blob.md) | | [optional] + +## Methods + +### NewBlobListResponse + +`func NewBlobListResponse() *BlobListResponse` + +NewBlobListResponse instantiates a new BlobListResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlobListResponseWithDefaults + +`func NewBlobListResponseWithDefaults() *BlobListResponse` + +NewBlobListResponseWithDefaults instantiates a new BlobListResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBlobs + +`func (o *BlobListResponse) GetBlobs() []Blob` + +GetBlobs returns the Blobs field if non-nil, zero value otherwise. + +### GetBlobsOk + +`func (o *BlobListResponse) GetBlobsOk() (*[]Blob, bool)` + +GetBlobsOk returns a tuple with the Blobs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBlobs + +`func (o *BlobListResponse) SetBlobs(v []Blob)` + +SetBlobs sets Blobs field to given value. + +### HasBlobs + +`func (o *BlobListResponse) HasBlobs() bool` + +HasBlobs returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlobValueResponse.md b/clients/apiclient/docs/BlobValueResponse.md new file mode 100644 index 0000000000..5c1c25766b --- /dev/null +++ b/clients/apiclient/docs/BlobValueResponse.md @@ -0,0 +1,51 @@ +# BlobValueResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ValueData** | **string** | The blob data (Hex) | + +## Methods + +### NewBlobValueResponse + +`func NewBlobValueResponse(valueData string, ) *BlobValueResponse` + +NewBlobValueResponse instantiates a new BlobValueResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlobValueResponseWithDefaults + +`func NewBlobValueResponseWithDefaults() *BlobValueResponse` + +NewBlobValueResponseWithDefaults instantiates a new BlobValueResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetValueData + +`func (o *BlobValueResponse) GetValueData() string` + +GetValueData returns the ValueData field if non-nil, zero value otherwise. + +### GetValueDataOk + +`func (o *BlobValueResponse) GetValueDataOk() (*string, bool)` + +GetValueDataOk returns a tuple with the ValueData field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValueData + +`func (o *BlobValueResponse) SetValueData(v string)` + +SetValueData sets ValueData field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlockInfoResponse.md b/clients/apiclient/docs/BlockInfoResponse.md new file mode 100644 index 0000000000..424f4f0c75 --- /dev/null +++ b/clients/apiclient/docs/BlockInfoResponse.md @@ -0,0 +1,303 @@ +# BlockInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AnchorTransactionId** | **string** | | +**BlockIndex** | **uint32** | | +**GasBurned** | **string** | The burned gas (uint64 as string) | +**GasFeeCharged** | **string** | The charged gas fee (uint64 as string) | +**L1CommitmentHash** | **string** | | +**NumOffLedgerRequests** | **uint32** | | +**NumSuccessfulRequests** | **uint32** | | +**PreviousL1CommitmentHash** | **string** | | +**Timestamp** | **time.Time** | | +**TotalBaseTokensInL2Accounts** | **string** | The total L2 base tokens (uint64 as string) | +**TotalRequests** | **uint32** | | +**TotalStorageDeposit** | **string** | The total storage deposit (uint64 as string) | +**TransactionSubEssenceHash** | **string** | | + +## Methods + +### NewBlockInfoResponse + +`func NewBlockInfoResponse(anchorTransactionId string, blockIndex uint32, gasBurned string, gasFeeCharged string, l1CommitmentHash string, numOffLedgerRequests uint32, numSuccessfulRequests uint32, previousL1CommitmentHash string, timestamp time.Time, totalBaseTokensInL2Accounts string, totalRequests uint32, totalStorageDeposit string, transactionSubEssenceHash string, ) *BlockInfoResponse` + +NewBlockInfoResponse instantiates a new BlockInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlockInfoResponseWithDefaults + +`func NewBlockInfoResponseWithDefaults() *BlockInfoResponse` + +NewBlockInfoResponseWithDefaults instantiates a new BlockInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAnchorTransactionId + +`func (o *BlockInfoResponse) GetAnchorTransactionId() string` + +GetAnchorTransactionId returns the AnchorTransactionId field if non-nil, zero value otherwise. + +### GetAnchorTransactionIdOk + +`func (o *BlockInfoResponse) GetAnchorTransactionIdOk() (*string, bool)` + +GetAnchorTransactionIdOk returns a tuple with the AnchorTransactionId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAnchorTransactionId + +`func (o *BlockInfoResponse) SetAnchorTransactionId(v string)` + +SetAnchorTransactionId sets AnchorTransactionId field to given value. + + +### GetBlockIndex + +`func (o *BlockInfoResponse) GetBlockIndex() uint32` + +GetBlockIndex returns the BlockIndex field if non-nil, zero value otherwise. + +### GetBlockIndexOk + +`func (o *BlockInfoResponse) GetBlockIndexOk() (*uint32, bool)` + +GetBlockIndexOk returns a tuple with the BlockIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBlockIndex + +`func (o *BlockInfoResponse) SetBlockIndex(v uint32)` + +SetBlockIndex sets BlockIndex field to given value. + + +### GetGasBurned + +`func (o *BlockInfoResponse) GetGasBurned() string` + +GetGasBurned returns the GasBurned field if non-nil, zero value otherwise. + +### GetGasBurnedOk + +`func (o *BlockInfoResponse) GetGasBurnedOk() (*string, bool)` + +GetGasBurnedOk returns a tuple with the GasBurned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurned + +`func (o *BlockInfoResponse) SetGasBurned(v string)` + +SetGasBurned sets GasBurned field to given value. + + +### GetGasFeeCharged + +`func (o *BlockInfoResponse) GetGasFeeCharged() string` + +GetGasFeeCharged returns the GasFeeCharged field if non-nil, zero value otherwise. + +### GetGasFeeChargedOk + +`func (o *BlockInfoResponse) GetGasFeeChargedOk() (*string, bool)` + +GetGasFeeChargedOk returns a tuple with the GasFeeCharged field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeeCharged + +`func (o *BlockInfoResponse) SetGasFeeCharged(v string)` + +SetGasFeeCharged sets GasFeeCharged field to given value. + + +### GetL1CommitmentHash + +`func (o *BlockInfoResponse) GetL1CommitmentHash() string` + +GetL1CommitmentHash returns the L1CommitmentHash field if non-nil, zero value otherwise. + +### GetL1CommitmentHashOk + +`func (o *BlockInfoResponse) GetL1CommitmentHashOk() (*string, bool)` + +GetL1CommitmentHashOk returns a tuple with the L1CommitmentHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetL1CommitmentHash + +`func (o *BlockInfoResponse) SetL1CommitmentHash(v string)` + +SetL1CommitmentHash sets L1CommitmentHash field to given value. + + +### GetNumOffLedgerRequests + +`func (o *BlockInfoResponse) GetNumOffLedgerRequests() uint32` + +GetNumOffLedgerRequests returns the NumOffLedgerRequests field if non-nil, zero value otherwise. + +### GetNumOffLedgerRequestsOk + +`func (o *BlockInfoResponse) GetNumOffLedgerRequestsOk() (*uint32, bool)` + +GetNumOffLedgerRequestsOk returns a tuple with the NumOffLedgerRequests field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumOffLedgerRequests + +`func (o *BlockInfoResponse) SetNumOffLedgerRequests(v uint32)` + +SetNumOffLedgerRequests sets NumOffLedgerRequests field to given value. + + +### GetNumSuccessfulRequests + +`func (o *BlockInfoResponse) GetNumSuccessfulRequests() uint32` + +GetNumSuccessfulRequests returns the NumSuccessfulRequests field if non-nil, zero value otherwise. + +### GetNumSuccessfulRequestsOk + +`func (o *BlockInfoResponse) GetNumSuccessfulRequestsOk() (*uint32, bool)` + +GetNumSuccessfulRequestsOk returns a tuple with the NumSuccessfulRequests field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumSuccessfulRequests + +`func (o *BlockInfoResponse) SetNumSuccessfulRequests(v uint32)` + +SetNumSuccessfulRequests sets NumSuccessfulRequests field to given value. + + +### GetPreviousL1CommitmentHash + +`func (o *BlockInfoResponse) GetPreviousL1CommitmentHash() string` + +GetPreviousL1CommitmentHash returns the PreviousL1CommitmentHash field if non-nil, zero value otherwise. + +### GetPreviousL1CommitmentHashOk + +`func (o *BlockInfoResponse) GetPreviousL1CommitmentHashOk() (*string, bool)` + +GetPreviousL1CommitmentHashOk returns a tuple with the PreviousL1CommitmentHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPreviousL1CommitmentHash + +`func (o *BlockInfoResponse) SetPreviousL1CommitmentHash(v string)` + +SetPreviousL1CommitmentHash sets PreviousL1CommitmentHash field to given value. + + +### GetTimestamp + +`func (o *BlockInfoResponse) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *BlockInfoResponse) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *BlockInfoResponse) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + +### GetTotalBaseTokensInL2Accounts + +`func (o *BlockInfoResponse) GetTotalBaseTokensInL2Accounts() string` + +GetTotalBaseTokensInL2Accounts returns the TotalBaseTokensInL2Accounts field if non-nil, zero value otherwise. + +### GetTotalBaseTokensInL2AccountsOk + +`func (o *BlockInfoResponse) GetTotalBaseTokensInL2AccountsOk() (*string, bool)` + +GetTotalBaseTokensInL2AccountsOk returns a tuple with the TotalBaseTokensInL2Accounts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalBaseTokensInL2Accounts + +`func (o *BlockInfoResponse) SetTotalBaseTokensInL2Accounts(v string)` + +SetTotalBaseTokensInL2Accounts sets TotalBaseTokensInL2Accounts field to given value. + + +### GetTotalRequests + +`func (o *BlockInfoResponse) GetTotalRequests() uint32` + +GetTotalRequests returns the TotalRequests field if non-nil, zero value otherwise. + +### GetTotalRequestsOk + +`func (o *BlockInfoResponse) GetTotalRequestsOk() (*uint32, bool)` + +GetTotalRequestsOk returns a tuple with the TotalRequests field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalRequests + +`func (o *BlockInfoResponse) SetTotalRequests(v uint32)` + +SetTotalRequests sets TotalRequests field to given value. + + +### GetTotalStorageDeposit + +`func (o *BlockInfoResponse) GetTotalStorageDeposit() string` + +GetTotalStorageDeposit returns the TotalStorageDeposit field if non-nil, zero value otherwise. + +### GetTotalStorageDepositOk + +`func (o *BlockInfoResponse) GetTotalStorageDepositOk() (*string, bool)` + +GetTotalStorageDepositOk returns a tuple with the TotalStorageDeposit field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTotalStorageDeposit + +`func (o *BlockInfoResponse) SetTotalStorageDeposit(v string)` + +SetTotalStorageDeposit sets TotalStorageDeposit field to given value. + + +### GetTransactionSubEssenceHash + +`func (o *BlockInfoResponse) GetTransactionSubEssenceHash() string` + +GetTransactionSubEssenceHash returns the TransactionSubEssenceHash field if non-nil, zero value otherwise. + +### GetTransactionSubEssenceHashOk + +`func (o *BlockInfoResponse) GetTransactionSubEssenceHashOk() (*string, bool)` + +GetTransactionSubEssenceHashOk returns a tuple with the TransactionSubEssenceHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTransactionSubEssenceHash + +`func (o *BlockInfoResponse) SetTransactionSubEssenceHash(v string)` + +SetTransactionSubEssenceHash sets TransactionSubEssenceHash field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlockReceiptError.md b/clients/apiclient/docs/BlockReceiptError.md new file mode 100644 index 0000000000..b827da6f7f --- /dev/null +++ b/clients/apiclient/docs/BlockReceiptError.md @@ -0,0 +1,72 @@ +# BlockReceiptError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ErrorMessage** | **string** | | +**Hash** | **string** | | + +## Methods + +### NewBlockReceiptError + +`func NewBlockReceiptError(errorMessage string, hash string, ) *BlockReceiptError` + +NewBlockReceiptError instantiates a new BlockReceiptError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlockReceiptErrorWithDefaults + +`func NewBlockReceiptErrorWithDefaults() *BlockReceiptError` + +NewBlockReceiptErrorWithDefaults instantiates a new BlockReceiptError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetErrorMessage + +`func (o *BlockReceiptError) GetErrorMessage() string` + +GetErrorMessage returns the ErrorMessage field if non-nil, zero value otherwise. + +### GetErrorMessageOk + +`func (o *BlockReceiptError) GetErrorMessageOk() (*string, bool)` + +GetErrorMessageOk returns a tuple with the ErrorMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorMessage + +`func (o *BlockReceiptError) SetErrorMessage(v string)` + +SetErrorMessage sets ErrorMessage field to given value. + + +### GetHash + +`func (o *BlockReceiptError) GetHash() string` + +GetHash returns the Hash field if non-nil, zero value otherwise. + +### GetHashOk + +`func (o *BlockReceiptError) GetHashOk() (*string, bool)` + +GetHashOk returns a tuple with the Hash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHash + +`func (o *BlockReceiptError) SetHash(v string)` + +SetHash sets Hash field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BlockReceiptsResponse.md b/clients/apiclient/docs/BlockReceiptsResponse.md new file mode 100644 index 0000000000..538591dec8 --- /dev/null +++ b/clients/apiclient/docs/BlockReceiptsResponse.md @@ -0,0 +1,51 @@ +# BlockReceiptsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Receipts** | [**[]RequestReceiptResponse**](RequestReceiptResponse.md) | | + +## Methods + +### NewBlockReceiptsResponse + +`func NewBlockReceiptsResponse(receipts []RequestReceiptResponse, ) *BlockReceiptsResponse` + +NewBlockReceiptsResponse instantiates a new BlockReceiptsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBlockReceiptsResponseWithDefaults + +`func NewBlockReceiptsResponseWithDefaults() *BlockReceiptsResponse` + +NewBlockReceiptsResponseWithDefaults instantiates a new BlockReceiptsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetReceipts + +`func (o *BlockReceiptsResponse) GetReceipts() []RequestReceiptResponse` + +GetReceipts returns the Receipts field if non-nil, zero value otherwise. + +### GetReceiptsOk + +`func (o *BlockReceiptsResponse) GetReceiptsOk() (*[]RequestReceiptResponse, bool)` + +GetReceiptsOk returns a tuple with the Receipts field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetReceipts + +`func (o *BlockReceiptsResponse) SetReceipts(v []RequestReceiptResponse)` + +SetReceipts sets Receipts field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BurnLog.md b/clients/apiclient/docs/BurnLog.md new file mode 100644 index 0000000000..53d223a00d --- /dev/null +++ b/clients/apiclient/docs/BurnLog.md @@ -0,0 +1,51 @@ +# BurnLog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Records** | [**[]BurnRecord**](BurnRecord.md) | | + +## Methods + +### NewBurnLog + +`func NewBurnLog(records []BurnRecord, ) *BurnLog` + +NewBurnLog instantiates a new BurnLog object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBurnLogWithDefaults + +`func NewBurnLogWithDefaults() *BurnLog` + +NewBurnLogWithDefaults instantiates a new BurnLog object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetRecords + +`func (o *BurnLog) GetRecords() []BurnRecord` + +GetRecords returns the Records field if non-nil, zero value otherwise. + +### GetRecordsOk + +`func (o *BurnLog) GetRecordsOk() (*[]BurnRecord, bool)` + +GetRecordsOk returns a tuple with the Records field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRecords + +`func (o *BurnLog) SetRecords(v []BurnRecord)` + +SetRecords sets Records field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/BurnRecord.md b/clients/apiclient/docs/BurnRecord.md new file mode 100644 index 0000000000..840ebc129b --- /dev/null +++ b/clients/apiclient/docs/BurnRecord.md @@ -0,0 +1,72 @@ +# BurnRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int32** | | +**GasBurned** | **int64** | | + +## Methods + +### NewBurnRecord + +`func NewBurnRecord(code int32, gasBurned int64, ) *BurnRecord` + +NewBurnRecord instantiates a new BurnRecord object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewBurnRecordWithDefaults + +`func NewBurnRecordWithDefaults() *BurnRecord` + +NewBurnRecordWithDefaults instantiates a new BurnRecord object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCode + +`func (o *BurnRecord) GetCode() int32` + +GetCode returns the Code field if non-nil, zero value otherwise. + +### GetCodeOk + +`func (o *BurnRecord) GetCodeOk() (*int32, bool)` + +GetCodeOk returns a tuple with the Code field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCode + +`func (o *BurnRecord) SetCode(v int32)` + +SetCode sets Code field to given value. + + +### GetGasBurned + +`func (o *BurnRecord) GetGasBurned() int64` + +GetGasBurned returns the GasBurned field if non-nil, zero value otherwise. + +### GetGasBurnedOk + +`func (o *BurnRecord) GetGasBurnedOk() (*int64, bool)` + +GetGasBurnedOk returns a tuple with the GasBurned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurned + +`func (o *BurnRecord) SetGasBurned(v int64)` + +SetGasBurned sets GasBurned field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/CallTarget.md b/clients/apiclient/docs/CallTarget.md new file mode 100644 index 0000000000..d472416851 --- /dev/null +++ b/clients/apiclient/docs/CallTarget.md @@ -0,0 +1,72 @@ +# CallTarget + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ContractHName** | **string** | The contract name as HName (Hex) | +**FunctionHName** | **string** | The function name as HName (Hex) | + +## Methods + +### NewCallTarget + +`func NewCallTarget(contractHName string, functionHName string, ) *CallTarget` + +NewCallTarget instantiates a new CallTarget object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCallTargetWithDefaults + +`func NewCallTargetWithDefaults() *CallTarget` + +NewCallTargetWithDefaults instantiates a new CallTarget object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetContractHName + +`func (o *CallTarget) GetContractHName() string` + +GetContractHName returns the ContractHName field if non-nil, zero value otherwise. + +### GetContractHNameOk + +`func (o *CallTarget) GetContractHNameOk() (*string, bool)` + +GetContractHNameOk returns a tuple with the ContractHName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContractHName + +`func (o *CallTarget) SetContractHName(v string)` + +SetContractHName sets ContractHName field to given value. + + +### GetFunctionHName + +`func (o *CallTarget) GetFunctionHName() string` + +GetFunctionHName returns the FunctionHName field if non-nil, zero value otherwise. + +### GetFunctionHNameOk + +`func (o *CallTarget) GetFunctionHNameOk() (*string, bool)` + +GetFunctionHNameOk returns a tuple with the FunctionHName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFunctionHName + +`func (o *CallTarget) SetFunctionHName(v string)` + +SetFunctionHName sets FunctionHName field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ChainInfoResponse.md b/clients/apiclient/docs/ChainInfoResponse.md new file mode 100644 index 0000000000..8bf23b128f --- /dev/null +++ b/clients/apiclient/docs/ChainInfoResponse.md @@ -0,0 +1,224 @@ +# ChainInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainID** | **string** | ChainID (Bech32-encoded). | +**ChainOwnerId** | **string** | The chain owner address (Bech32-encoded). | +**Description** | **string** | The description of the chain. | +**EvmChainId** | **uint32** | The EVM chain ID | +**GasFeePolicy** | Pointer to [**GasFeePolicy**](GasFeePolicy.md) | | [optional] +**IsActive** | **bool** | Whether or not the chain is active. | +**MaxBlobSize** | **uint32** | The maximum contract blob size. | +**MaxEventSize** | **uint32** | The maximum event size. | +**MaxEventsPerReq** | **uint32** | The maximum amount of events per request. | + +## Methods + +### NewChainInfoResponse + +`func NewChainInfoResponse(chainID string, chainOwnerId string, description string, evmChainId uint32, isActive bool, maxBlobSize uint32, maxEventSize uint32, maxEventsPerReq uint32, ) *ChainInfoResponse` + +NewChainInfoResponse instantiates a new ChainInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewChainInfoResponseWithDefaults + +`func NewChainInfoResponseWithDefaults() *ChainInfoResponse` + +NewChainInfoResponseWithDefaults instantiates a new ChainInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetChainID + +`func (o *ChainInfoResponse) GetChainID() string` + +GetChainID returns the ChainID field if non-nil, zero value otherwise. + +### GetChainIDOk + +`func (o *ChainInfoResponse) GetChainIDOk() (*string, bool)` + +GetChainIDOk returns a tuple with the ChainID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainID + +`func (o *ChainInfoResponse) SetChainID(v string)` + +SetChainID sets ChainID field to given value. + + +### GetChainOwnerId + +`func (o *ChainInfoResponse) GetChainOwnerId() string` + +GetChainOwnerId returns the ChainOwnerId field if non-nil, zero value otherwise. + +### GetChainOwnerIdOk + +`func (o *ChainInfoResponse) GetChainOwnerIdOk() (*string, bool)` + +GetChainOwnerIdOk returns a tuple with the ChainOwnerId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainOwnerId + +`func (o *ChainInfoResponse) SetChainOwnerId(v string)` + +SetChainOwnerId sets ChainOwnerId field to given value. + + +### GetDescription + +`func (o *ChainInfoResponse) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *ChainInfoResponse) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *ChainInfoResponse) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetEvmChainId + +`func (o *ChainInfoResponse) GetEvmChainId() uint32` + +GetEvmChainId returns the EvmChainId field if non-nil, zero value otherwise. + +### GetEvmChainIdOk + +`func (o *ChainInfoResponse) GetEvmChainIdOk() (*uint32, bool)` + +GetEvmChainIdOk returns a tuple with the EvmChainId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEvmChainId + +`func (o *ChainInfoResponse) SetEvmChainId(v uint32)` + +SetEvmChainId sets EvmChainId field to given value. + + +### GetGasFeePolicy + +`func (o *ChainInfoResponse) GetGasFeePolicy() GasFeePolicy` + +GetGasFeePolicy returns the GasFeePolicy field if non-nil, zero value otherwise. + +### GetGasFeePolicyOk + +`func (o *ChainInfoResponse) GetGasFeePolicyOk() (*GasFeePolicy, bool)` + +GetGasFeePolicyOk returns a tuple with the GasFeePolicy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeePolicy + +`func (o *ChainInfoResponse) SetGasFeePolicy(v GasFeePolicy)` + +SetGasFeePolicy sets GasFeePolicy field to given value. + +### HasGasFeePolicy + +`func (o *ChainInfoResponse) HasGasFeePolicy() bool` + +HasGasFeePolicy returns a boolean if a field has been set. + +### GetIsActive + +`func (o *ChainInfoResponse) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *ChainInfoResponse) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *ChainInfoResponse) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + + +### GetMaxBlobSize + +`func (o *ChainInfoResponse) GetMaxBlobSize() uint32` + +GetMaxBlobSize returns the MaxBlobSize field if non-nil, zero value otherwise. + +### GetMaxBlobSizeOk + +`func (o *ChainInfoResponse) GetMaxBlobSizeOk() (*uint32, bool)` + +GetMaxBlobSizeOk returns a tuple with the MaxBlobSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxBlobSize + +`func (o *ChainInfoResponse) SetMaxBlobSize(v uint32)` + +SetMaxBlobSize sets MaxBlobSize field to given value. + + +### GetMaxEventSize + +`func (o *ChainInfoResponse) GetMaxEventSize() uint32` + +GetMaxEventSize returns the MaxEventSize field if non-nil, zero value otherwise. + +### GetMaxEventSizeOk + +`func (o *ChainInfoResponse) GetMaxEventSizeOk() (*uint32, bool)` + +GetMaxEventSizeOk returns a tuple with the MaxEventSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxEventSize + +`func (o *ChainInfoResponse) SetMaxEventSize(v uint32)` + +SetMaxEventSize sets MaxEventSize field to given value. + + +### GetMaxEventsPerReq + +`func (o *ChainInfoResponse) GetMaxEventsPerReq() uint32` + +GetMaxEventsPerReq returns the MaxEventsPerReq field if non-nil, zero value otherwise. + +### GetMaxEventsPerReqOk + +`func (o *ChainInfoResponse) GetMaxEventsPerReqOk() (*uint32, bool)` + +GetMaxEventsPerReqOk returns a tuple with the MaxEventsPerReq field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxEventsPerReq + +`func (o *ChainInfoResponse) SetMaxEventsPerReq(v uint32)` + +SetMaxEventsPerReq sets MaxEventsPerReq field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ChainMetrics.md b/clients/apiclient/docs/ChainMetrics.md new file mode 100644 index 0000000000..e66c028b65 --- /dev/null +++ b/clients/apiclient/docs/ChainMetrics.md @@ -0,0 +1,282 @@ +# ChainMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**InAliasOutput** | [**AliasOutputMetricItem**](AliasOutputMetricItem.md) | | +**InMilestone** | [**MilestoneMetricItem**](MilestoneMetricItem.md) | | +**InOnLedgerRequest** | [**OnLedgerRequestMetricItem**](OnLedgerRequestMetricItem.md) | | +**InOutput** | [**InOutputMetricItem**](InOutputMetricItem.md) | | +**InStateOutput** | [**InStateOutputMetricItem**](InStateOutputMetricItem.md) | | +**InTxInclusionState** | [**TxInclusionStateMsgMetricItem**](TxInclusionStateMsgMetricItem.md) | | +**OutPublishGovernanceTransaction** | [**TransactionMetricItem**](TransactionMetricItem.md) | | +**OutPublisherStateTransaction** | [**PublisherStateTransactionItem**](PublisherStateTransactionItem.md) | | +**OutPullLatestOutput** | [**InterfaceMetricItem**](InterfaceMetricItem.md) | | +**OutPullOutputByID** | [**UTXOInputMetricItem**](UTXOInputMetricItem.md) | | +**OutPullTxInclusionState** | [**TransactionIDMetricItem**](TransactionIDMetricItem.md) | | +**RegisteredChainIDs** | **[]string** | | + +## Methods + +### NewChainMetrics + +`func NewChainMetrics(inAliasOutput AliasOutputMetricItem, inMilestone MilestoneMetricItem, inOnLedgerRequest OnLedgerRequestMetricItem, inOutput InOutputMetricItem, inStateOutput InStateOutputMetricItem, inTxInclusionState TxInclusionStateMsgMetricItem, outPublishGovernanceTransaction TransactionMetricItem, outPublisherStateTransaction PublisherStateTransactionItem, outPullLatestOutput InterfaceMetricItem, outPullOutputByID UTXOInputMetricItem, outPullTxInclusionState TransactionIDMetricItem, registeredChainIDs []string, ) *ChainMetrics` + +NewChainMetrics instantiates a new ChainMetrics object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewChainMetricsWithDefaults + +`func NewChainMetricsWithDefaults() *ChainMetrics` + +NewChainMetricsWithDefaults instantiates a new ChainMetrics object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetInAliasOutput + +`func (o *ChainMetrics) GetInAliasOutput() AliasOutputMetricItem` + +GetInAliasOutput returns the InAliasOutput field if non-nil, zero value otherwise. + +### GetInAliasOutputOk + +`func (o *ChainMetrics) GetInAliasOutputOk() (*AliasOutputMetricItem, bool)` + +GetInAliasOutputOk returns a tuple with the InAliasOutput field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInAliasOutput + +`func (o *ChainMetrics) SetInAliasOutput(v AliasOutputMetricItem)` + +SetInAliasOutput sets InAliasOutput field to given value. + + +### GetInMilestone + +`func (o *ChainMetrics) GetInMilestone() MilestoneMetricItem` + +GetInMilestone returns the InMilestone field if non-nil, zero value otherwise. + +### GetInMilestoneOk + +`func (o *ChainMetrics) GetInMilestoneOk() (*MilestoneMetricItem, bool)` + +GetInMilestoneOk returns a tuple with the InMilestone field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInMilestone + +`func (o *ChainMetrics) SetInMilestone(v MilestoneMetricItem)` + +SetInMilestone sets InMilestone field to given value. + + +### GetInOnLedgerRequest + +`func (o *ChainMetrics) GetInOnLedgerRequest() OnLedgerRequestMetricItem` + +GetInOnLedgerRequest returns the InOnLedgerRequest field if non-nil, zero value otherwise. + +### GetInOnLedgerRequestOk + +`func (o *ChainMetrics) GetInOnLedgerRequestOk() (*OnLedgerRequestMetricItem, bool)` + +GetInOnLedgerRequestOk returns a tuple with the InOnLedgerRequest field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInOnLedgerRequest + +`func (o *ChainMetrics) SetInOnLedgerRequest(v OnLedgerRequestMetricItem)` + +SetInOnLedgerRequest sets InOnLedgerRequest field to given value. + + +### GetInOutput + +`func (o *ChainMetrics) GetInOutput() InOutputMetricItem` + +GetInOutput returns the InOutput field if non-nil, zero value otherwise. + +### GetInOutputOk + +`func (o *ChainMetrics) GetInOutputOk() (*InOutputMetricItem, bool)` + +GetInOutputOk returns a tuple with the InOutput field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInOutput + +`func (o *ChainMetrics) SetInOutput(v InOutputMetricItem)` + +SetInOutput sets InOutput field to given value. + + +### GetInStateOutput + +`func (o *ChainMetrics) GetInStateOutput() InStateOutputMetricItem` + +GetInStateOutput returns the InStateOutput field if non-nil, zero value otherwise. + +### GetInStateOutputOk + +`func (o *ChainMetrics) GetInStateOutputOk() (*InStateOutputMetricItem, bool)` + +GetInStateOutputOk returns a tuple with the InStateOutput field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInStateOutput + +`func (o *ChainMetrics) SetInStateOutput(v InStateOutputMetricItem)` + +SetInStateOutput sets InStateOutput field to given value. + + +### GetInTxInclusionState + +`func (o *ChainMetrics) GetInTxInclusionState() TxInclusionStateMsgMetricItem` + +GetInTxInclusionState returns the InTxInclusionState field if non-nil, zero value otherwise. + +### GetInTxInclusionStateOk + +`func (o *ChainMetrics) GetInTxInclusionStateOk() (*TxInclusionStateMsgMetricItem, bool)` + +GetInTxInclusionStateOk returns a tuple with the InTxInclusionState field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetInTxInclusionState + +`func (o *ChainMetrics) SetInTxInclusionState(v TxInclusionStateMsgMetricItem)` + +SetInTxInclusionState sets InTxInclusionState field to given value. + + +### GetOutPublishGovernanceTransaction + +`func (o *ChainMetrics) GetOutPublishGovernanceTransaction() TransactionMetricItem` + +GetOutPublishGovernanceTransaction returns the OutPublishGovernanceTransaction field if non-nil, zero value otherwise. + +### GetOutPublishGovernanceTransactionOk + +`func (o *ChainMetrics) GetOutPublishGovernanceTransactionOk() (*TransactionMetricItem, bool)` + +GetOutPublishGovernanceTransactionOk returns a tuple with the OutPublishGovernanceTransaction field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutPublishGovernanceTransaction + +`func (o *ChainMetrics) SetOutPublishGovernanceTransaction(v TransactionMetricItem)` + +SetOutPublishGovernanceTransaction sets OutPublishGovernanceTransaction field to given value. + + +### GetOutPublisherStateTransaction + +`func (o *ChainMetrics) GetOutPublisherStateTransaction() PublisherStateTransactionItem` + +GetOutPublisherStateTransaction returns the OutPublisherStateTransaction field if non-nil, zero value otherwise. + +### GetOutPublisherStateTransactionOk + +`func (o *ChainMetrics) GetOutPublisherStateTransactionOk() (*PublisherStateTransactionItem, bool)` + +GetOutPublisherStateTransactionOk returns a tuple with the OutPublisherStateTransaction field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutPublisherStateTransaction + +`func (o *ChainMetrics) SetOutPublisherStateTransaction(v PublisherStateTransactionItem)` + +SetOutPublisherStateTransaction sets OutPublisherStateTransaction field to given value. + + +### GetOutPullLatestOutput + +`func (o *ChainMetrics) GetOutPullLatestOutput() InterfaceMetricItem` + +GetOutPullLatestOutput returns the OutPullLatestOutput field if non-nil, zero value otherwise. + +### GetOutPullLatestOutputOk + +`func (o *ChainMetrics) GetOutPullLatestOutputOk() (*InterfaceMetricItem, bool)` + +GetOutPullLatestOutputOk returns a tuple with the OutPullLatestOutput field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutPullLatestOutput + +`func (o *ChainMetrics) SetOutPullLatestOutput(v InterfaceMetricItem)` + +SetOutPullLatestOutput sets OutPullLatestOutput field to given value. + + +### GetOutPullOutputByID + +`func (o *ChainMetrics) GetOutPullOutputByID() UTXOInputMetricItem` + +GetOutPullOutputByID returns the OutPullOutputByID field if non-nil, zero value otherwise. + +### GetOutPullOutputByIDOk + +`func (o *ChainMetrics) GetOutPullOutputByIDOk() (*UTXOInputMetricItem, bool)` + +GetOutPullOutputByIDOk returns a tuple with the OutPullOutputByID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutPullOutputByID + +`func (o *ChainMetrics) SetOutPullOutputByID(v UTXOInputMetricItem)` + +SetOutPullOutputByID sets OutPullOutputByID field to given value. + + +### GetOutPullTxInclusionState + +`func (o *ChainMetrics) GetOutPullTxInclusionState() TransactionIDMetricItem` + +GetOutPullTxInclusionState returns the OutPullTxInclusionState field if non-nil, zero value otherwise. + +### GetOutPullTxInclusionStateOk + +`func (o *ChainMetrics) GetOutPullTxInclusionStateOk() (*TransactionIDMetricItem, bool)` + +GetOutPullTxInclusionStateOk returns a tuple with the OutPullTxInclusionState field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutPullTxInclusionState + +`func (o *ChainMetrics) SetOutPullTxInclusionState(v TransactionIDMetricItem)` + +SetOutPullTxInclusionState sets OutPullTxInclusionState field to given value. + + +### GetRegisteredChainIDs + +`func (o *ChainMetrics) GetRegisteredChainIDs() []string` + +GetRegisteredChainIDs returns the RegisteredChainIDs field if non-nil, zero value otherwise. + +### GetRegisteredChainIDsOk + +`func (o *ChainMetrics) GetRegisteredChainIDsOk() (*[]string, bool)` + +GetRegisteredChainIDsOk returns a tuple with the RegisteredChainIDs field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRegisteredChainIDs + +`func (o *ChainMetrics) SetRegisteredChainIDs(v []string)` + +SetRegisteredChainIDs sets RegisteredChainIDs field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ChainRecord.md b/clients/apiclient/docs/ChainRecord.md new file mode 100644 index 0000000000..403e40ff49 --- /dev/null +++ b/clients/apiclient/docs/ChainRecord.md @@ -0,0 +1,72 @@ +# ChainRecord + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessNodes** | **[]string** | | +**IsActive** | **bool** | | + +## Methods + +### NewChainRecord + +`func NewChainRecord(accessNodes []string, isActive bool, ) *ChainRecord` + +NewChainRecord instantiates a new ChainRecord object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewChainRecordWithDefaults + +`func NewChainRecordWithDefaults() *ChainRecord` + +NewChainRecordWithDefaults instantiates a new ChainRecord object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAccessNodes + +`func (o *ChainRecord) GetAccessNodes() []string` + +GetAccessNodes returns the AccessNodes field if non-nil, zero value otherwise. + +### GetAccessNodesOk + +`func (o *ChainRecord) GetAccessNodesOk() (*[]string, bool)` + +GetAccessNodesOk returns a tuple with the AccessNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessNodes + +`func (o *ChainRecord) SetAccessNodes(v []string)` + +SetAccessNodes sets AccessNodes field to given value. + + +### GetIsActive + +`func (o *ChainRecord) GetIsActive() bool` + +GetIsActive returns the IsActive field if non-nil, zero value otherwise. + +### GetIsActiveOk + +`func (o *ChainRecord) GetIsActiveOk() (*bool, bool)` + +GetIsActiveOk returns a tuple with the IsActive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsActive + +`func (o *ChainRecord) SetIsActive(v bool)` + +SetIsActive sets IsActive field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ChainsApi.md b/clients/apiclient/docs/ChainsApi.md new file mode 100644 index 0000000000..48a6f747fe --- /dev/null +++ b/clients/apiclient/docs/ChainsApi.md @@ -0,0 +1,898 @@ +# \ChainsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**ActivateChain**](ChainsApi.md#ActivateChain) | **Post** /chains/{chainID}/activate | Activate a chain +[**AddAccessNode**](ChainsApi.md#AddAccessNode) | **Put** /chains/{chainID}/access-node/{publicKey} | Configure a trusted node to be an access node. +[**AttachToWebsocket**](ChainsApi.md#AttachToWebsocket) | **Get** /chains/{chainID}/ws | +[**ChainsChainIDEvmGet**](ChainsApi.md#ChainsChainIDEvmGet) | **Get** /chains/{chainID}/evm | +[**DeactivateChain**](ChainsApi.md#DeactivateChain) | **Post** /chains/{chainID}/deactivate | Deactivate a chain +[**GetChainInfo**](ChainsApi.md#GetChainInfo) | **Get** /chains/{chainID} | Get information about a specific chain +[**GetChains**](ChainsApi.md#GetChains) | **Get** /chains | Get a list of all chains +[**GetCommitteeInfo**](ChainsApi.md#GetCommitteeInfo) | **Get** /chains/{chainID}/committee | Get information about the deployed committee +[**GetContracts**](ChainsApi.md#GetContracts) | **Get** /chains/{chainID}/contracts | Get all available chain contracts +[**GetRequestIDFromEVMTransactionID**](ChainsApi.md#GetRequestIDFromEVMTransactionID) | **Get** /chains/{chainID}/evm/tx/{txHash} | Get the ISC request ID for the given Ethereum transaction hash +[**GetStateValue**](ChainsApi.md#GetStateValue) | **Get** /chains/{chainID}/state/{stateKey} | Fetch the raw value associated with the given key in the chain state +[**RemoveAccessNode**](ChainsApi.md#RemoveAccessNode) | **Delete** /chains/{chainID}/access-node/{publicKey} | Remove an access node. +[**SetChainRecord**](ChainsApi.md#SetChainRecord) | **Post** /chains/{chainID}/chainrecord | Sets the chain record. + + + +## ActivateChain + +> ActivateChain(ctx, chainID).Execute() + +Activate a chain + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.ActivateChain(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.ActivateChain``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiActivateChainRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AddAccessNode + +> AddAccessNode(ctx, chainID, publicKey).Execute() + +Configure a trusted node to be an access node. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + publicKey := "publicKey_example" // string | Nodes public key (Hex) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.AddAccessNode(context.Background(), chainID, publicKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.AddAccessNode``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**publicKey** | **string** | Nodes public key (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddAccessNodeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AttachToWebsocket + +> AttachToWebsocket(ctx, chainID).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32-encoded) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.AttachToWebsocket(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.AttachToWebsocket``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32-encoded) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAttachToWebsocketRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChainsChainIDEvmGet + +> string ChainsChainIDEvmGet(ctx, chainID).Execute() + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.ChainsChainIDEvmGet(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.ChainsChainIDEvmGet``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ChainsChainIDEvmGet`: string + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.ChainsChainIDEvmGet`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiChainsChainIDEvmGetRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +**string** + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeactivateChain + +> DeactivateChain(ctx, chainID).Execute() + +Deactivate a chain + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.DeactivateChain(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.DeactivateChain``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeactivateChainRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetChainInfo + +> ChainInfoResponse GetChainInfo(ctx, chainID).Execute() + +Get information about a specific chain + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetChainInfo(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetChainInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetChainInfo`: ChainInfoResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetChainInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetChainInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ChainInfoResponse**](ChainInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetChains + +> []ChainInfoResponse GetChains(ctx).Execute() + +Get a list of all chains + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetChains(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetChains``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetChains`: []ChainInfoResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetChains`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetChainsRequest struct via the builder pattern + + +### Return type + +[**[]ChainInfoResponse**](ChainInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetCommitteeInfo + +> CommitteeInfoResponse GetCommitteeInfo(ctx, chainID).Execute() + +Get information about the deployed committee + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetCommitteeInfo(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetCommitteeInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetCommitteeInfo`: CommitteeInfoResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetCommitteeInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetCommitteeInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**CommitteeInfoResponse**](CommitteeInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetContracts + +> []ContractInfoResponse GetContracts(ctx, chainID).Execute() + +Get all available chain contracts + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetContracts(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetContracts``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetContracts`: []ContractInfoResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetContracts`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetContractsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**[]ContractInfoResponse**](ContractInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetRequestIDFromEVMTransactionID + +> RequestIDResponse GetRequestIDFromEVMTransactionID(ctx, chainID, txHash).Execute() + +Get the ISC request ID for the given Ethereum transaction hash + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + txHash := "txHash_example" // string | Transaction hash (Hex-encoded) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetRequestIDFromEVMTransactionID(context.Background(), chainID, txHash).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetRequestIDFromEVMTransactionID``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetRequestIDFromEVMTransactionID`: RequestIDResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetRequestIDFromEVMTransactionID`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**txHash** | **string** | Transaction hash (Hex-encoded) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetRequestIDFromEVMTransactionIDRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**RequestIDResponse**](RequestIDResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetStateValue + +> StateResponse GetStateValue(ctx, chainID, stateKey).Execute() + +Fetch the raw value associated with the given key in the chain state + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + stateKey := "stateKey_example" // string | Key (Hex-encoded) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.GetStateValue(context.Background(), chainID, stateKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.GetStateValue``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetStateValue`: StateResponse + fmt.Fprintf(os.Stdout, "Response from `ChainsApi.GetStateValue`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**stateKey** | **string** | Key (Hex-encoded) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetStateValueRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**StateResponse**](StateResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## RemoveAccessNode + +> RemoveAccessNode(ctx, chainID, publicKey).Execute() + +Remove an access node. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + publicKey := "publicKey_example" // string | Nodes public key (Hex) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.RemoveAccessNode(context.Background(), chainID, publicKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.RemoveAccessNode``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**publicKey** | **string** | Nodes public key (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiRemoveAccessNodeRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SetChainRecord + +> SetChainRecord(ctx, chainID).ChainRecord(chainRecord).Execute() + +Sets the chain record. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + chainRecord := *openapiclient.NewChainRecord([]string{"AccessNodes_example"}, false) // ChainRecord | Chain Record + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.ChainsApi.SetChainRecord(context.Background(), chainID).ChainRecord(chainRecord).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `ChainsApi.SetChainRecord``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetChainRecordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **chainRecord** | [**ChainRecord**](ChainRecord.md) | Chain Record | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/CommitteeInfoResponse.md b/clients/apiclient/docs/CommitteeInfoResponse.md new file mode 100644 index 0000000000..4afcfd3db0 --- /dev/null +++ b/clients/apiclient/docs/CommitteeInfoResponse.md @@ -0,0 +1,156 @@ +# CommitteeInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessNodes** | [**[]CommitteeNode**](CommitteeNode.md) | A list of all access nodes and their peering info. | +**Active** | **bool** | Whether or not the chain is active. | +**CandidateNodes** | [**[]CommitteeNode**](CommitteeNode.md) | A list of all candidate nodes and their peering info. | +**ChainId** | **string** | ChainID (Bech32-encoded). | +**CommitteeNodes** | [**[]CommitteeNode**](CommitteeNode.md) | A list of all committee nodes and their peering info. | +**StateAddress** | **string** | | + +## Methods + +### NewCommitteeInfoResponse + +`func NewCommitteeInfoResponse(accessNodes []CommitteeNode, active bool, candidateNodes []CommitteeNode, chainId string, committeeNodes []CommitteeNode, stateAddress string, ) *CommitteeInfoResponse` + +NewCommitteeInfoResponse instantiates a new CommitteeInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCommitteeInfoResponseWithDefaults + +`func NewCommitteeInfoResponseWithDefaults() *CommitteeInfoResponse` + +NewCommitteeInfoResponseWithDefaults instantiates a new CommitteeInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAccessNodes + +`func (o *CommitteeInfoResponse) GetAccessNodes() []CommitteeNode` + +GetAccessNodes returns the AccessNodes field if non-nil, zero value otherwise. + +### GetAccessNodesOk + +`func (o *CommitteeInfoResponse) GetAccessNodesOk() (*[]CommitteeNode, bool)` + +GetAccessNodesOk returns a tuple with the AccessNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessNodes + +`func (o *CommitteeInfoResponse) SetAccessNodes(v []CommitteeNode)` + +SetAccessNodes sets AccessNodes field to given value. + + +### GetActive + +`func (o *CommitteeInfoResponse) GetActive() bool` + +GetActive returns the Active field if non-nil, zero value otherwise. + +### GetActiveOk + +`func (o *CommitteeInfoResponse) GetActiveOk() (*bool, bool)` + +GetActiveOk returns a tuple with the Active field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetActive + +`func (o *CommitteeInfoResponse) SetActive(v bool)` + +SetActive sets Active field to given value. + + +### GetCandidateNodes + +`func (o *CommitteeInfoResponse) GetCandidateNodes() []CommitteeNode` + +GetCandidateNodes returns the CandidateNodes field if non-nil, zero value otherwise. + +### GetCandidateNodesOk + +`func (o *CommitteeInfoResponse) GetCandidateNodesOk() (*[]CommitteeNode, bool)` + +GetCandidateNodesOk returns a tuple with the CandidateNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCandidateNodes + +`func (o *CommitteeInfoResponse) SetCandidateNodes(v []CommitteeNode)` + +SetCandidateNodes sets CandidateNodes field to given value. + + +### GetChainId + +`func (o *CommitteeInfoResponse) GetChainId() string` + +GetChainId returns the ChainId field if non-nil, zero value otherwise. + +### GetChainIdOk + +`func (o *CommitteeInfoResponse) GetChainIdOk() (*string, bool)` + +GetChainIdOk returns a tuple with the ChainId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainId + +`func (o *CommitteeInfoResponse) SetChainId(v string)` + +SetChainId sets ChainId field to given value. + + +### GetCommitteeNodes + +`func (o *CommitteeInfoResponse) GetCommitteeNodes() []CommitteeNode` + +GetCommitteeNodes returns the CommitteeNodes field if non-nil, zero value otherwise. + +### GetCommitteeNodesOk + +`func (o *CommitteeInfoResponse) GetCommitteeNodesOk() (*[]CommitteeNode, bool)` + +GetCommitteeNodesOk returns a tuple with the CommitteeNodes field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCommitteeNodes + +`func (o *CommitteeInfoResponse) SetCommitteeNodes(v []CommitteeNode)` + +SetCommitteeNodes sets CommitteeNodes field to given value. + + +### GetStateAddress + +`func (o *CommitteeInfoResponse) GetStateAddress() string` + +GetStateAddress returns the StateAddress field if non-nil, zero value otherwise. + +### GetStateAddressOk + +`func (o *CommitteeInfoResponse) GetStateAddressOk() (*string, bool)` + +GetStateAddressOk returns a tuple with the StateAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStateAddress + +`func (o *CommitteeInfoResponse) SetStateAddress(v string)` + +SetStateAddress sets StateAddress field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/CommitteeNode.md b/clients/apiclient/docs/CommitteeNode.md new file mode 100644 index 0000000000..20e0af1e2f --- /dev/null +++ b/clients/apiclient/docs/CommitteeNode.md @@ -0,0 +1,72 @@ +# CommitteeNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AccessAPI** | **string** | | +**Node** | [**PeeringNodeStatusResponse**](PeeringNodeStatusResponse.md) | | + +## Methods + +### NewCommitteeNode + +`func NewCommitteeNode(accessAPI string, node PeeringNodeStatusResponse, ) *CommitteeNode` + +NewCommitteeNode instantiates a new CommitteeNode object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewCommitteeNodeWithDefaults + +`func NewCommitteeNodeWithDefaults() *CommitteeNode` + +NewCommitteeNodeWithDefaults instantiates a new CommitteeNode object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAccessAPI + +`func (o *CommitteeNode) GetAccessAPI() string` + +GetAccessAPI returns the AccessAPI field if non-nil, zero value otherwise. + +### GetAccessAPIOk + +`func (o *CommitteeNode) GetAccessAPIOk() (*string, bool)` + +GetAccessAPIOk returns a tuple with the AccessAPI field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAccessAPI + +`func (o *CommitteeNode) SetAccessAPI(v string)` + +SetAccessAPI sets AccessAPI field to given value. + + +### GetNode + +`func (o *CommitteeNode) GetNode() PeeringNodeStatusResponse` + +GetNode returns the Node field if non-nil, zero value otherwise. + +### GetNodeOk + +`func (o *CommitteeNode) GetNodeOk() (*PeeringNodeStatusResponse, bool)` + +GetNodeOk returns a tuple with the Node field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNode + +`func (o *CommitteeNode) SetNode(v PeeringNodeStatusResponse)` + +SetNode sets Node field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ConsensusPipeMetrics.md b/clients/apiclient/docs/ConsensusPipeMetrics.md new file mode 100644 index 0000000000..d2db03e462 --- /dev/null +++ b/clients/apiclient/docs/ConsensusPipeMetrics.md @@ -0,0 +1,135 @@ +# ConsensusPipeMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EventACSMsgPipeSize** | **int32** | | +**EventPeerLogIndexMsgPipeSize** | **int32** | | +**EventStateTransitionMsgPipeSize** | **int32** | | +**EventTimerMsgPipeSize** | **int32** | | +**EventVMResultMsgPipeSize** | **int32** | | + +## Methods + +### NewConsensusPipeMetrics + +`func NewConsensusPipeMetrics(eventACSMsgPipeSize int32, eventPeerLogIndexMsgPipeSize int32, eventStateTransitionMsgPipeSize int32, eventTimerMsgPipeSize int32, eventVMResultMsgPipeSize int32, ) *ConsensusPipeMetrics` + +NewConsensusPipeMetrics instantiates a new ConsensusPipeMetrics object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewConsensusPipeMetricsWithDefaults + +`func NewConsensusPipeMetricsWithDefaults() *ConsensusPipeMetrics` + +NewConsensusPipeMetricsWithDefaults instantiates a new ConsensusPipeMetrics object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEventACSMsgPipeSize + +`func (o *ConsensusPipeMetrics) GetEventACSMsgPipeSize() int32` + +GetEventACSMsgPipeSize returns the EventACSMsgPipeSize field if non-nil, zero value otherwise. + +### GetEventACSMsgPipeSizeOk + +`func (o *ConsensusPipeMetrics) GetEventACSMsgPipeSizeOk() (*int32, bool)` + +GetEventACSMsgPipeSizeOk returns a tuple with the EventACSMsgPipeSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEventACSMsgPipeSize + +`func (o *ConsensusPipeMetrics) SetEventACSMsgPipeSize(v int32)` + +SetEventACSMsgPipeSize sets EventACSMsgPipeSize field to given value. + + +### GetEventPeerLogIndexMsgPipeSize + +`func (o *ConsensusPipeMetrics) GetEventPeerLogIndexMsgPipeSize() int32` + +GetEventPeerLogIndexMsgPipeSize returns the EventPeerLogIndexMsgPipeSize field if non-nil, zero value otherwise. + +### GetEventPeerLogIndexMsgPipeSizeOk + +`func (o *ConsensusPipeMetrics) GetEventPeerLogIndexMsgPipeSizeOk() (*int32, bool)` + +GetEventPeerLogIndexMsgPipeSizeOk returns a tuple with the EventPeerLogIndexMsgPipeSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEventPeerLogIndexMsgPipeSize + +`func (o *ConsensusPipeMetrics) SetEventPeerLogIndexMsgPipeSize(v int32)` + +SetEventPeerLogIndexMsgPipeSize sets EventPeerLogIndexMsgPipeSize field to given value. + + +### GetEventStateTransitionMsgPipeSize + +`func (o *ConsensusPipeMetrics) GetEventStateTransitionMsgPipeSize() int32` + +GetEventStateTransitionMsgPipeSize returns the EventStateTransitionMsgPipeSize field if non-nil, zero value otherwise. + +### GetEventStateTransitionMsgPipeSizeOk + +`func (o *ConsensusPipeMetrics) GetEventStateTransitionMsgPipeSizeOk() (*int32, bool)` + +GetEventStateTransitionMsgPipeSizeOk returns a tuple with the EventStateTransitionMsgPipeSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEventStateTransitionMsgPipeSize + +`func (o *ConsensusPipeMetrics) SetEventStateTransitionMsgPipeSize(v int32)` + +SetEventStateTransitionMsgPipeSize sets EventStateTransitionMsgPipeSize field to given value. + + +### GetEventTimerMsgPipeSize + +`func (o *ConsensusPipeMetrics) GetEventTimerMsgPipeSize() int32` + +GetEventTimerMsgPipeSize returns the EventTimerMsgPipeSize field if non-nil, zero value otherwise. + +### GetEventTimerMsgPipeSizeOk + +`func (o *ConsensusPipeMetrics) GetEventTimerMsgPipeSizeOk() (*int32, bool)` + +GetEventTimerMsgPipeSizeOk returns a tuple with the EventTimerMsgPipeSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEventTimerMsgPipeSize + +`func (o *ConsensusPipeMetrics) SetEventTimerMsgPipeSize(v int32)` + +SetEventTimerMsgPipeSize sets EventTimerMsgPipeSize field to given value. + + +### GetEventVMResultMsgPipeSize + +`func (o *ConsensusPipeMetrics) GetEventVMResultMsgPipeSize() int32` + +GetEventVMResultMsgPipeSize returns the EventVMResultMsgPipeSize field if non-nil, zero value otherwise. + +### GetEventVMResultMsgPipeSizeOk + +`func (o *ConsensusPipeMetrics) GetEventVMResultMsgPipeSizeOk() (*int32, bool)` + +GetEventVMResultMsgPipeSizeOk returns a tuple with the EventVMResultMsgPipeSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEventVMResultMsgPipeSize + +`func (o *ConsensusPipeMetrics) SetEventVMResultMsgPipeSize(v int32)` + +SetEventVMResultMsgPipeSize sets EventVMResultMsgPipeSize field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ConsensusWorkflowMetrics.md b/clients/apiclient/docs/ConsensusWorkflowMetrics.md new file mode 100644 index 0000000000..87e6acb219 --- /dev/null +++ b/clients/apiclient/docs/ConsensusWorkflowMetrics.md @@ -0,0 +1,413 @@ +# ConsensusWorkflowMetrics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**CurrentStateIndex** | Pointer to **uint32** | Shows current state index of the consensus | [optional] +**FlagBatchProposalSent** | **bool** | Shows if batch proposal is sent out in current consensus iteration | +**FlagConsensusBatchKnown** | **bool** | Shows if consensus on batch is reached and known in current consensus iteration | +**FlagInProgress** | **bool** | Shows if consensus algorithm is still not completed in current consensus iteration | +**FlagStateReceived** | **bool** | Shows if state output is received in current consensus iteration | +**FlagTransactionFinalized** | **bool** | Shows if consensus on transaction is reached in current consensus iteration | +**FlagTransactionPosted** | **bool** | Shows if transaction is posted to L1 in current consensus iteration | +**FlagTransactionSeen** | **bool** | Shows if L1 reported that it has seen the transaction of current consensus iteration | +**FlagVMResultSigned** | **bool** | Shows if virtual machine has returned its results in current consensus iteration | +**FlagVMStarted** | **bool** | Shows if virtual machine is started in current consensus iteration | +**TimeBatchProposalSent** | **time.Time** | Shows when batch proposal was last sent out in current consensus iteration | +**TimeCompleted** | **time.Time** | Shows when algorithm was last completed in current consensus iteration | +**TimeConsensusBatchKnown** | **time.Time** | Shows when ACS results of consensus on batch was last received in current consensus iteration | +**TimeTransactionFinalized** | **time.Time** | Shows when algorithm last noted that all the data for consensus on transaction had been received in current consensus iteration | +**TimeTransactionPosted** | **time.Time** | Shows when transaction was last posted to L1 in current consensus iteration | +**TimeTransactionSeen** | **time.Time** | Shows when algorithm last noted that transaction had been seen by L1 in current consensus iteration | +**TimeVMResultSigned** | **time.Time** | Shows when virtual machine results were last received and signed in current consensus iteration | +**TimeVMStarted** | **time.Time** | Shows when virtual machine was last started in current consensus iteration | + +## Methods + +### NewConsensusWorkflowMetrics + +`func NewConsensusWorkflowMetrics(flagBatchProposalSent bool, flagConsensusBatchKnown bool, flagInProgress bool, flagStateReceived bool, flagTransactionFinalized bool, flagTransactionPosted bool, flagTransactionSeen bool, flagVMResultSigned bool, flagVMStarted bool, timeBatchProposalSent time.Time, timeCompleted time.Time, timeConsensusBatchKnown time.Time, timeTransactionFinalized time.Time, timeTransactionPosted time.Time, timeTransactionSeen time.Time, timeVMResultSigned time.Time, timeVMStarted time.Time, ) *ConsensusWorkflowMetrics` + +NewConsensusWorkflowMetrics instantiates a new ConsensusWorkflowMetrics object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewConsensusWorkflowMetricsWithDefaults + +`func NewConsensusWorkflowMetricsWithDefaults() *ConsensusWorkflowMetrics` + +NewConsensusWorkflowMetricsWithDefaults instantiates a new ConsensusWorkflowMetrics object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCurrentStateIndex + +`func (o *ConsensusWorkflowMetrics) GetCurrentStateIndex() uint32` + +GetCurrentStateIndex returns the CurrentStateIndex field if non-nil, zero value otherwise. + +### GetCurrentStateIndexOk + +`func (o *ConsensusWorkflowMetrics) GetCurrentStateIndexOk() (*uint32, bool)` + +GetCurrentStateIndexOk returns a tuple with the CurrentStateIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCurrentStateIndex + +`func (o *ConsensusWorkflowMetrics) SetCurrentStateIndex(v uint32)` + +SetCurrentStateIndex sets CurrentStateIndex field to given value. + +### HasCurrentStateIndex + +`func (o *ConsensusWorkflowMetrics) HasCurrentStateIndex() bool` + +HasCurrentStateIndex returns a boolean if a field has been set. + +### GetFlagBatchProposalSent + +`func (o *ConsensusWorkflowMetrics) GetFlagBatchProposalSent() bool` + +GetFlagBatchProposalSent returns the FlagBatchProposalSent field if non-nil, zero value otherwise. + +### GetFlagBatchProposalSentOk + +`func (o *ConsensusWorkflowMetrics) GetFlagBatchProposalSentOk() (*bool, bool)` + +GetFlagBatchProposalSentOk returns a tuple with the FlagBatchProposalSent field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagBatchProposalSent + +`func (o *ConsensusWorkflowMetrics) SetFlagBatchProposalSent(v bool)` + +SetFlagBatchProposalSent sets FlagBatchProposalSent field to given value. + + +### GetFlagConsensusBatchKnown + +`func (o *ConsensusWorkflowMetrics) GetFlagConsensusBatchKnown() bool` + +GetFlagConsensusBatchKnown returns the FlagConsensusBatchKnown field if non-nil, zero value otherwise. + +### GetFlagConsensusBatchKnownOk + +`func (o *ConsensusWorkflowMetrics) GetFlagConsensusBatchKnownOk() (*bool, bool)` + +GetFlagConsensusBatchKnownOk returns a tuple with the FlagConsensusBatchKnown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagConsensusBatchKnown + +`func (o *ConsensusWorkflowMetrics) SetFlagConsensusBatchKnown(v bool)` + +SetFlagConsensusBatchKnown sets FlagConsensusBatchKnown field to given value. + + +### GetFlagInProgress + +`func (o *ConsensusWorkflowMetrics) GetFlagInProgress() bool` + +GetFlagInProgress returns the FlagInProgress field if non-nil, zero value otherwise. + +### GetFlagInProgressOk + +`func (o *ConsensusWorkflowMetrics) GetFlagInProgressOk() (*bool, bool)` + +GetFlagInProgressOk returns a tuple with the FlagInProgress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagInProgress + +`func (o *ConsensusWorkflowMetrics) SetFlagInProgress(v bool)` + +SetFlagInProgress sets FlagInProgress field to given value. + + +### GetFlagStateReceived + +`func (o *ConsensusWorkflowMetrics) GetFlagStateReceived() bool` + +GetFlagStateReceived returns the FlagStateReceived field if non-nil, zero value otherwise. + +### GetFlagStateReceivedOk + +`func (o *ConsensusWorkflowMetrics) GetFlagStateReceivedOk() (*bool, bool)` + +GetFlagStateReceivedOk returns a tuple with the FlagStateReceived field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagStateReceived + +`func (o *ConsensusWorkflowMetrics) SetFlagStateReceived(v bool)` + +SetFlagStateReceived sets FlagStateReceived field to given value. + + +### GetFlagTransactionFinalized + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionFinalized() bool` + +GetFlagTransactionFinalized returns the FlagTransactionFinalized field if non-nil, zero value otherwise. + +### GetFlagTransactionFinalizedOk + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionFinalizedOk() (*bool, bool)` + +GetFlagTransactionFinalizedOk returns a tuple with the FlagTransactionFinalized field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagTransactionFinalized + +`func (o *ConsensusWorkflowMetrics) SetFlagTransactionFinalized(v bool)` + +SetFlagTransactionFinalized sets FlagTransactionFinalized field to given value. + + +### GetFlagTransactionPosted + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionPosted() bool` + +GetFlagTransactionPosted returns the FlagTransactionPosted field if non-nil, zero value otherwise. + +### GetFlagTransactionPostedOk + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionPostedOk() (*bool, bool)` + +GetFlagTransactionPostedOk returns a tuple with the FlagTransactionPosted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagTransactionPosted + +`func (o *ConsensusWorkflowMetrics) SetFlagTransactionPosted(v bool)` + +SetFlagTransactionPosted sets FlagTransactionPosted field to given value. + + +### GetFlagTransactionSeen + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionSeen() bool` + +GetFlagTransactionSeen returns the FlagTransactionSeen field if non-nil, zero value otherwise. + +### GetFlagTransactionSeenOk + +`func (o *ConsensusWorkflowMetrics) GetFlagTransactionSeenOk() (*bool, bool)` + +GetFlagTransactionSeenOk returns a tuple with the FlagTransactionSeen field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagTransactionSeen + +`func (o *ConsensusWorkflowMetrics) SetFlagTransactionSeen(v bool)` + +SetFlagTransactionSeen sets FlagTransactionSeen field to given value. + + +### GetFlagVMResultSigned + +`func (o *ConsensusWorkflowMetrics) GetFlagVMResultSigned() bool` + +GetFlagVMResultSigned returns the FlagVMResultSigned field if non-nil, zero value otherwise. + +### GetFlagVMResultSignedOk + +`func (o *ConsensusWorkflowMetrics) GetFlagVMResultSignedOk() (*bool, bool)` + +GetFlagVMResultSignedOk returns a tuple with the FlagVMResultSigned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagVMResultSigned + +`func (o *ConsensusWorkflowMetrics) SetFlagVMResultSigned(v bool)` + +SetFlagVMResultSigned sets FlagVMResultSigned field to given value. + + +### GetFlagVMStarted + +`func (o *ConsensusWorkflowMetrics) GetFlagVMStarted() bool` + +GetFlagVMStarted returns the FlagVMStarted field if non-nil, zero value otherwise. + +### GetFlagVMStartedOk + +`func (o *ConsensusWorkflowMetrics) GetFlagVMStartedOk() (*bool, bool)` + +GetFlagVMStartedOk returns a tuple with the FlagVMStarted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFlagVMStarted + +`func (o *ConsensusWorkflowMetrics) SetFlagVMStarted(v bool)` + +SetFlagVMStarted sets FlagVMStarted field to given value. + + +### GetTimeBatchProposalSent + +`func (o *ConsensusWorkflowMetrics) GetTimeBatchProposalSent() time.Time` + +GetTimeBatchProposalSent returns the TimeBatchProposalSent field if non-nil, zero value otherwise. + +### GetTimeBatchProposalSentOk + +`func (o *ConsensusWorkflowMetrics) GetTimeBatchProposalSentOk() (*time.Time, bool)` + +GetTimeBatchProposalSentOk returns a tuple with the TimeBatchProposalSent field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeBatchProposalSent + +`func (o *ConsensusWorkflowMetrics) SetTimeBatchProposalSent(v time.Time)` + +SetTimeBatchProposalSent sets TimeBatchProposalSent field to given value. + + +### GetTimeCompleted + +`func (o *ConsensusWorkflowMetrics) GetTimeCompleted() time.Time` + +GetTimeCompleted returns the TimeCompleted field if non-nil, zero value otherwise. + +### GetTimeCompletedOk + +`func (o *ConsensusWorkflowMetrics) GetTimeCompletedOk() (*time.Time, bool)` + +GetTimeCompletedOk returns a tuple with the TimeCompleted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeCompleted + +`func (o *ConsensusWorkflowMetrics) SetTimeCompleted(v time.Time)` + +SetTimeCompleted sets TimeCompleted field to given value. + + +### GetTimeConsensusBatchKnown + +`func (o *ConsensusWorkflowMetrics) GetTimeConsensusBatchKnown() time.Time` + +GetTimeConsensusBatchKnown returns the TimeConsensusBatchKnown field if non-nil, zero value otherwise. + +### GetTimeConsensusBatchKnownOk + +`func (o *ConsensusWorkflowMetrics) GetTimeConsensusBatchKnownOk() (*time.Time, bool)` + +GetTimeConsensusBatchKnownOk returns a tuple with the TimeConsensusBatchKnown field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeConsensusBatchKnown + +`func (o *ConsensusWorkflowMetrics) SetTimeConsensusBatchKnown(v time.Time)` + +SetTimeConsensusBatchKnown sets TimeConsensusBatchKnown field to given value. + + +### GetTimeTransactionFinalized + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionFinalized() time.Time` + +GetTimeTransactionFinalized returns the TimeTransactionFinalized field if non-nil, zero value otherwise. + +### GetTimeTransactionFinalizedOk + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionFinalizedOk() (*time.Time, bool)` + +GetTimeTransactionFinalizedOk returns a tuple with the TimeTransactionFinalized field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeTransactionFinalized + +`func (o *ConsensusWorkflowMetrics) SetTimeTransactionFinalized(v time.Time)` + +SetTimeTransactionFinalized sets TimeTransactionFinalized field to given value. + + +### GetTimeTransactionPosted + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionPosted() time.Time` + +GetTimeTransactionPosted returns the TimeTransactionPosted field if non-nil, zero value otherwise. + +### GetTimeTransactionPostedOk + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionPostedOk() (*time.Time, bool)` + +GetTimeTransactionPostedOk returns a tuple with the TimeTransactionPosted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeTransactionPosted + +`func (o *ConsensusWorkflowMetrics) SetTimeTransactionPosted(v time.Time)` + +SetTimeTransactionPosted sets TimeTransactionPosted field to given value. + + +### GetTimeTransactionSeen + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionSeen() time.Time` + +GetTimeTransactionSeen returns the TimeTransactionSeen field if non-nil, zero value otherwise. + +### GetTimeTransactionSeenOk + +`func (o *ConsensusWorkflowMetrics) GetTimeTransactionSeenOk() (*time.Time, bool)` + +GetTimeTransactionSeenOk returns a tuple with the TimeTransactionSeen field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeTransactionSeen + +`func (o *ConsensusWorkflowMetrics) SetTimeTransactionSeen(v time.Time)` + +SetTimeTransactionSeen sets TimeTransactionSeen field to given value. + + +### GetTimeVMResultSigned + +`func (o *ConsensusWorkflowMetrics) GetTimeVMResultSigned() time.Time` + +GetTimeVMResultSigned returns the TimeVMResultSigned field if non-nil, zero value otherwise. + +### GetTimeVMResultSignedOk + +`func (o *ConsensusWorkflowMetrics) GetTimeVMResultSignedOk() (*time.Time, bool)` + +GetTimeVMResultSignedOk returns a tuple with the TimeVMResultSigned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeVMResultSigned + +`func (o *ConsensusWorkflowMetrics) SetTimeVMResultSigned(v time.Time)` + +SetTimeVMResultSigned sets TimeVMResultSigned field to given value. + + +### GetTimeVMStarted + +`func (o *ConsensusWorkflowMetrics) GetTimeVMStarted() time.Time` + +GetTimeVMStarted returns the TimeVMStarted field if non-nil, zero value otherwise. + +### GetTimeVMStartedOk + +`func (o *ConsensusWorkflowMetrics) GetTimeVMStartedOk() (*time.Time, bool)` + +GetTimeVMStartedOk returns a tuple with the TimeVMStarted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeVMStarted + +`func (o *ConsensusWorkflowMetrics) SetTimeVMStarted(v time.Time)` + +SetTimeVMStarted sets TimeVMStarted field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ContractCallViewRequest.md b/clients/apiclient/docs/ContractCallViewRequest.md new file mode 100644 index 0000000000..ffe1abe336 --- /dev/null +++ b/clients/apiclient/docs/ContractCallViewRequest.md @@ -0,0 +1,156 @@ +# ContractCallViewRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Arguments** | [**JSONDict**](JSONDict.md) | | +**ChainId** | **string** | The chain id | +**ContractHName** | **string** | The contract name as HName (Hex) | +**ContractName** | **string** | The contract name | +**FunctionHName** | **string** | The function name as HName (Hex) | +**FunctionName** | **string** | The function name | + +## Methods + +### NewContractCallViewRequest + +`func NewContractCallViewRequest(arguments JSONDict, chainId string, contractHName string, contractName string, functionHName string, functionName string, ) *ContractCallViewRequest` + +NewContractCallViewRequest instantiates a new ContractCallViewRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewContractCallViewRequestWithDefaults + +`func NewContractCallViewRequestWithDefaults() *ContractCallViewRequest` + +NewContractCallViewRequestWithDefaults instantiates a new ContractCallViewRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetArguments + +`func (o *ContractCallViewRequest) GetArguments() JSONDict` + +GetArguments returns the Arguments field if non-nil, zero value otherwise. + +### GetArgumentsOk + +`func (o *ContractCallViewRequest) GetArgumentsOk() (*JSONDict, bool)` + +GetArgumentsOk returns a tuple with the Arguments field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetArguments + +`func (o *ContractCallViewRequest) SetArguments(v JSONDict)` + +SetArguments sets Arguments field to given value. + + +### GetChainId + +`func (o *ContractCallViewRequest) GetChainId() string` + +GetChainId returns the ChainId field if non-nil, zero value otherwise. + +### GetChainIdOk + +`func (o *ContractCallViewRequest) GetChainIdOk() (*string, bool)` + +GetChainIdOk returns a tuple with the ChainId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainId + +`func (o *ContractCallViewRequest) SetChainId(v string)` + +SetChainId sets ChainId field to given value. + + +### GetContractHName + +`func (o *ContractCallViewRequest) GetContractHName() string` + +GetContractHName returns the ContractHName field if non-nil, zero value otherwise. + +### GetContractHNameOk + +`func (o *ContractCallViewRequest) GetContractHNameOk() (*string, bool)` + +GetContractHNameOk returns a tuple with the ContractHName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContractHName + +`func (o *ContractCallViewRequest) SetContractHName(v string)` + +SetContractHName sets ContractHName field to given value. + + +### GetContractName + +`func (o *ContractCallViewRequest) GetContractName() string` + +GetContractName returns the ContractName field if non-nil, zero value otherwise. + +### GetContractNameOk + +`func (o *ContractCallViewRequest) GetContractNameOk() (*string, bool)` + +GetContractNameOk returns a tuple with the ContractName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContractName + +`func (o *ContractCallViewRequest) SetContractName(v string)` + +SetContractName sets ContractName field to given value. + + +### GetFunctionHName + +`func (o *ContractCallViewRequest) GetFunctionHName() string` + +GetFunctionHName returns the FunctionHName field if non-nil, zero value otherwise. + +### GetFunctionHNameOk + +`func (o *ContractCallViewRequest) GetFunctionHNameOk() (*string, bool)` + +GetFunctionHNameOk returns a tuple with the FunctionHName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFunctionHName + +`func (o *ContractCallViewRequest) SetFunctionHName(v string)` + +SetFunctionHName sets FunctionHName field to given value. + + +### GetFunctionName + +`func (o *ContractCallViewRequest) GetFunctionName() string` + +GetFunctionName returns the FunctionName field if non-nil, zero value otherwise. + +### GetFunctionNameOk + +`func (o *ContractCallViewRequest) GetFunctionNameOk() (*string, bool)` + +GetFunctionNameOk returns a tuple with the FunctionName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFunctionName + +`func (o *ContractCallViewRequest) SetFunctionName(v string)` + +SetFunctionName sets FunctionName field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ContractInfoResponse.md b/clients/apiclient/docs/ContractInfoResponse.md new file mode 100644 index 0000000000..17a153d6fe --- /dev/null +++ b/clients/apiclient/docs/ContractInfoResponse.md @@ -0,0 +1,114 @@ +# ContractInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | **string** | The description of the contract. | +**HName** | **string** | The id (HName as Hex)) of the contract. | +**Name** | **string** | The name of the contract. | +**ProgramHash** | **string** | The hash of the contract. (Hex encoded) | + +## Methods + +### NewContractInfoResponse + +`func NewContractInfoResponse(description string, hName string, name string, programHash string, ) *ContractInfoResponse` + +NewContractInfoResponse instantiates a new ContractInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewContractInfoResponseWithDefaults + +`func NewContractInfoResponseWithDefaults() *ContractInfoResponse` + +NewContractInfoResponseWithDefaults instantiates a new ContractInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetDescription + +`func (o *ContractInfoResponse) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *ContractInfoResponse) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *ContractInfoResponse) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetHName + +`func (o *ContractInfoResponse) GetHName() string` + +GetHName returns the HName field if non-nil, zero value otherwise. + +### GetHNameOk + +`func (o *ContractInfoResponse) GetHNameOk() (*string, bool)` + +GetHNameOk returns a tuple with the HName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHName + +`func (o *ContractInfoResponse) SetHName(v string)` + +SetHName sets HName field to given value. + + +### GetName + +`func (o *ContractInfoResponse) GetName() string` + +GetName returns the Name field if non-nil, zero value otherwise. + +### GetNameOk + +`func (o *ContractInfoResponse) GetNameOk() (*string, bool)` + +GetNameOk returns a tuple with the Name field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetName + +`func (o *ContractInfoResponse) SetName(v string)` + +SetName sets Name field to given value. + + +### GetProgramHash + +`func (o *ContractInfoResponse) GetProgramHash() string` + +GetProgramHash returns the ProgramHash field if non-nil, zero value otherwise. + +### GetProgramHashOk + +`func (o *ContractInfoResponse) GetProgramHashOk() (*string, bool)` + +GetProgramHashOk returns a tuple with the ProgramHash field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProgramHash + +`func (o *ContractInfoResponse) SetProgramHash(v string)` + +SetProgramHash sets ProgramHash field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ControlAddressesResponse.md b/clients/apiclient/docs/ControlAddressesResponse.md new file mode 100644 index 0000000000..27e0a8771b --- /dev/null +++ b/clients/apiclient/docs/ControlAddressesResponse.md @@ -0,0 +1,93 @@ +# ControlAddressesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GoverningAddress** | **string** | The governing address (Bech32) | +**SinceBlockIndex** | **uint32** | The block index (uint32 | +**StateAddress** | **string** | The state address (Bech32) | + +## Methods + +### NewControlAddressesResponse + +`func NewControlAddressesResponse(governingAddress string, sinceBlockIndex uint32, stateAddress string, ) *ControlAddressesResponse` + +NewControlAddressesResponse instantiates a new ControlAddressesResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewControlAddressesResponseWithDefaults + +`func NewControlAddressesResponseWithDefaults() *ControlAddressesResponse` + +NewControlAddressesResponseWithDefaults instantiates a new ControlAddressesResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetGoverningAddress + +`func (o *ControlAddressesResponse) GetGoverningAddress() string` + +GetGoverningAddress returns the GoverningAddress field if non-nil, zero value otherwise. + +### GetGoverningAddressOk + +`func (o *ControlAddressesResponse) GetGoverningAddressOk() (*string, bool)` + +GetGoverningAddressOk returns a tuple with the GoverningAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGoverningAddress + +`func (o *ControlAddressesResponse) SetGoverningAddress(v string)` + +SetGoverningAddress sets GoverningAddress field to given value. + + +### GetSinceBlockIndex + +`func (o *ControlAddressesResponse) GetSinceBlockIndex() uint32` + +GetSinceBlockIndex returns the SinceBlockIndex field if non-nil, zero value otherwise. + +### GetSinceBlockIndexOk + +`func (o *ControlAddressesResponse) GetSinceBlockIndexOk() (*uint32, bool)` + +GetSinceBlockIndexOk returns a tuple with the SinceBlockIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSinceBlockIndex + +`func (o *ControlAddressesResponse) SetSinceBlockIndex(v uint32)` + +SetSinceBlockIndex sets SinceBlockIndex field to given value. + + +### GetStateAddress + +`func (o *ControlAddressesResponse) GetStateAddress() string` + +GetStateAddress returns the StateAddress field if non-nil, zero value otherwise. + +### GetStateAddressOk + +`func (o *ControlAddressesResponse) GetStateAddressOk() (*string, bool)` + +GetStateAddressOk returns a tuple with the StateAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStateAddress + +`func (o *ControlAddressesResponse) SetStateAddress(v string)` + +SetStateAddress sets StateAddress field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/CorecontractsApi.md b/clients/apiclient/docs/CorecontractsApi.md new file mode 100644 index 0000000000..6c24b28e67 --- /dev/null +++ b/clients/apiclient/docs/CorecontractsApi.md @@ -0,0 +1,2000 @@ +# \CorecontractsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AccountsGetAccountBalance**](CorecontractsApi.md#AccountsGetAccountBalance) | **Get** /chains/{chainID}/core/accounts/account/{agentID}/balance | Get all assets belonging to an account +[**AccountsGetAccountNFTIDs**](CorecontractsApi.md#AccountsGetAccountNFTIDs) | **Get** /chains/{chainID}/core/accounts/account/{agentID}/nfts | Get all NFT ids belonging to an account +[**AccountsGetAccountNonce**](CorecontractsApi.md#AccountsGetAccountNonce) | **Get** /chains/{chainID}/core/accounts/account/{agentID}/nonce | Get the current nonce of an account +[**AccountsGetAccounts**](CorecontractsApi.md#AccountsGetAccounts) | **Get** /chains/{chainID}/core/accounts | Get a list of all accounts +[**AccountsGetFoundryOutput**](CorecontractsApi.md#AccountsGetFoundryOutput) | **Get** /chains/{chainID}/core/accounts/foundry_output/{serialNumber} | Get the foundry output +[**AccountsGetNFTData**](CorecontractsApi.md#AccountsGetNFTData) | **Get** /chains/{chainID}/core/accounts/nftdata | Get the NFT data by an ID +[**AccountsGetNativeTokenIDRegistry**](CorecontractsApi.md#AccountsGetNativeTokenIDRegistry) | **Get** /chains/{chainID}/core/accounts/token_registry | Get a list of all registries +[**AccountsGetTotalAssets**](CorecontractsApi.md#AccountsGetTotalAssets) | **Get** /chains/{chainID}/core/accounts/total_assets | Get all stored assets +[**BlobsGetAllBlobs**](CorecontractsApi.md#BlobsGetAllBlobs) | **Get** /chains/{chainID}/core/blobs | Get all stored blobs +[**BlobsGetBlobInfo**](CorecontractsApi.md#BlobsGetBlobInfo) | **Get** /chains/{chainID}/core/blobs/{blobHash} | Get all fields of a blob +[**BlobsGetBlobValue**](CorecontractsApi.md#BlobsGetBlobValue) | **Get** /chains/{chainID}/core/blobs/{blobHash}/data/{fieldKey} | Get the value of the supplied field (key) +[**BlocklogGetBlockInfo**](CorecontractsApi.md#BlocklogGetBlockInfo) | **Get** /chains/{chainID}/core/blocklog/blocks/{blockIndex} | Get the block info of a certain block index +[**BlocklogGetControlAddresses**](CorecontractsApi.md#BlocklogGetControlAddresses) | **Get** /chains/{chainID}/core/blocklog/controladdresses | Get the control addresses +[**BlocklogGetEventsOfBlock**](CorecontractsApi.md#BlocklogGetEventsOfBlock) | **Get** /chains/{chainID}/core/blocklog/events/block/{blockIndex} | Get events of a block +[**BlocklogGetEventsOfContract**](CorecontractsApi.md#BlocklogGetEventsOfContract) | **Get** /chains/{chainID}/core/blocklog/events/contract/{contractHname} | Get events of a contract +[**BlocklogGetEventsOfLatestBlock**](CorecontractsApi.md#BlocklogGetEventsOfLatestBlock) | **Get** /chains/{chainID}/core/blocklog/events/block/latest | Get events of the latest block +[**BlocklogGetEventsOfRequest**](CorecontractsApi.md#BlocklogGetEventsOfRequest) | **Get** /chains/{chainID}/core/blocklog/events/request/{requestID} | Get events of a request +[**BlocklogGetLatestBlockInfo**](CorecontractsApi.md#BlocklogGetLatestBlockInfo) | **Get** /chains/{chainID}/core/blocklog/blocks/latest | Get the block info of the latest block +[**BlocklogGetRequestIDsForBlock**](CorecontractsApi.md#BlocklogGetRequestIDsForBlock) | **Get** /chains/{chainID}/core/blocklog/blocks/{blockIndex}/requestids | Get the request ids for a certain block index +[**BlocklogGetRequestIDsForLatestBlock**](CorecontractsApi.md#BlocklogGetRequestIDsForLatestBlock) | **Get** /chains/{chainID}/core/blocklog/blocks/latest/requestids | Get the request ids for the latest block +[**BlocklogGetRequestIsProcessed**](CorecontractsApi.md#BlocklogGetRequestIsProcessed) | **Get** /chains/{chainID}/core/blocklog/requests/{requestID}/is_processed | Get the request processing status +[**BlocklogGetRequestReceipt**](CorecontractsApi.md#BlocklogGetRequestReceipt) | **Get** /chains/{chainID}/core/blocklog/requests/{requestID} | Get the receipt of a certain request id +[**BlocklogGetRequestReceiptsOfBlock**](CorecontractsApi.md#BlocklogGetRequestReceiptsOfBlock) | **Get** /chains/{chainID}/core/blocklog/blocks/{blockIndex}/receipts | Get all receipts of a certain block +[**BlocklogGetRequestReceiptsOfLatestBlock**](CorecontractsApi.md#BlocklogGetRequestReceiptsOfLatestBlock) | **Get** /chains/{chainID}/core/blocklog/blocks/latest/receipts | Get all receipts of the latest block +[**ErrorsGetErrorMessageFormat**](CorecontractsApi.md#ErrorsGetErrorMessageFormat) | **Get** /chains/{chainID}/core/errors/{contractHname}/message/{errorID} | Get the error message format of a specific error id +[**GovernanceGetAllowedStateControllerAddresses**](CorecontractsApi.md#GovernanceGetAllowedStateControllerAddresses) | **Get** /chains/{chainID}/core/governance/allowedstatecontrollers | Get the allowed state controller addresses +[**GovernanceGetChainInfo**](CorecontractsApi.md#GovernanceGetChainInfo) | **Get** /chains/{chainID}/core/governance/chaininfo | Get the chain info +[**GovernanceGetChainOwner**](CorecontractsApi.md#GovernanceGetChainOwner) | **Get** /chains/{chainID}/core/governance/chainowner | Get the chain owner + + + +## AccountsGetAccountBalance + +> AssetsResponse AccountsGetAccountBalance(ctx, chainID, agentID).Execute() + +Get all assets belonging to an account + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + agentID := "agentID_example" // string | AgentID (Bech32 for WasmVM | Hex for EVM) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetAccountBalance(context.Background(), chainID, agentID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetAccountBalance``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetAccountBalance`: AssetsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetAccountBalance`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**agentID** | **string** | AgentID (Bech32 for WasmVM | Hex for EVM) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetAccountBalanceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**AssetsResponse**](AssetsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetAccountNFTIDs + +> AccountNFTsResponse AccountsGetAccountNFTIDs(ctx, chainID, agentID).Execute() + +Get all NFT ids belonging to an account + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + agentID := "agentID_example" // string | AgentID (Bech32 for WasmVM | Hex for EVM) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetAccountNFTIDs(context.Background(), chainID, agentID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetAccountNFTIDs``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetAccountNFTIDs`: AccountNFTsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetAccountNFTIDs`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**agentID** | **string** | AgentID (Bech32 for WasmVM | Hex for EVM) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetAccountNFTIDsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**AccountNFTsResponse**](AccountNFTsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetAccountNonce + +> AccountNonceResponse AccountsGetAccountNonce(ctx, chainID, agentID).Execute() + +Get the current nonce of an account + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + agentID := "agentID_example" // string | AgentID (Bech32 for WasmVM | Hex for EVM | '000000@Bech32' Addresses require urlencode) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetAccountNonce(context.Background(), chainID, agentID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetAccountNonce``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetAccountNonce`: AccountNonceResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetAccountNonce`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**agentID** | **string** | AgentID (Bech32 for WasmVM | Hex for EVM | '000000@Bech32' Addresses require urlencode) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetAccountNonceRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**AccountNonceResponse**](AccountNonceResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetAccounts + +> AccountListResponse AccountsGetAccounts(ctx, chainID).Execute() + +Get a list of all accounts + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetAccounts(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetAccounts``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetAccounts`: AccountListResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetAccounts`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetAccountsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**AccountListResponse**](AccountListResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetFoundryOutput + +> FoundryOutputResponse AccountsGetFoundryOutput(ctx, chainID, serialNumber).Execute() + +Get the foundry output + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + serialNumber := uint32(56) // uint32 | Serial Number (uint32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetFoundryOutput(context.Background(), chainID, serialNumber).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetFoundryOutput``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetFoundryOutput`: FoundryOutputResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetFoundryOutput`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**serialNumber** | **uint32** | Serial Number (uint32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetFoundryOutputRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**FoundryOutputResponse**](FoundryOutputResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetNFTData + +> NFTDataResponse AccountsGetNFTData(ctx, chainID, nftID).Execute() + +Get the NFT data by an ID + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + nftID := "nftID_example" // string | NFT ID (Hex) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetNFTData(context.Background(), chainID, nftID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetNFTData``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetNFTData`: NFTDataResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetNFTData`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**nftID** | **string** | NFT ID (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetNFTDataRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**NFTDataResponse**](NFTDataResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetNativeTokenIDRegistry + +> NativeTokenIDRegistryResponse AccountsGetNativeTokenIDRegistry(ctx, chainID).Execute() + +Get a list of all registries + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetNativeTokenIDRegistry(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetNativeTokenIDRegistry``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetNativeTokenIDRegistry`: NativeTokenIDRegistryResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetNativeTokenIDRegistry`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetNativeTokenIDRegistryRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**NativeTokenIDRegistryResponse**](NativeTokenIDRegistryResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## AccountsGetTotalAssets + +> AssetsResponse AccountsGetTotalAssets(ctx, chainID).Execute() + +Get all stored assets + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.AccountsGetTotalAssets(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.AccountsGetTotalAssets``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `AccountsGetTotalAssets`: AssetsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.AccountsGetTotalAssets`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiAccountsGetTotalAssetsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**AssetsResponse**](AssetsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlobsGetAllBlobs + +> BlobListResponse BlobsGetAllBlobs(ctx, chainID).Execute() + +Get all stored blobs + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlobsGetAllBlobs(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlobsGetAllBlobs``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlobsGetAllBlobs`: BlobListResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlobsGetAllBlobs`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlobsGetAllBlobsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**BlobListResponse**](BlobListResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlobsGetBlobInfo + +> BlobInfoResponse BlobsGetBlobInfo(ctx, chainID, blobHash).Execute() + +Get all fields of a blob + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blobHash := "blobHash_example" // string | BlobHash (Hex) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlobsGetBlobInfo(context.Background(), chainID, blobHash).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlobsGetBlobInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlobsGetBlobInfo`: BlobInfoResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlobsGetBlobInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blobHash** | **string** | BlobHash (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlobsGetBlobInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**BlobInfoResponse**](BlobInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlobsGetBlobValue + +> BlobValueResponse BlobsGetBlobValue(ctx, chainID, blobHash, fieldKey).Execute() + +Get the value of the supplied field (key) + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blobHash := "blobHash_example" // string | BlobHash (Hex) + fieldKey := "fieldKey_example" // string | FieldKey (String) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlobsGetBlobValue(context.Background(), chainID, blobHash, fieldKey).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlobsGetBlobValue``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlobsGetBlobValue`: BlobValueResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlobsGetBlobValue`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blobHash** | **string** | BlobHash (Hex) | +**fieldKey** | **string** | FieldKey (String) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlobsGetBlobValueRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + +### Return type + +[**BlobValueResponse**](BlobValueResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetBlockInfo + +> BlockInfoResponse BlocklogGetBlockInfo(ctx, chainID, blockIndex).Execute() + +Get the block info of a certain block index + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blockIndex := uint32(56) // uint32 | BlockIndex (uint32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetBlockInfo(context.Background(), chainID, blockIndex).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetBlockInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetBlockInfo`: BlockInfoResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetBlockInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blockIndex** | **uint32** | BlockIndex (uint32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetBlockInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**BlockInfoResponse**](BlockInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetControlAddresses + +> ControlAddressesResponse BlocklogGetControlAddresses(ctx, chainID).Execute() + +Get the control addresses + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetControlAddresses(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetControlAddresses``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetControlAddresses`: ControlAddressesResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetControlAddresses`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetControlAddressesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ControlAddressesResponse**](ControlAddressesResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetEventsOfBlock + +> EventsResponse BlocklogGetEventsOfBlock(ctx, chainID, blockIndex).Execute() + +Get events of a block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blockIndex := uint32(56) // uint32 | BlockIndex (uint32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetEventsOfBlock(context.Background(), chainID, blockIndex).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetEventsOfBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetEventsOfBlock`: EventsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetEventsOfBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blockIndex** | **uint32** | BlockIndex (uint32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetEventsOfBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**EventsResponse**](EventsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetEventsOfContract + +> EventsResponse BlocklogGetEventsOfContract(ctx, chainID, contractHname).Execute() + +Get events of a contract + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + contractHname := "contractHname_example" // string | Contract (Hname) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetEventsOfContract(context.Background(), chainID, contractHname).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetEventsOfContract``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetEventsOfContract`: EventsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetEventsOfContract`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**contractHname** | **string** | Contract (Hname) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetEventsOfContractRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**EventsResponse**](EventsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetEventsOfLatestBlock + +> EventsResponse BlocklogGetEventsOfLatestBlock(ctx, chainID).Execute() + +Get events of the latest block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetEventsOfLatestBlock(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetEventsOfLatestBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetEventsOfLatestBlock`: EventsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetEventsOfLatestBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetEventsOfLatestBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**EventsResponse**](EventsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetEventsOfRequest + +> EventsResponse BlocklogGetEventsOfRequest(ctx, chainID, requestID).Execute() + +Get events of a request + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + requestID := "requestID_example" // string | Request ID (ISCRequestID) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetEventsOfRequest(context.Background(), chainID, requestID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetEventsOfRequest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetEventsOfRequest`: EventsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetEventsOfRequest`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**requestID** | **string** | Request ID (ISCRequestID) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetEventsOfRequestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**EventsResponse**](EventsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetLatestBlockInfo + +> BlockInfoResponse BlocklogGetLatestBlockInfo(ctx, chainID).Execute() + +Get the block info of the latest block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetLatestBlockInfo(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetLatestBlockInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetLatestBlockInfo`: BlockInfoResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetLatestBlockInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetLatestBlockInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**BlockInfoResponse**](BlockInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestIDsForBlock + +> RequestIDsResponse BlocklogGetRequestIDsForBlock(ctx, chainID, blockIndex).Execute() + +Get the request ids for a certain block index + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blockIndex := uint32(56) // uint32 | BlockIndex (uint32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestIDsForBlock(context.Background(), chainID, blockIndex).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestIDsForBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestIDsForBlock`: RequestIDsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestIDsForBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blockIndex** | **uint32** | BlockIndex (uint32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestIDsForBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**RequestIDsResponse**](RequestIDsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestIDsForLatestBlock + +> RequestIDsResponse BlocklogGetRequestIDsForLatestBlock(ctx, chainID).Execute() + +Get the request ids for the latest block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestIDsForLatestBlock(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestIDsForLatestBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestIDsForLatestBlock`: RequestIDsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestIDsForLatestBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestIDsForLatestBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**RequestIDsResponse**](RequestIDsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestIsProcessed + +> RequestProcessedResponse BlocklogGetRequestIsProcessed(ctx, chainID, requestID).Execute() + +Get the request processing status + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + requestID := "requestID_example" // string | Request ID (ISCRequestID) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestIsProcessed(context.Background(), chainID, requestID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestIsProcessed``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestIsProcessed`: RequestProcessedResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestIsProcessed`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**requestID** | **string** | Request ID (ISCRequestID) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestIsProcessedRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**RequestProcessedResponse**](RequestProcessedResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestReceipt + +> RequestReceiptResponse BlocklogGetRequestReceipt(ctx, chainID, requestID).Execute() + +Get the receipt of a certain request id + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + requestID := "requestID_example" // string | Request ID (ISCRequestID) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestReceipt(context.Background(), chainID, requestID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestReceipt``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestReceipt`: RequestReceiptResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestReceipt`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**requestID** | **string** | Request ID (ISCRequestID) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestReceiptRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**RequestReceiptResponse**](RequestReceiptResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestReceiptsOfBlock + +> BlockReceiptsResponse BlocklogGetRequestReceiptsOfBlock(ctx, chainID, blockIndex).Execute() + +Get all receipts of a certain block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + blockIndex := uint32(56) // uint32 | BlockIndex (uint32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestReceiptsOfBlock(context.Background(), chainID, blockIndex).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestReceiptsOfBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestReceiptsOfBlock`: BlockReceiptsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestReceiptsOfBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**blockIndex** | **uint32** | BlockIndex (uint32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestReceiptsOfBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**BlockReceiptsResponse**](BlockReceiptsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## BlocklogGetRequestReceiptsOfLatestBlock + +> BlockReceiptsResponse BlocklogGetRequestReceiptsOfLatestBlock(ctx, chainID).Execute() + +Get all receipts of the latest block + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.BlocklogGetRequestReceiptsOfLatestBlock(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.BlocklogGetRequestReceiptsOfLatestBlock``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `BlocklogGetRequestReceiptsOfLatestBlock`: BlockReceiptsResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.BlocklogGetRequestReceiptsOfLatestBlock`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiBlocklogGetRequestReceiptsOfLatestBlockRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**BlockReceiptsResponse**](BlockReceiptsResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ErrorsGetErrorMessageFormat + +> ErrorMessageFormatResponse ErrorsGetErrorMessageFormat(ctx, chainID, contractHname, errorID).Execute() + +Get the error message format of a specific error id + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + contractHname := "contractHname_example" // string | Contract (Hname as Hex) + errorID := uint32(56) // uint32 | Error Id (uint16) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.ErrorsGetErrorMessageFormat(context.Background(), chainID, contractHname, errorID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.ErrorsGetErrorMessageFormat``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ErrorsGetErrorMessageFormat`: ErrorMessageFormatResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.ErrorsGetErrorMessageFormat`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**contractHname** | **string** | Contract (Hname as Hex) | +**errorID** | **uint32** | Error Id (uint16) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiErrorsGetErrorMessageFormatRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + + +### Return type + +[**ErrorMessageFormatResponse**](ErrorMessageFormatResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GovernanceGetAllowedStateControllerAddresses + +> GovAllowedStateControllerAddressesResponse GovernanceGetAllowedStateControllerAddresses(ctx, chainID).Execute() + +Get the allowed state controller addresses + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.GovernanceGetAllowedStateControllerAddresses(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.GovernanceGetAllowedStateControllerAddresses``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GovernanceGetAllowedStateControllerAddresses`: GovAllowedStateControllerAddressesResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.GovernanceGetAllowedStateControllerAddresses`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGovernanceGetAllowedStateControllerAddressesRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**GovAllowedStateControllerAddressesResponse**](GovAllowedStateControllerAddressesResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GovernanceGetChainInfo + +> GovChainInfoResponse GovernanceGetChainInfo(ctx, chainID).Execute() + +Get the chain info + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.GovernanceGetChainInfo(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.GovernanceGetChainInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GovernanceGetChainInfo`: GovChainInfoResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.GovernanceGetChainInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGovernanceGetChainInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**GovChainInfoResponse**](GovChainInfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GovernanceGetChainOwner + +> GovChainOwnerResponse GovernanceGetChainOwner(ctx, chainID).Execute() + +Get the chain owner + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.CorecontractsApi.GovernanceGetChainOwner(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `CorecontractsApi.GovernanceGetChainOwner``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GovernanceGetChainOwner`: GovChainOwnerResponse + fmt.Fprintf(os.Stdout, "Response from `CorecontractsApi.GovernanceGetChainOwner`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGovernanceGetChainOwnerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**GovChainOwnerResponse**](GovChainOwnerResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/DKSharesInfo.md b/clients/apiclient/docs/DKSharesInfo.md new file mode 100644 index 0000000000..23906df7c0 --- /dev/null +++ b/clients/apiclient/docs/DKSharesInfo.md @@ -0,0 +1,156 @@ +# DKSharesInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Address** | **string** | New generated shared address. | +**PeerIdentities** | **[]string** | Identities of the nodes sharing the key. (Hex) | +**PeerIndex** | **uint32** | | +**PublicKey** | **string** | Used public key. (Hex) | +**PublicKeyShares** | **[]string** | Public key shares for all the peers. (Hex) | +**Threshold** | **uint32** | | + +## Methods + +### NewDKSharesInfo + +`func NewDKSharesInfo(address string, peerIdentities []string, peerIndex uint32, publicKey string, publicKeyShares []string, threshold uint32, ) *DKSharesInfo` + +NewDKSharesInfo instantiates a new DKSharesInfo object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDKSharesInfoWithDefaults + +`func NewDKSharesInfoWithDefaults() *DKSharesInfo` + +NewDKSharesInfoWithDefaults instantiates a new DKSharesInfo object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAddress + +`func (o *DKSharesInfo) GetAddress() string` + +GetAddress returns the Address field if non-nil, zero value otherwise. + +### GetAddressOk + +`func (o *DKSharesInfo) GetAddressOk() (*string, bool)` + +GetAddressOk returns a tuple with the Address field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAddress + +`func (o *DKSharesInfo) SetAddress(v string)` + +SetAddress sets Address field to given value. + + +### GetPeerIdentities + +`func (o *DKSharesInfo) GetPeerIdentities() []string` + +GetPeerIdentities returns the PeerIdentities field if non-nil, zero value otherwise. + +### GetPeerIdentitiesOk + +`func (o *DKSharesInfo) GetPeerIdentitiesOk() (*[]string, bool)` + +GetPeerIdentitiesOk returns a tuple with the PeerIdentities field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPeerIdentities + +`func (o *DKSharesInfo) SetPeerIdentities(v []string)` + +SetPeerIdentities sets PeerIdentities field to given value. + + +### GetPeerIndex + +`func (o *DKSharesInfo) GetPeerIndex() uint32` + +GetPeerIndex returns the PeerIndex field if non-nil, zero value otherwise. + +### GetPeerIndexOk + +`func (o *DKSharesInfo) GetPeerIndexOk() (*uint32, bool)` + +GetPeerIndexOk returns a tuple with the PeerIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPeerIndex + +`func (o *DKSharesInfo) SetPeerIndex(v uint32)` + +SetPeerIndex sets PeerIndex field to given value. + + +### GetPublicKey + +`func (o *DKSharesInfo) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *DKSharesInfo) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *DKSharesInfo) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + +### GetPublicKeyShares + +`func (o *DKSharesInfo) GetPublicKeyShares() []string` + +GetPublicKeyShares returns the PublicKeyShares field if non-nil, zero value otherwise. + +### GetPublicKeySharesOk + +`func (o *DKSharesInfo) GetPublicKeySharesOk() (*[]string, bool)` + +GetPublicKeySharesOk returns a tuple with the PublicKeyShares field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKeyShares + +`func (o *DKSharesInfo) SetPublicKeyShares(v []string)` + +SetPublicKeyShares sets PublicKeyShares field to given value. + + +### GetThreshold + +`func (o *DKSharesInfo) GetThreshold() uint32` + +GetThreshold returns the Threshold field if non-nil, zero value otherwise. + +### GetThresholdOk + +`func (o *DKSharesInfo) GetThresholdOk() (*uint32, bool)` + +GetThresholdOk returns a tuple with the Threshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetThreshold + +`func (o *DKSharesInfo) SetThreshold(v uint32)` + +SetThreshold sets Threshold field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/DKSharesPostRequest.md b/clients/apiclient/docs/DKSharesPostRequest.md new file mode 100644 index 0000000000..625f9c4b62 --- /dev/null +++ b/clients/apiclient/docs/DKSharesPostRequest.md @@ -0,0 +1,93 @@ +# DKSharesPostRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PeerIdentities** | **[]string** | | +**Threshold** | **uint32** | Should be =< len(PeerPublicIdentities) | +**TimeoutMS** | **uint32** | Timeout in milliseconds. | + +## Methods + +### NewDKSharesPostRequest + +`func NewDKSharesPostRequest(peerIdentities []string, threshold uint32, timeoutMS uint32, ) *DKSharesPostRequest` + +NewDKSharesPostRequest instantiates a new DKSharesPostRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewDKSharesPostRequestWithDefaults + +`func NewDKSharesPostRequestWithDefaults() *DKSharesPostRequest` + +NewDKSharesPostRequestWithDefaults instantiates a new DKSharesPostRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPeerIdentities + +`func (o *DKSharesPostRequest) GetPeerIdentities() []string` + +GetPeerIdentities returns the PeerIdentities field if non-nil, zero value otherwise. + +### GetPeerIdentitiesOk + +`func (o *DKSharesPostRequest) GetPeerIdentitiesOk() (*[]string, bool)` + +GetPeerIdentitiesOk returns a tuple with the PeerIdentities field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPeerIdentities + +`func (o *DKSharesPostRequest) SetPeerIdentities(v []string)` + +SetPeerIdentities sets PeerIdentities field to given value. + + +### GetThreshold + +`func (o *DKSharesPostRequest) GetThreshold() uint32` + +GetThreshold returns the Threshold field if non-nil, zero value otherwise. + +### GetThresholdOk + +`func (o *DKSharesPostRequest) GetThresholdOk() (*uint32, bool)` + +GetThresholdOk returns a tuple with the Threshold field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetThreshold + +`func (o *DKSharesPostRequest) SetThreshold(v uint32)` + +SetThreshold sets Threshold field to given value. + + +### GetTimeoutMS + +`func (o *DKSharesPostRequest) GetTimeoutMS() uint32` + +GetTimeoutMS returns the TimeoutMS field if non-nil, zero value otherwise. + +### GetTimeoutMSOk + +`func (o *DKSharesPostRequest) GetTimeoutMSOk() (*uint32, bool)` + +GetTimeoutMSOk returns a tuple with the TimeoutMS field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimeoutMS + +`func (o *DKSharesPostRequest) SetTimeoutMS(v uint32)` + +SetTimeoutMS sets TimeoutMS field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ErrorMessageFormatResponse.md b/clients/apiclient/docs/ErrorMessageFormatResponse.md new file mode 100644 index 0000000000..b7a41a1121 --- /dev/null +++ b/clients/apiclient/docs/ErrorMessageFormatResponse.md @@ -0,0 +1,51 @@ +# ErrorMessageFormatResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MessageFormat** | **string** | | + +## Methods + +### NewErrorMessageFormatResponse + +`func NewErrorMessageFormatResponse(messageFormat string, ) *ErrorMessageFormatResponse` + +NewErrorMessageFormatResponse instantiates a new ErrorMessageFormatResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewErrorMessageFormatResponseWithDefaults + +`func NewErrorMessageFormatResponseWithDefaults() *ErrorMessageFormatResponse` + +NewErrorMessageFormatResponseWithDefaults instantiates a new ErrorMessageFormatResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetMessageFormat + +`func (o *ErrorMessageFormatResponse) GetMessageFormat() string` + +GetMessageFormat returns the MessageFormat field if non-nil, zero value otherwise. + +### GetMessageFormatOk + +`func (o *ErrorMessageFormatResponse) GetMessageFormatOk() (*string, bool)` + +GetMessageFormatOk returns a tuple with the MessageFormat field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessageFormat + +`func (o *ErrorMessageFormatResponse) SetMessageFormat(v string)` + +SetMessageFormat sets MessageFormat field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/EventsResponse.md b/clients/apiclient/docs/EventsResponse.md new file mode 100644 index 0000000000..5b47062940 --- /dev/null +++ b/clients/apiclient/docs/EventsResponse.md @@ -0,0 +1,51 @@ +# EventsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Events** | **[]string** | | + +## Methods + +### NewEventsResponse + +`func NewEventsResponse(events []string, ) *EventsResponse` + +NewEventsResponse instantiates a new EventsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewEventsResponseWithDefaults + +`func NewEventsResponseWithDefaults() *EventsResponse` + +NewEventsResponseWithDefaults instantiates a new EventsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetEvents + +`func (o *EventsResponse) GetEvents() []string` + +GetEvents returns the Events field if non-nil, zero value otherwise. + +### GetEventsOk + +`func (o *EventsResponse) GetEventsOk() (*[]string, bool)` + +GetEventsOk returns a tuple with the Events field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetEvents + +`func (o *EventsResponse) SetEvents(v []string)` + +SetEvents sets Events field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/FoundryOutputResponse.md b/clients/apiclient/docs/FoundryOutputResponse.md new file mode 100644 index 0000000000..70df0bdade --- /dev/null +++ b/clients/apiclient/docs/FoundryOutputResponse.md @@ -0,0 +1,72 @@ +# FoundryOutputResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Assets** | [**AssetsResponse**](AssetsResponse.md) | | +**FoundryId** | **string** | | + +## Methods + +### NewFoundryOutputResponse + +`func NewFoundryOutputResponse(assets AssetsResponse, foundryId string, ) *FoundryOutputResponse` + +NewFoundryOutputResponse instantiates a new FoundryOutputResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewFoundryOutputResponseWithDefaults + +`func NewFoundryOutputResponseWithDefaults() *FoundryOutputResponse` + +NewFoundryOutputResponseWithDefaults instantiates a new FoundryOutputResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAssets + +`func (o *FoundryOutputResponse) GetAssets() AssetsResponse` + +GetAssets returns the Assets field if non-nil, zero value otherwise. + +### GetAssetsOk + +`func (o *FoundryOutputResponse) GetAssetsOk() (*AssetsResponse, bool)` + +GetAssetsOk returns a tuple with the Assets field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAssets + +`func (o *FoundryOutputResponse) SetAssets(v AssetsResponse)` + +SetAssets sets Assets field to given value. + + +### GetFoundryId + +`func (o *FoundryOutputResponse) GetFoundryId() string` + +GetFoundryId returns the FoundryId field if non-nil, zero value otherwise. + +### GetFoundryIdOk + +`func (o *FoundryOutputResponse) GetFoundryIdOk() (*string, bool)` + +GetFoundryIdOk returns a tuple with the FoundryId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFoundryId + +`func (o *FoundryOutputResponse) SetFoundryId(v string)` + +SetFoundryId sets FoundryId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/GasFeePolicy.md b/clients/apiclient/docs/GasFeePolicy.md new file mode 100644 index 0000000000..b9a62e55df --- /dev/null +++ b/clients/apiclient/docs/GasFeePolicy.md @@ -0,0 +1,93 @@ +# GasFeePolicy + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**GasFeeTokenId** | **string** | The gas fee token id. Empty if base token. | +**GasPerToken** | **string** | The amount of gas per token. (uint64 as string) | +**ValidatorFeeShare** | **int32** | The validator fee share. | + +## Methods + +### NewGasFeePolicy + +`func NewGasFeePolicy(gasFeeTokenId string, gasPerToken string, validatorFeeShare int32, ) *GasFeePolicy` + +NewGasFeePolicy instantiates a new GasFeePolicy object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGasFeePolicyWithDefaults + +`func NewGasFeePolicyWithDefaults() *GasFeePolicy` + +NewGasFeePolicyWithDefaults instantiates a new GasFeePolicy object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetGasFeeTokenId + +`func (o *GasFeePolicy) GetGasFeeTokenId() string` + +GetGasFeeTokenId returns the GasFeeTokenId field if non-nil, zero value otherwise. + +### GetGasFeeTokenIdOk + +`func (o *GasFeePolicy) GetGasFeeTokenIdOk() (*string, bool)` + +GetGasFeeTokenIdOk returns a tuple with the GasFeeTokenId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeeTokenId + +`func (o *GasFeePolicy) SetGasFeeTokenId(v string)` + +SetGasFeeTokenId sets GasFeeTokenId field to given value. + + +### GetGasPerToken + +`func (o *GasFeePolicy) GetGasPerToken() string` + +GetGasPerToken returns the GasPerToken field if non-nil, zero value otherwise. + +### GetGasPerTokenOk + +`func (o *GasFeePolicy) GetGasPerTokenOk() (*string, bool)` + +GetGasPerTokenOk returns a tuple with the GasPerToken field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasPerToken + +`func (o *GasFeePolicy) SetGasPerToken(v string)` + +SetGasPerToken sets GasPerToken field to given value. + + +### GetValidatorFeeShare + +`func (o *GasFeePolicy) GetValidatorFeeShare() int32` + +GetValidatorFeeShare returns the ValidatorFeeShare field if non-nil, zero value otherwise. + +### GetValidatorFeeShareOk + +`func (o *GasFeePolicy) GetValidatorFeeShareOk() (*int32, bool)` + +GetValidatorFeeShareOk returns a tuple with the ValidatorFeeShare field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValidatorFeeShare + +`func (o *GasFeePolicy) SetValidatorFeeShare(v int32)` + +SetValidatorFeeShare sets ValidatorFeeShare field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/GovAllowedStateControllerAddressesResponse.md b/clients/apiclient/docs/GovAllowedStateControllerAddressesResponse.md new file mode 100644 index 0000000000..0e2e0d9699 --- /dev/null +++ b/clients/apiclient/docs/GovAllowedStateControllerAddressesResponse.md @@ -0,0 +1,56 @@ +# GovAllowedStateControllerAddressesResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Addresses** | Pointer to **[]string** | The allowed state controller addresses (Bech32-encoded) | [optional] + +## Methods + +### NewGovAllowedStateControllerAddressesResponse + +`func NewGovAllowedStateControllerAddressesResponse() *GovAllowedStateControllerAddressesResponse` + +NewGovAllowedStateControllerAddressesResponse instantiates a new GovAllowedStateControllerAddressesResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGovAllowedStateControllerAddressesResponseWithDefaults + +`func NewGovAllowedStateControllerAddressesResponseWithDefaults() *GovAllowedStateControllerAddressesResponse` + +NewGovAllowedStateControllerAddressesResponseWithDefaults instantiates a new GovAllowedStateControllerAddressesResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAddresses + +`func (o *GovAllowedStateControllerAddressesResponse) GetAddresses() []string` + +GetAddresses returns the Addresses field if non-nil, zero value otherwise. + +### GetAddressesOk + +`func (o *GovAllowedStateControllerAddressesResponse) GetAddressesOk() (*[]string, bool)` + +GetAddressesOk returns a tuple with the Addresses field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAddresses + +`func (o *GovAllowedStateControllerAddressesResponse) SetAddresses(v []string)` + +SetAddresses sets Addresses field to given value. + +### HasAddresses + +`func (o *GovAllowedStateControllerAddressesResponse) HasAddresses() bool` + +HasAddresses returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/GovChainInfoResponse.md b/clients/apiclient/docs/GovChainInfoResponse.md new file mode 100644 index 0000000000..6da5bf797e --- /dev/null +++ b/clients/apiclient/docs/GovChainInfoResponse.md @@ -0,0 +1,177 @@ +# GovChainInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainID** | **string** | ChainID (Bech32-encoded). | +**ChainOwnerId** | **string** | The chain owner address (Bech32-encoded). | +**Description** | **string** | The description of the chain. | +**GasFeePolicy** | [**GasFeePolicy**](GasFeePolicy.md) | | +**MaxBlobSize** | **int32** | The maximum contract blob size. | +**MaxEventSize** | **int32** | The maximum event size. | +**MaxEventsPerReq** | **int32** | The maximum amount of events per request. | + +## Methods + +### NewGovChainInfoResponse + +`func NewGovChainInfoResponse(chainID string, chainOwnerId string, description string, gasFeePolicy GasFeePolicy, maxBlobSize int32, maxEventSize int32, maxEventsPerReq int32, ) *GovChainInfoResponse` + +NewGovChainInfoResponse instantiates a new GovChainInfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGovChainInfoResponseWithDefaults + +`func NewGovChainInfoResponseWithDefaults() *GovChainInfoResponse` + +NewGovChainInfoResponseWithDefaults instantiates a new GovChainInfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetChainID + +`func (o *GovChainInfoResponse) GetChainID() string` + +GetChainID returns the ChainID field if non-nil, zero value otherwise. + +### GetChainIDOk + +`func (o *GovChainInfoResponse) GetChainIDOk() (*string, bool)` + +GetChainIDOk returns a tuple with the ChainID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainID + +`func (o *GovChainInfoResponse) SetChainID(v string)` + +SetChainID sets ChainID field to given value. + + +### GetChainOwnerId + +`func (o *GovChainInfoResponse) GetChainOwnerId() string` + +GetChainOwnerId returns the ChainOwnerId field if non-nil, zero value otherwise. + +### GetChainOwnerIdOk + +`func (o *GovChainInfoResponse) GetChainOwnerIdOk() (*string, bool)` + +GetChainOwnerIdOk returns a tuple with the ChainOwnerId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainOwnerId + +`func (o *GovChainInfoResponse) SetChainOwnerId(v string)` + +SetChainOwnerId sets ChainOwnerId field to given value. + + +### GetDescription + +`func (o *GovChainInfoResponse) GetDescription() string` + +GetDescription returns the Description field if non-nil, zero value otherwise. + +### GetDescriptionOk + +`func (o *GovChainInfoResponse) GetDescriptionOk() (*string, bool)` + +GetDescriptionOk returns a tuple with the Description field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetDescription + +`func (o *GovChainInfoResponse) SetDescription(v string)` + +SetDescription sets Description field to given value. + + +### GetGasFeePolicy + +`func (o *GovChainInfoResponse) GetGasFeePolicy() GasFeePolicy` + +GetGasFeePolicy returns the GasFeePolicy field if non-nil, zero value otherwise. + +### GetGasFeePolicyOk + +`func (o *GovChainInfoResponse) GetGasFeePolicyOk() (*GasFeePolicy, bool)` + +GetGasFeePolicyOk returns a tuple with the GasFeePolicy field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeePolicy + +`func (o *GovChainInfoResponse) SetGasFeePolicy(v GasFeePolicy)` + +SetGasFeePolicy sets GasFeePolicy field to given value. + + +### GetMaxBlobSize + +`func (o *GovChainInfoResponse) GetMaxBlobSize() int32` + +GetMaxBlobSize returns the MaxBlobSize field if non-nil, zero value otherwise. + +### GetMaxBlobSizeOk + +`func (o *GovChainInfoResponse) GetMaxBlobSizeOk() (*int32, bool)` + +GetMaxBlobSizeOk returns a tuple with the MaxBlobSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxBlobSize + +`func (o *GovChainInfoResponse) SetMaxBlobSize(v int32)` + +SetMaxBlobSize sets MaxBlobSize field to given value. + + +### GetMaxEventSize + +`func (o *GovChainInfoResponse) GetMaxEventSize() int32` + +GetMaxEventSize returns the MaxEventSize field if non-nil, zero value otherwise. + +### GetMaxEventSizeOk + +`func (o *GovChainInfoResponse) GetMaxEventSizeOk() (*int32, bool)` + +GetMaxEventSizeOk returns a tuple with the MaxEventSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxEventSize + +`func (o *GovChainInfoResponse) SetMaxEventSize(v int32)` + +SetMaxEventSize sets MaxEventSize field to given value. + + +### GetMaxEventsPerReq + +`func (o *GovChainInfoResponse) GetMaxEventsPerReq() int32` + +GetMaxEventsPerReq returns the MaxEventsPerReq field if non-nil, zero value otherwise. + +### GetMaxEventsPerReqOk + +`func (o *GovChainInfoResponse) GetMaxEventsPerReqOk() (*int32, bool)` + +GetMaxEventsPerReqOk returns a tuple with the MaxEventsPerReq field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxEventsPerReq + +`func (o *GovChainInfoResponse) SetMaxEventsPerReq(v int32)` + +SetMaxEventsPerReq sets MaxEventsPerReq field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/GovChainOwnerResponse.md b/clients/apiclient/docs/GovChainOwnerResponse.md new file mode 100644 index 0000000000..deae81b68b --- /dev/null +++ b/clients/apiclient/docs/GovChainOwnerResponse.md @@ -0,0 +1,56 @@ +# GovChainOwnerResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainOwner** | Pointer to **string** | The chain owner (Bech32-encoded) | [optional] + +## Methods + +### NewGovChainOwnerResponse + +`func NewGovChainOwnerResponse() *GovChainOwnerResponse` + +NewGovChainOwnerResponse instantiates a new GovChainOwnerResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewGovChainOwnerResponseWithDefaults + +`func NewGovChainOwnerResponseWithDefaults() *GovChainOwnerResponse` + +NewGovChainOwnerResponseWithDefaults instantiates a new GovChainOwnerResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetChainOwner + +`func (o *GovChainOwnerResponse) GetChainOwner() string` + +GetChainOwner returns the ChainOwner field if non-nil, zero value otherwise. + +### GetChainOwnerOk + +`func (o *GovChainOwnerResponse) GetChainOwnerOk() (*string, bool)` + +GetChainOwnerOk returns a tuple with the ChainOwner field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainOwner + +`func (o *GovChainOwnerResponse) SetChainOwner(v string)` + +SetChainOwner sets ChainOwner field to given value. + +### HasChainOwner + +`func (o *GovChainOwnerResponse) HasChainOwner() bool` + +HasChainOwner returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InOutput.md b/clients/apiclient/docs/InOutput.md new file mode 100644 index 0000000000..9862d21537 --- /dev/null +++ b/clients/apiclient/docs/InOutput.md @@ -0,0 +1,72 @@ +# InOutput + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Output** | [**Output**](Output.md) | | +**OutputId** | **string** | The output ID | + +## Methods + +### NewInOutput + +`func NewInOutput(output Output, outputId string, ) *InOutput` + +NewInOutput instantiates a new InOutput object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInOutputWithDefaults + +`func NewInOutputWithDefaults() *InOutput` + +NewInOutputWithDefaults instantiates a new InOutput object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOutput + +`func (o *InOutput) GetOutput() Output` + +GetOutput returns the Output field if non-nil, zero value otherwise. + +### GetOutputOk + +`func (o *InOutput) GetOutputOk() (*Output, bool)` + +GetOutputOk returns a tuple with the Output field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutput + +`func (o *InOutput) SetOutput(v Output)` + +SetOutput sets Output field to given value. + + +### GetOutputId + +`func (o *InOutput) GetOutputId() string` + +GetOutputId returns the OutputId field if non-nil, zero value otherwise. + +### GetOutputIdOk + +`func (o *InOutput) GetOutputIdOk() (*string, bool)` + +GetOutputIdOk returns a tuple with the OutputId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutputId + +`func (o *InOutput) SetOutputId(v string)` + +SetOutputId sets OutputId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InOutputMetricItem.md b/clients/apiclient/docs/InOutputMetricItem.md new file mode 100644 index 0000000000..6ddf39686d --- /dev/null +++ b/clients/apiclient/docs/InOutputMetricItem.md @@ -0,0 +1,93 @@ +# InOutputMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**InOutput**](InOutput.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewInOutputMetricItem + +`func NewInOutputMetricItem(lastMessage InOutput, messages uint32, timestamp time.Time, ) *InOutputMetricItem` + +NewInOutputMetricItem instantiates a new InOutputMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInOutputMetricItemWithDefaults + +`func NewInOutputMetricItemWithDefaults() *InOutputMetricItem` + +NewInOutputMetricItemWithDefaults instantiates a new InOutputMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *InOutputMetricItem) GetLastMessage() InOutput` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *InOutputMetricItem) GetLastMessageOk() (*InOutput, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *InOutputMetricItem) SetLastMessage(v InOutput)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *InOutputMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *InOutputMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *InOutputMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *InOutputMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *InOutputMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *InOutputMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InStateOutput.md b/clients/apiclient/docs/InStateOutput.md new file mode 100644 index 0000000000..b69fc47d3c --- /dev/null +++ b/clients/apiclient/docs/InStateOutput.md @@ -0,0 +1,72 @@ +# InStateOutput + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Output** | [**Output**](Output.md) | | +**OutputId** | **string** | The output ID | + +## Methods + +### NewInStateOutput + +`func NewInStateOutput(output Output, outputId string, ) *InStateOutput` + +NewInStateOutput instantiates a new InStateOutput object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInStateOutputWithDefaults + +`func NewInStateOutputWithDefaults() *InStateOutput` + +NewInStateOutputWithDefaults instantiates a new InStateOutput object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOutput + +`func (o *InStateOutput) GetOutput() Output` + +GetOutput returns the Output field if non-nil, zero value otherwise. + +### GetOutputOk + +`func (o *InStateOutput) GetOutputOk() (*Output, bool)` + +GetOutputOk returns a tuple with the Output field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutput + +`func (o *InStateOutput) SetOutput(v Output)` + +SetOutput sets Output field to given value. + + +### GetOutputId + +`func (o *InStateOutput) GetOutputId() string` + +GetOutputId returns the OutputId field if non-nil, zero value otherwise. + +### GetOutputIdOk + +`func (o *InStateOutput) GetOutputIdOk() (*string, bool)` + +GetOutputIdOk returns a tuple with the OutputId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutputId + +`func (o *InStateOutput) SetOutputId(v string)` + +SetOutputId sets OutputId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InStateOutputMetricItem.md b/clients/apiclient/docs/InStateOutputMetricItem.md new file mode 100644 index 0000000000..16d3f732bf --- /dev/null +++ b/clients/apiclient/docs/InStateOutputMetricItem.md @@ -0,0 +1,93 @@ +# InStateOutputMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**InStateOutput**](InStateOutput.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewInStateOutputMetricItem + +`func NewInStateOutputMetricItem(lastMessage InStateOutput, messages uint32, timestamp time.Time, ) *InStateOutputMetricItem` + +NewInStateOutputMetricItem instantiates a new InStateOutputMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInStateOutputMetricItemWithDefaults + +`func NewInStateOutputMetricItemWithDefaults() *InStateOutputMetricItem` + +NewInStateOutputMetricItemWithDefaults instantiates a new InStateOutputMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *InStateOutputMetricItem) GetLastMessage() InStateOutput` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *InStateOutputMetricItem) GetLastMessageOk() (*InStateOutput, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *InStateOutputMetricItem) SetLastMessage(v InStateOutput)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *InStateOutputMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *InStateOutputMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *InStateOutputMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *InStateOutputMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *InStateOutputMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *InStateOutputMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InfoResponse.md b/clients/apiclient/docs/InfoResponse.md new file mode 100644 index 0000000000..d1f10f5d3e --- /dev/null +++ b/clients/apiclient/docs/InfoResponse.md @@ -0,0 +1,114 @@ +# InfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**L1Params** | [**L1Params**](L1Params.md) | | +**NetID** | **string** | The net id of the node | +**PublicKey** | **string** | The public key of the node (Hex) | +**Version** | **string** | The version of the node | + +## Methods + +### NewInfoResponse + +`func NewInfoResponse(l1Params L1Params, netID string, publicKey string, version string, ) *InfoResponse` + +NewInfoResponse instantiates a new InfoResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInfoResponseWithDefaults + +`func NewInfoResponseWithDefaults() *InfoResponse` + +NewInfoResponseWithDefaults instantiates a new InfoResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetL1Params + +`func (o *InfoResponse) GetL1Params() L1Params` + +GetL1Params returns the L1Params field if non-nil, zero value otherwise. + +### GetL1ParamsOk + +`func (o *InfoResponse) GetL1ParamsOk() (*L1Params, bool)` + +GetL1ParamsOk returns a tuple with the L1Params field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetL1Params + +`func (o *InfoResponse) SetL1Params(v L1Params)` + +SetL1Params sets L1Params field to given value. + + +### GetNetID + +`func (o *InfoResponse) GetNetID() string` + +GetNetID returns the NetID field if non-nil, zero value otherwise. + +### GetNetIDOk + +`func (o *InfoResponse) GetNetIDOk() (*string, bool)` + +GetNetIDOk returns a tuple with the NetID field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetID + +`func (o *InfoResponse) SetNetID(v string)` + +SetNetID sets NetID field to given value. + + +### GetPublicKey + +`func (o *InfoResponse) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *InfoResponse) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *InfoResponse) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + +### GetVersion + +`func (o *InfoResponse) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *InfoResponse) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *InfoResponse) SetVersion(v string)` + +SetVersion sets Version field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/InterfaceMetricItem.md b/clients/apiclient/docs/InterfaceMetricItem.md new file mode 100644 index 0000000000..f09df97915 --- /dev/null +++ b/clients/apiclient/docs/InterfaceMetricItem.md @@ -0,0 +1,93 @@ +# InterfaceMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | **string** | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewInterfaceMetricItem + +`func NewInterfaceMetricItem(lastMessage string, messages uint32, timestamp time.Time, ) *InterfaceMetricItem` + +NewInterfaceMetricItem instantiates a new InterfaceMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewInterfaceMetricItemWithDefaults + +`func NewInterfaceMetricItemWithDefaults() *InterfaceMetricItem` + +NewInterfaceMetricItemWithDefaults instantiates a new InterfaceMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *InterfaceMetricItem) GetLastMessage() string` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *InterfaceMetricItem) GetLastMessageOk() (*string, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *InterfaceMetricItem) SetLastMessage(v string)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *InterfaceMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *InterfaceMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *InterfaceMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *InterfaceMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *InterfaceMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *InterfaceMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/Item.md b/clients/apiclient/docs/Item.md new file mode 100644 index 0000000000..ede0c93f98 --- /dev/null +++ b/clients/apiclient/docs/Item.md @@ -0,0 +1,72 @@ +# Item + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Key** | **string** | key (hex-encoded) | +**Value** | **string** | value (hex-encoded) | + +## Methods + +### NewItem + +`func NewItem(key string, value string, ) *Item` + +NewItem instantiates a new Item object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewItemWithDefaults + +`func NewItemWithDefaults() *Item` + +NewItemWithDefaults instantiates a new Item object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetKey + +`func (o *Item) GetKey() string` + +GetKey returns the Key field if non-nil, zero value otherwise. + +### GetKeyOk + +`func (o *Item) GetKeyOk() (*string, bool)` + +GetKeyOk returns a tuple with the Key field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetKey + +`func (o *Item) SetKey(v string)` + +SetKey sets Key field to given value. + + +### GetValue + +`func (o *Item) GetValue() string` + +GetValue returns the Value field if non-nil, zero value otherwise. + +### GetValueOk + +`func (o *Item) GetValueOk() (*string, bool)` + +GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetValue + +`func (o *Item) SetValue(v string)` + +SetValue sets Value field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/JSONDict.md b/clients/apiclient/docs/JSONDict.md new file mode 100644 index 0000000000..2c8b476fb3 --- /dev/null +++ b/clients/apiclient/docs/JSONDict.md @@ -0,0 +1,56 @@ +# JSONDict + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Items** | Pointer to [**[]Item**](Item.md) | | [optional] + +## Methods + +### NewJSONDict + +`func NewJSONDict() *JSONDict` + +NewJSONDict instantiates a new JSONDict object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewJSONDictWithDefaults + +`func NewJSONDictWithDefaults() *JSONDict` + +NewJSONDictWithDefaults instantiates a new JSONDict object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetItems + +`func (o *JSONDict) GetItems() []Item` + +GetItems returns the Items field if non-nil, zero value otherwise. + +### GetItemsOk + +`func (o *JSONDict) GetItemsOk() (*[]Item, bool)` + +GetItemsOk returns a tuple with the Items field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetItems + +`func (o *JSONDict) SetItems(v []Item)` + +SetItems sets Items field to given value. + +### HasItems + +`func (o *JSONDict) HasItems() bool` + +HasItems returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/L1Params.md b/clients/apiclient/docs/L1Params.md new file mode 100644 index 0000000000..021891ba0b --- /dev/null +++ b/clients/apiclient/docs/L1Params.md @@ -0,0 +1,93 @@ +# L1Params + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BaseToken** | [**BaseToken**](BaseToken.md) | | +**MaxPayloadSize** | **int32** | The max payload size | +**Protocol** | [**ProtocolParameters**](ProtocolParameters.md) | | + +## Methods + +### NewL1Params + +`func NewL1Params(baseToken BaseToken, maxPayloadSize int32, protocol ProtocolParameters, ) *L1Params` + +NewL1Params instantiates a new L1Params object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewL1ParamsWithDefaults + +`func NewL1ParamsWithDefaults() *L1Params` + +NewL1ParamsWithDefaults instantiates a new L1Params object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBaseToken + +`func (o *L1Params) GetBaseToken() BaseToken` + +GetBaseToken returns the BaseToken field if non-nil, zero value otherwise. + +### GetBaseTokenOk + +`func (o *L1Params) GetBaseTokenOk() (*BaseToken, bool)` + +GetBaseTokenOk returns a tuple with the BaseToken field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBaseToken + +`func (o *L1Params) SetBaseToken(v BaseToken)` + +SetBaseToken sets BaseToken field to given value. + + +### GetMaxPayloadSize + +`func (o *L1Params) GetMaxPayloadSize() int32` + +GetMaxPayloadSize returns the MaxPayloadSize field if non-nil, zero value otherwise. + +### GetMaxPayloadSizeOk + +`func (o *L1Params) GetMaxPayloadSizeOk() (*int32, bool)` + +GetMaxPayloadSizeOk returns a tuple with the MaxPayloadSize field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMaxPayloadSize + +`func (o *L1Params) SetMaxPayloadSize(v int32)` + +SetMaxPayloadSize sets MaxPayloadSize field to given value. + + +### GetProtocol + +`func (o *L1Params) GetProtocol() ProtocolParameters` + +GetProtocol returns the Protocol field if non-nil, zero value otherwise. + +### GetProtocolOk + +`func (o *L1Params) GetProtocolOk() (*ProtocolParameters, bool)` + +GetProtocolOk returns a tuple with the Protocol field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetProtocol + +`func (o *L1Params) SetProtocol(v ProtocolParameters)` + +SetProtocol sets Protocol field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/LoginRequest.md b/clients/apiclient/docs/LoginRequest.md new file mode 100644 index 0000000000..a83ab06d9f --- /dev/null +++ b/clients/apiclient/docs/LoginRequest.md @@ -0,0 +1,72 @@ +# LoginRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Password** | **string** | | +**Username** | **string** | | + +## Methods + +### NewLoginRequest + +`func NewLoginRequest(password string, username string, ) *LoginRequest` + +NewLoginRequest instantiates a new LoginRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewLoginRequestWithDefaults + +`func NewLoginRequestWithDefaults() *LoginRequest` + +NewLoginRequestWithDefaults instantiates a new LoginRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPassword + +`func (o *LoginRequest) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *LoginRequest) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *LoginRequest) SetPassword(v string)` + +SetPassword sets Password field to given value. + + +### GetUsername + +`func (o *LoginRequest) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *LoginRequest) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *LoginRequest) SetUsername(v string)` + +SetUsername sets Username field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/LoginResponse.md b/clients/apiclient/docs/LoginResponse.md new file mode 100644 index 0000000000..127bebfead --- /dev/null +++ b/clients/apiclient/docs/LoginResponse.md @@ -0,0 +1,72 @@ +# LoginResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error** | **string** | | +**Jwt** | **string** | | + +## Methods + +### NewLoginResponse + +`func NewLoginResponse(error_ string, jwt string, ) *LoginResponse` + +NewLoginResponse instantiates a new LoginResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewLoginResponseWithDefaults + +`func NewLoginResponseWithDefaults() *LoginResponse` + +NewLoginResponseWithDefaults instantiates a new LoginResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetError + +`func (o *LoginResponse) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *LoginResponse) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *LoginResponse) SetError(v string)` + +SetError sets Error field to given value. + + +### GetJwt + +`func (o *LoginResponse) GetJwt() string` + +GetJwt returns the Jwt field if non-nil, zero value otherwise. + +### GetJwtOk + +`func (o *LoginResponse) GetJwtOk() (*string, bool)` + +GetJwtOk returns a tuple with the Jwt field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetJwt + +`func (o *LoginResponse) SetJwt(v string)` + +SetJwt sets Jwt field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/MetricsApi.md b/clients/apiclient/docs/MetricsApi.md new file mode 100644 index 0000000000..46d92dd3bc --- /dev/null +++ b/clients/apiclient/docs/MetricsApi.md @@ -0,0 +1,275 @@ +# \MetricsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**GetChainMetrics**](MetricsApi.md#GetChainMetrics) | **Get** /metrics/chain/{chainID} | Get chain specific metrics. +[**GetChainPipeMetrics**](MetricsApi.md#GetChainPipeMetrics) | **Get** /metrics/chain/{chainID}/pipe | Get chain pipe event metrics. +[**GetChainWorkflowMetrics**](MetricsApi.md#GetChainWorkflowMetrics) | **Get** /metrics/chain/{chainID}/workflow | Get chain workflow metrics. +[**GetL1Metrics**](MetricsApi.md#GetL1Metrics) | **Get** /metrics/l1 | Get accumulated metrics. + + + +## GetChainMetrics + +> ChainMetrics GetChainMetrics(ctx, chainID).Execute() + +Get chain specific metrics. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetricsApi.GetChainMetrics(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetChainMetrics``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetChainMetrics`: ChainMetrics + fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetChainMetrics`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetChainMetricsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ChainMetrics**](ChainMetrics.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetChainPipeMetrics + +> ConsensusPipeMetrics GetChainPipeMetrics(ctx, chainID).Execute() + +Get chain pipe event metrics. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetricsApi.GetChainPipeMetrics(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetChainPipeMetrics``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetChainPipeMetrics`: ConsensusPipeMetrics + fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetChainPipeMetrics`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetChainPipeMetricsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ConsensusPipeMetrics**](ConsensusPipeMetrics.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetChainWorkflowMetrics + +> ConsensusWorkflowMetrics GetChainWorkflowMetrics(ctx, chainID).Execute() + +Get chain workflow metrics. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetricsApi.GetChainWorkflowMetrics(context.Background(), chainID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetChainWorkflowMetrics``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetChainWorkflowMetrics`: ConsensusWorkflowMetrics + fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetChainWorkflowMetrics`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetChainWorkflowMetricsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**ConsensusWorkflowMetrics**](ConsensusWorkflowMetrics.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetL1Metrics + +> ChainMetrics GetL1Metrics(ctx).Execute() + +Get accumulated metrics. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.MetricsApi.GetL1Metrics(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.GetL1Metrics``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetL1Metrics`: ChainMetrics + fmt.Fprintf(os.Stdout, "Response from `MetricsApi.GetL1Metrics`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetL1MetricsRequest struct via the builder pattern + + +### Return type + +[**ChainMetrics**](ChainMetrics.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/MilestoneInfo.md b/clients/apiclient/docs/MilestoneInfo.md new file mode 100644 index 0000000000..657d661fca --- /dev/null +++ b/clients/apiclient/docs/MilestoneInfo.md @@ -0,0 +1,108 @@ +# MilestoneInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Index** | Pointer to **uint32** | | [optional] +**MilestoneId** | Pointer to **string** | | [optional] +**Timestamp** | Pointer to **uint32** | | [optional] + +## Methods + +### NewMilestoneInfo + +`func NewMilestoneInfo() *MilestoneInfo` + +NewMilestoneInfo instantiates a new MilestoneInfo object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewMilestoneInfoWithDefaults + +`func NewMilestoneInfoWithDefaults() *MilestoneInfo` + +NewMilestoneInfoWithDefaults instantiates a new MilestoneInfo object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIndex + +`func (o *MilestoneInfo) GetIndex() uint32` + +GetIndex returns the Index field if non-nil, zero value otherwise. + +### GetIndexOk + +`func (o *MilestoneInfo) GetIndexOk() (*uint32, bool)` + +GetIndexOk returns a tuple with the Index field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIndex + +`func (o *MilestoneInfo) SetIndex(v uint32)` + +SetIndex sets Index field to given value. + +### HasIndex + +`func (o *MilestoneInfo) HasIndex() bool` + +HasIndex returns a boolean if a field has been set. + +### GetMilestoneId + +`func (o *MilestoneInfo) GetMilestoneId() string` + +GetMilestoneId returns the MilestoneId field if non-nil, zero value otherwise. + +### GetMilestoneIdOk + +`func (o *MilestoneInfo) GetMilestoneIdOk() (*string, bool)` + +GetMilestoneIdOk returns a tuple with the MilestoneId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMilestoneId + +`func (o *MilestoneInfo) SetMilestoneId(v string)` + +SetMilestoneId sets MilestoneId field to given value. + +### HasMilestoneId + +`func (o *MilestoneInfo) HasMilestoneId() bool` + +HasMilestoneId returns a boolean if a field has been set. + +### GetTimestamp + +`func (o *MilestoneInfo) GetTimestamp() uint32` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *MilestoneInfo) GetTimestampOk() (*uint32, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *MilestoneInfo) SetTimestamp(v uint32)` + +SetTimestamp sets Timestamp field to given value. + +### HasTimestamp + +`func (o *MilestoneInfo) HasTimestamp() bool` + +HasTimestamp returns a boolean if a field has been set. + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/MilestoneMetricItem.md b/clients/apiclient/docs/MilestoneMetricItem.md new file mode 100644 index 0000000000..b0dc15959e --- /dev/null +++ b/clients/apiclient/docs/MilestoneMetricItem.md @@ -0,0 +1,93 @@ +# MilestoneMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**MilestoneInfo**](MilestoneInfo.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewMilestoneMetricItem + +`func NewMilestoneMetricItem(lastMessage MilestoneInfo, messages uint32, timestamp time.Time, ) *MilestoneMetricItem` + +NewMilestoneMetricItem instantiates a new MilestoneMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewMilestoneMetricItemWithDefaults + +`func NewMilestoneMetricItemWithDefaults() *MilestoneMetricItem` + +NewMilestoneMetricItemWithDefaults instantiates a new MilestoneMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *MilestoneMetricItem) GetLastMessage() MilestoneInfo` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *MilestoneMetricItem) GetLastMessageOk() (*MilestoneInfo, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *MilestoneMetricItem) SetLastMessage(v MilestoneInfo)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *MilestoneMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *MilestoneMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *MilestoneMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *MilestoneMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *MilestoneMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *MilestoneMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/NFTDataResponse.md b/clients/apiclient/docs/NFTDataResponse.md new file mode 100644 index 0000000000..8a5f6a9f89 --- /dev/null +++ b/clients/apiclient/docs/NFTDataResponse.md @@ -0,0 +1,114 @@ +# NFTDataResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | +**Issuer** | **string** | | +**Metadata** | **string** | | +**Owner** | **string** | | + +## Methods + +### NewNFTDataResponse + +`func NewNFTDataResponse(id string, issuer string, metadata string, owner string, ) *NFTDataResponse` + +NewNFTDataResponse instantiates a new NFTDataResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNFTDataResponseWithDefaults + +`func NewNFTDataResponseWithDefaults() *NFTDataResponse` + +NewNFTDataResponseWithDefaults instantiates a new NFTDataResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *NFTDataResponse) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NFTDataResponse) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NFTDataResponse) SetId(v string)` + +SetId sets Id field to given value. + + +### GetIssuer + +`func (o *NFTDataResponse) GetIssuer() string` + +GetIssuer returns the Issuer field if non-nil, zero value otherwise. + +### GetIssuerOk + +`func (o *NFTDataResponse) GetIssuerOk() (*string, bool)` + +GetIssuerOk returns a tuple with the Issuer field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIssuer + +`func (o *NFTDataResponse) SetIssuer(v string)` + +SetIssuer sets Issuer field to given value. + + +### GetMetadata + +`func (o *NFTDataResponse) GetMetadata() string` + +GetMetadata returns the Metadata field if non-nil, zero value otherwise. + +### GetMetadataOk + +`func (o *NFTDataResponse) GetMetadataOk() (*string, bool)` + +GetMetadataOk returns a tuple with the Metadata field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMetadata + +`func (o *NFTDataResponse) SetMetadata(v string)` + +SetMetadata sets Metadata field to given value. + + +### GetOwner + +`func (o *NFTDataResponse) GetOwner() string` + +GetOwner returns the Owner field if non-nil, zero value otherwise. + +### GetOwnerOk + +`func (o *NFTDataResponse) GetOwnerOk() (*string, bool)` + +GetOwnerOk returns a tuple with the Owner field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOwner + +`func (o *NFTDataResponse) SetOwner(v string)` + +SetOwner sets Owner field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/NativeToken.md b/clients/apiclient/docs/NativeToken.md new file mode 100644 index 0000000000..a7a919947c --- /dev/null +++ b/clients/apiclient/docs/NativeToken.md @@ -0,0 +1,72 @@ +# NativeToken + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Amount** | **string** | | +**Id** | **string** | | + +## Methods + +### NewNativeToken + +`func NewNativeToken(amount string, id string, ) *NativeToken` + +NewNativeToken instantiates a new NativeToken object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNativeTokenWithDefaults + +`func NewNativeTokenWithDefaults() *NativeToken` + +NewNativeTokenWithDefaults instantiates a new NativeToken object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAmount + +`func (o *NativeToken) GetAmount() string` + +GetAmount returns the Amount field if non-nil, zero value otherwise. + +### GetAmountOk + +`func (o *NativeToken) GetAmountOk() (*string, bool)` + +GetAmountOk returns a tuple with the Amount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAmount + +`func (o *NativeToken) SetAmount(v string)` + +SetAmount sets Amount field to given value. + + +### GetId + +`func (o *NativeToken) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *NativeToken) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *NativeToken) SetId(v string)` + +SetId sets Id field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/NativeTokenIDRegistryResponse.md b/clients/apiclient/docs/NativeTokenIDRegistryResponse.md new file mode 100644 index 0000000000..75d8c6171e --- /dev/null +++ b/clients/apiclient/docs/NativeTokenIDRegistryResponse.md @@ -0,0 +1,51 @@ +# NativeTokenIDRegistryResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NativeTokenRegistryIds** | **[]string** | | + +## Methods + +### NewNativeTokenIDRegistryResponse + +`func NewNativeTokenIDRegistryResponse(nativeTokenRegistryIds []string, ) *NativeTokenIDRegistryResponse` + +NewNativeTokenIDRegistryResponse instantiates a new NativeTokenIDRegistryResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNativeTokenIDRegistryResponseWithDefaults + +`func NewNativeTokenIDRegistryResponseWithDefaults() *NativeTokenIDRegistryResponse` + +NewNativeTokenIDRegistryResponseWithDefaults instantiates a new NativeTokenIDRegistryResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNativeTokenRegistryIds + +`func (o *NativeTokenIDRegistryResponse) GetNativeTokenRegistryIds() []string` + +GetNativeTokenRegistryIds returns the NativeTokenRegistryIds field if non-nil, zero value otherwise. + +### GetNativeTokenRegistryIdsOk + +`func (o *NativeTokenIDRegistryResponse) GetNativeTokenRegistryIdsOk() (*[]string, bool)` + +GetNativeTokenRegistryIdsOk returns a tuple with the NativeTokenRegistryIds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNativeTokenRegistryIds + +`func (o *NativeTokenIDRegistryResponse) SetNativeTokenRegistryIds(v []string)` + +SetNativeTokenRegistryIds sets NativeTokenRegistryIds field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/NodeApi.md b/clients/apiclient/docs/NodeApi.md new file mode 100644 index 0000000000..e1c6d8eed7 --- /dev/null +++ b/clients/apiclient/docs/NodeApi.md @@ -0,0 +1,751 @@ +# \NodeApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DistrustPeer**](NodeApi.md#DistrustPeer) | **Delete** /node/peers/trusted | Distrust a peering node +[**GenerateDKS**](NodeApi.md#GenerateDKS) | **Post** /node/dks | Generate a new distributed key +[**GetAllPeers**](NodeApi.md#GetAllPeers) | **Get** /node/peers | Get basic information about all configured peers +[**GetConfiguration**](NodeApi.md#GetConfiguration) | **Get** /node/config | Return the Wasp configuration +[**GetDKSInfo**](NodeApi.md#GetDKSInfo) | **Get** /node/dks/{sharedAddress} | Get information about the shared address DKS configuration +[**GetInfo**](NodeApi.md#GetInfo) | **Get** /node/info | Returns private information about this node. +[**GetPeeringIdentity**](NodeApi.md#GetPeeringIdentity) | **Get** /node/peers/identity | Get basic peer info of the current node +[**GetTrustedPeers**](NodeApi.md#GetTrustedPeers) | **Get** /node/peers/trusted | Get trusted peers +[**GetVersion**](NodeApi.md#GetVersion) | **Get** /node/version | Returns the node version. +[**SetNodeOwner**](NodeApi.md#SetNodeOwner) | **Post** /node/owner/certificate | Sets the node owner +[**ShutdownNode**](NodeApi.md#ShutdownNode) | **Post** /node/shutdown | Shut down the node +[**TrustPeer**](NodeApi.md#TrustPeer) | **Post** /node/peers/trusted | Trust a peering node + + + +## DistrustPeer + +> DistrustPeer(ctx).PeeringTrustRequest(peeringTrustRequest).Execute() + +Distrust a peering node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + peeringTrustRequest := *openapiclient.NewPeeringTrustRequest("localhost:4000", "0x0000") // PeeringTrustRequest | Info of the peer to distrust + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.DistrustPeer(context.Background()).PeeringTrustRequest(peeringTrustRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.DistrustPeer``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiDistrustPeerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **peeringTrustRequest** | [**PeeringTrustRequest**](PeeringTrustRequest.md) | Info of the peer to distrust | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GenerateDKS + +> DKSharesInfo GenerateDKS(ctx).DKSharesPostRequest(dKSharesPostRequest).Execute() + +Generate a new distributed key + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + dKSharesPostRequest := *openapiclient.NewDKSharesPostRequest([]string{"PeerIdentities_example"}, uint32(123), uint32(123)) // DKSharesPostRequest | Request parameters + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GenerateDKS(context.Background()).DKSharesPostRequest(dKSharesPostRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GenerateDKS``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GenerateDKS`: DKSharesInfo + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GenerateDKS`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiGenerateDKSRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **dKSharesPostRequest** | [**DKSharesPostRequest**](DKSharesPostRequest.md) | Request parameters | + +### Return type + +[**DKSharesInfo**](DKSharesInfo.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAllPeers + +> []PeeringNodeStatusResponse GetAllPeers(ctx).Execute() + +Get basic information about all configured peers + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetAllPeers(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetAllPeers``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAllPeers`: []PeeringNodeStatusResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetAllPeers`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAllPeersRequest struct via the builder pattern + + +### Return type + +[**[]PeeringNodeStatusResponse**](PeeringNodeStatusResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetConfiguration + +> map[string]string GetConfiguration(ctx).Execute() + +Return the Wasp configuration + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetConfiguration(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetConfiguration``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetConfiguration`: map[string]string + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetConfiguration`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetConfigurationRequest struct via the builder pattern + + +### Return type + +**map[string]string** + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetDKSInfo + +> DKSharesInfo GetDKSInfo(ctx, sharedAddress).Execute() + +Get information about the shared address DKS configuration + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + sharedAddress := "sharedAddress_example" // string | SharedAddress (Bech32) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetDKSInfo(context.Background(), sharedAddress).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetDKSInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetDKSInfo`: DKSharesInfo + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetDKSInfo`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**sharedAddress** | **string** | SharedAddress (Bech32) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetDKSInfoRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**DKSharesInfo**](DKSharesInfo.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetInfo + +> InfoResponse GetInfo(ctx).Execute() + +Returns private information about this node. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetInfo(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetInfo``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetInfo`: InfoResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetInfo`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetInfoRequest struct via the builder pattern + + +### Return type + +[**InfoResponse**](InfoResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPeeringIdentity + +> PeeringNodeIdentityResponse GetPeeringIdentity(ctx).Execute() + +Get basic peer info of the current node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetPeeringIdentity(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetPeeringIdentity``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetPeeringIdentity`: PeeringNodeIdentityResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetPeeringIdentity`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetPeeringIdentityRequest struct via the builder pattern + + +### Return type + +[**PeeringNodeIdentityResponse**](PeeringNodeIdentityResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetTrustedPeers + +> []PeeringNodeIdentityResponse GetTrustedPeers(ctx).Execute() + +Get trusted peers + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetTrustedPeers(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetTrustedPeers``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetTrustedPeers`: []PeeringNodeIdentityResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetTrustedPeers`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetTrustedPeersRequest struct via the builder pattern + + +### Return type + +[**[]PeeringNodeIdentityResponse**](PeeringNodeIdentityResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetVersion + +> VersionResponse GetVersion(ctx).Execute() + +Returns the node version. + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.GetVersion(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.GetVersion``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetVersion`: VersionResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.GetVersion`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetVersionRequest struct via the builder pattern + + +### Return type + +[**VersionResponse**](VersionResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## SetNodeOwner + +> NodeOwnerCertificateResponse SetNodeOwner(ctx).NodeOwnerCertificateRequest(nodeOwnerCertificateRequest).Execute() + +Sets the node owner + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + nodeOwnerCertificateRequest := *openapiclient.NewNodeOwnerCertificateRequest("OwnerAddress_example", "PublicKey_example") // NodeOwnerCertificateRequest | The node owner certificate + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.SetNodeOwner(context.Background()).NodeOwnerCertificateRequest(nodeOwnerCertificateRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.SetNodeOwner``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `SetNodeOwner`: NodeOwnerCertificateResponse + fmt.Fprintf(os.Stdout, "Response from `NodeApi.SetNodeOwner`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiSetNodeOwnerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **nodeOwnerCertificateRequest** | [**NodeOwnerCertificateRequest**](NodeOwnerCertificateRequest.md) | The node owner certificate | + +### Return type + +[**NodeOwnerCertificateResponse**](NodeOwnerCertificateResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ShutdownNode + +> ShutdownNode(ctx).Execute() + +Shut down the node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.ShutdownNode(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.ShutdownNode``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiShutdownNodeRequest struct via the builder pattern + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TrustPeer + +> TrustPeer(ctx).PeeringTrustRequest(peeringTrustRequest).Execute() + +Trust a peering node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + peeringTrustRequest := *openapiclient.NewPeeringTrustRequest("localhost:4000", "0x0000") // PeeringTrustRequest | Info of the peer to trust + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.NodeApi.TrustPeer(context.Background()).PeeringTrustRequest(peeringTrustRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `NodeApi.TrustPeer``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiTrustPeerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **peeringTrustRequest** | [**PeeringTrustRequest**](PeeringTrustRequest.md) | Info of the peer to trust | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/NodeOwnerCertificateRequest.md b/clients/apiclient/docs/NodeOwnerCertificateRequest.md new file mode 100644 index 0000000000..9e14a49176 --- /dev/null +++ b/clients/apiclient/docs/NodeOwnerCertificateRequest.md @@ -0,0 +1,72 @@ +# NodeOwnerCertificateRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OwnerAddress** | **string** | Node owner address. (Bech32) | +**PublicKey** | **string** | The public key of the node (Hex) | + +## Methods + +### NewNodeOwnerCertificateRequest + +`func NewNodeOwnerCertificateRequest(ownerAddress string, publicKey string, ) *NodeOwnerCertificateRequest` + +NewNodeOwnerCertificateRequest instantiates a new NodeOwnerCertificateRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNodeOwnerCertificateRequestWithDefaults + +`func NewNodeOwnerCertificateRequestWithDefaults() *NodeOwnerCertificateRequest` + +NewNodeOwnerCertificateRequestWithDefaults instantiates a new NodeOwnerCertificateRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOwnerAddress + +`func (o *NodeOwnerCertificateRequest) GetOwnerAddress() string` + +GetOwnerAddress returns the OwnerAddress field if non-nil, zero value otherwise. + +### GetOwnerAddressOk + +`func (o *NodeOwnerCertificateRequest) GetOwnerAddressOk() (*string, bool)` + +GetOwnerAddressOk returns a tuple with the OwnerAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOwnerAddress + +`func (o *NodeOwnerCertificateRequest) SetOwnerAddress(v string)` + +SetOwnerAddress sets OwnerAddress field to given value. + + +### GetPublicKey + +`func (o *NodeOwnerCertificateRequest) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *NodeOwnerCertificateRequest) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *NodeOwnerCertificateRequest) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/NodeOwnerCertificateResponse.md b/clients/apiclient/docs/NodeOwnerCertificateResponse.md new file mode 100644 index 0000000000..91f293c800 --- /dev/null +++ b/clients/apiclient/docs/NodeOwnerCertificateResponse.md @@ -0,0 +1,51 @@ +# NodeOwnerCertificateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Certificate** | **string** | Certificate stating the ownership. (Hex) | + +## Methods + +### NewNodeOwnerCertificateResponse + +`func NewNodeOwnerCertificateResponse(certificate string, ) *NodeOwnerCertificateResponse` + +NewNodeOwnerCertificateResponse instantiates a new NodeOwnerCertificateResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewNodeOwnerCertificateResponseWithDefaults + +`func NewNodeOwnerCertificateResponseWithDefaults() *NodeOwnerCertificateResponse` + +NewNodeOwnerCertificateResponseWithDefaults instantiates a new NodeOwnerCertificateResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetCertificate + +`func (o *NodeOwnerCertificateResponse) GetCertificate() string` + +GetCertificate returns the Certificate field if non-nil, zero value otherwise. + +### GetCertificateOk + +`func (o *NodeOwnerCertificateResponse) GetCertificateOk() (*string, bool)` + +GetCertificateOk returns a tuple with the Certificate field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCertificate + +`func (o *NodeOwnerCertificateResponse) SetCertificate(v string)` + +SetCertificate sets Certificate field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/OffLedgerRequest.md b/clients/apiclient/docs/OffLedgerRequest.md new file mode 100644 index 0000000000..4550dc5102 --- /dev/null +++ b/clients/apiclient/docs/OffLedgerRequest.md @@ -0,0 +1,72 @@ +# OffLedgerRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainId** | **string** | The chain id | +**Request** | **string** | Offledger Request (Hex) | + +## Methods + +### NewOffLedgerRequest + +`func NewOffLedgerRequest(chainId string, request string, ) *OffLedgerRequest` + +NewOffLedgerRequest instantiates a new OffLedgerRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOffLedgerRequestWithDefaults + +`func NewOffLedgerRequestWithDefaults() *OffLedgerRequest` + +NewOffLedgerRequestWithDefaults instantiates a new OffLedgerRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetChainId + +`func (o *OffLedgerRequest) GetChainId() string` + +GetChainId returns the ChainId field if non-nil, zero value otherwise. + +### GetChainIdOk + +`func (o *OffLedgerRequest) GetChainIdOk() (*string, bool)` + +GetChainIdOk returns a tuple with the ChainId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainId + +`func (o *OffLedgerRequest) SetChainId(v string)` + +SetChainId sets ChainId field to given value. + + +### GetRequest + +`func (o *OffLedgerRequest) GetRequest() string` + +GetRequest returns the Request field if non-nil, zero value otherwise. + +### GetRequestOk + +`func (o *OffLedgerRequest) GetRequestOk() (*string, bool)` + +GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequest + +`func (o *OffLedgerRequest) SetRequest(v string)` + +SetRequest sets Request field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/OnLedgerRequest.md b/clients/apiclient/docs/OnLedgerRequest.md new file mode 100644 index 0000000000..3cbafa62d6 --- /dev/null +++ b/clients/apiclient/docs/OnLedgerRequest.md @@ -0,0 +1,114 @@ +# OnLedgerRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | The request ID | +**Output** | [**Output**](Output.md) | | +**OutputId** | **string** | The output ID | +**Raw** | **string** | The raw data of the request (Hex) | + +## Methods + +### NewOnLedgerRequest + +`func NewOnLedgerRequest(id string, output Output, outputId string, raw string, ) *OnLedgerRequest` + +NewOnLedgerRequest instantiates a new OnLedgerRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOnLedgerRequestWithDefaults + +`func NewOnLedgerRequestWithDefaults() *OnLedgerRequest` + +NewOnLedgerRequestWithDefaults instantiates a new OnLedgerRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetId + +`func (o *OnLedgerRequest) GetId() string` + +GetId returns the Id field if non-nil, zero value otherwise. + +### GetIdOk + +`func (o *OnLedgerRequest) GetIdOk() (*string, bool)` + +GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetId + +`func (o *OnLedgerRequest) SetId(v string)` + +SetId sets Id field to given value. + + +### GetOutput + +`func (o *OnLedgerRequest) GetOutput() Output` + +GetOutput returns the Output field if non-nil, zero value otherwise. + +### GetOutputOk + +`func (o *OnLedgerRequest) GetOutputOk() (*Output, bool)` + +GetOutputOk returns a tuple with the Output field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutput + +`func (o *OnLedgerRequest) SetOutput(v Output)` + +SetOutput sets Output field to given value. + + +### GetOutputId + +`func (o *OnLedgerRequest) GetOutputId() string` + +GetOutputId returns the OutputId field if non-nil, zero value otherwise. + +### GetOutputIdOk + +`func (o *OnLedgerRequest) GetOutputIdOk() (*string, bool)` + +GetOutputIdOk returns a tuple with the OutputId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutputId + +`func (o *OnLedgerRequest) SetOutputId(v string)` + +SetOutputId sets OutputId field to given value. + + +### GetRaw + +`func (o *OnLedgerRequest) GetRaw() string` + +GetRaw returns the Raw field if non-nil, zero value otherwise. + +### GetRawOk + +`func (o *OnLedgerRequest) GetRawOk() (*string, bool)` + +GetRawOk returns a tuple with the Raw field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRaw + +`func (o *OnLedgerRequest) SetRaw(v string)` + +SetRaw sets Raw field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/OnLedgerRequestMetricItem.md b/clients/apiclient/docs/OnLedgerRequestMetricItem.md new file mode 100644 index 0000000000..a2c39fa285 --- /dev/null +++ b/clients/apiclient/docs/OnLedgerRequestMetricItem.md @@ -0,0 +1,93 @@ +# OnLedgerRequestMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**OnLedgerRequest**](OnLedgerRequest.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewOnLedgerRequestMetricItem + +`func NewOnLedgerRequestMetricItem(lastMessage OnLedgerRequest, messages uint32, timestamp time.Time, ) *OnLedgerRequestMetricItem` + +NewOnLedgerRequestMetricItem instantiates a new OnLedgerRequestMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOnLedgerRequestMetricItemWithDefaults + +`func NewOnLedgerRequestMetricItemWithDefaults() *OnLedgerRequestMetricItem` + +NewOnLedgerRequestMetricItemWithDefaults instantiates a new OnLedgerRequestMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *OnLedgerRequestMetricItem) GetLastMessage() OnLedgerRequest` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *OnLedgerRequestMetricItem) GetLastMessageOk() (*OnLedgerRequest, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *OnLedgerRequestMetricItem) SetLastMessage(v OnLedgerRequest)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *OnLedgerRequestMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *OnLedgerRequestMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *OnLedgerRequestMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *OnLedgerRequestMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *OnLedgerRequestMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *OnLedgerRequestMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/Output.md b/clients/apiclient/docs/Output.md new file mode 100644 index 0000000000..669acce103 --- /dev/null +++ b/clients/apiclient/docs/Output.md @@ -0,0 +1,72 @@ +# Output + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OutputType** | **int32** | The output type | +**Raw** | **string** | The raw data of the output (Hex) | + +## Methods + +### NewOutput + +`func NewOutput(outputType int32, raw string, ) *Output` + +NewOutput instantiates a new Output object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOutputWithDefaults + +`func NewOutputWithDefaults() *Output` + +NewOutputWithDefaults instantiates a new Output object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOutputType + +`func (o *Output) GetOutputType() int32` + +GetOutputType returns the OutputType field if non-nil, zero value otherwise. + +### GetOutputTypeOk + +`func (o *Output) GetOutputTypeOk() (*int32, bool)` + +GetOutputTypeOk returns a tuple with the OutputType field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutputType + +`func (o *Output) SetOutputType(v int32)` + +SetOutputType sets OutputType field to given value. + + +### GetRaw + +`func (o *Output) GetRaw() string` + +GetRaw returns the Raw field if non-nil, zero value otherwise. + +### GetRawOk + +`func (o *Output) GetRawOk() (*string, bool)` + +GetRawOk returns a tuple with the Raw field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRaw + +`func (o *Output) SetRaw(v string)` + +SetRaw sets Raw field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/OutputID.md b/clients/apiclient/docs/OutputID.md new file mode 100644 index 0000000000..6e64156ca4 --- /dev/null +++ b/clients/apiclient/docs/OutputID.md @@ -0,0 +1,51 @@ +# OutputID + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**OutputId** | **string** | The output ID | + +## Methods + +### NewOutputID + +`func NewOutputID(outputId string, ) *OutputID` + +NewOutputID instantiates a new OutputID object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewOutputIDWithDefaults + +`func NewOutputIDWithDefaults() *OutputID` + +NewOutputIDWithDefaults instantiates a new OutputID object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetOutputId + +`func (o *OutputID) GetOutputId() string` + +GetOutputId returns the OutputId field if non-nil, zero value otherwise. + +### GetOutputIdOk + +`func (o *OutputID) GetOutputIdOk() (*string, bool)` + +GetOutputIdOk returns a tuple with the OutputId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOutputId + +`func (o *OutputID) SetOutputId(v string)` + +SetOutputId sets OutputId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/PeeringNodeIdentityResponse.md b/clients/apiclient/docs/PeeringNodeIdentityResponse.md new file mode 100644 index 0000000000..4378e55c1d --- /dev/null +++ b/clients/apiclient/docs/PeeringNodeIdentityResponse.md @@ -0,0 +1,93 @@ +# PeeringNodeIdentityResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsTrusted** | **bool** | | +**NetId** | **string** | The NetID of the peer | +**PublicKey** | **string** | The peers public key encoded in Hex | + +## Methods + +### NewPeeringNodeIdentityResponse + +`func NewPeeringNodeIdentityResponse(isTrusted bool, netId string, publicKey string, ) *PeeringNodeIdentityResponse` + +NewPeeringNodeIdentityResponse instantiates a new PeeringNodeIdentityResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPeeringNodeIdentityResponseWithDefaults + +`func NewPeeringNodeIdentityResponseWithDefaults() *PeeringNodeIdentityResponse` + +NewPeeringNodeIdentityResponseWithDefaults instantiates a new PeeringNodeIdentityResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsTrusted + +`func (o *PeeringNodeIdentityResponse) GetIsTrusted() bool` + +GetIsTrusted returns the IsTrusted field if non-nil, zero value otherwise. + +### GetIsTrustedOk + +`func (o *PeeringNodeIdentityResponse) GetIsTrustedOk() (*bool, bool)` + +GetIsTrustedOk returns a tuple with the IsTrusted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsTrusted + +`func (o *PeeringNodeIdentityResponse) SetIsTrusted(v bool)` + +SetIsTrusted sets IsTrusted field to given value. + + +### GetNetId + +`func (o *PeeringNodeIdentityResponse) GetNetId() string` + +GetNetId returns the NetId field if non-nil, zero value otherwise. + +### GetNetIdOk + +`func (o *PeeringNodeIdentityResponse) GetNetIdOk() (*string, bool)` + +GetNetIdOk returns a tuple with the NetId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetId + +`func (o *PeeringNodeIdentityResponse) SetNetId(v string)` + +SetNetId sets NetId field to given value. + + +### GetPublicKey + +`func (o *PeeringNodeIdentityResponse) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *PeeringNodeIdentityResponse) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *PeeringNodeIdentityResponse) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/PeeringNodeStatusResponse.md b/clients/apiclient/docs/PeeringNodeStatusResponse.md new file mode 100644 index 0000000000..69423b3092 --- /dev/null +++ b/clients/apiclient/docs/PeeringNodeStatusResponse.md @@ -0,0 +1,135 @@ +# PeeringNodeStatusResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IsAlive** | **bool** | Whether or not the peer is activated | +**IsTrusted** | **bool** | | +**NetId** | **string** | The NetID of the peer | +**NumUsers** | **int32** | The amount of users attached to the peer | +**PublicKey** | **string** | The peers public key encoded in Hex | + +## Methods + +### NewPeeringNodeStatusResponse + +`func NewPeeringNodeStatusResponse(isAlive bool, isTrusted bool, netId string, numUsers int32, publicKey string, ) *PeeringNodeStatusResponse` + +NewPeeringNodeStatusResponse instantiates a new PeeringNodeStatusResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPeeringNodeStatusResponseWithDefaults + +`func NewPeeringNodeStatusResponseWithDefaults() *PeeringNodeStatusResponse` + +NewPeeringNodeStatusResponseWithDefaults instantiates a new PeeringNodeStatusResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetIsAlive + +`func (o *PeeringNodeStatusResponse) GetIsAlive() bool` + +GetIsAlive returns the IsAlive field if non-nil, zero value otherwise. + +### GetIsAliveOk + +`func (o *PeeringNodeStatusResponse) GetIsAliveOk() (*bool, bool)` + +GetIsAliveOk returns a tuple with the IsAlive field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsAlive + +`func (o *PeeringNodeStatusResponse) SetIsAlive(v bool)` + +SetIsAlive sets IsAlive field to given value. + + +### GetIsTrusted + +`func (o *PeeringNodeStatusResponse) GetIsTrusted() bool` + +GetIsTrusted returns the IsTrusted field if non-nil, zero value otherwise. + +### GetIsTrustedOk + +`func (o *PeeringNodeStatusResponse) GetIsTrustedOk() (*bool, bool)` + +GetIsTrustedOk returns a tuple with the IsTrusted field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsTrusted + +`func (o *PeeringNodeStatusResponse) SetIsTrusted(v bool)` + +SetIsTrusted sets IsTrusted field to given value. + + +### GetNetId + +`func (o *PeeringNodeStatusResponse) GetNetId() string` + +GetNetId returns the NetId field if non-nil, zero value otherwise. + +### GetNetIdOk + +`func (o *PeeringNodeStatusResponse) GetNetIdOk() (*string, bool)` + +GetNetIdOk returns a tuple with the NetId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetId + +`func (o *PeeringNodeStatusResponse) SetNetId(v string)` + +SetNetId sets NetId field to given value. + + +### GetNumUsers + +`func (o *PeeringNodeStatusResponse) GetNumUsers() int32` + +GetNumUsers returns the NumUsers field if non-nil, zero value otherwise. + +### GetNumUsersOk + +`func (o *PeeringNodeStatusResponse) GetNumUsersOk() (*int32, bool)` + +GetNumUsersOk returns a tuple with the NumUsers field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNumUsers + +`func (o *PeeringNodeStatusResponse) SetNumUsers(v int32)` + +SetNumUsers sets NumUsers field to given value. + + +### GetPublicKey + +`func (o *PeeringNodeStatusResponse) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *PeeringNodeStatusResponse) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *PeeringNodeStatusResponse) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/PeeringTrustRequest.md b/clients/apiclient/docs/PeeringTrustRequest.md new file mode 100644 index 0000000000..de60f9c99f --- /dev/null +++ b/clients/apiclient/docs/PeeringTrustRequest.md @@ -0,0 +1,72 @@ +# PeeringTrustRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**NetId** | **string** | The NetID of the peer | +**PublicKey** | **string** | The peers public key encoded in Hex | + +## Methods + +### NewPeeringTrustRequest + +`func NewPeeringTrustRequest(netId string, publicKey string, ) *PeeringTrustRequest` + +NewPeeringTrustRequest instantiates a new PeeringTrustRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPeeringTrustRequestWithDefaults + +`func NewPeeringTrustRequestWithDefaults() *PeeringTrustRequest` + +NewPeeringTrustRequestWithDefaults instantiates a new PeeringTrustRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetNetId + +`func (o *PeeringTrustRequest) GetNetId() string` + +GetNetId returns the NetId field if non-nil, zero value otherwise. + +### GetNetIdOk + +`func (o *PeeringTrustRequest) GetNetIdOk() (*string, bool)` + +GetNetIdOk returns a tuple with the NetId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetId + +`func (o *PeeringTrustRequest) SetNetId(v string)` + +SetNetId sets NetId field to given value. + + +### GetPublicKey + +`func (o *PeeringTrustRequest) GetPublicKey() string` + +GetPublicKey returns the PublicKey field if non-nil, zero value otherwise. + +### GetPublicKeyOk + +`func (o *PeeringTrustRequest) GetPublicKeyOk() (*string, bool)` + +GetPublicKeyOk returns a tuple with the PublicKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPublicKey + +`func (o *PeeringTrustRequest) SetPublicKey(v string)` + +SetPublicKey sets PublicKey field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ProtocolParameters.md b/clients/apiclient/docs/ProtocolParameters.md new file mode 100644 index 0000000000..14141e5189 --- /dev/null +++ b/clients/apiclient/docs/ProtocolParameters.md @@ -0,0 +1,177 @@ +# ProtocolParameters + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bech32Hrp** | **string** | The human readable network prefix | +**BelowMaxDepth** | **uint32** | The networks max depth | +**MinPowScore** | **uint32** | The minimal PoW score | +**NetworkName** | **string** | The network name | +**RentStructure** | [**RentStructure**](RentStructure.md) | | +**TokenSupply** | **string** | The token supply | +**Version** | **int32** | The protocol version | + +## Methods + +### NewProtocolParameters + +`func NewProtocolParameters(bech32Hrp string, belowMaxDepth uint32, minPowScore uint32, networkName string, rentStructure RentStructure, tokenSupply string, version int32, ) *ProtocolParameters` + +NewProtocolParameters instantiates a new ProtocolParameters object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewProtocolParametersWithDefaults + +`func NewProtocolParametersWithDefaults() *ProtocolParameters` + +NewProtocolParametersWithDefaults instantiates a new ProtocolParameters object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBech32Hrp + +`func (o *ProtocolParameters) GetBech32Hrp() string` + +GetBech32Hrp returns the Bech32Hrp field if non-nil, zero value otherwise. + +### GetBech32HrpOk + +`func (o *ProtocolParameters) GetBech32HrpOk() (*string, bool)` + +GetBech32HrpOk returns a tuple with the Bech32Hrp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBech32Hrp + +`func (o *ProtocolParameters) SetBech32Hrp(v string)` + +SetBech32Hrp sets Bech32Hrp field to given value. + + +### GetBelowMaxDepth + +`func (o *ProtocolParameters) GetBelowMaxDepth() uint32` + +GetBelowMaxDepth returns the BelowMaxDepth field if non-nil, zero value otherwise. + +### GetBelowMaxDepthOk + +`func (o *ProtocolParameters) GetBelowMaxDepthOk() (*uint32, bool)` + +GetBelowMaxDepthOk returns a tuple with the BelowMaxDepth field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBelowMaxDepth + +`func (o *ProtocolParameters) SetBelowMaxDepth(v uint32)` + +SetBelowMaxDepth sets BelowMaxDepth field to given value. + + +### GetMinPowScore + +`func (o *ProtocolParameters) GetMinPowScore() uint32` + +GetMinPowScore returns the MinPowScore field if non-nil, zero value otherwise. + +### GetMinPowScoreOk + +`func (o *ProtocolParameters) GetMinPowScoreOk() (*uint32, bool)` + +GetMinPowScoreOk returns a tuple with the MinPowScore field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMinPowScore + +`func (o *ProtocolParameters) SetMinPowScore(v uint32)` + +SetMinPowScore sets MinPowScore field to given value. + + +### GetNetworkName + +`func (o *ProtocolParameters) GetNetworkName() string` + +GetNetworkName returns the NetworkName field if non-nil, zero value otherwise. + +### GetNetworkNameOk + +`func (o *ProtocolParameters) GetNetworkNameOk() (*string, bool)` + +GetNetworkNameOk returns a tuple with the NetworkName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNetworkName + +`func (o *ProtocolParameters) SetNetworkName(v string)` + +SetNetworkName sets NetworkName field to given value. + + +### GetRentStructure + +`func (o *ProtocolParameters) GetRentStructure() RentStructure` + +GetRentStructure returns the RentStructure field if non-nil, zero value otherwise. + +### GetRentStructureOk + +`func (o *ProtocolParameters) GetRentStructureOk() (*RentStructure, bool)` + +GetRentStructureOk returns a tuple with the RentStructure field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRentStructure + +`func (o *ProtocolParameters) SetRentStructure(v RentStructure)` + +SetRentStructure sets RentStructure field to given value. + + +### GetTokenSupply + +`func (o *ProtocolParameters) GetTokenSupply() string` + +GetTokenSupply returns the TokenSupply field if non-nil, zero value otherwise. + +### GetTokenSupplyOk + +`func (o *ProtocolParameters) GetTokenSupplyOk() (*string, bool)` + +GetTokenSupplyOk returns a tuple with the TokenSupply field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTokenSupply + +`func (o *ProtocolParameters) SetTokenSupply(v string)` + +SetTokenSupply sets TokenSupply field to given value. + + +### GetVersion + +`func (o *ProtocolParameters) GetVersion() int32` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *ProtocolParameters) GetVersionOk() (*int32, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *ProtocolParameters) SetVersion(v int32)` + +SetVersion sets Version field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/PublisherStateTransactionItem.md b/clients/apiclient/docs/PublisherStateTransactionItem.md new file mode 100644 index 0000000000..68749aafbe --- /dev/null +++ b/clients/apiclient/docs/PublisherStateTransactionItem.md @@ -0,0 +1,93 @@ +# PublisherStateTransactionItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**StateTransaction**](StateTransaction.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewPublisherStateTransactionItem + +`func NewPublisherStateTransactionItem(lastMessage StateTransaction, messages uint32, timestamp time.Time, ) *PublisherStateTransactionItem` + +NewPublisherStateTransactionItem instantiates a new PublisherStateTransactionItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewPublisherStateTransactionItemWithDefaults + +`func NewPublisherStateTransactionItemWithDefaults() *PublisherStateTransactionItem` + +NewPublisherStateTransactionItemWithDefaults instantiates a new PublisherStateTransactionItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *PublisherStateTransactionItem) GetLastMessage() StateTransaction` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *PublisherStateTransactionItem) GetLastMessageOk() (*StateTransaction, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *PublisherStateTransactionItem) SetLastMessage(v StateTransaction)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *PublisherStateTransactionItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *PublisherStateTransactionItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *PublisherStateTransactionItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *PublisherStateTransactionItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *PublisherStateTransactionItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *PublisherStateTransactionItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ReceiptError.md b/clients/apiclient/docs/ReceiptError.md new file mode 100644 index 0000000000..405dc32901 --- /dev/null +++ b/clients/apiclient/docs/ReceiptError.md @@ -0,0 +1,156 @@ +# ReceiptError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ContractHName** | **string** | The contract hname (Hex) | +**ErrorCode** | **string** | | +**ErrorId** | **uint32** | | +**Message** | **string** | | +**MessageFormat** | **string** | | +**Parameters** | **[]string** | | + +## Methods + +### NewReceiptError + +`func NewReceiptError(contractHName string, errorCode string, errorId uint32, message string, messageFormat string, parameters []string, ) *ReceiptError` + +NewReceiptError instantiates a new ReceiptError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewReceiptErrorWithDefaults + +`func NewReceiptErrorWithDefaults() *ReceiptError` + +NewReceiptErrorWithDefaults instantiates a new ReceiptError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetContractHName + +`func (o *ReceiptError) GetContractHName() string` + +GetContractHName returns the ContractHName field if non-nil, zero value otherwise. + +### GetContractHNameOk + +`func (o *ReceiptError) GetContractHNameOk() (*string, bool)` + +GetContractHNameOk returns a tuple with the ContractHName field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetContractHName + +`func (o *ReceiptError) SetContractHName(v string)` + +SetContractHName sets ContractHName field to given value. + + +### GetErrorCode + +`func (o *ReceiptError) GetErrorCode() string` + +GetErrorCode returns the ErrorCode field if non-nil, zero value otherwise. + +### GetErrorCodeOk + +`func (o *ReceiptError) GetErrorCodeOk() (*string, bool)` + +GetErrorCodeOk returns a tuple with the ErrorCode field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorCode + +`func (o *ReceiptError) SetErrorCode(v string)` + +SetErrorCode sets ErrorCode field to given value. + + +### GetErrorId + +`func (o *ReceiptError) GetErrorId() uint32` + +GetErrorId returns the ErrorId field if non-nil, zero value otherwise. + +### GetErrorIdOk + +`func (o *ReceiptError) GetErrorIdOk() (*uint32, bool)` + +GetErrorIdOk returns a tuple with the ErrorId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetErrorId + +`func (o *ReceiptError) SetErrorId(v uint32)` + +SetErrorId sets ErrorId field to given value. + + +### GetMessage + +`func (o *ReceiptError) GetMessage() string` + +GetMessage returns the Message field if non-nil, zero value otherwise. + +### GetMessageOk + +`func (o *ReceiptError) GetMessageOk() (*string, bool)` + +GetMessageOk returns a tuple with the Message field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessage + +`func (o *ReceiptError) SetMessage(v string)` + +SetMessage sets Message field to given value. + + +### GetMessageFormat + +`func (o *ReceiptError) GetMessageFormat() string` + +GetMessageFormat returns the MessageFormat field if non-nil, zero value otherwise. + +### GetMessageFormatOk + +`func (o *ReceiptError) GetMessageFormatOk() (*string, bool)` + +GetMessageFormatOk returns a tuple with the MessageFormat field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessageFormat + +`func (o *ReceiptError) SetMessageFormat(v string)` + +SetMessageFormat sets MessageFormat field to given value. + + +### GetParameters + +`func (o *ReceiptError) GetParameters() []string` + +GetParameters returns the Parameters field if non-nil, zero value otherwise. + +### GetParametersOk + +`func (o *ReceiptError) GetParametersOk() (*[]string, bool)` + +GetParametersOk returns a tuple with the Parameters field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParameters + +`func (o *ReceiptError) SetParameters(v []string)` + +SetParameters sets Parameters field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/ReceiptResponse.md b/clients/apiclient/docs/ReceiptResponse.md new file mode 100644 index 0000000000..a535827555 --- /dev/null +++ b/clients/apiclient/docs/ReceiptResponse.md @@ -0,0 +1,203 @@ +# ReceiptResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BlockIndex** | **uint32** | | +**Error** | Pointer to [**ReceiptError**](ReceiptError.md) | | [optional] +**GasBudget** | **string** | The gas budget (uint64 as string) | +**GasBurnLog** | [**[]BurnRecord**](BurnRecord.md) | | +**GasBurned** | **string** | The burned gas (uint64 as string) | +**GasFeeCharged** | **string** | The charged gas fee (uint64 as string) | +**Request** | **string** | | +**RequestIndex** | **uint32** | | + +## Methods + +### NewReceiptResponse + +`func NewReceiptResponse(blockIndex uint32, gasBudget string, gasBurnLog []BurnRecord, gasBurned string, gasFeeCharged string, request string, requestIndex uint32, ) *ReceiptResponse` + +NewReceiptResponse instantiates a new ReceiptResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewReceiptResponseWithDefaults + +`func NewReceiptResponseWithDefaults() *ReceiptResponse` + +NewReceiptResponseWithDefaults instantiates a new ReceiptResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBlockIndex + +`func (o *ReceiptResponse) GetBlockIndex() uint32` + +GetBlockIndex returns the BlockIndex field if non-nil, zero value otherwise. + +### GetBlockIndexOk + +`func (o *ReceiptResponse) GetBlockIndexOk() (*uint32, bool)` + +GetBlockIndexOk returns a tuple with the BlockIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBlockIndex + +`func (o *ReceiptResponse) SetBlockIndex(v uint32)` + +SetBlockIndex sets BlockIndex field to given value. + + +### GetError + +`func (o *ReceiptResponse) GetError() ReceiptError` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *ReceiptResponse) GetErrorOk() (*ReceiptError, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *ReceiptResponse) SetError(v ReceiptError)` + +SetError sets Error field to given value. + +### HasError + +`func (o *ReceiptResponse) HasError() bool` + +HasError returns a boolean if a field has been set. + +### GetGasBudget + +`func (o *ReceiptResponse) GetGasBudget() string` + +GetGasBudget returns the GasBudget field if non-nil, zero value otherwise. + +### GetGasBudgetOk + +`func (o *ReceiptResponse) GetGasBudgetOk() (*string, bool)` + +GetGasBudgetOk returns a tuple with the GasBudget field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBudget + +`func (o *ReceiptResponse) SetGasBudget(v string)` + +SetGasBudget sets GasBudget field to given value. + + +### GetGasBurnLog + +`func (o *ReceiptResponse) GetGasBurnLog() []BurnRecord` + +GetGasBurnLog returns the GasBurnLog field if non-nil, zero value otherwise. + +### GetGasBurnLogOk + +`func (o *ReceiptResponse) GetGasBurnLogOk() (*[]BurnRecord, bool)` + +GetGasBurnLogOk returns a tuple with the GasBurnLog field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurnLog + +`func (o *ReceiptResponse) SetGasBurnLog(v []BurnRecord)` + +SetGasBurnLog sets GasBurnLog field to given value. + + +### GetGasBurned + +`func (o *ReceiptResponse) GetGasBurned() string` + +GetGasBurned returns the GasBurned field if non-nil, zero value otherwise. + +### GetGasBurnedOk + +`func (o *ReceiptResponse) GetGasBurnedOk() (*string, bool)` + +GetGasBurnedOk returns a tuple with the GasBurned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurned + +`func (o *ReceiptResponse) SetGasBurned(v string)` + +SetGasBurned sets GasBurned field to given value. + + +### GetGasFeeCharged + +`func (o *ReceiptResponse) GetGasFeeCharged() string` + +GetGasFeeCharged returns the GasFeeCharged field if non-nil, zero value otherwise. + +### GetGasFeeChargedOk + +`func (o *ReceiptResponse) GetGasFeeChargedOk() (*string, bool)` + +GetGasFeeChargedOk returns a tuple with the GasFeeCharged field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeeCharged + +`func (o *ReceiptResponse) SetGasFeeCharged(v string)` + +SetGasFeeCharged sets GasFeeCharged field to given value. + + +### GetRequest + +`func (o *ReceiptResponse) GetRequest() string` + +GetRequest returns the Request field if non-nil, zero value otherwise. + +### GetRequestOk + +`func (o *ReceiptResponse) GetRequestOk() (*string, bool)` + +GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequest + +`func (o *ReceiptResponse) SetRequest(v string)` + +SetRequest sets Request field to given value. + + +### GetRequestIndex + +`func (o *ReceiptResponse) GetRequestIndex() uint32` + +GetRequestIndex returns the RequestIndex field if non-nil, zero value otherwise. + +### GetRequestIndexOk + +`func (o *ReceiptResponse) GetRequestIndexOk() (*uint32, bool)` + +GetRequestIndexOk returns a tuple with the RequestIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestIndex + +`func (o *ReceiptResponse) SetRequestIndex(v uint32)` + +SetRequestIndex sets RequestIndex field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RentStructure.md b/clients/apiclient/docs/RentStructure.md new file mode 100644 index 0000000000..6c15d4dc9d --- /dev/null +++ b/clients/apiclient/docs/RentStructure.md @@ -0,0 +1,93 @@ +# RentStructure + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VByteCost** | **uint32** | The virtual byte cost | +**VByteFactorData** | **int32** | The virtual byte factor for data fields | +**VByteFactorKey** | **int32** | The virtual byte factor for key/lookup generating fields | + +## Methods + +### NewRentStructure + +`func NewRentStructure(vByteCost uint32, vByteFactorData int32, vByteFactorKey int32, ) *RentStructure` + +NewRentStructure instantiates a new RentStructure object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRentStructureWithDefaults + +`func NewRentStructureWithDefaults() *RentStructure` + +NewRentStructureWithDefaults instantiates a new RentStructure object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetVByteCost + +`func (o *RentStructure) GetVByteCost() uint32` + +GetVByteCost returns the VByteCost field if non-nil, zero value otherwise. + +### GetVByteCostOk + +`func (o *RentStructure) GetVByteCostOk() (*uint32, bool)` + +GetVByteCostOk returns a tuple with the VByteCost field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVByteCost + +`func (o *RentStructure) SetVByteCost(v uint32)` + +SetVByteCost sets VByteCost field to given value. + + +### GetVByteFactorData + +`func (o *RentStructure) GetVByteFactorData() int32` + +GetVByteFactorData returns the VByteFactorData field if non-nil, zero value otherwise. + +### GetVByteFactorDataOk + +`func (o *RentStructure) GetVByteFactorDataOk() (*int32, bool)` + +GetVByteFactorDataOk returns a tuple with the VByteFactorData field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVByteFactorData + +`func (o *RentStructure) SetVByteFactorData(v int32)` + +SetVByteFactorData sets VByteFactorData field to given value. + + +### GetVByteFactorKey + +`func (o *RentStructure) GetVByteFactorKey() int32` + +GetVByteFactorKey returns the VByteFactorKey field if non-nil, zero value otherwise. + +### GetVByteFactorKeyOk + +`func (o *RentStructure) GetVByteFactorKeyOk() (*int32, bool)` + +GetVByteFactorKeyOk returns a tuple with the VByteFactorKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVByteFactorKey + +`func (o *RentStructure) SetVByteFactorKey(v int32)` + +SetVByteFactorKey sets VByteFactorKey field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestDetail.md b/clients/apiclient/docs/RequestDetail.md new file mode 100644 index 0000000000..364d257284 --- /dev/null +++ b/clients/apiclient/docs/RequestDetail.md @@ -0,0 +1,261 @@ +# RequestDetail + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Allowance** | [**Assets**](Assets.md) | | +**CallTarget** | [**CallTarget**](CallTarget.md) | | +**FungibleTokens** | [**Assets**](Assets.md) | | +**GasGudget** | **string** | The gas budget (uint64 as string) | +**IsEVM** | **bool** | | +**IsOffLedger** | **bool** | | +**Nft** | [**NFTDataResponse**](NFTDataResponse.md) | | +**Params** | [**JSONDict**](JSONDict.md) | | +**RequestId** | **string** | | +**SenderAccount** | **string** | | +**TargetAddress** | **string** | | + +## Methods + +### NewRequestDetail + +`func NewRequestDetail(allowance Assets, callTarget CallTarget, fungibleTokens Assets, gasGudget string, isEVM bool, isOffLedger bool, nft NFTDataResponse, params JSONDict, requestId string, senderAccount string, targetAddress string, ) *RequestDetail` + +NewRequestDetail instantiates a new RequestDetail object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRequestDetailWithDefaults + +`func NewRequestDetailWithDefaults() *RequestDetail` + +NewRequestDetailWithDefaults instantiates a new RequestDetail object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetAllowance + +`func (o *RequestDetail) GetAllowance() Assets` + +GetAllowance returns the Allowance field if non-nil, zero value otherwise. + +### GetAllowanceOk + +`func (o *RequestDetail) GetAllowanceOk() (*Assets, bool)` + +GetAllowanceOk returns a tuple with the Allowance field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetAllowance + +`func (o *RequestDetail) SetAllowance(v Assets)` + +SetAllowance sets Allowance field to given value. + + +### GetCallTarget + +`func (o *RequestDetail) GetCallTarget() CallTarget` + +GetCallTarget returns the CallTarget field if non-nil, zero value otherwise. + +### GetCallTargetOk + +`func (o *RequestDetail) GetCallTargetOk() (*CallTarget, bool)` + +GetCallTargetOk returns a tuple with the CallTarget field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetCallTarget + +`func (o *RequestDetail) SetCallTarget(v CallTarget)` + +SetCallTarget sets CallTarget field to given value. + + +### GetFungibleTokens + +`func (o *RequestDetail) GetFungibleTokens() Assets` + +GetFungibleTokens returns the FungibleTokens field if non-nil, zero value otherwise. + +### GetFungibleTokensOk + +`func (o *RequestDetail) GetFungibleTokensOk() (*Assets, bool)` + +GetFungibleTokensOk returns a tuple with the FungibleTokens field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFungibleTokens + +`func (o *RequestDetail) SetFungibleTokens(v Assets)` + +SetFungibleTokens sets FungibleTokens field to given value. + + +### GetGasGudget + +`func (o *RequestDetail) GetGasGudget() string` + +GetGasGudget returns the GasGudget field if non-nil, zero value otherwise. + +### GetGasGudgetOk + +`func (o *RequestDetail) GetGasGudgetOk() (*string, bool)` + +GetGasGudgetOk returns a tuple with the GasGudget field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasGudget + +`func (o *RequestDetail) SetGasGudget(v string)` + +SetGasGudget sets GasGudget field to given value. + + +### GetIsEVM + +`func (o *RequestDetail) GetIsEVM() bool` + +GetIsEVM returns the IsEVM field if non-nil, zero value otherwise. + +### GetIsEVMOk + +`func (o *RequestDetail) GetIsEVMOk() (*bool, bool)` + +GetIsEVMOk returns a tuple with the IsEVM field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsEVM + +`func (o *RequestDetail) SetIsEVM(v bool)` + +SetIsEVM sets IsEVM field to given value. + + +### GetIsOffLedger + +`func (o *RequestDetail) GetIsOffLedger() bool` + +GetIsOffLedger returns the IsOffLedger field if non-nil, zero value otherwise. + +### GetIsOffLedgerOk + +`func (o *RequestDetail) GetIsOffLedgerOk() (*bool, bool)` + +GetIsOffLedgerOk returns a tuple with the IsOffLedger field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsOffLedger + +`func (o *RequestDetail) SetIsOffLedger(v bool)` + +SetIsOffLedger sets IsOffLedger field to given value. + + +### GetNft + +`func (o *RequestDetail) GetNft() NFTDataResponse` + +GetNft returns the Nft field if non-nil, zero value otherwise. + +### GetNftOk + +`func (o *RequestDetail) GetNftOk() (*NFTDataResponse, bool)` + +GetNftOk returns a tuple with the Nft field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetNft + +`func (o *RequestDetail) SetNft(v NFTDataResponse)` + +SetNft sets Nft field to given value. + + +### GetParams + +`func (o *RequestDetail) GetParams() JSONDict` + +GetParams returns the Params field if non-nil, zero value otherwise. + +### GetParamsOk + +`func (o *RequestDetail) GetParamsOk() (*JSONDict, bool)` + +GetParamsOk returns a tuple with the Params field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetParams + +`func (o *RequestDetail) SetParams(v JSONDict)` + +SetParams sets Params field to given value. + + +### GetRequestId + +`func (o *RequestDetail) GetRequestId() string` + +GetRequestId returns the RequestId field if non-nil, zero value otherwise. + +### GetRequestIdOk + +`func (o *RequestDetail) GetRequestIdOk() (*string, bool)` + +GetRequestIdOk returns a tuple with the RequestId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestId + +`func (o *RequestDetail) SetRequestId(v string)` + +SetRequestId sets RequestId field to given value. + + +### GetSenderAccount + +`func (o *RequestDetail) GetSenderAccount() string` + +GetSenderAccount returns the SenderAccount field if non-nil, zero value otherwise. + +### GetSenderAccountOk + +`func (o *RequestDetail) GetSenderAccountOk() (*string, bool)` + +GetSenderAccountOk returns a tuple with the SenderAccount field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSenderAccount + +`func (o *RequestDetail) SetSenderAccount(v string)` + +SetSenderAccount sets SenderAccount field to given value. + + +### GetTargetAddress + +`func (o *RequestDetail) GetTargetAddress() string` + +GetTargetAddress returns the TargetAddress field if non-nil, zero value otherwise. + +### GetTargetAddressOk + +`func (o *RequestDetail) GetTargetAddressOk() (*string, bool)` + +GetTargetAddressOk returns a tuple with the TargetAddress field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTargetAddress + +`func (o *RequestDetail) SetTargetAddress(v string)` + +SetTargetAddress sets TargetAddress field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestIDResponse.md b/clients/apiclient/docs/RequestIDResponse.md new file mode 100644 index 0000000000..c3518a7b19 --- /dev/null +++ b/clients/apiclient/docs/RequestIDResponse.md @@ -0,0 +1,51 @@ +# RequestIDResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequestId** | **string** | The request ID of the given transaction ID. (Hex) | + +## Methods + +### NewRequestIDResponse + +`func NewRequestIDResponse(requestId string, ) *RequestIDResponse` + +NewRequestIDResponse instantiates a new RequestIDResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRequestIDResponseWithDefaults + +`func NewRequestIDResponseWithDefaults() *RequestIDResponse` + +NewRequestIDResponseWithDefaults instantiates a new RequestIDResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetRequestId + +`func (o *RequestIDResponse) GetRequestId() string` + +GetRequestId returns the RequestId field if non-nil, zero value otherwise. + +### GetRequestIdOk + +`func (o *RequestIDResponse) GetRequestIdOk() (*string, bool)` + +GetRequestIdOk returns a tuple with the RequestId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestId + +`func (o *RequestIDResponse) SetRequestId(v string)` + +SetRequestId sets RequestId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestIDsResponse.md b/clients/apiclient/docs/RequestIDsResponse.md new file mode 100644 index 0000000000..dd172564a0 --- /dev/null +++ b/clients/apiclient/docs/RequestIDsResponse.md @@ -0,0 +1,51 @@ +# RequestIDsResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequestIds** | **[]string** | | + +## Methods + +### NewRequestIDsResponse + +`func NewRequestIDsResponse(requestIds []string, ) *RequestIDsResponse` + +NewRequestIDsResponse instantiates a new RequestIDsResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRequestIDsResponseWithDefaults + +`func NewRequestIDsResponseWithDefaults() *RequestIDsResponse` + +NewRequestIDsResponseWithDefaults instantiates a new RequestIDsResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetRequestIds + +`func (o *RequestIDsResponse) GetRequestIds() []string` + +GetRequestIds returns the RequestIds field if non-nil, zero value otherwise. + +### GetRequestIdsOk + +`func (o *RequestIDsResponse) GetRequestIdsOk() (*[]string, bool)` + +GetRequestIdsOk returns a tuple with the RequestIds field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestIds + +`func (o *RequestIDsResponse) SetRequestIds(v []string)` + +SetRequestIds sets RequestIds field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestProcessedResponse.md b/clients/apiclient/docs/RequestProcessedResponse.md new file mode 100644 index 0000000000..13b524fc52 --- /dev/null +++ b/clients/apiclient/docs/RequestProcessedResponse.md @@ -0,0 +1,93 @@ +# RequestProcessedResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ChainId** | **string** | | +**IsProcessed** | **bool** | | +**RequestId** | **string** | | + +## Methods + +### NewRequestProcessedResponse + +`func NewRequestProcessedResponse(chainId string, isProcessed bool, requestId string, ) *RequestProcessedResponse` + +NewRequestProcessedResponse instantiates a new RequestProcessedResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRequestProcessedResponseWithDefaults + +`func NewRequestProcessedResponseWithDefaults() *RequestProcessedResponse` + +NewRequestProcessedResponseWithDefaults instantiates a new RequestProcessedResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetChainId + +`func (o *RequestProcessedResponse) GetChainId() string` + +GetChainId returns the ChainId field if non-nil, zero value otherwise. + +### GetChainIdOk + +`func (o *RequestProcessedResponse) GetChainIdOk() (*string, bool)` + +GetChainIdOk returns a tuple with the ChainId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetChainId + +`func (o *RequestProcessedResponse) SetChainId(v string)` + +SetChainId sets ChainId field to given value. + + +### GetIsProcessed + +`func (o *RequestProcessedResponse) GetIsProcessed() bool` + +GetIsProcessed returns the IsProcessed field if non-nil, zero value otherwise. + +### GetIsProcessedOk + +`func (o *RequestProcessedResponse) GetIsProcessedOk() (*bool, bool)` + +GetIsProcessedOk returns a tuple with the IsProcessed field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsProcessed + +`func (o *RequestProcessedResponse) SetIsProcessed(v bool)` + +SetIsProcessed sets IsProcessed field to given value. + + +### GetRequestId + +`func (o *RequestProcessedResponse) GetRequestId() string` + +GetRequestId returns the RequestId field if non-nil, zero value otherwise. + +### GetRequestIdOk + +`func (o *RequestProcessedResponse) GetRequestIdOk() (*string, bool)` + +GetRequestIdOk returns a tuple with the RequestId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestId + +`func (o *RequestProcessedResponse) SetRequestId(v string)` + +SetRequestId sets RequestId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestReceiptResponse.md b/clients/apiclient/docs/RequestReceiptResponse.md new file mode 100644 index 0000000000..cd16b98841 --- /dev/null +++ b/clients/apiclient/docs/RequestReceiptResponse.md @@ -0,0 +1,203 @@ +# RequestReceiptResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**BlockIndex** | **uint32** | | +**Error** | Pointer to [**BlockReceiptError**](BlockReceiptError.md) | | [optional] +**GasBudget** | **string** | The gas budget (uint64 as string) | +**GasBurnLog** | [**BurnLog**](BurnLog.md) | | +**GasBurned** | **string** | The burned gas (uint64 as string) | +**GasFeeCharged** | **string** | The charged gas fee (uint64 as string) | +**Request** | [**RequestDetail**](RequestDetail.md) | | +**RequestIndex** | **uint32** | | + +## Methods + +### NewRequestReceiptResponse + +`func NewRequestReceiptResponse(blockIndex uint32, gasBudget string, gasBurnLog BurnLog, gasBurned string, gasFeeCharged string, request RequestDetail, requestIndex uint32, ) *RequestReceiptResponse` + +NewRequestReceiptResponse instantiates a new RequestReceiptResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewRequestReceiptResponseWithDefaults + +`func NewRequestReceiptResponseWithDefaults() *RequestReceiptResponse` + +NewRequestReceiptResponseWithDefaults instantiates a new RequestReceiptResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetBlockIndex + +`func (o *RequestReceiptResponse) GetBlockIndex() uint32` + +GetBlockIndex returns the BlockIndex field if non-nil, zero value otherwise. + +### GetBlockIndexOk + +`func (o *RequestReceiptResponse) GetBlockIndexOk() (*uint32, bool)` + +GetBlockIndexOk returns a tuple with the BlockIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetBlockIndex + +`func (o *RequestReceiptResponse) SetBlockIndex(v uint32)` + +SetBlockIndex sets BlockIndex field to given value. + + +### GetError + +`func (o *RequestReceiptResponse) GetError() BlockReceiptError` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *RequestReceiptResponse) GetErrorOk() (*BlockReceiptError, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *RequestReceiptResponse) SetError(v BlockReceiptError)` + +SetError sets Error field to given value. + +### HasError + +`func (o *RequestReceiptResponse) HasError() bool` + +HasError returns a boolean if a field has been set. + +### GetGasBudget + +`func (o *RequestReceiptResponse) GetGasBudget() string` + +GetGasBudget returns the GasBudget field if non-nil, zero value otherwise. + +### GetGasBudgetOk + +`func (o *RequestReceiptResponse) GetGasBudgetOk() (*string, bool)` + +GetGasBudgetOk returns a tuple with the GasBudget field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBudget + +`func (o *RequestReceiptResponse) SetGasBudget(v string)` + +SetGasBudget sets GasBudget field to given value. + + +### GetGasBurnLog + +`func (o *RequestReceiptResponse) GetGasBurnLog() BurnLog` + +GetGasBurnLog returns the GasBurnLog field if non-nil, zero value otherwise. + +### GetGasBurnLogOk + +`func (o *RequestReceiptResponse) GetGasBurnLogOk() (*BurnLog, bool)` + +GetGasBurnLogOk returns a tuple with the GasBurnLog field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurnLog + +`func (o *RequestReceiptResponse) SetGasBurnLog(v BurnLog)` + +SetGasBurnLog sets GasBurnLog field to given value. + + +### GetGasBurned + +`func (o *RequestReceiptResponse) GetGasBurned() string` + +GetGasBurned returns the GasBurned field if non-nil, zero value otherwise. + +### GetGasBurnedOk + +`func (o *RequestReceiptResponse) GetGasBurnedOk() (*string, bool)` + +GetGasBurnedOk returns a tuple with the GasBurned field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasBurned + +`func (o *RequestReceiptResponse) SetGasBurned(v string)` + +SetGasBurned sets GasBurned field to given value. + + +### GetGasFeeCharged + +`func (o *RequestReceiptResponse) GetGasFeeCharged() string` + +GetGasFeeCharged returns the GasFeeCharged field if non-nil, zero value otherwise. + +### GetGasFeeChargedOk + +`func (o *RequestReceiptResponse) GetGasFeeChargedOk() (*string, bool)` + +GetGasFeeChargedOk returns a tuple with the GasFeeCharged field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetGasFeeCharged + +`func (o *RequestReceiptResponse) SetGasFeeCharged(v string)` + +SetGasFeeCharged sets GasFeeCharged field to given value. + + +### GetRequest + +`func (o *RequestReceiptResponse) GetRequest() RequestDetail` + +GetRequest returns the Request field if non-nil, zero value otherwise. + +### GetRequestOk + +`func (o *RequestReceiptResponse) GetRequestOk() (*RequestDetail, bool)` + +GetRequestOk returns a tuple with the Request field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequest + +`func (o *RequestReceiptResponse) SetRequest(v RequestDetail)` + +SetRequest sets Request field to given value. + + +### GetRequestIndex + +`func (o *RequestReceiptResponse) GetRequestIndex() uint32` + +GetRequestIndex returns the RequestIndex field if non-nil, zero value otherwise. + +### GetRequestIndexOk + +`func (o *RequestReceiptResponse) GetRequestIndexOk() (*uint32, bool)` + +GetRequestIndexOk returns a tuple with the RequestIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetRequestIndex + +`func (o *RequestReceiptResponse) SetRequestIndex(v uint32)` + +SetRequestIndex sets RequestIndex field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/RequestsApi.md b/clients/apiclient/docs/RequestsApi.md new file mode 100644 index 0000000000..616f6a60ea --- /dev/null +++ b/clients/apiclient/docs/RequestsApi.md @@ -0,0 +1,284 @@ +# \RequestsApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CallView**](RequestsApi.md#CallView) | **Post** /requests/callview | Call a view function on a contract by Hname +[**GetReceipt**](RequestsApi.md#GetReceipt) | **Get** /chains/{chainID}/receipts/{requestID} | Get a receipt from a request ID +[**OffLedger**](RequestsApi.md#OffLedger) | **Post** /requests/offledger | Post an off-ledger request +[**WaitForRequest**](RequestsApi.md#WaitForRequest) | **Get** /chains/{chainID}/requests/{requestID}/wait | Wait until the given request has been processed by the node + + + +## CallView + +> JSONDict CallView(ctx).ContractCallViewRequest(contractCallViewRequest).Execute() + +Call a view function on a contract by Hname + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + contractCallViewRequest := *openapiclient.NewContractCallViewRequest(*openapiclient.NewJSONDict(), "ChainId_example", "ContractHName_example", "ContractName_example", "FunctionHName_example", "FunctionName_example") // ContractCallViewRequest | Parameters + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RequestsApi.CallView(context.Background()).ContractCallViewRequest(contractCallViewRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RequestsApi.CallView``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `CallView`: JSONDict + fmt.Fprintf(os.Stdout, "Response from `RequestsApi.CallView`: %v\n", resp) +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiCallViewRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contractCallViewRequest** | [**ContractCallViewRequest**](ContractCallViewRequest.md) | Parameters | + +### Return type + +[**JSONDict**](JSONDict.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetReceipt + +> ReceiptResponse GetReceipt(ctx, chainID, requestID).Execute() + +Get a receipt from a request ID + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + requestID := "requestID_example" // string | RequestID (Hex) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RequestsApi.GetReceipt(context.Background(), chainID, requestID).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RequestsApi.GetReceipt``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetReceipt`: ReceiptResponse + fmt.Fprintf(os.Stdout, "Response from `RequestsApi.GetReceipt`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**requestID** | **string** | RequestID (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetReceiptRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +[**ReceiptResponse**](ReceiptResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## OffLedger + +> OffLedger(ctx).OffLedgerRequest(offLedgerRequest).Execute() + +Post an off-ledger request + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + offLedgerRequest := *openapiclient.NewOffLedgerRequest("ChainId_example", "Hex string") // OffLedgerRequest | Offledger request as JSON. Request encoded in Hex + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RequestsApi.OffLedger(context.Background()).OffLedgerRequest(offLedgerRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RequestsApi.OffLedger``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiOffLedgerRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **offLedgerRequest** | [**OffLedgerRequest**](OffLedgerRequest.md) | Offledger request as JSON. Request encoded in Hex | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## WaitForRequest + +> ReceiptResponse WaitForRequest(ctx, chainID, requestID).TimeoutSeconds(timeoutSeconds).Execute() + +Wait until the given request has been processed by the node + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + chainID := "chainID_example" // string | ChainID (Bech32) + requestID := "requestID_example" // string | RequestID (Hex) + timeoutSeconds := int32(56) // int32 | The timeout in seconds (optional) + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.RequestsApi.WaitForRequest(context.Background(), chainID, requestID).TimeoutSeconds(timeoutSeconds).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `RequestsApi.WaitForRequest``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `WaitForRequest`: ReceiptResponse + fmt.Fprintf(os.Stdout, "Response from `RequestsApi.WaitForRequest`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**chainID** | **string** | ChainID (Bech32) | +**requestID** | **string** | RequestID (Hex) | + +### Other Parameters + +Other parameters are passed through a pointer to a apiWaitForRequestRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + **timeoutSeconds** | **int32** | The timeout in seconds | + +### Return type + +[**ReceiptResponse**](ReceiptResponse.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/StateResponse.md b/clients/apiclient/docs/StateResponse.md new file mode 100644 index 0000000000..59055ebf7f --- /dev/null +++ b/clients/apiclient/docs/StateResponse.md @@ -0,0 +1,51 @@ +# StateResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**State** | **string** | The state of the requested key (Hex-encoded) | + +## Methods + +### NewStateResponse + +`func NewStateResponse(state string, ) *StateResponse` + +NewStateResponse instantiates a new StateResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewStateResponseWithDefaults + +`func NewStateResponseWithDefaults() *StateResponse` + +NewStateResponseWithDefaults instantiates a new StateResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetState + +`func (o *StateResponse) GetState() string` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *StateResponse) GetStateOk() (*string, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *StateResponse) SetState(v string)` + +SetState sets State field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/StateTransaction.md b/clients/apiclient/docs/StateTransaction.md new file mode 100644 index 0000000000..e9e4869736 --- /dev/null +++ b/clients/apiclient/docs/StateTransaction.md @@ -0,0 +1,72 @@ +# StateTransaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**StateIndex** | **uint32** | The state index | +**TxId** | **string** | The transaction ID | + +## Methods + +### NewStateTransaction + +`func NewStateTransaction(stateIndex uint32, txId string, ) *StateTransaction` + +NewStateTransaction instantiates a new StateTransaction object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewStateTransactionWithDefaults + +`func NewStateTransactionWithDefaults() *StateTransaction` + +NewStateTransactionWithDefaults instantiates a new StateTransaction object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetStateIndex + +`func (o *StateTransaction) GetStateIndex() uint32` + +GetStateIndex returns the StateIndex field if non-nil, zero value otherwise. + +### GetStateIndexOk + +`func (o *StateTransaction) GetStateIndexOk() (*uint32, bool)` + +GetStateIndexOk returns a tuple with the StateIndex field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetStateIndex + +`func (o *StateTransaction) SetStateIndex(v uint32)` + +SetStateIndex sets StateIndex field to given value. + + +### GetTxId + +`func (o *StateTransaction) GetTxId() string` + +GetTxId returns the TxId field if non-nil, zero value otherwise. + +### GetTxIdOk + +`func (o *StateTransaction) GetTxIdOk() (*string, bool)` + +GetTxIdOk returns a tuple with the TxId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxId + +`func (o *StateTransaction) SetTxId(v string)` + +SetTxId sets TxId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/Transaction.md b/clients/apiclient/docs/Transaction.md new file mode 100644 index 0000000000..c3e4350af9 --- /dev/null +++ b/clients/apiclient/docs/Transaction.md @@ -0,0 +1,51 @@ +# Transaction + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TxId** | **string** | The transaction ID | + +## Methods + +### NewTransaction + +`func NewTransaction(txId string, ) *Transaction` + +NewTransaction instantiates a new Transaction object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTransactionWithDefaults + +`func NewTransactionWithDefaults() *Transaction` + +NewTransactionWithDefaults instantiates a new Transaction object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetTxId + +`func (o *Transaction) GetTxId() string` + +GetTxId returns the TxId field if non-nil, zero value otherwise. + +### GetTxIdOk + +`func (o *Transaction) GetTxIdOk() (*string, bool)` + +GetTxIdOk returns a tuple with the TxId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxId + +`func (o *Transaction) SetTxId(v string)` + +SetTxId sets TxId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/TransactionIDMetricItem.md b/clients/apiclient/docs/TransactionIDMetricItem.md new file mode 100644 index 0000000000..d3ab06079f --- /dev/null +++ b/clients/apiclient/docs/TransactionIDMetricItem.md @@ -0,0 +1,93 @@ +# TransactionIDMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**Transaction**](Transaction.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewTransactionIDMetricItem + +`func NewTransactionIDMetricItem(lastMessage Transaction, messages uint32, timestamp time.Time, ) *TransactionIDMetricItem` + +NewTransactionIDMetricItem instantiates a new TransactionIDMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTransactionIDMetricItemWithDefaults + +`func NewTransactionIDMetricItemWithDefaults() *TransactionIDMetricItem` + +NewTransactionIDMetricItemWithDefaults instantiates a new TransactionIDMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *TransactionIDMetricItem) GetLastMessage() Transaction` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *TransactionIDMetricItem) GetLastMessageOk() (*Transaction, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *TransactionIDMetricItem) SetLastMessage(v Transaction)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *TransactionIDMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *TransactionIDMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *TransactionIDMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *TransactionIDMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *TransactionIDMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *TransactionIDMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/TransactionMetricItem.md b/clients/apiclient/docs/TransactionMetricItem.md new file mode 100644 index 0000000000..52a6864a0a --- /dev/null +++ b/clients/apiclient/docs/TransactionMetricItem.md @@ -0,0 +1,93 @@ +# TransactionMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**Transaction**](Transaction.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewTransactionMetricItem + +`func NewTransactionMetricItem(lastMessage Transaction, messages uint32, timestamp time.Time, ) *TransactionMetricItem` + +NewTransactionMetricItem instantiates a new TransactionMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTransactionMetricItemWithDefaults + +`func NewTransactionMetricItemWithDefaults() *TransactionMetricItem` + +NewTransactionMetricItemWithDefaults instantiates a new TransactionMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *TransactionMetricItem) GetLastMessage() Transaction` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *TransactionMetricItem) GetLastMessageOk() (*Transaction, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *TransactionMetricItem) SetLastMessage(v Transaction)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *TransactionMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *TransactionMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *TransactionMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *TransactionMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *TransactionMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *TransactionMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/TxInclusionStateMsg.md b/clients/apiclient/docs/TxInclusionStateMsg.md new file mode 100644 index 0000000000..5a8abdfbf9 --- /dev/null +++ b/clients/apiclient/docs/TxInclusionStateMsg.md @@ -0,0 +1,72 @@ +# TxInclusionStateMsg + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**State** | **string** | The inclusion state | +**TxId** | **string** | The transaction ID | + +## Methods + +### NewTxInclusionStateMsg + +`func NewTxInclusionStateMsg(state string, txId string, ) *TxInclusionStateMsg` + +NewTxInclusionStateMsg instantiates a new TxInclusionStateMsg object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTxInclusionStateMsgWithDefaults + +`func NewTxInclusionStateMsgWithDefaults() *TxInclusionStateMsg` + +NewTxInclusionStateMsgWithDefaults instantiates a new TxInclusionStateMsg object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetState + +`func (o *TxInclusionStateMsg) GetState() string` + +GetState returns the State field if non-nil, zero value otherwise. + +### GetStateOk + +`func (o *TxInclusionStateMsg) GetStateOk() (*string, bool)` + +GetStateOk returns a tuple with the State field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetState + +`func (o *TxInclusionStateMsg) SetState(v string)` + +SetState sets State field to given value. + + +### GetTxId + +`func (o *TxInclusionStateMsg) GetTxId() string` + +GetTxId returns the TxId field if non-nil, zero value otherwise. + +### GetTxIdOk + +`func (o *TxInclusionStateMsg) GetTxIdOk() (*string, bool)` + +GetTxIdOk returns a tuple with the TxId field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTxId + +`func (o *TxInclusionStateMsg) SetTxId(v string)` + +SetTxId sets TxId field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/TxInclusionStateMsgMetricItem.md b/clients/apiclient/docs/TxInclusionStateMsgMetricItem.md new file mode 100644 index 0000000000..7a93d347a3 --- /dev/null +++ b/clients/apiclient/docs/TxInclusionStateMsgMetricItem.md @@ -0,0 +1,93 @@ +# TxInclusionStateMsgMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**TxInclusionStateMsg**](TxInclusionStateMsg.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewTxInclusionStateMsgMetricItem + +`func NewTxInclusionStateMsgMetricItem(lastMessage TxInclusionStateMsg, messages uint32, timestamp time.Time, ) *TxInclusionStateMsgMetricItem` + +NewTxInclusionStateMsgMetricItem instantiates a new TxInclusionStateMsgMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTxInclusionStateMsgMetricItemWithDefaults + +`func NewTxInclusionStateMsgMetricItemWithDefaults() *TxInclusionStateMsgMetricItem` + +NewTxInclusionStateMsgMetricItemWithDefaults instantiates a new TxInclusionStateMsgMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *TxInclusionStateMsgMetricItem) GetLastMessage() TxInclusionStateMsg` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *TxInclusionStateMsgMetricItem) GetLastMessageOk() (*TxInclusionStateMsg, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *TxInclusionStateMsgMetricItem) SetLastMessage(v TxInclusionStateMsg)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *TxInclusionStateMsgMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *TxInclusionStateMsgMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *TxInclusionStateMsgMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *TxInclusionStateMsgMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *TxInclusionStateMsgMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *TxInclusionStateMsgMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/UTXOInputMetricItem.md b/clients/apiclient/docs/UTXOInputMetricItem.md new file mode 100644 index 0000000000..7881ee67e7 --- /dev/null +++ b/clients/apiclient/docs/UTXOInputMetricItem.md @@ -0,0 +1,93 @@ +# UTXOInputMetricItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LastMessage** | [**OutputID**](OutputID.md) | | +**Messages** | **uint32** | | +**Timestamp** | **time.Time** | | + +## Methods + +### NewUTXOInputMetricItem + +`func NewUTXOInputMetricItem(lastMessage OutputID, messages uint32, timestamp time.Time, ) *UTXOInputMetricItem` + +NewUTXOInputMetricItem instantiates a new UTXOInputMetricItem object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUTXOInputMetricItemWithDefaults + +`func NewUTXOInputMetricItemWithDefaults() *UTXOInputMetricItem` + +NewUTXOInputMetricItemWithDefaults instantiates a new UTXOInputMetricItem object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetLastMessage + +`func (o *UTXOInputMetricItem) GetLastMessage() OutputID` + +GetLastMessage returns the LastMessage field if non-nil, zero value otherwise. + +### GetLastMessageOk + +`func (o *UTXOInputMetricItem) GetLastMessageOk() (*OutputID, bool)` + +GetLastMessageOk returns a tuple with the LastMessage field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetLastMessage + +`func (o *UTXOInputMetricItem) SetLastMessage(v OutputID)` + +SetLastMessage sets LastMessage field to given value. + + +### GetMessages + +`func (o *UTXOInputMetricItem) GetMessages() uint32` + +GetMessages returns the Messages field if non-nil, zero value otherwise. + +### GetMessagesOk + +`func (o *UTXOInputMetricItem) GetMessagesOk() (*uint32, bool)` + +GetMessagesOk returns a tuple with the Messages field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMessages + +`func (o *UTXOInputMetricItem) SetMessages(v uint32)` + +SetMessages sets Messages field to given value. + + +### GetTimestamp + +`func (o *UTXOInputMetricItem) GetTimestamp() time.Time` + +GetTimestamp returns the Timestamp field if non-nil, zero value otherwise. + +### GetTimestampOk + +`func (o *UTXOInputMetricItem) GetTimestampOk() (*time.Time, bool)` + +GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTimestamp + +`func (o *UTXOInputMetricItem) SetTimestamp(v time.Time)` + +SetTimestamp sets Timestamp field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/UpdateUserPasswordRequest.md b/clients/apiclient/docs/UpdateUserPasswordRequest.md new file mode 100644 index 0000000000..bc7fb2ee7b --- /dev/null +++ b/clients/apiclient/docs/UpdateUserPasswordRequest.md @@ -0,0 +1,51 @@ +# UpdateUserPasswordRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Password** | **string** | | + +## Methods + +### NewUpdateUserPasswordRequest + +`func NewUpdateUserPasswordRequest(password string, ) *UpdateUserPasswordRequest` + +NewUpdateUserPasswordRequest instantiates a new UpdateUserPasswordRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateUserPasswordRequestWithDefaults + +`func NewUpdateUserPasswordRequestWithDefaults() *UpdateUserPasswordRequest` + +NewUpdateUserPasswordRequestWithDefaults instantiates a new UpdateUserPasswordRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPassword + +`func (o *UpdateUserPasswordRequest) GetPassword() string` + +GetPassword returns the Password field if non-nil, zero value otherwise. + +### GetPasswordOk + +`func (o *UpdateUserPasswordRequest) GetPasswordOk() (*string, bool)` + +GetPasswordOk returns a tuple with the Password field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPassword + +`func (o *UpdateUserPasswordRequest) SetPassword(v string)` + +SetPassword sets Password field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/UpdateUserPermissionsRequest.md b/clients/apiclient/docs/UpdateUserPermissionsRequest.md new file mode 100644 index 0000000000..02caa8931c --- /dev/null +++ b/clients/apiclient/docs/UpdateUserPermissionsRequest.md @@ -0,0 +1,51 @@ +# UpdateUserPermissionsRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Permissions** | **[]string** | | + +## Methods + +### NewUpdateUserPermissionsRequest + +`func NewUpdateUserPermissionsRequest(permissions []string, ) *UpdateUserPermissionsRequest` + +NewUpdateUserPermissionsRequest instantiates a new UpdateUserPermissionsRequest object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUpdateUserPermissionsRequestWithDefaults + +`func NewUpdateUserPermissionsRequestWithDefaults() *UpdateUserPermissionsRequest` + +NewUpdateUserPermissionsRequestWithDefaults instantiates a new UpdateUserPermissionsRequest object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPermissions + +`func (o *UpdateUserPermissionsRequest) GetPermissions() []string` + +GetPermissions returns the Permissions field if non-nil, zero value otherwise. + +### GetPermissionsOk + +`func (o *UpdateUserPermissionsRequest) GetPermissionsOk() (*[]string, bool)` + +GetPermissionsOk returns a tuple with the Permissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPermissions + +`func (o *UpdateUserPermissionsRequest) SetPermissions(v []string)` + +SetPermissions sets Permissions field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/User.md b/clients/apiclient/docs/User.md new file mode 100644 index 0000000000..3ac52a3937 --- /dev/null +++ b/clients/apiclient/docs/User.md @@ -0,0 +1,72 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Permissions** | **[]string** | | +**Username** | **string** | | + +## Methods + +### NewUser + +`func NewUser(permissions []string, username string, ) *User` + +NewUser instantiates a new User object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewUserWithDefaults + +`func NewUserWithDefaults() *User` + +NewUserWithDefaults instantiates a new User object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetPermissions + +`func (o *User) GetPermissions() []string` + +GetPermissions returns the Permissions field if non-nil, zero value otherwise. + +### GetPermissionsOk + +`func (o *User) GetPermissionsOk() (*[]string, bool)` + +GetPermissionsOk returns a tuple with the Permissions field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetPermissions + +`func (o *User) SetPermissions(v []string)` + +SetPermissions sets Permissions field to given value. + + +### GetUsername + +`func (o *User) GetUsername() string` + +GetUsername returns the Username field if non-nil, zero value otherwise. + +### GetUsernameOk + +`func (o *User) GetUsernameOk() (*string, bool)` + +GetUsernameOk returns a tuple with the Username field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetUsername + +`func (o *User) SetUsername(v string)` + +SetUsername sets Username field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/UsersApi.md b/clients/apiclient/docs/UsersApi.md new file mode 100644 index 0000000000..e8e49e2f5a --- /dev/null +++ b/clients/apiclient/docs/UsersApi.md @@ -0,0 +1,405 @@ +# \UsersApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddUser**](UsersApi.md#AddUser) | **Post** /users | Add a user +[**ChangeUserPassword**](UsersApi.md#ChangeUserPassword) | **Put** /users/{username}/password | Change user password +[**ChangeUserPermissions**](UsersApi.md#ChangeUserPermissions) | **Put** /users/{username}/permissions | Change user permissions +[**DeleteUser**](UsersApi.md#DeleteUser) | **Delete** /users/{username} | Deletes a user +[**GetUser**](UsersApi.md#GetUser) | **Get** /users/{username} | Get a user +[**GetUsers**](UsersApi.md#GetUsers) | **Get** /users | Get a list of all users + + + +## AddUser + +> AddUser(ctx).AddUserRequest(addUserRequest).Execute() + +Add a user + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + addUserRequest := *openapiclient.NewAddUserRequest("Password_example", []string{"Permissions_example"}, "Username_example") // AddUserRequest | The user data + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.AddUser(context.Background()).AddUserRequest(addUserRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.AddUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiAddUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **addUserRequest** | [**AddUserRequest**](AddUserRequest.md) | The user data | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChangeUserPassword + +> ChangeUserPassword(ctx, username).UpdateUserPasswordRequest(updateUserPasswordRequest).Execute() + +Change user password + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The username. + updateUserPasswordRequest := *openapiclient.NewUpdateUserPasswordRequest("Password_example") // UpdateUserPasswordRequest | The users new password + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.ChangeUserPassword(context.Background(), username).UpdateUserPasswordRequest(updateUserPasswordRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ChangeUserPassword``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The username. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiChangeUserPasswordRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateUserPasswordRequest** | [**UpdateUserPasswordRequest**](UpdateUserPasswordRequest.md) | The users new password | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ChangeUserPermissions + +> ChangeUserPermissions(ctx, username).UpdateUserPermissionsRequest(updateUserPermissionsRequest).Execute() + +Change user permissions + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The username. + updateUserPermissionsRequest := *openapiclient.NewUpdateUserPermissionsRequest([]string{"Permissions_example"}) // UpdateUserPermissionsRequest | The users new permissions + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.ChangeUserPermissions(context.Background(), username).UpdateUserPermissionsRequest(updateUserPermissionsRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.ChangeUserPermissions``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The username. | + +### Other Parameters + +Other parameters are passed through a pointer to a apiChangeUserPermissionsRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **updateUserPermissionsRequest** | [**UpdateUserPermissionsRequest**](UpdateUserPermissionsRequest.md) | The users new permissions | + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUser + +> DeleteUser(ctx, username).Execute() + +Deletes a user + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.DeleteUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.DeleteUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiDeleteUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUser + +> User GetUser(ctx, username).Execute() + +Get a user + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + username := "username_example" // string | The username + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.GetUser(context.Background(), username).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUser``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUser`: User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetUser`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string** | The username | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUserRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +[**User**](User.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUsers + +> []User GetUsers(ctx).Execute() + +Get a list of all users + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.UsersApi.GetUsers(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `UsersApi.GetUsers``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetUsers`: []User + fmt.Fprintf(os.Stdout, "Response from `UsersApi.GetUsers`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetUsersRequest struct via the builder pattern + + +### Return type + +[**[]User**](User.md) + +### Authorization + +[Authorization](../README.md#Authorization) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/clients/apiclient/docs/ValidationError.md b/clients/apiclient/docs/ValidationError.md new file mode 100644 index 0000000000..fa751268f4 --- /dev/null +++ b/clients/apiclient/docs/ValidationError.md @@ -0,0 +1,72 @@ +# ValidationError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Error** | **string** | | +**MissingPermission** | **string** | | + +## Methods + +### NewValidationError + +`func NewValidationError(error_ string, missingPermission string, ) *ValidationError` + +NewValidationError instantiates a new ValidationError object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewValidationErrorWithDefaults + +`func NewValidationErrorWithDefaults() *ValidationError` + +NewValidationErrorWithDefaults instantiates a new ValidationError object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetError + +`func (o *ValidationError) GetError() string` + +GetError returns the Error field if non-nil, zero value otherwise. + +### GetErrorOk + +`func (o *ValidationError) GetErrorOk() (*string, bool)` + +GetErrorOk returns a tuple with the Error field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetError + +`func (o *ValidationError) SetError(v string)` + +SetError sets Error field to given value. + + +### GetMissingPermission + +`func (o *ValidationError) GetMissingPermission() string` + +GetMissingPermission returns the MissingPermission field if non-nil, zero value otherwise. + +### GetMissingPermissionOk + +`func (o *ValidationError) GetMissingPermissionOk() (*string, bool)` + +GetMissingPermissionOk returns a tuple with the MissingPermission field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMissingPermission + +`func (o *ValidationError) SetMissingPermission(v string)` + +SetMissingPermission sets MissingPermission field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/docs/VersionResponse.md b/clients/apiclient/docs/VersionResponse.md new file mode 100644 index 0000000000..9f7f6e5172 --- /dev/null +++ b/clients/apiclient/docs/VersionResponse.md @@ -0,0 +1,51 @@ +# VersionResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Version** | **string** | The version of the node | + +## Methods + +### NewVersionResponse + +`func NewVersionResponse(version string, ) *VersionResponse` + +NewVersionResponse instantiates a new VersionResponse object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewVersionResponseWithDefaults + +`func NewVersionResponseWithDefaults() *VersionResponse` + +NewVersionResponseWithDefaults instantiates a new VersionResponse object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetVersion + +`func (o *VersionResponse) GetVersion() string` + +GetVersion returns the Version field if non-nil, zero value otherwise. + +### GetVersionOk + +`func (o *VersionResponse) GetVersionOk() (*string, bool)` + +GetVersionOk returns a tuple with the Version field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetVersion + +`func (o *VersionResponse) SetVersion(v string)` + +SetVersion sets Version field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/clients/apiclient/generate_client.sh b/clients/apiclient/generate_client.sh new file mode 100644 index 0000000000..a8a857db50 --- /dev/null +++ b/clients/apiclient/generate_client.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +function finish { + rm -f "$SCRIPTPATH/wasp_swagger_schema.json" + echo "Done" +} +trap finish EXIT + + +APIGEN_FOLDER="../../tools/api-gen/" +APIGEN_SCRIPT="apigen.sh" + +SCRIPT=$(readlink -f "$0") +SCRIPTPATH=$(dirname "$SCRIPT") + +(cd "$SCRIPTPATH/$APIGEN_FOLDER"; sh -c "./$APIGEN_SCRIPT >| $SCRIPTPATH/wasp_swagger_schema.json") + +openapi-generator-cli generate -i "$SCRIPTPATH/wasp_swagger_schema.json" \ + --global-property=models,supportingFiles,apis,modelTests=false,apiTests=false \ + -g go \ + -o "$SCRIPTPATH" \ + --package-name=apiclient \ + --additional-properties preferUnsignedInt=TRUE + +## This is a temporary fix for the blob info response. +## The Schema generator does not properly handle the uint32 type and this is adjusted manually for now. + +echo "Patching blob info response int=>uint" + +sed -i "/uint32/! s/int32/uint32/g" "$SCRIPTPATH/model_blob_info_response.go" +sed -i "/uint32/! s/int32/uint32/g" "$SCRIPTPATH/docs/BlobInfoResponse.md" diff --git a/clients/apiclient/git_push.sh b/clients/apiclient/git_push.sh new file mode 100644 index 0000000000..f53a75d4fa --- /dev/null +++ b/clients/apiclient/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/clients/apiclient/go.sum b/clients/apiclient/go.sum new file mode 100644 index 0000000000..c966c8ddfd --- /dev/null +++ b/clients/apiclient/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/clients/apiclient/model_account_list_response.go b/clients/apiclient/model_account_list_response.go new file mode 100644 index 0000000000..bc4b90e400 --- /dev/null +++ b/clients/apiclient/model_account_list_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AccountListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccountListResponse{} + +// AccountListResponse struct for AccountListResponse +type AccountListResponse struct { + Accounts []string `json:"accounts"` +} + +// NewAccountListResponse instantiates a new AccountListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAccountListResponse(accounts []string) *AccountListResponse { + this := AccountListResponse{} + this.Accounts = accounts + return &this +} + +// NewAccountListResponseWithDefaults instantiates a new AccountListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAccountListResponseWithDefaults() *AccountListResponse { + this := AccountListResponse{} + return &this +} + +// GetAccounts returns the Accounts field value +func (o *AccountListResponse) GetAccounts() []string { + if o == nil { + var ret []string + return ret + } + + return o.Accounts +} + +// GetAccountsOk returns a tuple with the Accounts field value +// and a boolean to check if the value has been set. +func (o *AccountListResponse) GetAccountsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Accounts, true +} + +// SetAccounts sets field value +func (o *AccountListResponse) SetAccounts(v []string) { + o.Accounts = v +} + +func (o AccountListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccountListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accounts"] = o.Accounts + return toSerialize, nil +} + +type NullableAccountListResponse struct { + value *AccountListResponse + isSet bool +} + +func (v NullableAccountListResponse) Get() *AccountListResponse { + return v.value +} + +func (v *NullableAccountListResponse) Set(val *AccountListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAccountListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAccountListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccountListResponse(val *AccountListResponse) *NullableAccountListResponse { + return &NullableAccountListResponse{value: val, isSet: true} +} + +func (v NullableAccountListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccountListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_account_nfts_response.go b/clients/apiclient/model_account_nfts_response.go new file mode 100644 index 0000000000..909da3ada0 --- /dev/null +++ b/clients/apiclient/model_account_nfts_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AccountNFTsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccountNFTsResponse{} + +// AccountNFTsResponse struct for AccountNFTsResponse +type AccountNFTsResponse struct { + NftIds []string `json:"nftIds"` +} + +// NewAccountNFTsResponse instantiates a new AccountNFTsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAccountNFTsResponse(nftIds []string) *AccountNFTsResponse { + this := AccountNFTsResponse{} + this.NftIds = nftIds + return &this +} + +// NewAccountNFTsResponseWithDefaults instantiates a new AccountNFTsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAccountNFTsResponseWithDefaults() *AccountNFTsResponse { + this := AccountNFTsResponse{} + return &this +} + +// GetNftIds returns the NftIds field value +func (o *AccountNFTsResponse) GetNftIds() []string { + if o == nil { + var ret []string + return ret + } + + return o.NftIds +} + +// GetNftIdsOk returns a tuple with the NftIds field value +// and a boolean to check if the value has been set. +func (o *AccountNFTsResponse) GetNftIdsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.NftIds, true +} + +// SetNftIds sets field value +func (o *AccountNFTsResponse) SetNftIds(v []string) { + o.NftIds = v +} + +func (o AccountNFTsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccountNFTsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nftIds"] = o.NftIds + return toSerialize, nil +} + +type NullableAccountNFTsResponse struct { + value *AccountNFTsResponse + isSet bool +} + +func (v NullableAccountNFTsResponse) Get() *AccountNFTsResponse { + return v.value +} + +func (v *NullableAccountNFTsResponse) Set(val *AccountNFTsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAccountNFTsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAccountNFTsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccountNFTsResponse(val *AccountNFTsResponse) *NullableAccountNFTsResponse { + return &NullableAccountNFTsResponse{value: val, isSet: true} +} + +func (v NullableAccountNFTsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccountNFTsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_account_nonce_response.go b/clients/apiclient/model_account_nonce_response.go new file mode 100644 index 0000000000..ba5595f732 --- /dev/null +++ b/clients/apiclient/model_account_nonce_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AccountNonceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccountNonceResponse{} + +// AccountNonceResponse struct for AccountNonceResponse +type AccountNonceResponse struct { + // The nonce (uint64 as string) + Nonce string `json:"nonce"` +} + +// NewAccountNonceResponse instantiates a new AccountNonceResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAccountNonceResponse(nonce string) *AccountNonceResponse { + this := AccountNonceResponse{} + this.Nonce = nonce + return &this +} + +// NewAccountNonceResponseWithDefaults instantiates a new AccountNonceResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAccountNonceResponseWithDefaults() *AccountNonceResponse { + this := AccountNonceResponse{} + return &this +} + +// GetNonce returns the Nonce field value +func (o *AccountNonceResponse) GetNonce() string { + if o == nil { + var ret string + return ret + } + + return o.Nonce +} + +// GetNonceOk returns a tuple with the Nonce field value +// and a boolean to check if the value has been set. +func (o *AccountNonceResponse) GetNonceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Nonce, true +} + +// SetNonce sets field value +func (o *AccountNonceResponse) SetNonce(v string) { + o.Nonce = v +} + +func (o AccountNonceResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccountNonceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nonce"] = o.Nonce + return toSerialize, nil +} + +type NullableAccountNonceResponse struct { + value *AccountNonceResponse + isSet bool +} + +func (v NullableAccountNonceResponse) Get() *AccountNonceResponse { + return v.value +} + +func (v *NullableAccountNonceResponse) Set(val *AccountNonceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAccountNonceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAccountNonceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccountNonceResponse(val *AccountNonceResponse) *NullableAccountNonceResponse { + return &NullableAccountNonceResponse{value: val, isSet: true} +} + +func (v NullableAccountNonceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccountNonceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_add_user_request.go b/clients/apiclient/model_add_user_request.go new file mode 100644 index 0000000000..74f19b40cc --- /dev/null +++ b/clients/apiclient/model_add_user_request.go @@ -0,0 +1,171 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AddUserRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddUserRequest{} + +// AddUserRequest struct for AddUserRequest +type AddUserRequest struct { + Password string `json:"password"` + Permissions []string `json:"permissions"` + Username string `json:"username"` +} + +// NewAddUserRequest instantiates a new AddUserRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddUserRequest(password string, permissions []string, username string) *AddUserRequest { + this := AddUserRequest{} + this.Password = password + this.Permissions = permissions + this.Username = username + return &this +} + +// NewAddUserRequestWithDefaults instantiates a new AddUserRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddUserRequestWithDefaults() *AddUserRequest { + this := AddUserRequest{} + return &this +} + +// GetPassword returns the Password field value +func (o *AddUserRequest) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *AddUserRequest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *AddUserRequest) SetPassword(v string) { + o.Password = v +} + +// GetPermissions returns the Permissions field value +func (o *AddUserRequest) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AddUserRequest) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *AddUserRequest) SetPermissions(v []string) { + o.Permissions = v +} + +// GetUsername returns the Username field value +func (o *AddUserRequest) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *AddUserRequest) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *AddUserRequest) SetUsername(v string) { + o.Username = v +} + +func (o AddUserRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddUserRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["password"] = o.Password + toSerialize["permissions"] = o.Permissions + toSerialize["username"] = o.Username + return toSerialize, nil +} + +type NullableAddUserRequest struct { + value *AddUserRequest + isSet bool +} + +func (v NullableAddUserRequest) Get() *AddUserRequest { + return v.value +} + +func (v *NullableAddUserRequest) Set(val *AddUserRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAddUserRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAddUserRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddUserRequest(val *AddUserRequest) *NullableAddUserRequest { + return &NullableAddUserRequest{value: val, isSet: true} +} + +func (v NullableAddUserRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddUserRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_alias_output_metric_item.go b/clients/apiclient/model_alias_output_metric_item.go new file mode 100644 index 0000000000..34f6f32622 --- /dev/null +++ b/clients/apiclient/model_alias_output_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the AliasOutputMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AliasOutputMetricItem{} + +// AliasOutputMetricItem struct for AliasOutputMetricItem +type AliasOutputMetricItem struct { + LastMessage Output `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewAliasOutputMetricItem instantiates a new AliasOutputMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAliasOutputMetricItem(lastMessage Output, messages uint32, timestamp time.Time) *AliasOutputMetricItem { + this := AliasOutputMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewAliasOutputMetricItemWithDefaults instantiates a new AliasOutputMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAliasOutputMetricItemWithDefaults() *AliasOutputMetricItem { + this := AliasOutputMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *AliasOutputMetricItem) GetLastMessage() Output { + if o == nil { + var ret Output + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *AliasOutputMetricItem) GetLastMessageOk() (*Output, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *AliasOutputMetricItem) SetLastMessage(v Output) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *AliasOutputMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *AliasOutputMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *AliasOutputMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *AliasOutputMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *AliasOutputMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *AliasOutputMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o AliasOutputMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AliasOutputMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableAliasOutputMetricItem struct { + value *AliasOutputMetricItem + isSet bool +} + +func (v NullableAliasOutputMetricItem) Get() *AliasOutputMetricItem { + return v.value +} + +func (v *NullableAliasOutputMetricItem) Set(val *AliasOutputMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableAliasOutputMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableAliasOutputMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAliasOutputMetricItem(val *AliasOutputMetricItem) *NullableAliasOutputMetricItem { + return &NullableAliasOutputMetricItem{value: val, isSet: true} +} + +func (v NullableAliasOutputMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAliasOutputMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_assets.go b/clients/apiclient/model_assets.go new file mode 100644 index 0000000000..f32e36b5dc --- /dev/null +++ b/clients/apiclient/model_assets.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the Assets type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Assets{} + +// Assets struct for Assets +type Assets struct { + // The base tokens (uint64 as string) + BaseTokens string `json:"baseTokens"` + NativeTokens []NativeToken `json:"nativeTokens"` + Nfts []string `json:"nfts"` +} + +// NewAssets instantiates a new Assets object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAssets(baseTokens string, nativeTokens []NativeToken, nfts []string) *Assets { + this := Assets{} + this.BaseTokens = baseTokens + this.NativeTokens = nativeTokens + this.Nfts = nfts + return &this +} + +// NewAssetsWithDefaults instantiates a new Assets object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAssetsWithDefaults() *Assets { + this := Assets{} + return &this +} + +// GetBaseTokens returns the BaseTokens field value +func (o *Assets) GetBaseTokens() string { + if o == nil { + var ret string + return ret + } + + return o.BaseTokens +} + +// GetBaseTokensOk returns a tuple with the BaseTokens field value +// and a boolean to check if the value has been set. +func (o *Assets) GetBaseTokensOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BaseTokens, true +} + +// SetBaseTokens sets field value +func (o *Assets) SetBaseTokens(v string) { + o.BaseTokens = v +} + +// GetNativeTokens returns the NativeTokens field value +func (o *Assets) GetNativeTokens() []NativeToken { + if o == nil { + var ret []NativeToken + return ret + } + + return o.NativeTokens +} + +// GetNativeTokensOk returns a tuple with the NativeTokens field value +// and a boolean to check if the value has been set. +func (o *Assets) GetNativeTokensOk() ([]NativeToken, bool) { + if o == nil { + return nil, false + } + return o.NativeTokens, true +} + +// SetNativeTokens sets field value +func (o *Assets) SetNativeTokens(v []NativeToken) { + o.NativeTokens = v +} + +// GetNfts returns the Nfts field value +func (o *Assets) GetNfts() []string { + if o == nil { + var ret []string + return ret + } + + return o.Nfts +} + +// GetNftsOk returns a tuple with the Nfts field value +// and a boolean to check if the value has been set. +func (o *Assets) GetNftsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Nfts, true +} + +// SetNfts sets field value +func (o *Assets) SetNfts(v []string) { + o.Nfts = v +} + +func (o Assets) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Assets) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["baseTokens"] = o.BaseTokens + toSerialize["nativeTokens"] = o.NativeTokens + toSerialize["nfts"] = o.Nfts + return toSerialize, nil +} + +type NullableAssets struct { + value *Assets + isSet bool +} + +func (v NullableAssets) Get() *Assets { + return v.value +} + +func (v *NullableAssets) Set(val *Assets) { + v.value = val + v.isSet = true +} + +func (v NullableAssets) IsSet() bool { + return v.isSet +} + +func (v *NullableAssets) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAssets(val *Assets) *NullableAssets { + return &NullableAssets{value: val, isSet: true} +} + +func (v NullableAssets) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAssets) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_assets_response.go b/clients/apiclient/model_assets_response.go new file mode 100644 index 0000000000..65413bd8c2 --- /dev/null +++ b/clients/apiclient/model_assets_response.go @@ -0,0 +1,145 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AssetsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AssetsResponse{} + +// AssetsResponse struct for AssetsResponse +type AssetsResponse struct { + // The base tokens (uint64 as string) + BaseTokens string `json:"baseTokens"` + NativeTokens []NativeToken `json:"nativeTokens"` +} + +// NewAssetsResponse instantiates a new AssetsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAssetsResponse(baseTokens string, nativeTokens []NativeToken) *AssetsResponse { + this := AssetsResponse{} + this.BaseTokens = baseTokens + this.NativeTokens = nativeTokens + return &this +} + +// NewAssetsResponseWithDefaults instantiates a new AssetsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAssetsResponseWithDefaults() *AssetsResponse { + this := AssetsResponse{} + return &this +} + +// GetBaseTokens returns the BaseTokens field value +func (o *AssetsResponse) GetBaseTokens() string { + if o == nil { + var ret string + return ret + } + + return o.BaseTokens +} + +// GetBaseTokensOk returns a tuple with the BaseTokens field value +// and a boolean to check if the value has been set. +func (o *AssetsResponse) GetBaseTokensOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BaseTokens, true +} + +// SetBaseTokens sets field value +func (o *AssetsResponse) SetBaseTokens(v string) { + o.BaseTokens = v +} + +// GetNativeTokens returns the NativeTokens field value +func (o *AssetsResponse) GetNativeTokens() []NativeToken { + if o == nil { + var ret []NativeToken + return ret + } + + return o.NativeTokens +} + +// GetNativeTokensOk returns a tuple with the NativeTokens field value +// and a boolean to check if the value has been set. +func (o *AssetsResponse) GetNativeTokensOk() ([]NativeToken, bool) { + if o == nil { + return nil, false + } + return o.NativeTokens, true +} + +// SetNativeTokens sets field value +func (o *AssetsResponse) SetNativeTokens(v []NativeToken) { + o.NativeTokens = v +} + +func (o AssetsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AssetsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["baseTokens"] = o.BaseTokens + toSerialize["nativeTokens"] = o.NativeTokens + return toSerialize, nil +} + +type NullableAssetsResponse struct { + value *AssetsResponse + isSet bool +} + +func (v NullableAssetsResponse) Get() *AssetsResponse { + return v.value +} + +func (v *NullableAssetsResponse) Set(val *AssetsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAssetsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAssetsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAssetsResponse(val *AssetsResponse) *NullableAssetsResponse { + return &NullableAssetsResponse{value: val, isSet: true} +} + +func (v NullableAssetsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAssetsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_auth_info_model.go b/clients/apiclient/model_auth_info_model.go new file mode 100644 index 0000000000..37d4d0e653 --- /dev/null +++ b/clients/apiclient/model_auth_info_model.go @@ -0,0 +1,145 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the AuthInfoModel type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuthInfoModel{} + +// AuthInfoModel struct for AuthInfoModel +type AuthInfoModel struct { + // JWT only + AuthURL string `json:"authURL"` + Scheme string `json:"scheme"` +} + +// NewAuthInfoModel instantiates a new AuthInfoModel object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAuthInfoModel(authURL string, scheme string) *AuthInfoModel { + this := AuthInfoModel{} + this.AuthURL = authURL + this.Scheme = scheme + return &this +} + +// NewAuthInfoModelWithDefaults instantiates a new AuthInfoModel object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAuthInfoModelWithDefaults() *AuthInfoModel { + this := AuthInfoModel{} + return &this +} + +// GetAuthURL returns the AuthURL field value +func (o *AuthInfoModel) GetAuthURL() string { + if o == nil { + var ret string + return ret + } + + return o.AuthURL +} + +// GetAuthURLOk returns a tuple with the AuthURL field value +// and a boolean to check if the value has been set. +func (o *AuthInfoModel) GetAuthURLOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AuthURL, true +} + +// SetAuthURL sets field value +func (o *AuthInfoModel) SetAuthURL(v string) { + o.AuthURL = v +} + +// GetScheme returns the Scheme field value +func (o *AuthInfoModel) GetScheme() string { + if o == nil { + var ret string + return ret + } + + return o.Scheme +} + +// GetSchemeOk returns a tuple with the Scheme field value +// and a boolean to check if the value has been set. +func (o *AuthInfoModel) GetSchemeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Scheme, true +} + +// SetScheme sets field value +func (o *AuthInfoModel) SetScheme(v string) { + o.Scheme = v +} + +func (o AuthInfoModel) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuthInfoModel) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["authURL"] = o.AuthURL + toSerialize["scheme"] = o.Scheme + return toSerialize, nil +} + +type NullableAuthInfoModel struct { + value *AuthInfoModel + isSet bool +} + +func (v NullableAuthInfoModel) Get() *AuthInfoModel { + return v.value +} + +func (v *NullableAuthInfoModel) Set(val *AuthInfoModel) { + v.value = val + v.isSet = true +} + +func (v NullableAuthInfoModel) IsSet() bool { + return v.isSet +} + +func (v *NullableAuthInfoModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuthInfoModel(val *AuthInfoModel) *NullableAuthInfoModel { + return &NullableAuthInfoModel{value: val, isSet: true} +} + +func (v NullableAuthInfoModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuthInfoModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_base_token.go b/clients/apiclient/model_base_token.go new file mode 100644 index 0000000000..96f06aef92 --- /dev/null +++ b/clients/apiclient/model_base_token.go @@ -0,0 +1,258 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BaseToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseToken{} + +// BaseToken struct for BaseToken +type BaseToken struct { + // The token decimals + Decimals int32 `json:"decimals"` + // The base token name + Name string `json:"name"` + // The token subunit + Subunit string `json:"subunit"` + // The ticker symbol + TickerSymbol string `json:"tickerSymbol"` + // The token unit + Unit string `json:"unit"` + // Whether or not the token uses a metric prefix + UseMetricPrefix bool `json:"useMetricPrefix"` +} + +// NewBaseToken instantiates a new BaseToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseToken(decimals int32, name string, subunit string, tickerSymbol string, unit string, useMetricPrefix bool) *BaseToken { + this := BaseToken{} + this.Decimals = decimals + this.Name = name + this.Subunit = subunit + this.TickerSymbol = tickerSymbol + this.Unit = unit + this.UseMetricPrefix = useMetricPrefix + return &this +} + +// NewBaseTokenWithDefaults instantiates a new BaseToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseTokenWithDefaults() *BaseToken { + this := BaseToken{} + return &this +} + +// GetDecimals returns the Decimals field value +func (o *BaseToken) GetDecimals() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Decimals +} + +// GetDecimalsOk returns a tuple with the Decimals field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetDecimalsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Decimals, true +} + +// SetDecimals sets field value +func (o *BaseToken) SetDecimals(v int32) { + o.Decimals = v +} + +// GetName returns the Name field value +func (o *BaseToken) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *BaseToken) SetName(v string) { + o.Name = v +} + +// GetSubunit returns the Subunit field value +func (o *BaseToken) GetSubunit() string { + if o == nil { + var ret string + return ret + } + + return o.Subunit +} + +// GetSubunitOk returns a tuple with the Subunit field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetSubunitOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subunit, true +} + +// SetSubunit sets field value +func (o *BaseToken) SetSubunit(v string) { + o.Subunit = v +} + +// GetTickerSymbol returns the TickerSymbol field value +func (o *BaseToken) GetTickerSymbol() string { + if o == nil { + var ret string + return ret + } + + return o.TickerSymbol +} + +// GetTickerSymbolOk returns a tuple with the TickerSymbol field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetTickerSymbolOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TickerSymbol, true +} + +// SetTickerSymbol sets field value +func (o *BaseToken) SetTickerSymbol(v string) { + o.TickerSymbol = v +} + +// GetUnit returns the Unit field value +func (o *BaseToken) GetUnit() string { + if o == nil { + var ret string + return ret + } + + return o.Unit +} + +// GetUnitOk returns a tuple with the Unit field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetUnitOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Unit, true +} + +// SetUnit sets field value +func (o *BaseToken) SetUnit(v string) { + o.Unit = v +} + +// GetUseMetricPrefix returns the UseMetricPrefix field value +func (o *BaseToken) GetUseMetricPrefix() bool { + if o == nil { + var ret bool + return ret + } + + return o.UseMetricPrefix +} + +// GetUseMetricPrefixOk returns a tuple with the UseMetricPrefix field value +// and a boolean to check if the value has been set. +func (o *BaseToken) GetUseMetricPrefixOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.UseMetricPrefix, true +} + +// SetUseMetricPrefix sets field value +func (o *BaseToken) SetUseMetricPrefix(v bool) { + o.UseMetricPrefix = v +} + +func (o BaseToken) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BaseToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["decimals"] = o.Decimals + toSerialize["name"] = o.Name + toSerialize["subunit"] = o.Subunit + toSerialize["tickerSymbol"] = o.TickerSymbol + toSerialize["unit"] = o.Unit + toSerialize["useMetricPrefix"] = o.UseMetricPrefix + return toSerialize, nil +} + +type NullableBaseToken struct { + value *BaseToken + isSet bool +} + +func (v NullableBaseToken) Get() *BaseToken { + return v.value +} + +func (v *NullableBaseToken) Set(val *BaseToken) { + v.value = val + v.isSet = true +} + +func (v NullableBaseToken) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseToken(val *BaseToken) *NullableBaseToken { + return &NullableBaseToken{value: val, isSet: true} +} + +func (v NullableBaseToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_blob.go b/clients/apiclient/model_blob.go new file mode 100644 index 0000000000..5fa2336c80 --- /dev/null +++ b/clients/apiclient/model_blob.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the Blob type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Blob{} + +// Blob struct for Blob +type Blob struct { + Hash string `json:"hash"` + Size uint32 `json:"size"` +} + +// NewBlob instantiates a new Blob object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlob(hash string, size uint32) *Blob { + this := Blob{} + this.Hash = hash + this.Size = size + return &this +} + +// NewBlobWithDefaults instantiates a new Blob object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlobWithDefaults() *Blob { + this := Blob{} + return &this +} + +// GetHash returns the Hash field value +func (o *Blob) GetHash() string { + if o == nil { + var ret string + return ret + } + + return o.Hash +} + +// GetHashOk returns a tuple with the Hash field value +// and a boolean to check if the value has been set. +func (o *Blob) GetHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Hash, true +} + +// SetHash sets field value +func (o *Blob) SetHash(v string) { + o.Hash = v +} + +// GetSize returns the Size field value +func (o *Blob) GetSize() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *Blob) GetSizeOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *Blob) SetSize(v uint32) { + o.Size = v +} + +func (o Blob) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Blob) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["hash"] = o.Hash + toSerialize["size"] = o.Size + return toSerialize, nil +} + +type NullableBlob struct { + value *Blob + isSet bool +} + +func (v NullableBlob) Get() *Blob { + return v.value +} + +func (v *NullableBlob) Set(val *Blob) { + v.value = val + v.isSet = true +} + +func (v NullableBlob) IsSet() bool { + return v.isSet +} + +func (v *NullableBlob) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlob(val *Blob) *NullableBlob { + return &NullableBlob{value: val, isSet: true} +} + +func (v NullableBlob) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlob) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_blob_info_response.go b/clients/apiclient/model_blob_info_response.go new file mode 100644 index 0000000000..44c3a222ca --- /dev/null +++ b/clients/apiclient/model_blob_info_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BlobInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlobInfoResponse{} + +// BlobInfoResponse struct for BlobInfoResponse +type BlobInfoResponse struct { + Fields map[string]uint32 `json:"fields"` +} + +// NewBlobInfoResponse instantiates a new BlobInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlobInfoResponse(fields map[string]uint32) *BlobInfoResponse { + this := BlobInfoResponse{} + this.Fields = fields + return &this +} + +// NewBlobInfoResponseWithDefaults instantiates a new BlobInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlobInfoResponseWithDefaults() *BlobInfoResponse { + this := BlobInfoResponse{} + return &this +} + +// GetFields returns the Fields field value +func (o *BlobInfoResponse) GetFields() map[string]uint32 { + if o == nil { + var ret map[string]uint32 + return ret + } + + return o.Fields +} + +// GetFieldsOk returns a tuple with the Fields field value +// and a boolean to check if the value has been set. +func (o *BlobInfoResponse) GetFieldsOk() (*map[string]uint32, bool) { + if o == nil { + return nil, false + } + return &o.Fields, true +} + +// SetFields sets field value +func (o *BlobInfoResponse) SetFields(v map[string]uint32) { + o.Fields = v +} + +func (o BlobInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlobInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["fields"] = o.Fields + return toSerialize, nil +} + +type NullableBlobInfoResponse struct { + value *BlobInfoResponse + isSet bool +} + +func (v NullableBlobInfoResponse) Get() *BlobInfoResponse { + return v.value +} + +func (v *NullableBlobInfoResponse) Set(val *BlobInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBlobInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBlobInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlobInfoResponse(val *BlobInfoResponse) *NullableBlobInfoResponse { + return &NullableBlobInfoResponse{value: val, isSet: true} +} + +func (v NullableBlobInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlobInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_blob_list_response.go b/clients/apiclient/model_blob_list_response.go new file mode 100644 index 0000000000..c747d4098e --- /dev/null +++ b/clients/apiclient/model_blob_list_response.go @@ -0,0 +1,126 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BlobListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlobListResponse{} + +// BlobListResponse struct for BlobListResponse +type BlobListResponse struct { + Blobs []Blob `json:"Blobs,omitempty"` +} + +// NewBlobListResponse instantiates a new BlobListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlobListResponse() *BlobListResponse { + this := BlobListResponse{} + return &this +} + +// NewBlobListResponseWithDefaults instantiates a new BlobListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlobListResponseWithDefaults() *BlobListResponse { + this := BlobListResponse{} + return &this +} + +// GetBlobs returns the Blobs field value if set, zero value otherwise. +func (o *BlobListResponse) GetBlobs() []Blob { + if o == nil || isNil(o.Blobs) { + var ret []Blob + return ret + } + return o.Blobs +} + +// GetBlobsOk returns a tuple with the Blobs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BlobListResponse) GetBlobsOk() ([]Blob, bool) { + if o == nil || isNil(o.Blobs) { + return nil, false + } + return o.Blobs, true +} + +// HasBlobs returns a boolean if a field has been set. +func (o *BlobListResponse) HasBlobs() bool { + if o != nil && !isNil(o.Blobs) { + return true + } + + return false +} + +// SetBlobs gets a reference to the given []Blob and assigns it to the Blobs field. +func (o *BlobListResponse) SetBlobs(v []Blob) { + o.Blobs = v +} + +func (o BlobListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlobListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Blobs) { + toSerialize["Blobs"] = o.Blobs + } + return toSerialize, nil +} + +type NullableBlobListResponse struct { + value *BlobListResponse + isSet bool +} + +func (v NullableBlobListResponse) Get() *BlobListResponse { + return v.value +} + +func (v *NullableBlobListResponse) Set(val *BlobListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBlobListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBlobListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlobListResponse(val *BlobListResponse) *NullableBlobListResponse { + return &NullableBlobListResponse{value: val, isSet: true} +} + +func (v NullableBlobListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlobListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_blob_value_response.go b/clients/apiclient/model_blob_value_response.go new file mode 100644 index 0000000000..3ad0b563da --- /dev/null +++ b/clients/apiclient/model_blob_value_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BlobValueResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlobValueResponse{} + +// BlobValueResponse struct for BlobValueResponse +type BlobValueResponse struct { + // The blob data (Hex) + ValueData string `json:"valueData"` +} + +// NewBlobValueResponse instantiates a new BlobValueResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlobValueResponse(valueData string) *BlobValueResponse { + this := BlobValueResponse{} + this.ValueData = valueData + return &this +} + +// NewBlobValueResponseWithDefaults instantiates a new BlobValueResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlobValueResponseWithDefaults() *BlobValueResponse { + this := BlobValueResponse{} + return &this +} + +// GetValueData returns the ValueData field value +func (o *BlobValueResponse) GetValueData() string { + if o == nil { + var ret string + return ret + } + + return o.ValueData +} + +// GetValueDataOk returns a tuple with the ValueData field value +// and a boolean to check if the value has been set. +func (o *BlobValueResponse) GetValueDataOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ValueData, true +} + +// SetValueData sets field value +func (o *BlobValueResponse) SetValueData(v string) { + o.ValueData = v +} + +func (o BlobValueResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlobValueResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["valueData"] = o.ValueData + return toSerialize, nil +} + +type NullableBlobValueResponse struct { + value *BlobValueResponse + isSet bool +} + +func (v NullableBlobValueResponse) Get() *BlobValueResponse { + return v.value +} + +func (v *NullableBlobValueResponse) Set(val *BlobValueResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBlobValueResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBlobValueResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlobValueResponse(val *BlobValueResponse) *NullableBlobValueResponse { + return &NullableBlobValueResponse{value: val, isSet: true} +} + +func (v NullableBlobValueResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlobValueResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_block_info_response.go b/clients/apiclient/model_block_info_response.go new file mode 100644 index 0000000000..6a76a731f8 --- /dev/null +++ b/clients/apiclient/model_block_info_response.go @@ -0,0 +1,446 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the BlockInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlockInfoResponse{} + +// BlockInfoResponse struct for BlockInfoResponse +type BlockInfoResponse struct { + AnchorTransactionId string `json:"anchorTransactionId"` + BlockIndex uint32 `json:"blockIndex"` + // The burned gas (uint64 as string) + GasBurned string `json:"gasBurned"` + // The charged gas fee (uint64 as string) + GasFeeCharged string `json:"gasFeeCharged"` + L1CommitmentHash string `json:"l1CommitmentHash"` + NumOffLedgerRequests uint32 `json:"numOffLedgerRequests"` + NumSuccessfulRequests uint32 `json:"numSuccessfulRequests"` + PreviousL1CommitmentHash string `json:"previousL1CommitmentHash"` + Timestamp time.Time `json:"timestamp"` + // The total L2 base tokens (uint64 as string) + TotalBaseTokensInL2Accounts string `json:"totalBaseTokensInL2Accounts"` + TotalRequests uint32 `json:"totalRequests"` + // The total storage deposit (uint64 as string) + TotalStorageDeposit string `json:"totalStorageDeposit"` + TransactionSubEssenceHash string `json:"transactionSubEssenceHash"` +} + +// NewBlockInfoResponse instantiates a new BlockInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlockInfoResponse(anchorTransactionId string, blockIndex uint32, gasBurned string, gasFeeCharged string, l1CommitmentHash string, numOffLedgerRequests uint32, numSuccessfulRequests uint32, previousL1CommitmentHash string, timestamp time.Time, totalBaseTokensInL2Accounts string, totalRequests uint32, totalStorageDeposit string, transactionSubEssenceHash string) *BlockInfoResponse { + this := BlockInfoResponse{} + this.AnchorTransactionId = anchorTransactionId + this.BlockIndex = blockIndex + this.GasBurned = gasBurned + this.GasFeeCharged = gasFeeCharged + this.L1CommitmentHash = l1CommitmentHash + this.NumOffLedgerRequests = numOffLedgerRequests + this.NumSuccessfulRequests = numSuccessfulRequests + this.PreviousL1CommitmentHash = previousL1CommitmentHash + this.Timestamp = timestamp + this.TotalBaseTokensInL2Accounts = totalBaseTokensInL2Accounts + this.TotalRequests = totalRequests + this.TotalStorageDeposit = totalStorageDeposit + this.TransactionSubEssenceHash = transactionSubEssenceHash + return &this +} + +// NewBlockInfoResponseWithDefaults instantiates a new BlockInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlockInfoResponseWithDefaults() *BlockInfoResponse { + this := BlockInfoResponse{} + return &this +} + +// GetAnchorTransactionId returns the AnchorTransactionId field value +func (o *BlockInfoResponse) GetAnchorTransactionId() string { + if o == nil { + var ret string + return ret + } + + return o.AnchorTransactionId +} + +// GetAnchorTransactionIdOk returns a tuple with the AnchorTransactionId field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetAnchorTransactionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AnchorTransactionId, true +} + +// SetAnchorTransactionId sets field value +func (o *BlockInfoResponse) SetAnchorTransactionId(v string) { + o.AnchorTransactionId = v +} + +// GetBlockIndex returns the BlockIndex field value +func (o *BlockInfoResponse) GetBlockIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.BlockIndex +} + +// GetBlockIndexOk returns a tuple with the BlockIndex field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetBlockIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.BlockIndex, true +} + +// SetBlockIndex sets field value +func (o *BlockInfoResponse) SetBlockIndex(v uint32) { + o.BlockIndex = v +} + +// GetGasBurned returns the GasBurned field value +func (o *BlockInfoResponse) GetGasBurned() string { + if o == nil { + var ret string + return ret + } + + return o.GasBurned +} + +// GetGasBurnedOk returns a tuple with the GasBurned field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetGasBurnedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasBurned, true +} + +// SetGasBurned sets field value +func (o *BlockInfoResponse) SetGasBurned(v string) { + o.GasBurned = v +} + +// GetGasFeeCharged returns the GasFeeCharged field value +func (o *BlockInfoResponse) GetGasFeeCharged() string { + if o == nil { + var ret string + return ret + } + + return o.GasFeeCharged +} + +// GetGasFeeChargedOk returns a tuple with the GasFeeCharged field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetGasFeeChargedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasFeeCharged, true +} + +// SetGasFeeCharged sets field value +func (o *BlockInfoResponse) SetGasFeeCharged(v string) { + o.GasFeeCharged = v +} + +// GetL1CommitmentHash returns the L1CommitmentHash field value +func (o *BlockInfoResponse) GetL1CommitmentHash() string { + if o == nil { + var ret string + return ret + } + + return o.L1CommitmentHash +} + +// GetL1CommitmentHashOk returns a tuple with the L1CommitmentHash field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetL1CommitmentHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.L1CommitmentHash, true +} + +// SetL1CommitmentHash sets field value +func (o *BlockInfoResponse) SetL1CommitmentHash(v string) { + o.L1CommitmentHash = v +} + +// GetNumOffLedgerRequests returns the NumOffLedgerRequests field value +func (o *BlockInfoResponse) GetNumOffLedgerRequests() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.NumOffLedgerRequests +} + +// GetNumOffLedgerRequestsOk returns a tuple with the NumOffLedgerRequests field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetNumOffLedgerRequestsOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.NumOffLedgerRequests, true +} + +// SetNumOffLedgerRequests sets field value +func (o *BlockInfoResponse) SetNumOffLedgerRequests(v uint32) { + o.NumOffLedgerRequests = v +} + +// GetNumSuccessfulRequests returns the NumSuccessfulRequests field value +func (o *BlockInfoResponse) GetNumSuccessfulRequests() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.NumSuccessfulRequests +} + +// GetNumSuccessfulRequestsOk returns a tuple with the NumSuccessfulRequests field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetNumSuccessfulRequestsOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.NumSuccessfulRequests, true +} + +// SetNumSuccessfulRequests sets field value +func (o *BlockInfoResponse) SetNumSuccessfulRequests(v uint32) { + o.NumSuccessfulRequests = v +} + +// GetPreviousL1CommitmentHash returns the PreviousL1CommitmentHash field value +func (o *BlockInfoResponse) GetPreviousL1CommitmentHash() string { + if o == nil { + var ret string + return ret + } + + return o.PreviousL1CommitmentHash +} + +// GetPreviousL1CommitmentHashOk returns a tuple with the PreviousL1CommitmentHash field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetPreviousL1CommitmentHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PreviousL1CommitmentHash, true +} + +// SetPreviousL1CommitmentHash sets field value +func (o *BlockInfoResponse) SetPreviousL1CommitmentHash(v string) { + o.PreviousL1CommitmentHash = v +} + +// GetTimestamp returns the Timestamp field value +func (o *BlockInfoResponse) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *BlockInfoResponse) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +// GetTotalBaseTokensInL2Accounts returns the TotalBaseTokensInL2Accounts field value +func (o *BlockInfoResponse) GetTotalBaseTokensInL2Accounts() string { + if o == nil { + var ret string + return ret + } + + return o.TotalBaseTokensInL2Accounts +} + +// GetTotalBaseTokensInL2AccountsOk returns a tuple with the TotalBaseTokensInL2Accounts field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetTotalBaseTokensInL2AccountsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TotalBaseTokensInL2Accounts, true +} + +// SetTotalBaseTokensInL2Accounts sets field value +func (o *BlockInfoResponse) SetTotalBaseTokensInL2Accounts(v string) { + o.TotalBaseTokensInL2Accounts = v +} + +// GetTotalRequests returns the TotalRequests field value +func (o *BlockInfoResponse) GetTotalRequests() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.TotalRequests +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetTotalRequestsOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.TotalRequests, true +} + +// SetTotalRequests sets field value +func (o *BlockInfoResponse) SetTotalRequests(v uint32) { + o.TotalRequests = v +} + +// GetTotalStorageDeposit returns the TotalStorageDeposit field value +func (o *BlockInfoResponse) GetTotalStorageDeposit() string { + if o == nil { + var ret string + return ret + } + + return o.TotalStorageDeposit +} + +// GetTotalStorageDepositOk returns a tuple with the TotalStorageDeposit field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetTotalStorageDepositOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TotalStorageDeposit, true +} + +// SetTotalStorageDeposit sets field value +func (o *BlockInfoResponse) SetTotalStorageDeposit(v string) { + o.TotalStorageDeposit = v +} + +// GetTransactionSubEssenceHash returns the TransactionSubEssenceHash field value +func (o *BlockInfoResponse) GetTransactionSubEssenceHash() string { + if o == nil { + var ret string + return ret + } + + return o.TransactionSubEssenceHash +} + +// GetTransactionSubEssenceHashOk returns a tuple with the TransactionSubEssenceHash field value +// and a boolean to check if the value has been set. +func (o *BlockInfoResponse) GetTransactionSubEssenceHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TransactionSubEssenceHash, true +} + +// SetTransactionSubEssenceHash sets field value +func (o *BlockInfoResponse) SetTransactionSubEssenceHash(v string) { + o.TransactionSubEssenceHash = v +} + +func (o BlockInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlockInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["anchorTransactionId"] = o.AnchorTransactionId + toSerialize["blockIndex"] = o.BlockIndex + toSerialize["gasBurned"] = o.GasBurned + toSerialize["gasFeeCharged"] = o.GasFeeCharged + toSerialize["l1CommitmentHash"] = o.L1CommitmentHash + toSerialize["numOffLedgerRequests"] = o.NumOffLedgerRequests + toSerialize["numSuccessfulRequests"] = o.NumSuccessfulRequests + toSerialize["previousL1CommitmentHash"] = o.PreviousL1CommitmentHash + toSerialize["timestamp"] = o.Timestamp + toSerialize["totalBaseTokensInL2Accounts"] = o.TotalBaseTokensInL2Accounts + toSerialize["totalRequests"] = o.TotalRequests + toSerialize["totalStorageDeposit"] = o.TotalStorageDeposit + toSerialize["transactionSubEssenceHash"] = o.TransactionSubEssenceHash + return toSerialize, nil +} + +type NullableBlockInfoResponse struct { + value *BlockInfoResponse + isSet bool +} + +func (v NullableBlockInfoResponse) Get() *BlockInfoResponse { + return v.value +} + +func (v *NullableBlockInfoResponse) Set(val *BlockInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBlockInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBlockInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlockInfoResponse(val *BlockInfoResponse) *NullableBlockInfoResponse { + return &NullableBlockInfoResponse{value: val, isSet: true} +} + +func (v NullableBlockInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlockInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_block_receipt_error.go b/clients/apiclient/model_block_receipt_error.go new file mode 100644 index 0000000000..aa3a3e3d7d --- /dev/null +++ b/clients/apiclient/model_block_receipt_error.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BlockReceiptError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlockReceiptError{} + +// BlockReceiptError struct for BlockReceiptError +type BlockReceiptError struct { + ErrorMessage string `json:"errorMessage"` + Hash string `json:"hash"` +} + +// NewBlockReceiptError instantiates a new BlockReceiptError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlockReceiptError(errorMessage string, hash string) *BlockReceiptError { + this := BlockReceiptError{} + this.ErrorMessage = errorMessage + this.Hash = hash + return &this +} + +// NewBlockReceiptErrorWithDefaults instantiates a new BlockReceiptError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlockReceiptErrorWithDefaults() *BlockReceiptError { + this := BlockReceiptError{} + return &this +} + +// GetErrorMessage returns the ErrorMessage field value +func (o *BlockReceiptError) GetErrorMessage() string { + if o == nil { + var ret string + return ret + } + + return o.ErrorMessage +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value +// and a boolean to check if the value has been set. +func (o *BlockReceiptError) GetErrorMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorMessage, true +} + +// SetErrorMessage sets field value +func (o *BlockReceiptError) SetErrorMessage(v string) { + o.ErrorMessage = v +} + +// GetHash returns the Hash field value +func (o *BlockReceiptError) GetHash() string { + if o == nil { + var ret string + return ret + } + + return o.Hash +} + +// GetHashOk returns a tuple with the Hash field value +// and a boolean to check if the value has been set. +func (o *BlockReceiptError) GetHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Hash, true +} + +// SetHash sets field value +func (o *BlockReceiptError) SetHash(v string) { + o.Hash = v +} + +func (o BlockReceiptError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlockReceiptError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["errorMessage"] = o.ErrorMessage + toSerialize["hash"] = o.Hash + return toSerialize, nil +} + +type NullableBlockReceiptError struct { + value *BlockReceiptError + isSet bool +} + +func (v NullableBlockReceiptError) Get() *BlockReceiptError { + return v.value +} + +func (v *NullableBlockReceiptError) Set(val *BlockReceiptError) { + v.value = val + v.isSet = true +} + +func (v NullableBlockReceiptError) IsSet() bool { + return v.isSet +} + +func (v *NullableBlockReceiptError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlockReceiptError(val *BlockReceiptError) *NullableBlockReceiptError { + return &NullableBlockReceiptError{value: val, isSet: true} +} + +func (v NullableBlockReceiptError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlockReceiptError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_block_receipts_response.go b/clients/apiclient/model_block_receipts_response.go new file mode 100644 index 0000000000..771b070172 --- /dev/null +++ b/clients/apiclient/model_block_receipts_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BlockReceiptsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BlockReceiptsResponse{} + +// BlockReceiptsResponse struct for BlockReceiptsResponse +type BlockReceiptsResponse struct { + Receipts []RequestReceiptResponse `json:"receipts"` +} + +// NewBlockReceiptsResponse instantiates a new BlockReceiptsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBlockReceiptsResponse(receipts []RequestReceiptResponse) *BlockReceiptsResponse { + this := BlockReceiptsResponse{} + this.Receipts = receipts + return &this +} + +// NewBlockReceiptsResponseWithDefaults instantiates a new BlockReceiptsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBlockReceiptsResponseWithDefaults() *BlockReceiptsResponse { + this := BlockReceiptsResponse{} + return &this +} + +// GetReceipts returns the Receipts field value +func (o *BlockReceiptsResponse) GetReceipts() []RequestReceiptResponse { + if o == nil { + var ret []RequestReceiptResponse + return ret + } + + return o.Receipts +} + +// GetReceiptsOk returns a tuple with the Receipts field value +// and a boolean to check if the value has been set. +func (o *BlockReceiptsResponse) GetReceiptsOk() ([]RequestReceiptResponse, bool) { + if o == nil { + return nil, false + } + return o.Receipts, true +} + +// SetReceipts sets field value +func (o *BlockReceiptsResponse) SetReceipts(v []RequestReceiptResponse) { + o.Receipts = v +} + +func (o BlockReceiptsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BlockReceiptsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["receipts"] = o.Receipts + return toSerialize, nil +} + +type NullableBlockReceiptsResponse struct { + value *BlockReceiptsResponse + isSet bool +} + +func (v NullableBlockReceiptsResponse) Get() *BlockReceiptsResponse { + return v.value +} + +func (v *NullableBlockReceiptsResponse) Set(val *BlockReceiptsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBlockReceiptsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBlockReceiptsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBlockReceiptsResponse(val *BlockReceiptsResponse) *NullableBlockReceiptsResponse { + return &NullableBlockReceiptsResponse{value: val, isSet: true} +} + +func (v NullableBlockReceiptsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBlockReceiptsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_burn_log.go b/clients/apiclient/model_burn_log.go new file mode 100644 index 0000000000..5f8843722f --- /dev/null +++ b/clients/apiclient/model_burn_log.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BurnLog type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BurnLog{} + +// BurnLog struct for BurnLog +type BurnLog struct { + Records []BurnRecord `json:"records"` +} + +// NewBurnLog instantiates a new BurnLog object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBurnLog(records []BurnRecord) *BurnLog { + this := BurnLog{} + this.Records = records + return &this +} + +// NewBurnLogWithDefaults instantiates a new BurnLog object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBurnLogWithDefaults() *BurnLog { + this := BurnLog{} + return &this +} + +// GetRecords returns the Records field value +func (o *BurnLog) GetRecords() []BurnRecord { + if o == nil { + var ret []BurnRecord + return ret + } + + return o.Records +} + +// GetRecordsOk returns a tuple with the Records field value +// and a boolean to check if the value has been set. +func (o *BurnLog) GetRecordsOk() ([]BurnRecord, bool) { + if o == nil { + return nil, false + } + return o.Records, true +} + +// SetRecords sets field value +func (o *BurnLog) SetRecords(v []BurnRecord) { + o.Records = v +} + +func (o BurnLog) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BurnLog) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["records"] = o.Records + return toSerialize, nil +} + +type NullableBurnLog struct { + value *BurnLog + isSet bool +} + +func (v NullableBurnLog) Get() *BurnLog { + return v.value +} + +func (v *NullableBurnLog) Set(val *BurnLog) { + v.value = val + v.isSet = true +} + +func (v NullableBurnLog) IsSet() bool { + return v.isSet +} + +func (v *NullableBurnLog) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBurnLog(val *BurnLog) *NullableBurnLog { + return &NullableBurnLog{value: val, isSet: true} +} + +func (v NullableBurnLog) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBurnLog) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_burn_record.go b/clients/apiclient/model_burn_record.go new file mode 100644 index 0000000000..65afb4ef93 --- /dev/null +++ b/clients/apiclient/model_burn_record.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the BurnRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BurnRecord{} + +// BurnRecord struct for BurnRecord +type BurnRecord struct { + Code int32 `json:"code"` + GasBurned int64 `json:"gasBurned"` +} + +// NewBurnRecord instantiates a new BurnRecord object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBurnRecord(code int32, gasBurned int64) *BurnRecord { + this := BurnRecord{} + this.Code = code + this.GasBurned = gasBurned + return &this +} + +// NewBurnRecordWithDefaults instantiates a new BurnRecord object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBurnRecordWithDefaults() *BurnRecord { + this := BurnRecord{} + return &this +} + +// GetCode returns the Code field value +func (o *BurnRecord) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *BurnRecord) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *BurnRecord) SetCode(v int32) { + o.Code = v +} + +// GetGasBurned returns the GasBurned field value +func (o *BurnRecord) GetGasBurned() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.GasBurned +} + +// GetGasBurnedOk returns a tuple with the GasBurned field value +// and a boolean to check if the value has been set. +func (o *BurnRecord) GetGasBurnedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.GasBurned, true +} + +// SetGasBurned sets field value +func (o *BurnRecord) SetGasBurned(v int64) { + o.GasBurned = v +} + +func (o BurnRecord) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BurnRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["gasBurned"] = o.GasBurned + return toSerialize, nil +} + +type NullableBurnRecord struct { + value *BurnRecord + isSet bool +} + +func (v NullableBurnRecord) Get() *BurnRecord { + return v.value +} + +func (v *NullableBurnRecord) Set(val *BurnRecord) { + v.value = val + v.isSet = true +} + +func (v NullableBurnRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableBurnRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBurnRecord(val *BurnRecord) *NullableBurnRecord { + return &NullableBurnRecord{value: val, isSet: true} +} + +func (v NullableBurnRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBurnRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_call_target.go b/clients/apiclient/model_call_target.go new file mode 100644 index 0000000000..63152740ff --- /dev/null +++ b/clients/apiclient/model_call_target.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the CallTarget type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CallTarget{} + +// CallTarget struct for CallTarget +type CallTarget struct { + // The contract name as HName (Hex) + ContractHName string `json:"contractHName"` + // The function name as HName (Hex) + FunctionHName string `json:"functionHName"` +} + +// NewCallTarget instantiates a new CallTarget object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCallTarget(contractHName string, functionHName string) *CallTarget { + this := CallTarget{} + this.ContractHName = contractHName + this.FunctionHName = functionHName + return &this +} + +// NewCallTargetWithDefaults instantiates a new CallTarget object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCallTargetWithDefaults() *CallTarget { + this := CallTarget{} + return &this +} + +// GetContractHName returns the ContractHName field value +func (o *CallTarget) GetContractHName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractHName +} + +// GetContractHNameOk returns a tuple with the ContractHName field value +// and a boolean to check if the value has been set. +func (o *CallTarget) GetContractHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractHName, true +} + +// SetContractHName sets field value +func (o *CallTarget) SetContractHName(v string) { + o.ContractHName = v +} + +// GetFunctionHName returns the FunctionHName field value +func (o *CallTarget) GetFunctionHName() string { + if o == nil { + var ret string + return ret + } + + return o.FunctionHName +} + +// GetFunctionHNameOk returns a tuple with the FunctionHName field value +// and a boolean to check if the value has been set. +func (o *CallTarget) GetFunctionHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FunctionHName, true +} + +// SetFunctionHName sets field value +func (o *CallTarget) SetFunctionHName(v string) { + o.FunctionHName = v +} + +func (o CallTarget) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CallTarget) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contractHName"] = o.ContractHName + toSerialize["functionHName"] = o.FunctionHName + return toSerialize, nil +} + +type NullableCallTarget struct { + value *CallTarget + isSet bool +} + +func (v NullableCallTarget) Get() *CallTarget { + return v.value +} + +func (v *NullableCallTarget) Set(val *CallTarget) { + v.value = val + v.isSet = true +} + +func (v NullableCallTarget) IsSet() bool { + return v.isSet +} + +func (v *NullableCallTarget) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCallTarget(val *CallTarget) *NullableCallTarget { + return &NullableCallTarget{value: val, isSet: true} +} + +func (v NullableCallTarget) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCallTarget) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_chain_info_response.go b/clients/apiclient/model_chain_info_response.go new file mode 100644 index 0000000000..fad1ecbef0 --- /dev/null +++ b/clients/apiclient/model_chain_info_response.go @@ -0,0 +1,350 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ChainInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChainInfoResponse{} + +// ChainInfoResponse struct for ChainInfoResponse +type ChainInfoResponse struct { + // ChainID (Bech32-encoded). + ChainID string `json:"chainID"` + // The chain owner address (Bech32-encoded). + ChainOwnerId string `json:"chainOwnerId"` + // The description of the chain. + Description string `json:"description"` + // The EVM chain ID + EvmChainId uint32 `json:"evmChainId"` + GasFeePolicy *GasFeePolicy `json:"gasFeePolicy,omitempty"` + // Whether or not the chain is active. + IsActive bool `json:"isActive"` + // The maximum contract blob size. + MaxBlobSize uint32 `json:"maxBlobSize"` + // The maximum event size. + MaxEventSize uint32 `json:"maxEventSize"` + // The maximum amount of events per request. + MaxEventsPerReq uint32 `json:"maxEventsPerReq"` +} + +// NewChainInfoResponse instantiates a new ChainInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewChainInfoResponse(chainID string, chainOwnerId string, description string, evmChainId uint32, isActive bool, maxBlobSize uint32, maxEventSize uint32, maxEventsPerReq uint32) *ChainInfoResponse { + this := ChainInfoResponse{} + this.ChainID = chainID + this.ChainOwnerId = chainOwnerId + this.Description = description + this.EvmChainId = evmChainId + this.IsActive = isActive + this.MaxBlobSize = maxBlobSize + this.MaxEventSize = maxEventSize + this.MaxEventsPerReq = maxEventsPerReq + return &this +} + +// NewChainInfoResponseWithDefaults instantiates a new ChainInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewChainInfoResponseWithDefaults() *ChainInfoResponse { + this := ChainInfoResponse{} + return &this +} + +// GetChainID returns the ChainID field value +func (o *ChainInfoResponse) GetChainID() string { + if o == nil { + var ret string + return ret + } + + return o.ChainID +} + +// GetChainIDOk returns a tuple with the ChainID field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetChainIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainID, true +} + +// SetChainID sets field value +func (o *ChainInfoResponse) SetChainID(v string) { + o.ChainID = v +} + +// GetChainOwnerId returns the ChainOwnerId field value +func (o *ChainInfoResponse) GetChainOwnerId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainOwnerId +} + +// GetChainOwnerIdOk returns a tuple with the ChainOwnerId field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetChainOwnerIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainOwnerId, true +} + +// SetChainOwnerId sets field value +func (o *ChainInfoResponse) SetChainOwnerId(v string) { + o.ChainOwnerId = v +} + +// GetDescription returns the Description field value +func (o *ChainInfoResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *ChainInfoResponse) SetDescription(v string) { + o.Description = v +} + +// GetEvmChainId returns the EvmChainId field value +func (o *ChainInfoResponse) GetEvmChainId() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.EvmChainId +} + +// GetEvmChainIdOk returns a tuple with the EvmChainId field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetEvmChainIdOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.EvmChainId, true +} + +// SetEvmChainId sets field value +func (o *ChainInfoResponse) SetEvmChainId(v uint32) { + o.EvmChainId = v +} + +// GetGasFeePolicy returns the GasFeePolicy field value if set, zero value otherwise. +func (o *ChainInfoResponse) GetGasFeePolicy() GasFeePolicy { + if o == nil || isNil(o.GasFeePolicy) { + var ret GasFeePolicy + return ret + } + return *o.GasFeePolicy +} + +// GetGasFeePolicyOk returns a tuple with the GasFeePolicy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetGasFeePolicyOk() (*GasFeePolicy, bool) { + if o == nil || isNil(o.GasFeePolicy) { + return nil, false + } + return o.GasFeePolicy, true +} + +// HasGasFeePolicy returns a boolean if a field has been set. +func (o *ChainInfoResponse) HasGasFeePolicy() bool { + if o != nil && !isNil(o.GasFeePolicy) { + return true + } + + return false +} + +// SetGasFeePolicy gets a reference to the given GasFeePolicy and assigns it to the GasFeePolicy field. +func (o *ChainInfoResponse) SetGasFeePolicy(v GasFeePolicy) { + o.GasFeePolicy = &v +} + +// GetIsActive returns the IsActive field value +func (o *ChainInfoResponse) GetIsActive() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetIsActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsActive, true +} + +// SetIsActive sets field value +func (o *ChainInfoResponse) SetIsActive(v bool) { + o.IsActive = v +} + +// GetMaxBlobSize returns the MaxBlobSize field value +func (o *ChainInfoResponse) GetMaxBlobSize() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.MaxBlobSize +} + +// GetMaxBlobSizeOk returns a tuple with the MaxBlobSize field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetMaxBlobSizeOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.MaxBlobSize, true +} + +// SetMaxBlobSize sets field value +func (o *ChainInfoResponse) SetMaxBlobSize(v uint32) { + o.MaxBlobSize = v +} + +// GetMaxEventSize returns the MaxEventSize field value +func (o *ChainInfoResponse) GetMaxEventSize() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.MaxEventSize +} + +// GetMaxEventSizeOk returns a tuple with the MaxEventSize field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetMaxEventSizeOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.MaxEventSize, true +} + +// SetMaxEventSize sets field value +func (o *ChainInfoResponse) SetMaxEventSize(v uint32) { + o.MaxEventSize = v +} + +// GetMaxEventsPerReq returns the MaxEventsPerReq field value +func (o *ChainInfoResponse) GetMaxEventsPerReq() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.MaxEventsPerReq +} + +// GetMaxEventsPerReqOk returns a tuple with the MaxEventsPerReq field value +// and a boolean to check if the value has been set. +func (o *ChainInfoResponse) GetMaxEventsPerReqOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.MaxEventsPerReq, true +} + +// SetMaxEventsPerReq sets field value +func (o *ChainInfoResponse) SetMaxEventsPerReq(v uint32) { + o.MaxEventsPerReq = v +} + +func (o ChainInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChainInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["chainID"] = o.ChainID + toSerialize["chainOwnerId"] = o.ChainOwnerId + toSerialize["description"] = o.Description + toSerialize["evmChainId"] = o.EvmChainId + if !isNil(o.GasFeePolicy) { + toSerialize["gasFeePolicy"] = o.GasFeePolicy + } + toSerialize["isActive"] = o.IsActive + toSerialize["maxBlobSize"] = o.MaxBlobSize + toSerialize["maxEventSize"] = o.MaxEventSize + toSerialize["maxEventsPerReq"] = o.MaxEventsPerReq + return toSerialize, nil +} + +type NullableChainInfoResponse struct { + value *ChainInfoResponse + isSet bool +} + +func (v NullableChainInfoResponse) Get() *ChainInfoResponse { + return v.value +} + +func (v *NullableChainInfoResponse) Set(val *ChainInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableChainInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableChainInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChainInfoResponse(val *ChainInfoResponse) *NullableChainInfoResponse { + return &NullableChainInfoResponse{value: val, isSet: true} +} + +func (v NullableChainInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChainInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_chain_metrics.go b/clients/apiclient/model_chain_metrics.go new file mode 100644 index 0000000000..2645ef64c9 --- /dev/null +++ b/clients/apiclient/model_chain_metrics.go @@ -0,0 +1,414 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ChainMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChainMetrics{} + +// ChainMetrics struct for ChainMetrics +type ChainMetrics struct { + InAliasOutput AliasOutputMetricItem `json:"inAliasOutput"` + InMilestone MilestoneMetricItem `json:"inMilestone"` + InOnLedgerRequest OnLedgerRequestMetricItem `json:"inOnLedgerRequest"` + InOutput InOutputMetricItem `json:"inOutput"` + InStateOutput InStateOutputMetricItem `json:"inStateOutput"` + InTxInclusionState TxInclusionStateMsgMetricItem `json:"inTxInclusionState"` + OutPublishGovernanceTransaction TransactionMetricItem `json:"outPublishGovernanceTransaction"` + OutPublisherStateTransaction PublisherStateTransactionItem `json:"outPublisherStateTransaction"` + OutPullLatestOutput InterfaceMetricItem `json:"outPullLatestOutput"` + OutPullOutputByID UTXOInputMetricItem `json:"outPullOutputByID"` + OutPullTxInclusionState TransactionIDMetricItem `json:"outPullTxInclusionState"` + RegisteredChainIDs []string `json:"registeredChainIDs"` +} + +// NewChainMetrics instantiates a new ChainMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewChainMetrics(inAliasOutput AliasOutputMetricItem, inMilestone MilestoneMetricItem, inOnLedgerRequest OnLedgerRequestMetricItem, inOutput InOutputMetricItem, inStateOutput InStateOutputMetricItem, inTxInclusionState TxInclusionStateMsgMetricItem, outPublishGovernanceTransaction TransactionMetricItem, outPublisherStateTransaction PublisherStateTransactionItem, outPullLatestOutput InterfaceMetricItem, outPullOutputByID UTXOInputMetricItem, outPullTxInclusionState TransactionIDMetricItem, registeredChainIDs []string) *ChainMetrics { + this := ChainMetrics{} + this.InAliasOutput = inAliasOutput + this.InMilestone = inMilestone + this.InOnLedgerRequest = inOnLedgerRequest + this.InOutput = inOutput + this.InStateOutput = inStateOutput + this.InTxInclusionState = inTxInclusionState + this.OutPublishGovernanceTransaction = outPublishGovernanceTransaction + this.OutPublisherStateTransaction = outPublisherStateTransaction + this.OutPullLatestOutput = outPullLatestOutput + this.OutPullOutputByID = outPullOutputByID + this.OutPullTxInclusionState = outPullTxInclusionState + this.RegisteredChainIDs = registeredChainIDs + return &this +} + +// NewChainMetricsWithDefaults instantiates a new ChainMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewChainMetricsWithDefaults() *ChainMetrics { + this := ChainMetrics{} + return &this +} + +// GetInAliasOutput returns the InAliasOutput field value +func (o *ChainMetrics) GetInAliasOutput() AliasOutputMetricItem { + if o == nil { + var ret AliasOutputMetricItem + return ret + } + + return o.InAliasOutput +} + +// GetInAliasOutputOk returns a tuple with the InAliasOutput field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInAliasOutputOk() (*AliasOutputMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InAliasOutput, true +} + +// SetInAliasOutput sets field value +func (o *ChainMetrics) SetInAliasOutput(v AliasOutputMetricItem) { + o.InAliasOutput = v +} + +// GetInMilestone returns the InMilestone field value +func (o *ChainMetrics) GetInMilestone() MilestoneMetricItem { + if o == nil { + var ret MilestoneMetricItem + return ret + } + + return o.InMilestone +} + +// GetInMilestoneOk returns a tuple with the InMilestone field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInMilestoneOk() (*MilestoneMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InMilestone, true +} + +// SetInMilestone sets field value +func (o *ChainMetrics) SetInMilestone(v MilestoneMetricItem) { + o.InMilestone = v +} + +// GetInOnLedgerRequest returns the InOnLedgerRequest field value +func (o *ChainMetrics) GetInOnLedgerRequest() OnLedgerRequestMetricItem { + if o == nil { + var ret OnLedgerRequestMetricItem + return ret + } + + return o.InOnLedgerRequest +} + +// GetInOnLedgerRequestOk returns a tuple with the InOnLedgerRequest field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInOnLedgerRequestOk() (*OnLedgerRequestMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InOnLedgerRequest, true +} + +// SetInOnLedgerRequest sets field value +func (o *ChainMetrics) SetInOnLedgerRequest(v OnLedgerRequestMetricItem) { + o.InOnLedgerRequest = v +} + +// GetInOutput returns the InOutput field value +func (o *ChainMetrics) GetInOutput() InOutputMetricItem { + if o == nil { + var ret InOutputMetricItem + return ret + } + + return o.InOutput +} + +// GetInOutputOk returns a tuple with the InOutput field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInOutputOk() (*InOutputMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InOutput, true +} + +// SetInOutput sets field value +func (o *ChainMetrics) SetInOutput(v InOutputMetricItem) { + o.InOutput = v +} + +// GetInStateOutput returns the InStateOutput field value +func (o *ChainMetrics) GetInStateOutput() InStateOutputMetricItem { + if o == nil { + var ret InStateOutputMetricItem + return ret + } + + return o.InStateOutput +} + +// GetInStateOutputOk returns a tuple with the InStateOutput field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInStateOutputOk() (*InStateOutputMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InStateOutput, true +} + +// SetInStateOutput sets field value +func (o *ChainMetrics) SetInStateOutput(v InStateOutputMetricItem) { + o.InStateOutput = v +} + +// GetInTxInclusionState returns the InTxInclusionState field value +func (o *ChainMetrics) GetInTxInclusionState() TxInclusionStateMsgMetricItem { + if o == nil { + var ret TxInclusionStateMsgMetricItem + return ret + } + + return o.InTxInclusionState +} + +// GetInTxInclusionStateOk returns a tuple with the InTxInclusionState field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetInTxInclusionStateOk() (*TxInclusionStateMsgMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.InTxInclusionState, true +} + +// SetInTxInclusionState sets field value +func (o *ChainMetrics) SetInTxInclusionState(v TxInclusionStateMsgMetricItem) { + o.InTxInclusionState = v +} + +// GetOutPublishGovernanceTransaction returns the OutPublishGovernanceTransaction field value +func (o *ChainMetrics) GetOutPublishGovernanceTransaction() TransactionMetricItem { + if o == nil { + var ret TransactionMetricItem + return ret + } + + return o.OutPublishGovernanceTransaction +} + +// GetOutPublishGovernanceTransactionOk returns a tuple with the OutPublishGovernanceTransaction field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetOutPublishGovernanceTransactionOk() (*TransactionMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.OutPublishGovernanceTransaction, true +} + +// SetOutPublishGovernanceTransaction sets field value +func (o *ChainMetrics) SetOutPublishGovernanceTransaction(v TransactionMetricItem) { + o.OutPublishGovernanceTransaction = v +} + +// GetOutPublisherStateTransaction returns the OutPublisherStateTransaction field value +func (o *ChainMetrics) GetOutPublisherStateTransaction() PublisherStateTransactionItem { + if o == nil { + var ret PublisherStateTransactionItem + return ret + } + + return o.OutPublisherStateTransaction +} + +// GetOutPublisherStateTransactionOk returns a tuple with the OutPublisherStateTransaction field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetOutPublisherStateTransactionOk() (*PublisherStateTransactionItem, bool) { + if o == nil { + return nil, false + } + return &o.OutPublisherStateTransaction, true +} + +// SetOutPublisherStateTransaction sets field value +func (o *ChainMetrics) SetOutPublisherStateTransaction(v PublisherStateTransactionItem) { + o.OutPublisherStateTransaction = v +} + +// GetOutPullLatestOutput returns the OutPullLatestOutput field value +func (o *ChainMetrics) GetOutPullLatestOutput() InterfaceMetricItem { + if o == nil { + var ret InterfaceMetricItem + return ret + } + + return o.OutPullLatestOutput +} + +// GetOutPullLatestOutputOk returns a tuple with the OutPullLatestOutput field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetOutPullLatestOutputOk() (*InterfaceMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.OutPullLatestOutput, true +} + +// SetOutPullLatestOutput sets field value +func (o *ChainMetrics) SetOutPullLatestOutput(v InterfaceMetricItem) { + o.OutPullLatestOutput = v +} + +// GetOutPullOutputByID returns the OutPullOutputByID field value +func (o *ChainMetrics) GetOutPullOutputByID() UTXOInputMetricItem { + if o == nil { + var ret UTXOInputMetricItem + return ret + } + + return o.OutPullOutputByID +} + +// GetOutPullOutputByIDOk returns a tuple with the OutPullOutputByID field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetOutPullOutputByIDOk() (*UTXOInputMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.OutPullOutputByID, true +} + +// SetOutPullOutputByID sets field value +func (o *ChainMetrics) SetOutPullOutputByID(v UTXOInputMetricItem) { + o.OutPullOutputByID = v +} + +// GetOutPullTxInclusionState returns the OutPullTxInclusionState field value +func (o *ChainMetrics) GetOutPullTxInclusionState() TransactionIDMetricItem { + if o == nil { + var ret TransactionIDMetricItem + return ret + } + + return o.OutPullTxInclusionState +} + +// GetOutPullTxInclusionStateOk returns a tuple with the OutPullTxInclusionState field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetOutPullTxInclusionStateOk() (*TransactionIDMetricItem, bool) { + if o == nil { + return nil, false + } + return &o.OutPullTxInclusionState, true +} + +// SetOutPullTxInclusionState sets field value +func (o *ChainMetrics) SetOutPullTxInclusionState(v TransactionIDMetricItem) { + o.OutPullTxInclusionState = v +} + +// GetRegisteredChainIDs returns the RegisteredChainIDs field value +func (o *ChainMetrics) GetRegisteredChainIDs() []string { + if o == nil { + var ret []string + return ret + } + + return o.RegisteredChainIDs +} + +// GetRegisteredChainIDsOk returns a tuple with the RegisteredChainIDs field value +// and a boolean to check if the value has been set. +func (o *ChainMetrics) GetRegisteredChainIDsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.RegisteredChainIDs, true +} + +// SetRegisteredChainIDs sets field value +func (o *ChainMetrics) SetRegisteredChainIDs(v []string) { + o.RegisteredChainIDs = v +} + +func (o ChainMetrics) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChainMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["inAliasOutput"] = o.InAliasOutput + toSerialize["inMilestone"] = o.InMilestone + toSerialize["inOnLedgerRequest"] = o.InOnLedgerRequest + toSerialize["inOutput"] = o.InOutput + toSerialize["inStateOutput"] = o.InStateOutput + toSerialize["inTxInclusionState"] = o.InTxInclusionState + toSerialize["outPublishGovernanceTransaction"] = o.OutPublishGovernanceTransaction + toSerialize["outPublisherStateTransaction"] = o.OutPublisherStateTransaction + toSerialize["outPullLatestOutput"] = o.OutPullLatestOutput + toSerialize["outPullOutputByID"] = o.OutPullOutputByID + toSerialize["outPullTxInclusionState"] = o.OutPullTxInclusionState + toSerialize["registeredChainIDs"] = o.RegisteredChainIDs + return toSerialize, nil +} + +type NullableChainMetrics struct { + value *ChainMetrics + isSet bool +} + +func (v NullableChainMetrics) Get() *ChainMetrics { + return v.value +} + +func (v *NullableChainMetrics) Set(val *ChainMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableChainMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableChainMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChainMetrics(val *ChainMetrics) *NullableChainMetrics { + return &NullableChainMetrics{value: val, isSet: true} +} + +func (v NullableChainMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChainMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_chain_record.go b/clients/apiclient/model_chain_record.go new file mode 100644 index 0000000000..b8ab5fabc8 --- /dev/null +++ b/clients/apiclient/model_chain_record.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ChainRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChainRecord{} + +// ChainRecord struct for ChainRecord +type ChainRecord struct { + AccessNodes []string `json:"accessNodes"` + IsActive bool `json:"isActive"` +} + +// NewChainRecord instantiates a new ChainRecord object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewChainRecord(accessNodes []string, isActive bool) *ChainRecord { + this := ChainRecord{} + this.AccessNodes = accessNodes + this.IsActive = isActive + return &this +} + +// NewChainRecordWithDefaults instantiates a new ChainRecord object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewChainRecordWithDefaults() *ChainRecord { + this := ChainRecord{} + return &this +} + +// GetAccessNodes returns the AccessNodes field value +func (o *ChainRecord) GetAccessNodes() []string { + if o == nil { + var ret []string + return ret + } + + return o.AccessNodes +} + +// GetAccessNodesOk returns a tuple with the AccessNodes field value +// and a boolean to check if the value has been set. +func (o *ChainRecord) GetAccessNodesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.AccessNodes, true +} + +// SetAccessNodes sets field value +func (o *ChainRecord) SetAccessNodes(v []string) { + o.AccessNodes = v +} + +// GetIsActive returns the IsActive field value +func (o *ChainRecord) GetIsActive() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value +// and a boolean to check if the value has been set. +func (o *ChainRecord) GetIsActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsActive, true +} + +// SetIsActive sets field value +func (o *ChainRecord) SetIsActive(v bool) { + o.IsActive = v +} + +func (o ChainRecord) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChainRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessNodes"] = o.AccessNodes + toSerialize["isActive"] = o.IsActive + return toSerialize, nil +} + +type NullableChainRecord struct { + value *ChainRecord + isSet bool +} + +func (v NullableChainRecord) Get() *ChainRecord { + return v.value +} + +func (v *NullableChainRecord) Set(val *ChainRecord) { + v.value = val + v.isSet = true +} + +func (v NullableChainRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableChainRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChainRecord(val *ChainRecord) *NullableChainRecord { + return &NullableChainRecord{value: val, isSet: true} +} + +func (v NullableChainRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChainRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_committee_info_response.go b/clients/apiclient/model_committee_info_response.go new file mode 100644 index 0000000000..0737021042 --- /dev/null +++ b/clients/apiclient/model_committee_info_response.go @@ -0,0 +1,257 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the CommitteeInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommitteeInfoResponse{} + +// CommitteeInfoResponse struct for CommitteeInfoResponse +type CommitteeInfoResponse struct { + // A list of all access nodes and their peering info. + AccessNodes []CommitteeNode `json:"accessNodes"` + // Whether or not the chain is active. + Active bool `json:"active"` + // A list of all candidate nodes and their peering info. + CandidateNodes []CommitteeNode `json:"candidateNodes"` + // ChainID (Bech32-encoded). + ChainId string `json:"chainId"` + // A list of all committee nodes and their peering info. + CommitteeNodes []CommitteeNode `json:"committeeNodes"` + StateAddress string `json:"stateAddress"` +} + +// NewCommitteeInfoResponse instantiates a new CommitteeInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCommitteeInfoResponse(accessNodes []CommitteeNode, active bool, candidateNodes []CommitteeNode, chainId string, committeeNodes []CommitteeNode, stateAddress string) *CommitteeInfoResponse { + this := CommitteeInfoResponse{} + this.AccessNodes = accessNodes + this.Active = active + this.CandidateNodes = candidateNodes + this.ChainId = chainId + this.CommitteeNodes = committeeNodes + this.StateAddress = stateAddress + return &this +} + +// NewCommitteeInfoResponseWithDefaults instantiates a new CommitteeInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCommitteeInfoResponseWithDefaults() *CommitteeInfoResponse { + this := CommitteeInfoResponse{} + return &this +} + +// GetAccessNodes returns the AccessNodes field value +func (o *CommitteeInfoResponse) GetAccessNodes() []CommitteeNode { + if o == nil { + var ret []CommitteeNode + return ret + } + + return o.AccessNodes +} + +// GetAccessNodesOk returns a tuple with the AccessNodes field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetAccessNodesOk() ([]CommitteeNode, bool) { + if o == nil { + return nil, false + } + return o.AccessNodes, true +} + +// SetAccessNodes sets field value +func (o *CommitteeInfoResponse) SetAccessNodes(v []CommitteeNode) { + o.AccessNodes = v +} + +// GetActive returns the Active field value +func (o *CommitteeInfoResponse) GetActive() bool { + if o == nil { + var ret bool + return ret + } + + return o.Active +} + +// GetActiveOk returns a tuple with the Active field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Active, true +} + +// SetActive sets field value +func (o *CommitteeInfoResponse) SetActive(v bool) { + o.Active = v +} + +// GetCandidateNodes returns the CandidateNodes field value +func (o *CommitteeInfoResponse) GetCandidateNodes() []CommitteeNode { + if o == nil { + var ret []CommitteeNode + return ret + } + + return o.CandidateNodes +} + +// GetCandidateNodesOk returns a tuple with the CandidateNodes field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetCandidateNodesOk() ([]CommitteeNode, bool) { + if o == nil { + return nil, false + } + return o.CandidateNodes, true +} + +// SetCandidateNodes sets field value +func (o *CommitteeInfoResponse) SetCandidateNodes(v []CommitteeNode) { + o.CandidateNodes = v +} + +// GetChainId returns the ChainId field value +func (o *CommitteeInfoResponse) GetChainId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainId +} + +// GetChainIdOk returns a tuple with the ChainId field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetChainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainId, true +} + +// SetChainId sets field value +func (o *CommitteeInfoResponse) SetChainId(v string) { + o.ChainId = v +} + +// GetCommitteeNodes returns the CommitteeNodes field value +func (o *CommitteeInfoResponse) GetCommitteeNodes() []CommitteeNode { + if o == nil { + var ret []CommitteeNode + return ret + } + + return o.CommitteeNodes +} + +// GetCommitteeNodesOk returns a tuple with the CommitteeNodes field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetCommitteeNodesOk() ([]CommitteeNode, bool) { + if o == nil { + return nil, false + } + return o.CommitteeNodes, true +} + +// SetCommitteeNodes sets field value +func (o *CommitteeInfoResponse) SetCommitteeNodes(v []CommitteeNode) { + o.CommitteeNodes = v +} + +// GetStateAddress returns the StateAddress field value +func (o *CommitteeInfoResponse) GetStateAddress() string { + if o == nil { + var ret string + return ret + } + + return o.StateAddress +} + +// GetStateAddressOk returns a tuple with the StateAddress field value +// and a boolean to check if the value has been set. +func (o *CommitteeInfoResponse) GetStateAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StateAddress, true +} + +// SetStateAddress sets field value +func (o *CommitteeInfoResponse) SetStateAddress(v string) { + o.StateAddress = v +} + +func (o CommitteeInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommitteeInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessNodes"] = o.AccessNodes + toSerialize["active"] = o.Active + toSerialize["candidateNodes"] = o.CandidateNodes + toSerialize["chainId"] = o.ChainId + toSerialize["committeeNodes"] = o.CommitteeNodes + toSerialize["stateAddress"] = o.StateAddress + return toSerialize, nil +} + +type NullableCommitteeInfoResponse struct { + value *CommitteeInfoResponse + isSet bool +} + +func (v NullableCommitteeInfoResponse) Get() *CommitteeInfoResponse { + return v.value +} + +func (v *NullableCommitteeInfoResponse) Set(val *CommitteeInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCommitteeInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCommitteeInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommitteeInfoResponse(val *CommitteeInfoResponse) *NullableCommitteeInfoResponse { + return &NullableCommitteeInfoResponse{value: val, isSet: true} +} + +func (v NullableCommitteeInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommitteeInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_committee_node.go b/clients/apiclient/model_committee_node.go new file mode 100644 index 0000000000..d8b9942ce6 --- /dev/null +++ b/clients/apiclient/model_committee_node.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the CommitteeNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CommitteeNode{} + +// CommitteeNode struct for CommitteeNode +type CommitteeNode struct { + AccessAPI string `json:"accessAPI"` + Node PeeringNodeStatusResponse `json:"node"` +} + +// NewCommitteeNode instantiates a new CommitteeNode object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCommitteeNode(accessAPI string, node PeeringNodeStatusResponse) *CommitteeNode { + this := CommitteeNode{} + this.AccessAPI = accessAPI + this.Node = node + return &this +} + +// NewCommitteeNodeWithDefaults instantiates a new CommitteeNode object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCommitteeNodeWithDefaults() *CommitteeNode { + this := CommitteeNode{} + return &this +} + +// GetAccessAPI returns the AccessAPI field value +func (o *CommitteeNode) GetAccessAPI() string { + if o == nil { + var ret string + return ret + } + + return o.AccessAPI +} + +// GetAccessAPIOk returns a tuple with the AccessAPI field value +// and a boolean to check if the value has been set. +func (o *CommitteeNode) GetAccessAPIOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AccessAPI, true +} + +// SetAccessAPI sets field value +func (o *CommitteeNode) SetAccessAPI(v string) { + o.AccessAPI = v +} + +// GetNode returns the Node field value +func (o *CommitteeNode) GetNode() PeeringNodeStatusResponse { + if o == nil { + var ret PeeringNodeStatusResponse + return ret + } + + return o.Node +} + +// GetNodeOk returns a tuple with the Node field value +// and a boolean to check if the value has been set. +func (o *CommitteeNode) GetNodeOk() (*PeeringNodeStatusResponse, bool) { + if o == nil { + return nil, false + } + return &o.Node, true +} + +// SetNode sets field value +func (o *CommitteeNode) SetNode(v PeeringNodeStatusResponse) { + o.Node = v +} + +func (o CommitteeNode) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CommitteeNode) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["accessAPI"] = o.AccessAPI + toSerialize["node"] = o.Node + return toSerialize, nil +} + +type NullableCommitteeNode struct { + value *CommitteeNode + isSet bool +} + +func (v NullableCommitteeNode) Get() *CommitteeNode { + return v.value +} + +func (v *NullableCommitteeNode) Set(val *CommitteeNode) { + v.value = val + v.isSet = true +} + +func (v NullableCommitteeNode) IsSet() bool { + return v.isSet +} + +func (v *NullableCommitteeNode) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommitteeNode(val *CommitteeNode) *NullableCommitteeNode { + return &NullableCommitteeNode{value: val, isSet: true} +} + +func (v NullableCommitteeNode) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommitteeNode) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_consensus_pipe_metrics.go b/clients/apiclient/model_consensus_pipe_metrics.go new file mode 100644 index 0000000000..5f73c2a7c5 --- /dev/null +++ b/clients/apiclient/model_consensus_pipe_metrics.go @@ -0,0 +1,225 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ConsensusPipeMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConsensusPipeMetrics{} + +// ConsensusPipeMetrics struct for ConsensusPipeMetrics +type ConsensusPipeMetrics struct { + EventACSMsgPipeSize int32 `json:"eventACSMsgPipeSize"` + EventPeerLogIndexMsgPipeSize int32 `json:"eventPeerLogIndexMsgPipeSize"` + EventStateTransitionMsgPipeSize int32 `json:"eventStateTransitionMsgPipeSize"` + EventTimerMsgPipeSize int32 `json:"eventTimerMsgPipeSize"` + EventVMResultMsgPipeSize int32 `json:"eventVMResultMsgPipeSize"` +} + +// NewConsensusPipeMetrics instantiates a new ConsensusPipeMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConsensusPipeMetrics(eventACSMsgPipeSize int32, eventPeerLogIndexMsgPipeSize int32, eventStateTransitionMsgPipeSize int32, eventTimerMsgPipeSize int32, eventVMResultMsgPipeSize int32) *ConsensusPipeMetrics { + this := ConsensusPipeMetrics{} + this.EventACSMsgPipeSize = eventACSMsgPipeSize + this.EventPeerLogIndexMsgPipeSize = eventPeerLogIndexMsgPipeSize + this.EventStateTransitionMsgPipeSize = eventStateTransitionMsgPipeSize + this.EventTimerMsgPipeSize = eventTimerMsgPipeSize + this.EventVMResultMsgPipeSize = eventVMResultMsgPipeSize + return &this +} + +// NewConsensusPipeMetricsWithDefaults instantiates a new ConsensusPipeMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConsensusPipeMetricsWithDefaults() *ConsensusPipeMetrics { + this := ConsensusPipeMetrics{} + return &this +} + +// GetEventACSMsgPipeSize returns the EventACSMsgPipeSize field value +func (o *ConsensusPipeMetrics) GetEventACSMsgPipeSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EventACSMsgPipeSize +} + +// GetEventACSMsgPipeSizeOk returns a tuple with the EventACSMsgPipeSize field value +// and a boolean to check if the value has been set. +func (o *ConsensusPipeMetrics) GetEventACSMsgPipeSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EventACSMsgPipeSize, true +} + +// SetEventACSMsgPipeSize sets field value +func (o *ConsensusPipeMetrics) SetEventACSMsgPipeSize(v int32) { + o.EventACSMsgPipeSize = v +} + +// GetEventPeerLogIndexMsgPipeSize returns the EventPeerLogIndexMsgPipeSize field value +func (o *ConsensusPipeMetrics) GetEventPeerLogIndexMsgPipeSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EventPeerLogIndexMsgPipeSize +} + +// GetEventPeerLogIndexMsgPipeSizeOk returns a tuple with the EventPeerLogIndexMsgPipeSize field value +// and a boolean to check if the value has been set. +func (o *ConsensusPipeMetrics) GetEventPeerLogIndexMsgPipeSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EventPeerLogIndexMsgPipeSize, true +} + +// SetEventPeerLogIndexMsgPipeSize sets field value +func (o *ConsensusPipeMetrics) SetEventPeerLogIndexMsgPipeSize(v int32) { + o.EventPeerLogIndexMsgPipeSize = v +} + +// GetEventStateTransitionMsgPipeSize returns the EventStateTransitionMsgPipeSize field value +func (o *ConsensusPipeMetrics) GetEventStateTransitionMsgPipeSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EventStateTransitionMsgPipeSize +} + +// GetEventStateTransitionMsgPipeSizeOk returns a tuple with the EventStateTransitionMsgPipeSize field value +// and a boolean to check if the value has been set. +func (o *ConsensusPipeMetrics) GetEventStateTransitionMsgPipeSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EventStateTransitionMsgPipeSize, true +} + +// SetEventStateTransitionMsgPipeSize sets field value +func (o *ConsensusPipeMetrics) SetEventStateTransitionMsgPipeSize(v int32) { + o.EventStateTransitionMsgPipeSize = v +} + +// GetEventTimerMsgPipeSize returns the EventTimerMsgPipeSize field value +func (o *ConsensusPipeMetrics) GetEventTimerMsgPipeSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EventTimerMsgPipeSize +} + +// GetEventTimerMsgPipeSizeOk returns a tuple with the EventTimerMsgPipeSize field value +// and a boolean to check if the value has been set. +func (o *ConsensusPipeMetrics) GetEventTimerMsgPipeSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EventTimerMsgPipeSize, true +} + +// SetEventTimerMsgPipeSize sets field value +func (o *ConsensusPipeMetrics) SetEventTimerMsgPipeSize(v int32) { + o.EventTimerMsgPipeSize = v +} + +// GetEventVMResultMsgPipeSize returns the EventVMResultMsgPipeSize field value +func (o *ConsensusPipeMetrics) GetEventVMResultMsgPipeSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EventVMResultMsgPipeSize +} + +// GetEventVMResultMsgPipeSizeOk returns a tuple with the EventVMResultMsgPipeSize field value +// and a boolean to check if the value has been set. +func (o *ConsensusPipeMetrics) GetEventVMResultMsgPipeSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EventVMResultMsgPipeSize, true +} + +// SetEventVMResultMsgPipeSize sets field value +func (o *ConsensusPipeMetrics) SetEventVMResultMsgPipeSize(v int32) { + o.EventVMResultMsgPipeSize = v +} + +func (o ConsensusPipeMetrics) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConsensusPipeMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["eventACSMsgPipeSize"] = o.EventACSMsgPipeSize + toSerialize["eventPeerLogIndexMsgPipeSize"] = o.EventPeerLogIndexMsgPipeSize + toSerialize["eventStateTransitionMsgPipeSize"] = o.EventStateTransitionMsgPipeSize + toSerialize["eventTimerMsgPipeSize"] = o.EventTimerMsgPipeSize + toSerialize["eventVMResultMsgPipeSize"] = o.EventVMResultMsgPipeSize + return toSerialize, nil +} + +type NullableConsensusPipeMetrics struct { + value *ConsensusPipeMetrics + isSet bool +} + +func (v NullableConsensusPipeMetrics) Get() *ConsensusPipeMetrics { + return v.value +} + +func (v *NullableConsensusPipeMetrics) Set(val *ConsensusPipeMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableConsensusPipeMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableConsensusPipeMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConsensusPipeMetrics(val *ConsensusPipeMetrics) *NullableConsensusPipeMetrics { + return &NullableConsensusPipeMetrics{value: val, isSet: true} +} + +func (v NullableConsensusPipeMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConsensusPipeMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_consensus_workflow_metrics.go b/clients/apiclient/model_consensus_workflow_metrics.go new file mode 100644 index 0000000000..67713008b8 --- /dev/null +++ b/clients/apiclient/model_consensus_workflow_metrics.go @@ -0,0 +1,604 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the ConsensusWorkflowMetrics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConsensusWorkflowMetrics{} + +// ConsensusWorkflowMetrics struct for ConsensusWorkflowMetrics +type ConsensusWorkflowMetrics struct { + // Shows current state index of the consensus + CurrentStateIndex *uint32 `json:"currentStateIndex,omitempty"` + // Shows if batch proposal is sent out in current consensus iteration + FlagBatchProposalSent bool `json:"flagBatchProposalSent"` + // Shows if consensus on batch is reached and known in current consensus iteration + FlagConsensusBatchKnown bool `json:"flagConsensusBatchKnown"` + // Shows if consensus algorithm is still not completed in current consensus iteration + FlagInProgress bool `json:"flagInProgress"` + // Shows if state output is received in current consensus iteration + FlagStateReceived bool `json:"flagStateReceived"` + // Shows if consensus on transaction is reached in current consensus iteration + FlagTransactionFinalized bool `json:"flagTransactionFinalized"` + // Shows if transaction is posted to L1 in current consensus iteration + FlagTransactionPosted bool `json:"flagTransactionPosted"` + // Shows if L1 reported that it has seen the transaction of current consensus iteration + FlagTransactionSeen bool `json:"flagTransactionSeen"` + // Shows if virtual machine has returned its results in current consensus iteration + FlagVMResultSigned bool `json:"flagVMResultSigned"` + // Shows if virtual machine is started in current consensus iteration + FlagVMStarted bool `json:"flagVMStarted"` + // Shows when batch proposal was last sent out in current consensus iteration + TimeBatchProposalSent time.Time `json:"timeBatchProposalSent"` + // Shows when algorithm was last completed in current consensus iteration + TimeCompleted time.Time `json:"timeCompleted"` + // Shows when ACS results of consensus on batch was last received in current consensus iteration + TimeConsensusBatchKnown time.Time `json:"timeConsensusBatchKnown"` + // Shows when algorithm last noted that all the data for consensus on transaction had been received in current consensus iteration + TimeTransactionFinalized time.Time `json:"timeTransactionFinalized"` + // Shows when transaction was last posted to L1 in current consensus iteration + TimeTransactionPosted time.Time `json:"timeTransactionPosted"` + // Shows when algorithm last noted that transaction had been seen by L1 in current consensus iteration + TimeTransactionSeen time.Time `json:"timeTransactionSeen"` + // Shows when virtual machine results were last received and signed in current consensus iteration + TimeVMResultSigned time.Time `json:"timeVMResultSigned"` + // Shows when virtual machine was last started in current consensus iteration + TimeVMStarted time.Time `json:"timeVMStarted"` +} + +// NewConsensusWorkflowMetrics instantiates a new ConsensusWorkflowMetrics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConsensusWorkflowMetrics(flagBatchProposalSent bool, flagConsensusBatchKnown bool, flagInProgress bool, flagStateReceived bool, flagTransactionFinalized bool, flagTransactionPosted bool, flagTransactionSeen bool, flagVMResultSigned bool, flagVMStarted bool, timeBatchProposalSent time.Time, timeCompleted time.Time, timeConsensusBatchKnown time.Time, timeTransactionFinalized time.Time, timeTransactionPosted time.Time, timeTransactionSeen time.Time, timeVMResultSigned time.Time, timeVMStarted time.Time) *ConsensusWorkflowMetrics { + this := ConsensusWorkflowMetrics{} + this.FlagBatchProposalSent = flagBatchProposalSent + this.FlagConsensusBatchKnown = flagConsensusBatchKnown + this.FlagInProgress = flagInProgress + this.FlagStateReceived = flagStateReceived + this.FlagTransactionFinalized = flagTransactionFinalized + this.FlagTransactionPosted = flagTransactionPosted + this.FlagTransactionSeen = flagTransactionSeen + this.FlagVMResultSigned = flagVMResultSigned + this.FlagVMStarted = flagVMStarted + this.TimeBatchProposalSent = timeBatchProposalSent + this.TimeCompleted = timeCompleted + this.TimeConsensusBatchKnown = timeConsensusBatchKnown + this.TimeTransactionFinalized = timeTransactionFinalized + this.TimeTransactionPosted = timeTransactionPosted + this.TimeTransactionSeen = timeTransactionSeen + this.TimeVMResultSigned = timeVMResultSigned + this.TimeVMStarted = timeVMStarted + return &this +} + +// NewConsensusWorkflowMetricsWithDefaults instantiates a new ConsensusWorkflowMetrics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConsensusWorkflowMetricsWithDefaults() *ConsensusWorkflowMetrics { + this := ConsensusWorkflowMetrics{} + return &this +} + +// GetCurrentStateIndex returns the CurrentStateIndex field value if set, zero value otherwise. +func (o *ConsensusWorkflowMetrics) GetCurrentStateIndex() uint32 { + if o == nil || isNil(o.CurrentStateIndex) { + var ret uint32 + return ret + } + return *o.CurrentStateIndex +} + +// GetCurrentStateIndexOk returns a tuple with the CurrentStateIndex field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetCurrentStateIndexOk() (*uint32, bool) { + if o == nil || isNil(o.CurrentStateIndex) { + return nil, false + } + return o.CurrentStateIndex, true +} + +// HasCurrentStateIndex returns a boolean if a field has been set. +func (o *ConsensusWorkflowMetrics) HasCurrentStateIndex() bool { + if o != nil && !isNil(o.CurrentStateIndex) { + return true + } + + return false +} + +// SetCurrentStateIndex gets a reference to the given uint32 and assigns it to the CurrentStateIndex field. +func (o *ConsensusWorkflowMetrics) SetCurrentStateIndex(v uint32) { + o.CurrentStateIndex = &v +} + +// GetFlagBatchProposalSent returns the FlagBatchProposalSent field value +func (o *ConsensusWorkflowMetrics) GetFlagBatchProposalSent() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagBatchProposalSent +} + +// GetFlagBatchProposalSentOk returns a tuple with the FlagBatchProposalSent field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagBatchProposalSentOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagBatchProposalSent, true +} + +// SetFlagBatchProposalSent sets field value +func (o *ConsensusWorkflowMetrics) SetFlagBatchProposalSent(v bool) { + o.FlagBatchProposalSent = v +} + +// GetFlagConsensusBatchKnown returns the FlagConsensusBatchKnown field value +func (o *ConsensusWorkflowMetrics) GetFlagConsensusBatchKnown() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagConsensusBatchKnown +} + +// GetFlagConsensusBatchKnownOk returns a tuple with the FlagConsensusBatchKnown field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagConsensusBatchKnownOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagConsensusBatchKnown, true +} + +// SetFlagConsensusBatchKnown sets field value +func (o *ConsensusWorkflowMetrics) SetFlagConsensusBatchKnown(v bool) { + o.FlagConsensusBatchKnown = v +} + +// GetFlagInProgress returns the FlagInProgress field value +func (o *ConsensusWorkflowMetrics) GetFlagInProgress() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagInProgress +} + +// GetFlagInProgressOk returns a tuple with the FlagInProgress field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagInProgressOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagInProgress, true +} + +// SetFlagInProgress sets field value +func (o *ConsensusWorkflowMetrics) SetFlagInProgress(v bool) { + o.FlagInProgress = v +} + +// GetFlagStateReceived returns the FlagStateReceived field value +func (o *ConsensusWorkflowMetrics) GetFlagStateReceived() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagStateReceived +} + +// GetFlagStateReceivedOk returns a tuple with the FlagStateReceived field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagStateReceivedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagStateReceived, true +} + +// SetFlagStateReceived sets field value +func (o *ConsensusWorkflowMetrics) SetFlagStateReceived(v bool) { + o.FlagStateReceived = v +} + +// GetFlagTransactionFinalized returns the FlagTransactionFinalized field value +func (o *ConsensusWorkflowMetrics) GetFlagTransactionFinalized() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagTransactionFinalized +} + +// GetFlagTransactionFinalizedOk returns a tuple with the FlagTransactionFinalized field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagTransactionFinalizedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagTransactionFinalized, true +} + +// SetFlagTransactionFinalized sets field value +func (o *ConsensusWorkflowMetrics) SetFlagTransactionFinalized(v bool) { + o.FlagTransactionFinalized = v +} + +// GetFlagTransactionPosted returns the FlagTransactionPosted field value +func (o *ConsensusWorkflowMetrics) GetFlagTransactionPosted() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagTransactionPosted +} + +// GetFlagTransactionPostedOk returns a tuple with the FlagTransactionPosted field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagTransactionPostedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagTransactionPosted, true +} + +// SetFlagTransactionPosted sets field value +func (o *ConsensusWorkflowMetrics) SetFlagTransactionPosted(v bool) { + o.FlagTransactionPosted = v +} + +// GetFlagTransactionSeen returns the FlagTransactionSeen field value +func (o *ConsensusWorkflowMetrics) GetFlagTransactionSeen() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagTransactionSeen +} + +// GetFlagTransactionSeenOk returns a tuple with the FlagTransactionSeen field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagTransactionSeenOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagTransactionSeen, true +} + +// SetFlagTransactionSeen sets field value +func (o *ConsensusWorkflowMetrics) SetFlagTransactionSeen(v bool) { + o.FlagTransactionSeen = v +} + +// GetFlagVMResultSigned returns the FlagVMResultSigned field value +func (o *ConsensusWorkflowMetrics) GetFlagVMResultSigned() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagVMResultSigned +} + +// GetFlagVMResultSignedOk returns a tuple with the FlagVMResultSigned field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagVMResultSignedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagVMResultSigned, true +} + +// SetFlagVMResultSigned sets field value +func (o *ConsensusWorkflowMetrics) SetFlagVMResultSigned(v bool) { + o.FlagVMResultSigned = v +} + +// GetFlagVMStarted returns the FlagVMStarted field value +func (o *ConsensusWorkflowMetrics) GetFlagVMStarted() bool { + if o == nil { + var ret bool + return ret + } + + return o.FlagVMStarted +} + +// GetFlagVMStartedOk returns a tuple with the FlagVMStarted field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetFlagVMStartedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.FlagVMStarted, true +} + +// SetFlagVMStarted sets field value +func (o *ConsensusWorkflowMetrics) SetFlagVMStarted(v bool) { + o.FlagVMStarted = v +} + +// GetTimeBatchProposalSent returns the TimeBatchProposalSent field value +func (o *ConsensusWorkflowMetrics) GetTimeBatchProposalSent() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeBatchProposalSent +} + +// GetTimeBatchProposalSentOk returns a tuple with the TimeBatchProposalSent field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeBatchProposalSentOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeBatchProposalSent, true +} + +// SetTimeBatchProposalSent sets field value +func (o *ConsensusWorkflowMetrics) SetTimeBatchProposalSent(v time.Time) { + o.TimeBatchProposalSent = v +} + +// GetTimeCompleted returns the TimeCompleted field value +func (o *ConsensusWorkflowMetrics) GetTimeCompleted() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeCompleted +} + +// GetTimeCompletedOk returns a tuple with the TimeCompleted field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeCompletedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeCompleted, true +} + +// SetTimeCompleted sets field value +func (o *ConsensusWorkflowMetrics) SetTimeCompleted(v time.Time) { + o.TimeCompleted = v +} + +// GetTimeConsensusBatchKnown returns the TimeConsensusBatchKnown field value +func (o *ConsensusWorkflowMetrics) GetTimeConsensusBatchKnown() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeConsensusBatchKnown +} + +// GetTimeConsensusBatchKnownOk returns a tuple with the TimeConsensusBatchKnown field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeConsensusBatchKnownOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeConsensusBatchKnown, true +} + +// SetTimeConsensusBatchKnown sets field value +func (o *ConsensusWorkflowMetrics) SetTimeConsensusBatchKnown(v time.Time) { + o.TimeConsensusBatchKnown = v +} + +// GetTimeTransactionFinalized returns the TimeTransactionFinalized field value +func (o *ConsensusWorkflowMetrics) GetTimeTransactionFinalized() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeTransactionFinalized +} + +// GetTimeTransactionFinalizedOk returns a tuple with the TimeTransactionFinalized field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeTransactionFinalizedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeTransactionFinalized, true +} + +// SetTimeTransactionFinalized sets field value +func (o *ConsensusWorkflowMetrics) SetTimeTransactionFinalized(v time.Time) { + o.TimeTransactionFinalized = v +} + +// GetTimeTransactionPosted returns the TimeTransactionPosted field value +func (o *ConsensusWorkflowMetrics) GetTimeTransactionPosted() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeTransactionPosted +} + +// GetTimeTransactionPostedOk returns a tuple with the TimeTransactionPosted field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeTransactionPostedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeTransactionPosted, true +} + +// SetTimeTransactionPosted sets field value +func (o *ConsensusWorkflowMetrics) SetTimeTransactionPosted(v time.Time) { + o.TimeTransactionPosted = v +} + +// GetTimeTransactionSeen returns the TimeTransactionSeen field value +func (o *ConsensusWorkflowMetrics) GetTimeTransactionSeen() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeTransactionSeen +} + +// GetTimeTransactionSeenOk returns a tuple with the TimeTransactionSeen field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeTransactionSeenOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeTransactionSeen, true +} + +// SetTimeTransactionSeen sets field value +func (o *ConsensusWorkflowMetrics) SetTimeTransactionSeen(v time.Time) { + o.TimeTransactionSeen = v +} + +// GetTimeVMResultSigned returns the TimeVMResultSigned field value +func (o *ConsensusWorkflowMetrics) GetTimeVMResultSigned() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeVMResultSigned +} + +// GetTimeVMResultSignedOk returns a tuple with the TimeVMResultSigned field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeVMResultSignedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeVMResultSigned, true +} + +// SetTimeVMResultSigned sets field value +func (o *ConsensusWorkflowMetrics) SetTimeVMResultSigned(v time.Time) { + o.TimeVMResultSigned = v +} + +// GetTimeVMStarted returns the TimeVMStarted field value +func (o *ConsensusWorkflowMetrics) GetTimeVMStarted() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeVMStarted +} + +// GetTimeVMStartedOk returns a tuple with the TimeVMStarted field value +// and a boolean to check if the value has been set. +func (o *ConsensusWorkflowMetrics) GetTimeVMStartedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeVMStarted, true +} + +// SetTimeVMStarted sets field value +func (o *ConsensusWorkflowMetrics) SetTimeVMStarted(v time.Time) { + o.TimeVMStarted = v +} + +func (o ConsensusWorkflowMetrics) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConsensusWorkflowMetrics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.CurrentStateIndex) { + toSerialize["currentStateIndex"] = o.CurrentStateIndex + } + toSerialize["flagBatchProposalSent"] = o.FlagBatchProposalSent + toSerialize["flagConsensusBatchKnown"] = o.FlagConsensusBatchKnown + toSerialize["flagInProgress"] = o.FlagInProgress + toSerialize["flagStateReceived"] = o.FlagStateReceived + toSerialize["flagTransactionFinalized"] = o.FlagTransactionFinalized + toSerialize["flagTransactionPosted"] = o.FlagTransactionPosted + toSerialize["flagTransactionSeen"] = o.FlagTransactionSeen + toSerialize["flagVMResultSigned"] = o.FlagVMResultSigned + toSerialize["flagVMStarted"] = o.FlagVMStarted + toSerialize["timeBatchProposalSent"] = o.TimeBatchProposalSent + toSerialize["timeCompleted"] = o.TimeCompleted + toSerialize["timeConsensusBatchKnown"] = o.TimeConsensusBatchKnown + toSerialize["timeTransactionFinalized"] = o.TimeTransactionFinalized + toSerialize["timeTransactionPosted"] = o.TimeTransactionPosted + toSerialize["timeTransactionSeen"] = o.TimeTransactionSeen + toSerialize["timeVMResultSigned"] = o.TimeVMResultSigned + toSerialize["timeVMStarted"] = o.TimeVMStarted + return toSerialize, nil +} + +type NullableConsensusWorkflowMetrics struct { + value *ConsensusWorkflowMetrics + isSet bool +} + +func (v NullableConsensusWorkflowMetrics) Get() *ConsensusWorkflowMetrics { + return v.value +} + +func (v *NullableConsensusWorkflowMetrics) Set(val *ConsensusWorkflowMetrics) { + v.value = val + v.isSet = true +} + +func (v NullableConsensusWorkflowMetrics) IsSet() bool { + return v.isSet +} + +func (v *NullableConsensusWorkflowMetrics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConsensusWorkflowMetrics(val *ConsensusWorkflowMetrics) *NullableConsensusWorkflowMetrics { + return &NullableConsensusWorkflowMetrics{value: val, isSet: true} +} + +func (v NullableConsensusWorkflowMetrics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConsensusWorkflowMetrics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_contract_call_view_request.go b/clients/apiclient/model_contract_call_view_request.go new file mode 100644 index 0000000000..a364551e9e --- /dev/null +++ b/clients/apiclient/model_contract_call_view_request.go @@ -0,0 +1,257 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ContractCallViewRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContractCallViewRequest{} + +// ContractCallViewRequest struct for ContractCallViewRequest +type ContractCallViewRequest struct { + Arguments JSONDict `json:"arguments"` + // The chain id + ChainId string `json:"chainId"` + // The contract name as HName (Hex) + ContractHName string `json:"contractHName"` + // The contract name + ContractName string `json:"contractName"` + // The function name as HName (Hex) + FunctionHName string `json:"functionHName"` + // The function name + FunctionName string `json:"functionName"` +} + +// NewContractCallViewRequest instantiates a new ContractCallViewRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewContractCallViewRequest(arguments JSONDict, chainId string, contractHName string, contractName string, functionHName string, functionName string) *ContractCallViewRequest { + this := ContractCallViewRequest{} + this.Arguments = arguments + this.ChainId = chainId + this.ContractHName = contractHName + this.ContractName = contractName + this.FunctionHName = functionHName + this.FunctionName = functionName + return &this +} + +// NewContractCallViewRequestWithDefaults instantiates a new ContractCallViewRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewContractCallViewRequestWithDefaults() *ContractCallViewRequest { + this := ContractCallViewRequest{} + return &this +} + +// GetArguments returns the Arguments field value +func (o *ContractCallViewRequest) GetArguments() JSONDict { + if o == nil { + var ret JSONDict + return ret + } + + return o.Arguments +} + +// GetArgumentsOk returns a tuple with the Arguments field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetArgumentsOk() (*JSONDict, bool) { + if o == nil { + return nil, false + } + return &o.Arguments, true +} + +// SetArguments sets field value +func (o *ContractCallViewRequest) SetArguments(v JSONDict) { + o.Arguments = v +} + +// GetChainId returns the ChainId field value +func (o *ContractCallViewRequest) GetChainId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainId +} + +// GetChainIdOk returns a tuple with the ChainId field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetChainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainId, true +} + +// SetChainId sets field value +func (o *ContractCallViewRequest) SetChainId(v string) { + o.ChainId = v +} + +// GetContractHName returns the ContractHName field value +func (o *ContractCallViewRequest) GetContractHName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractHName +} + +// GetContractHNameOk returns a tuple with the ContractHName field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetContractHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractHName, true +} + +// SetContractHName sets field value +func (o *ContractCallViewRequest) SetContractHName(v string) { + o.ContractHName = v +} + +// GetContractName returns the ContractName field value +func (o *ContractCallViewRequest) GetContractName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetContractNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractName, true +} + +// SetContractName sets field value +func (o *ContractCallViewRequest) SetContractName(v string) { + o.ContractName = v +} + +// GetFunctionHName returns the FunctionHName field value +func (o *ContractCallViewRequest) GetFunctionHName() string { + if o == nil { + var ret string + return ret + } + + return o.FunctionHName +} + +// GetFunctionHNameOk returns a tuple with the FunctionHName field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetFunctionHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FunctionHName, true +} + +// SetFunctionHName sets field value +func (o *ContractCallViewRequest) SetFunctionHName(v string) { + o.FunctionHName = v +} + +// GetFunctionName returns the FunctionName field value +func (o *ContractCallViewRequest) GetFunctionName() string { + if o == nil { + var ret string + return ret + } + + return o.FunctionName +} + +// GetFunctionNameOk returns a tuple with the FunctionName field value +// and a boolean to check if the value has been set. +func (o *ContractCallViewRequest) GetFunctionNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FunctionName, true +} + +// SetFunctionName sets field value +func (o *ContractCallViewRequest) SetFunctionName(v string) { + o.FunctionName = v +} + +func (o ContractCallViewRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ContractCallViewRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["arguments"] = o.Arguments + toSerialize["chainId"] = o.ChainId + toSerialize["contractHName"] = o.ContractHName + toSerialize["contractName"] = o.ContractName + toSerialize["functionHName"] = o.FunctionHName + toSerialize["functionName"] = o.FunctionName + return toSerialize, nil +} + +type NullableContractCallViewRequest struct { + value *ContractCallViewRequest + isSet bool +} + +func (v NullableContractCallViewRequest) Get() *ContractCallViewRequest { + return v.value +} + +func (v *NullableContractCallViewRequest) Set(val *ContractCallViewRequest) { + v.value = val + v.isSet = true +} + +func (v NullableContractCallViewRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableContractCallViewRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContractCallViewRequest(val *ContractCallViewRequest) *NullableContractCallViewRequest { + return &NullableContractCallViewRequest{value: val, isSet: true} +} + +func (v NullableContractCallViewRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContractCallViewRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_contract_info_response.go b/clients/apiclient/model_contract_info_response.go new file mode 100644 index 0000000000..27ed53b743 --- /dev/null +++ b/clients/apiclient/model_contract_info_response.go @@ -0,0 +1,202 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ContractInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContractInfoResponse{} + +// ContractInfoResponse struct for ContractInfoResponse +type ContractInfoResponse struct { + // The description of the contract. + Description string `json:"description"` + // The id (HName as Hex)) of the contract. + HName string `json:"hName"` + // The name of the contract. + Name string `json:"name"` + // The hash of the contract. (Hex encoded) + ProgramHash string `json:"programHash"` +} + +// NewContractInfoResponse instantiates a new ContractInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewContractInfoResponse(description string, hName string, name string, programHash string) *ContractInfoResponse { + this := ContractInfoResponse{} + this.Description = description + this.HName = hName + this.Name = name + this.ProgramHash = programHash + return &this +} + +// NewContractInfoResponseWithDefaults instantiates a new ContractInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewContractInfoResponseWithDefaults() *ContractInfoResponse { + this := ContractInfoResponse{} + return &this +} + +// GetDescription returns the Description field value +func (o *ContractInfoResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *ContractInfoResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *ContractInfoResponse) SetDescription(v string) { + o.Description = v +} + +// GetHName returns the HName field value +func (o *ContractInfoResponse) GetHName() string { + if o == nil { + var ret string + return ret + } + + return o.HName +} + +// GetHNameOk returns a tuple with the HName field value +// and a boolean to check if the value has been set. +func (o *ContractInfoResponse) GetHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.HName, true +} + +// SetHName sets field value +func (o *ContractInfoResponse) SetHName(v string) { + o.HName = v +} + +// GetName returns the Name field value +func (o *ContractInfoResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ContractInfoResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ContractInfoResponse) SetName(v string) { + o.Name = v +} + +// GetProgramHash returns the ProgramHash field value +func (o *ContractInfoResponse) GetProgramHash() string { + if o == nil { + var ret string + return ret + } + + return o.ProgramHash +} + +// GetProgramHashOk returns a tuple with the ProgramHash field value +// and a boolean to check if the value has been set. +func (o *ContractInfoResponse) GetProgramHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProgramHash, true +} + +// SetProgramHash sets field value +func (o *ContractInfoResponse) SetProgramHash(v string) { + o.ProgramHash = v +} + +func (o ContractInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ContractInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["hName"] = o.HName + toSerialize["name"] = o.Name + toSerialize["programHash"] = o.ProgramHash + return toSerialize, nil +} + +type NullableContractInfoResponse struct { + value *ContractInfoResponse + isSet bool +} + +func (v NullableContractInfoResponse) Get() *ContractInfoResponse { + return v.value +} + +func (v *NullableContractInfoResponse) Set(val *ContractInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableContractInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableContractInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableContractInfoResponse(val *ContractInfoResponse) *NullableContractInfoResponse { + return &NullableContractInfoResponse{value: val, isSet: true} +} + +func (v NullableContractInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableContractInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_control_addresses_response.go b/clients/apiclient/model_control_addresses_response.go new file mode 100644 index 0000000000..d29d7f3622 --- /dev/null +++ b/clients/apiclient/model_control_addresses_response.go @@ -0,0 +1,174 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ControlAddressesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ControlAddressesResponse{} + +// ControlAddressesResponse struct for ControlAddressesResponse +type ControlAddressesResponse struct { + // The governing address (Bech32) + GoverningAddress string `json:"governingAddress"` + // The block index (uint32 + SinceBlockIndex uint32 `json:"sinceBlockIndex"` + // The state address (Bech32) + StateAddress string `json:"stateAddress"` +} + +// NewControlAddressesResponse instantiates a new ControlAddressesResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewControlAddressesResponse(governingAddress string, sinceBlockIndex uint32, stateAddress string) *ControlAddressesResponse { + this := ControlAddressesResponse{} + this.GoverningAddress = governingAddress + this.SinceBlockIndex = sinceBlockIndex + this.StateAddress = stateAddress + return &this +} + +// NewControlAddressesResponseWithDefaults instantiates a new ControlAddressesResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewControlAddressesResponseWithDefaults() *ControlAddressesResponse { + this := ControlAddressesResponse{} + return &this +} + +// GetGoverningAddress returns the GoverningAddress field value +func (o *ControlAddressesResponse) GetGoverningAddress() string { + if o == nil { + var ret string + return ret + } + + return o.GoverningAddress +} + +// GetGoverningAddressOk returns a tuple with the GoverningAddress field value +// and a boolean to check if the value has been set. +func (o *ControlAddressesResponse) GetGoverningAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GoverningAddress, true +} + +// SetGoverningAddress sets field value +func (o *ControlAddressesResponse) SetGoverningAddress(v string) { + o.GoverningAddress = v +} + +// GetSinceBlockIndex returns the SinceBlockIndex field value +func (o *ControlAddressesResponse) GetSinceBlockIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.SinceBlockIndex +} + +// GetSinceBlockIndexOk returns a tuple with the SinceBlockIndex field value +// and a boolean to check if the value has been set. +func (o *ControlAddressesResponse) GetSinceBlockIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.SinceBlockIndex, true +} + +// SetSinceBlockIndex sets field value +func (o *ControlAddressesResponse) SetSinceBlockIndex(v uint32) { + o.SinceBlockIndex = v +} + +// GetStateAddress returns the StateAddress field value +func (o *ControlAddressesResponse) GetStateAddress() string { + if o == nil { + var ret string + return ret + } + + return o.StateAddress +} + +// GetStateAddressOk returns a tuple with the StateAddress field value +// and a boolean to check if the value has been set. +func (o *ControlAddressesResponse) GetStateAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.StateAddress, true +} + +// SetStateAddress sets field value +func (o *ControlAddressesResponse) SetStateAddress(v string) { + o.StateAddress = v +} + +func (o ControlAddressesResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ControlAddressesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["governingAddress"] = o.GoverningAddress + toSerialize["sinceBlockIndex"] = o.SinceBlockIndex + toSerialize["stateAddress"] = o.StateAddress + return toSerialize, nil +} + +type NullableControlAddressesResponse struct { + value *ControlAddressesResponse + isSet bool +} + +func (v NullableControlAddressesResponse) Get() *ControlAddressesResponse { + return v.value +} + +func (v *NullableControlAddressesResponse) Set(val *ControlAddressesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableControlAddressesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableControlAddressesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableControlAddressesResponse(val *ControlAddressesResponse) *NullableControlAddressesResponse { + return &NullableControlAddressesResponse{value: val, isSet: true} +} + +func (v NullableControlAddressesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableControlAddressesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_dk_shares_info.go b/clients/apiclient/model_dk_shares_info.go new file mode 100644 index 0000000000..f93e55efe7 --- /dev/null +++ b/clients/apiclient/model_dk_shares_info.go @@ -0,0 +1,256 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the DKSharesInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DKSharesInfo{} + +// DKSharesInfo struct for DKSharesInfo +type DKSharesInfo struct { + // New generated shared address. + Address string `json:"address"` + // Identities of the nodes sharing the key. (Hex) + PeerIdentities []string `json:"peerIdentities"` + PeerIndex uint32 `json:"peerIndex"` + // Used public key. (Hex) + PublicKey string `json:"publicKey"` + // Public key shares for all the peers. (Hex) + PublicKeyShares []string `json:"publicKeyShares"` + Threshold uint32 `json:"threshold"` +} + +// NewDKSharesInfo instantiates a new DKSharesInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDKSharesInfo(address string, peerIdentities []string, peerIndex uint32, publicKey string, publicKeyShares []string, threshold uint32) *DKSharesInfo { + this := DKSharesInfo{} + this.Address = address + this.PeerIdentities = peerIdentities + this.PeerIndex = peerIndex + this.PublicKey = publicKey + this.PublicKeyShares = publicKeyShares + this.Threshold = threshold + return &this +} + +// NewDKSharesInfoWithDefaults instantiates a new DKSharesInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDKSharesInfoWithDefaults() *DKSharesInfo { + this := DKSharesInfo{} + return &this +} + +// GetAddress returns the Address field value +func (o *DKSharesInfo) GetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.Address +} + +// GetAddressOk returns a tuple with the Address field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Address, true +} + +// SetAddress sets field value +func (o *DKSharesInfo) SetAddress(v string) { + o.Address = v +} + +// GetPeerIdentities returns the PeerIdentities field value +func (o *DKSharesInfo) GetPeerIdentities() []string { + if o == nil { + var ret []string + return ret + } + + return o.PeerIdentities +} + +// GetPeerIdentitiesOk returns a tuple with the PeerIdentities field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetPeerIdentitiesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.PeerIdentities, true +} + +// SetPeerIdentities sets field value +func (o *DKSharesInfo) SetPeerIdentities(v []string) { + o.PeerIdentities = v +} + +// GetPeerIndex returns the PeerIndex field value +func (o *DKSharesInfo) GetPeerIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.PeerIndex +} + +// GetPeerIndexOk returns a tuple with the PeerIndex field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetPeerIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.PeerIndex, true +} + +// SetPeerIndex sets field value +func (o *DKSharesInfo) SetPeerIndex(v uint32) { + o.PeerIndex = v +} + +// GetPublicKey returns the PublicKey field value +func (o *DKSharesInfo) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *DKSharesInfo) SetPublicKey(v string) { + o.PublicKey = v +} + +// GetPublicKeyShares returns the PublicKeyShares field value +func (o *DKSharesInfo) GetPublicKeyShares() []string { + if o == nil { + var ret []string + return ret + } + + return o.PublicKeyShares +} + +// GetPublicKeySharesOk returns a tuple with the PublicKeyShares field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetPublicKeySharesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.PublicKeyShares, true +} + +// SetPublicKeyShares sets field value +func (o *DKSharesInfo) SetPublicKeyShares(v []string) { + o.PublicKeyShares = v +} + +// GetThreshold returns the Threshold field value +func (o *DKSharesInfo) GetThreshold() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Threshold +} + +// GetThresholdOk returns a tuple with the Threshold field value +// and a boolean to check if the value has been set. +func (o *DKSharesInfo) GetThresholdOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Threshold, true +} + +// SetThreshold sets field value +func (o *DKSharesInfo) SetThreshold(v uint32) { + o.Threshold = v +} + +func (o DKSharesInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DKSharesInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["address"] = o.Address + toSerialize["peerIdentities"] = o.PeerIdentities + toSerialize["peerIndex"] = o.PeerIndex + toSerialize["publicKey"] = o.PublicKey + toSerialize["publicKeyShares"] = o.PublicKeyShares + toSerialize["threshold"] = o.Threshold + return toSerialize, nil +} + +type NullableDKSharesInfo struct { + value *DKSharesInfo + isSet bool +} + +func (v NullableDKSharesInfo) Get() *DKSharesInfo { + return v.value +} + +func (v *NullableDKSharesInfo) Set(val *DKSharesInfo) { + v.value = val + v.isSet = true +} + +func (v NullableDKSharesInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableDKSharesInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDKSharesInfo(val *DKSharesInfo) *NullableDKSharesInfo { + return &NullableDKSharesInfo{value: val, isSet: true} +} + +func (v NullableDKSharesInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDKSharesInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_dk_shares_post_request.go b/clients/apiclient/model_dk_shares_post_request.go new file mode 100644 index 0000000000..cdc00779d9 --- /dev/null +++ b/clients/apiclient/model_dk_shares_post_request.go @@ -0,0 +1,173 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the DKSharesPostRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DKSharesPostRequest{} + +// DKSharesPostRequest struct for DKSharesPostRequest +type DKSharesPostRequest struct { + PeerIdentities []string `json:"peerIdentities"` + // Should be =< len(PeerPublicIdentities) + Threshold uint32 `json:"threshold"` + // Timeout in milliseconds. + TimeoutMS uint32 `json:"timeoutMS"` +} + +// NewDKSharesPostRequest instantiates a new DKSharesPostRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDKSharesPostRequest(peerIdentities []string, threshold uint32, timeoutMS uint32) *DKSharesPostRequest { + this := DKSharesPostRequest{} + this.PeerIdentities = peerIdentities + this.Threshold = threshold + this.TimeoutMS = timeoutMS + return &this +} + +// NewDKSharesPostRequestWithDefaults instantiates a new DKSharesPostRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDKSharesPostRequestWithDefaults() *DKSharesPostRequest { + this := DKSharesPostRequest{} + return &this +} + +// GetPeerIdentities returns the PeerIdentities field value +func (o *DKSharesPostRequest) GetPeerIdentities() []string { + if o == nil { + var ret []string + return ret + } + + return o.PeerIdentities +} + +// GetPeerIdentitiesOk returns a tuple with the PeerIdentities field value +// and a boolean to check if the value has been set. +func (o *DKSharesPostRequest) GetPeerIdentitiesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.PeerIdentities, true +} + +// SetPeerIdentities sets field value +func (o *DKSharesPostRequest) SetPeerIdentities(v []string) { + o.PeerIdentities = v +} + +// GetThreshold returns the Threshold field value +func (o *DKSharesPostRequest) GetThreshold() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Threshold +} + +// GetThresholdOk returns a tuple with the Threshold field value +// and a boolean to check if the value has been set. +func (o *DKSharesPostRequest) GetThresholdOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Threshold, true +} + +// SetThreshold sets field value +func (o *DKSharesPostRequest) SetThreshold(v uint32) { + o.Threshold = v +} + +// GetTimeoutMS returns the TimeoutMS field value +func (o *DKSharesPostRequest) GetTimeoutMS() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.TimeoutMS +} + +// GetTimeoutMSOk returns a tuple with the TimeoutMS field value +// and a boolean to check if the value has been set. +func (o *DKSharesPostRequest) GetTimeoutMSOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.TimeoutMS, true +} + +// SetTimeoutMS sets field value +func (o *DKSharesPostRequest) SetTimeoutMS(v uint32) { + o.TimeoutMS = v +} + +func (o DKSharesPostRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DKSharesPostRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["peerIdentities"] = o.PeerIdentities + toSerialize["threshold"] = o.Threshold + toSerialize["timeoutMS"] = o.TimeoutMS + return toSerialize, nil +} + +type NullableDKSharesPostRequest struct { + value *DKSharesPostRequest + isSet bool +} + +func (v NullableDKSharesPostRequest) Get() *DKSharesPostRequest { + return v.value +} + +func (v *NullableDKSharesPostRequest) Set(val *DKSharesPostRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDKSharesPostRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDKSharesPostRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDKSharesPostRequest(val *DKSharesPostRequest) *NullableDKSharesPostRequest { + return &NullableDKSharesPostRequest{value: val, isSet: true} +} + +func (v NullableDKSharesPostRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDKSharesPostRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_error_message_format_response.go b/clients/apiclient/model_error_message_format_response.go new file mode 100644 index 0000000000..6361860fce --- /dev/null +++ b/clients/apiclient/model_error_message_format_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ErrorMessageFormatResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorMessageFormatResponse{} + +// ErrorMessageFormatResponse struct for ErrorMessageFormatResponse +type ErrorMessageFormatResponse struct { + MessageFormat string `json:"messageFormat"` +} + +// NewErrorMessageFormatResponse instantiates a new ErrorMessageFormatResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewErrorMessageFormatResponse(messageFormat string) *ErrorMessageFormatResponse { + this := ErrorMessageFormatResponse{} + this.MessageFormat = messageFormat + return &this +} + +// NewErrorMessageFormatResponseWithDefaults instantiates a new ErrorMessageFormatResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorMessageFormatResponseWithDefaults() *ErrorMessageFormatResponse { + this := ErrorMessageFormatResponse{} + return &this +} + +// GetMessageFormat returns the MessageFormat field value +func (o *ErrorMessageFormatResponse) GetMessageFormat() string { + if o == nil { + var ret string + return ret + } + + return o.MessageFormat +} + +// GetMessageFormatOk returns a tuple with the MessageFormat field value +// and a boolean to check if the value has been set. +func (o *ErrorMessageFormatResponse) GetMessageFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MessageFormat, true +} + +// SetMessageFormat sets field value +func (o *ErrorMessageFormatResponse) SetMessageFormat(v string) { + o.MessageFormat = v +} + +func (o ErrorMessageFormatResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorMessageFormatResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["messageFormat"] = o.MessageFormat + return toSerialize, nil +} + +type NullableErrorMessageFormatResponse struct { + value *ErrorMessageFormatResponse + isSet bool +} + +func (v NullableErrorMessageFormatResponse) Get() *ErrorMessageFormatResponse { + return v.value +} + +func (v *NullableErrorMessageFormatResponse) Set(val *ErrorMessageFormatResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorMessageFormatResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorMessageFormatResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorMessageFormatResponse(val *ErrorMessageFormatResponse) *NullableErrorMessageFormatResponse { + return &NullableErrorMessageFormatResponse{value: val, isSet: true} +} + +func (v NullableErrorMessageFormatResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorMessageFormatResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_events_response.go b/clients/apiclient/model_events_response.go new file mode 100644 index 0000000000..9869a9c733 --- /dev/null +++ b/clients/apiclient/model_events_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the EventsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EventsResponse{} + +// EventsResponse struct for EventsResponse +type EventsResponse struct { + Events []string `json:"events"` +} + +// NewEventsResponse instantiates a new EventsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEventsResponse(events []string) *EventsResponse { + this := EventsResponse{} + this.Events = events + return &this +} + +// NewEventsResponseWithDefaults instantiates a new EventsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEventsResponseWithDefaults() *EventsResponse { + this := EventsResponse{} + return &this +} + +// GetEvents returns the Events field value +func (o *EventsResponse) GetEvents() []string { + if o == nil { + var ret []string + return ret + } + + return o.Events +} + +// GetEventsOk returns a tuple with the Events field value +// and a boolean to check if the value has been set. +func (o *EventsResponse) GetEventsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Events, true +} + +// SetEvents sets field value +func (o *EventsResponse) SetEvents(v []string) { + o.Events = v +} + +func (o EventsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EventsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["events"] = o.Events + return toSerialize, nil +} + +type NullableEventsResponse struct { + value *EventsResponse + isSet bool +} + +func (v NullableEventsResponse) Get() *EventsResponse { + return v.value +} + +func (v *NullableEventsResponse) Set(val *EventsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEventsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEventsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEventsResponse(val *EventsResponse) *NullableEventsResponse { + return &NullableEventsResponse{value: val, isSet: true} +} + +func (v NullableEventsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEventsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_foundry_output_response.go b/clients/apiclient/model_foundry_output_response.go new file mode 100644 index 0000000000..e95de04045 --- /dev/null +++ b/clients/apiclient/model_foundry_output_response.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the FoundryOutputResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FoundryOutputResponse{} + +// FoundryOutputResponse struct for FoundryOutputResponse +type FoundryOutputResponse struct { + Assets AssetsResponse `json:"assets"` + FoundryId string `json:"foundryId"` +} + +// NewFoundryOutputResponse instantiates a new FoundryOutputResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFoundryOutputResponse(assets AssetsResponse, foundryId string) *FoundryOutputResponse { + this := FoundryOutputResponse{} + this.Assets = assets + this.FoundryId = foundryId + return &this +} + +// NewFoundryOutputResponseWithDefaults instantiates a new FoundryOutputResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFoundryOutputResponseWithDefaults() *FoundryOutputResponse { + this := FoundryOutputResponse{} + return &this +} + +// GetAssets returns the Assets field value +func (o *FoundryOutputResponse) GetAssets() AssetsResponse { + if o == nil { + var ret AssetsResponse + return ret + } + + return o.Assets +} + +// GetAssetsOk returns a tuple with the Assets field value +// and a boolean to check if the value has been set. +func (o *FoundryOutputResponse) GetAssetsOk() (*AssetsResponse, bool) { + if o == nil { + return nil, false + } + return &o.Assets, true +} + +// SetAssets sets field value +func (o *FoundryOutputResponse) SetAssets(v AssetsResponse) { + o.Assets = v +} + +// GetFoundryId returns the FoundryId field value +func (o *FoundryOutputResponse) GetFoundryId() string { + if o == nil { + var ret string + return ret + } + + return o.FoundryId +} + +// GetFoundryIdOk returns a tuple with the FoundryId field value +// and a boolean to check if the value has been set. +func (o *FoundryOutputResponse) GetFoundryIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FoundryId, true +} + +// SetFoundryId sets field value +func (o *FoundryOutputResponse) SetFoundryId(v string) { + o.FoundryId = v +} + +func (o FoundryOutputResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FoundryOutputResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["assets"] = o.Assets + toSerialize["foundryId"] = o.FoundryId + return toSerialize, nil +} + +type NullableFoundryOutputResponse struct { + value *FoundryOutputResponse + isSet bool +} + +func (v NullableFoundryOutputResponse) Get() *FoundryOutputResponse { + return v.value +} + +func (v *NullableFoundryOutputResponse) Set(val *FoundryOutputResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFoundryOutputResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFoundryOutputResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFoundryOutputResponse(val *FoundryOutputResponse) *NullableFoundryOutputResponse { + return &NullableFoundryOutputResponse{value: val, isSet: true} +} + +func (v NullableFoundryOutputResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFoundryOutputResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_gas_fee_policy.go b/clients/apiclient/model_gas_fee_policy.go new file mode 100644 index 0000000000..f283cb9553 --- /dev/null +++ b/clients/apiclient/model_gas_fee_policy.go @@ -0,0 +1,174 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the GasFeePolicy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GasFeePolicy{} + +// GasFeePolicy struct for GasFeePolicy +type GasFeePolicy struct { + // The gas fee token id. Empty if base token. + GasFeeTokenId string `json:"gasFeeTokenId"` + // The amount of gas per token. (uint64 as string) + GasPerToken string `json:"gasPerToken"` + // The validator fee share. + ValidatorFeeShare int32 `json:"validatorFeeShare"` +} + +// NewGasFeePolicy instantiates a new GasFeePolicy object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGasFeePolicy(gasFeeTokenId string, gasPerToken string, validatorFeeShare int32) *GasFeePolicy { + this := GasFeePolicy{} + this.GasFeeTokenId = gasFeeTokenId + this.GasPerToken = gasPerToken + this.ValidatorFeeShare = validatorFeeShare + return &this +} + +// NewGasFeePolicyWithDefaults instantiates a new GasFeePolicy object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGasFeePolicyWithDefaults() *GasFeePolicy { + this := GasFeePolicy{} + return &this +} + +// GetGasFeeTokenId returns the GasFeeTokenId field value +func (o *GasFeePolicy) GetGasFeeTokenId() string { + if o == nil { + var ret string + return ret + } + + return o.GasFeeTokenId +} + +// GetGasFeeTokenIdOk returns a tuple with the GasFeeTokenId field value +// and a boolean to check if the value has been set. +func (o *GasFeePolicy) GetGasFeeTokenIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasFeeTokenId, true +} + +// SetGasFeeTokenId sets field value +func (o *GasFeePolicy) SetGasFeeTokenId(v string) { + o.GasFeeTokenId = v +} + +// GetGasPerToken returns the GasPerToken field value +func (o *GasFeePolicy) GetGasPerToken() string { + if o == nil { + var ret string + return ret + } + + return o.GasPerToken +} + +// GetGasPerTokenOk returns a tuple with the GasPerToken field value +// and a boolean to check if the value has been set. +func (o *GasFeePolicy) GetGasPerTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasPerToken, true +} + +// SetGasPerToken sets field value +func (o *GasFeePolicy) SetGasPerToken(v string) { + o.GasPerToken = v +} + +// GetValidatorFeeShare returns the ValidatorFeeShare field value +func (o *GasFeePolicy) GetValidatorFeeShare() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ValidatorFeeShare +} + +// GetValidatorFeeShareOk returns a tuple with the ValidatorFeeShare field value +// and a boolean to check if the value has been set. +func (o *GasFeePolicy) GetValidatorFeeShareOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ValidatorFeeShare, true +} + +// SetValidatorFeeShare sets field value +func (o *GasFeePolicy) SetValidatorFeeShare(v int32) { + o.ValidatorFeeShare = v +} + +func (o GasFeePolicy) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GasFeePolicy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["gasFeeTokenId"] = o.GasFeeTokenId + toSerialize["gasPerToken"] = o.GasPerToken + toSerialize["validatorFeeShare"] = o.ValidatorFeeShare + return toSerialize, nil +} + +type NullableGasFeePolicy struct { + value *GasFeePolicy + isSet bool +} + +func (v NullableGasFeePolicy) Get() *GasFeePolicy { + return v.value +} + +func (v *NullableGasFeePolicy) Set(val *GasFeePolicy) { + v.value = val + v.isSet = true +} + +func (v NullableGasFeePolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableGasFeePolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGasFeePolicy(val *GasFeePolicy) *NullableGasFeePolicy { + return &NullableGasFeePolicy{value: val, isSet: true} +} + +func (v NullableGasFeePolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGasFeePolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_gov_allowed_state_controller_addresses_response.go b/clients/apiclient/model_gov_allowed_state_controller_addresses_response.go new file mode 100644 index 0000000000..5b3f97c5d9 --- /dev/null +++ b/clients/apiclient/model_gov_allowed_state_controller_addresses_response.go @@ -0,0 +1,127 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the GovAllowedStateControllerAddressesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GovAllowedStateControllerAddressesResponse{} + +// GovAllowedStateControllerAddressesResponse struct for GovAllowedStateControllerAddressesResponse +type GovAllowedStateControllerAddressesResponse struct { + // The allowed state controller addresses (Bech32-encoded) + Addresses []string `json:"addresses,omitempty"` +} + +// NewGovAllowedStateControllerAddressesResponse instantiates a new GovAllowedStateControllerAddressesResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGovAllowedStateControllerAddressesResponse() *GovAllowedStateControllerAddressesResponse { + this := GovAllowedStateControllerAddressesResponse{} + return &this +} + +// NewGovAllowedStateControllerAddressesResponseWithDefaults instantiates a new GovAllowedStateControllerAddressesResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGovAllowedStateControllerAddressesResponseWithDefaults() *GovAllowedStateControllerAddressesResponse { + this := GovAllowedStateControllerAddressesResponse{} + return &this +} + +// GetAddresses returns the Addresses field value if set, zero value otherwise. +func (o *GovAllowedStateControllerAddressesResponse) GetAddresses() []string { + if o == nil || isNil(o.Addresses) { + var ret []string + return ret + } + return o.Addresses +} + +// GetAddressesOk returns a tuple with the Addresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GovAllowedStateControllerAddressesResponse) GetAddressesOk() ([]string, bool) { + if o == nil || isNil(o.Addresses) { + return nil, false + } + return o.Addresses, true +} + +// HasAddresses returns a boolean if a field has been set. +func (o *GovAllowedStateControllerAddressesResponse) HasAddresses() bool { + if o != nil && !isNil(o.Addresses) { + return true + } + + return false +} + +// SetAddresses gets a reference to the given []string and assigns it to the Addresses field. +func (o *GovAllowedStateControllerAddressesResponse) SetAddresses(v []string) { + o.Addresses = v +} + +func (o GovAllowedStateControllerAddressesResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GovAllowedStateControllerAddressesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Addresses) { + toSerialize["addresses"] = o.Addresses + } + return toSerialize, nil +} + +type NullableGovAllowedStateControllerAddressesResponse struct { + value *GovAllowedStateControllerAddressesResponse + isSet bool +} + +func (v NullableGovAllowedStateControllerAddressesResponse) Get() *GovAllowedStateControllerAddressesResponse { + return v.value +} + +func (v *NullableGovAllowedStateControllerAddressesResponse) Set(val *GovAllowedStateControllerAddressesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGovAllowedStateControllerAddressesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGovAllowedStateControllerAddressesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGovAllowedStateControllerAddressesResponse(val *GovAllowedStateControllerAddressesResponse) *NullableGovAllowedStateControllerAddressesResponse { + return &NullableGovAllowedStateControllerAddressesResponse{value: val, isSet: true} +} + +func (v NullableGovAllowedStateControllerAddressesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGovAllowedStateControllerAddressesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_gov_chain_info_response.go b/clients/apiclient/model_gov_chain_info_response.go new file mode 100644 index 0000000000..5048003f09 --- /dev/null +++ b/clients/apiclient/model_gov_chain_info_response.go @@ -0,0 +1,285 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the GovChainInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GovChainInfoResponse{} + +// GovChainInfoResponse struct for GovChainInfoResponse +type GovChainInfoResponse struct { + // ChainID (Bech32-encoded). + ChainID string `json:"chainID"` + // The chain owner address (Bech32-encoded). + ChainOwnerId string `json:"chainOwnerId"` + // The description of the chain. + Description string `json:"description"` + GasFeePolicy GasFeePolicy `json:"gasFeePolicy"` + // The maximum contract blob size. + MaxBlobSize int32 `json:"maxBlobSize"` + // The maximum event size. + MaxEventSize int32 `json:"maxEventSize"` + // The maximum amount of events per request. + MaxEventsPerReq int32 `json:"maxEventsPerReq"` +} + +// NewGovChainInfoResponse instantiates a new GovChainInfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGovChainInfoResponse(chainID string, chainOwnerId string, description string, gasFeePolicy GasFeePolicy, maxBlobSize int32, maxEventSize int32, maxEventsPerReq int32) *GovChainInfoResponse { + this := GovChainInfoResponse{} + this.ChainID = chainID + this.ChainOwnerId = chainOwnerId + this.Description = description + this.GasFeePolicy = gasFeePolicy + this.MaxBlobSize = maxBlobSize + this.MaxEventSize = maxEventSize + this.MaxEventsPerReq = maxEventsPerReq + return &this +} + +// NewGovChainInfoResponseWithDefaults instantiates a new GovChainInfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGovChainInfoResponseWithDefaults() *GovChainInfoResponse { + this := GovChainInfoResponse{} + return &this +} + +// GetChainID returns the ChainID field value +func (o *GovChainInfoResponse) GetChainID() string { + if o == nil { + var ret string + return ret + } + + return o.ChainID +} + +// GetChainIDOk returns a tuple with the ChainID field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetChainIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainID, true +} + +// SetChainID sets field value +func (o *GovChainInfoResponse) SetChainID(v string) { + o.ChainID = v +} + +// GetChainOwnerId returns the ChainOwnerId field value +func (o *GovChainInfoResponse) GetChainOwnerId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainOwnerId +} + +// GetChainOwnerIdOk returns a tuple with the ChainOwnerId field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetChainOwnerIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainOwnerId, true +} + +// SetChainOwnerId sets field value +func (o *GovChainInfoResponse) SetChainOwnerId(v string) { + o.ChainOwnerId = v +} + +// GetDescription returns the Description field value +func (o *GovChainInfoResponse) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *GovChainInfoResponse) SetDescription(v string) { + o.Description = v +} + +// GetGasFeePolicy returns the GasFeePolicy field value +func (o *GovChainInfoResponse) GetGasFeePolicy() GasFeePolicy { + if o == nil { + var ret GasFeePolicy + return ret + } + + return o.GasFeePolicy +} + +// GetGasFeePolicyOk returns a tuple with the GasFeePolicy field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetGasFeePolicyOk() (*GasFeePolicy, bool) { + if o == nil { + return nil, false + } + return &o.GasFeePolicy, true +} + +// SetGasFeePolicy sets field value +func (o *GovChainInfoResponse) SetGasFeePolicy(v GasFeePolicy) { + o.GasFeePolicy = v +} + +// GetMaxBlobSize returns the MaxBlobSize field value +func (o *GovChainInfoResponse) GetMaxBlobSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxBlobSize +} + +// GetMaxBlobSizeOk returns a tuple with the MaxBlobSize field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetMaxBlobSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxBlobSize, true +} + +// SetMaxBlobSize sets field value +func (o *GovChainInfoResponse) SetMaxBlobSize(v int32) { + o.MaxBlobSize = v +} + +// GetMaxEventSize returns the MaxEventSize field value +func (o *GovChainInfoResponse) GetMaxEventSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxEventSize +} + +// GetMaxEventSizeOk returns a tuple with the MaxEventSize field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetMaxEventSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxEventSize, true +} + +// SetMaxEventSize sets field value +func (o *GovChainInfoResponse) SetMaxEventSize(v int32) { + o.MaxEventSize = v +} + +// GetMaxEventsPerReq returns the MaxEventsPerReq field value +func (o *GovChainInfoResponse) GetMaxEventsPerReq() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxEventsPerReq +} + +// GetMaxEventsPerReqOk returns a tuple with the MaxEventsPerReq field value +// and a boolean to check if the value has been set. +func (o *GovChainInfoResponse) GetMaxEventsPerReqOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxEventsPerReq, true +} + +// SetMaxEventsPerReq sets field value +func (o *GovChainInfoResponse) SetMaxEventsPerReq(v int32) { + o.MaxEventsPerReq = v +} + +func (o GovChainInfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GovChainInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["chainID"] = o.ChainID + toSerialize["chainOwnerId"] = o.ChainOwnerId + toSerialize["description"] = o.Description + toSerialize["gasFeePolicy"] = o.GasFeePolicy + toSerialize["maxBlobSize"] = o.MaxBlobSize + toSerialize["maxEventSize"] = o.MaxEventSize + toSerialize["maxEventsPerReq"] = o.MaxEventsPerReq + return toSerialize, nil +} + +type NullableGovChainInfoResponse struct { + value *GovChainInfoResponse + isSet bool +} + +func (v NullableGovChainInfoResponse) Get() *GovChainInfoResponse { + return v.value +} + +func (v *NullableGovChainInfoResponse) Set(val *GovChainInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGovChainInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGovChainInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGovChainInfoResponse(val *GovChainInfoResponse) *NullableGovChainInfoResponse { + return &NullableGovChainInfoResponse{value: val, isSet: true} +} + +func (v NullableGovChainInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGovChainInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_gov_chain_owner_response.go b/clients/apiclient/model_gov_chain_owner_response.go new file mode 100644 index 0000000000..9923c3b720 --- /dev/null +++ b/clients/apiclient/model_gov_chain_owner_response.go @@ -0,0 +1,127 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the GovChainOwnerResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GovChainOwnerResponse{} + +// GovChainOwnerResponse struct for GovChainOwnerResponse +type GovChainOwnerResponse struct { + // The chain owner (Bech32-encoded) + ChainOwner *string `json:"chainOwner,omitempty"` +} + +// NewGovChainOwnerResponse instantiates a new GovChainOwnerResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGovChainOwnerResponse() *GovChainOwnerResponse { + this := GovChainOwnerResponse{} + return &this +} + +// NewGovChainOwnerResponseWithDefaults instantiates a new GovChainOwnerResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGovChainOwnerResponseWithDefaults() *GovChainOwnerResponse { + this := GovChainOwnerResponse{} + return &this +} + +// GetChainOwner returns the ChainOwner field value if set, zero value otherwise. +func (o *GovChainOwnerResponse) GetChainOwner() string { + if o == nil || isNil(o.ChainOwner) { + var ret string + return ret + } + return *o.ChainOwner +} + +// GetChainOwnerOk returns a tuple with the ChainOwner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GovChainOwnerResponse) GetChainOwnerOk() (*string, bool) { + if o == nil || isNil(o.ChainOwner) { + return nil, false + } + return o.ChainOwner, true +} + +// HasChainOwner returns a boolean if a field has been set. +func (o *GovChainOwnerResponse) HasChainOwner() bool { + if o != nil && !isNil(o.ChainOwner) { + return true + } + + return false +} + +// SetChainOwner gets a reference to the given string and assigns it to the ChainOwner field. +func (o *GovChainOwnerResponse) SetChainOwner(v string) { + o.ChainOwner = &v +} + +func (o GovChainOwnerResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GovChainOwnerResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.ChainOwner) { + toSerialize["chainOwner"] = o.ChainOwner + } + return toSerialize, nil +} + +type NullableGovChainOwnerResponse struct { + value *GovChainOwnerResponse + isSet bool +} + +func (v NullableGovChainOwnerResponse) Get() *GovChainOwnerResponse { + return v.value +} + +func (v *NullableGovChainOwnerResponse) Set(val *GovChainOwnerResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGovChainOwnerResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGovChainOwnerResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGovChainOwnerResponse(val *GovChainOwnerResponse) *NullableGovChainOwnerResponse { + return &NullableGovChainOwnerResponse{value: val, isSet: true} +} + +func (v NullableGovChainOwnerResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGovChainOwnerResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_in_output.go b/clients/apiclient/model_in_output.go new file mode 100644 index 0000000000..ed1f305cb3 --- /dev/null +++ b/clients/apiclient/model_in_output.go @@ -0,0 +1,145 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the InOutput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InOutput{} + +// InOutput struct for InOutput +type InOutput struct { + Output Output `json:"output"` + // The output ID + OutputId string `json:"outputId"` +} + +// NewInOutput instantiates a new InOutput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInOutput(output Output, outputId string) *InOutput { + this := InOutput{} + this.Output = output + this.OutputId = outputId + return &this +} + +// NewInOutputWithDefaults instantiates a new InOutput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInOutputWithDefaults() *InOutput { + this := InOutput{} + return &this +} + +// GetOutput returns the Output field value +func (o *InOutput) GetOutput() Output { + if o == nil { + var ret Output + return ret + } + + return o.Output +} + +// GetOutputOk returns a tuple with the Output field value +// and a boolean to check if the value has been set. +func (o *InOutput) GetOutputOk() (*Output, bool) { + if o == nil { + return nil, false + } + return &o.Output, true +} + +// SetOutput sets field value +func (o *InOutput) SetOutput(v Output) { + o.Output = v +} + +// GetOutputId returns the OutputId field value +func (o *InOutput) GetOutputId() string { + if o == nil { + var ret string + return ret + } + + return o.OutputId +} + +// GetOutputIdOk returns a tuple with the OutputId field value +// and a boolean to check if the value has been set. +func (o *InOutput) GetOutputIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OutputId, true +} + +// SetOutputId sets field value +func (o *InOutput) SetOutputId(v string) { + o.OutputId = v +} + +func (o InOutput) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InOutput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["output"] = o.Output + toSerialize["outputId"] = o.OutputId + return toSerialize, nil +} + +type NullableInOutput struct { + value *InOutput + isSet bool +} + +func (v NullableInOutput) Get() *InOutput { + return v.value +} + +func (v *NullableInOutput) Set(val *InOutput) { + v.value = val + v.isSet = true +} + +func (v NullableInOutput) IsSet() bool { + return v.isSet +} + +func (v *NullableInOutput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInOutput(val *InOutput) *NullableInOutput { + return &NullableInOutput{value: val, isSet: true} +} + +func (v NullableInOutput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInOutput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_in_output_metric_item.go b/clients/apiclient/model_in_output_metric_item.go new file mode 100644 index 0000000000..beb526e774 --- /dev/null +++ b/clients/apiclient/model_in_output_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the InOutputMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InOutputMetricItem{} + +// InOutputMetricItem struct for InOutputMetricItem +type InOutputMetricItem struct { + LastMessage InOutput `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewInOutputMetricItem instantiates a new InOutputMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInOutputMetricItem(lastMessage InOutput, messages uint32, timestamp time.Time) *InOutputMetricItem { + this := InOutputMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewInOutputMetricItemWithDefaults instantiates a new InOutputMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInOutputMetricItemWithDefaults() *InOutputMetricItem { + this := InOutputMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *InOutputMetricItem) GetLastMessage() InOutput { + if o == nil { + var ret InOutput + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *InOutputMetricItem) GetLastMessageOk() (*InOutput, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *InOutputMetricItem) SetLastMessage(v InOutput) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *InOutputMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *InOutputMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *InOutputMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *InOutputMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *InOutputMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *InOutputMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o InOutputMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InOutputMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableInOutputMetricItem struct { + value *InOutputMetricItem + isSet bool +} + +func (v NullableInOutputMetricItem) Get() *InOutputMetricItem { + return v.value +} + +func (v *NullableInOutputMetricItem) Set(val *InOutputMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableInOutputMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableInOutputMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInOutputMetricItem(val *InOutputMetricItem) *NullableInOutputMetricItem { + return &NullableInOutputMetricItem{value: val, isSet: true} +} + +func (v NullableInOutputMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInOutputMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_in_state_output.go b/clients/apiclient/model_in_state_output.go new file mode 100644 index 0000000000..96a04a6e90 --- /dev/null +++ b/clients/apiclient/model_in_state_output.go @@ -0,0 +1,145 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the InStateOutput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InStateOutput{} + +// InStateOutput struct for InStateOutput +type InStateOutput struct { + Output Output `json:"output"` + // The output ID + OutputId string `json:"outputId"` +} + +// NewInStateOutput instantiates a new InStateOutput object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInStateOutput(output Output, outputId string) *InStateOutput { + this := InStateOutput{} + this.Output = output + this.OutputId = outputId + return &this +} + +// NewInStateOutputWithDefaults instantiates a new InStateOutput object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInStateOutputWithDefaults() *InStateOutput { + this := InStateOutput{} + return &this +} + +// GetOutput returns the Output field value +func (o *InStateOutput) GetOutput() Output { + if o == nil { + var ret Output + return ret + } + + return o.Output +} + +// GetOutputOk returns a tuple with the Output field value +// and a boolean to check if the value has been set. +func (o *InStateOutput) GetOutputOk() (*Output, bool) { + if o == nil { + return nil, false + } + return &o.Output, true +} + +// SetOutput sets field value +func (o *InStateOutput) SetOutput(v Output) { + o.Output = v +} + +// GetOutputId returns the OutputId field value +func (o *InStateOutput) GetOutputId() string { + if o == nil { + var ret string + return ret + } + + return o.OutputId +} + +// GetOutputIdOk returns a tuple with the OutputId field value +// and a boolean to check if the value has been set. +func (o *InStateOutput) GetOutputIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OutputId, true +} + +// SetOutputId sets field value +func (o *InStateOutput) SetOutputId(v string) { + o.OutputId = v +} + +func (o InStateOutput) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InStateOutput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["output"] = o.Output + toSerialize["outputId"] = o.OutputId + return toSerialize, nil +} + +type NullableInStateOutput struct { + value *InStateOutput + isSet bool +} + +func (v NullableInStateOutput) Get() *InStateOutput { + return v.value +} + +func (v *NullableInStateOutput) Set(val *InStateOutput) { + v.value = val + v.isSet = true +} + +func (v NullableInStateOutput) IsSet() bool { + return v.isSet +} + +func (v *NullableInStateOutput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInStateOutput(val *InStateOutput) *NullableInStateOutput { + return &NullableInStateOutput{value: val, isSet: true} +} + +func (v NullableInStateOutput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInStateOutput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_in_state_output_metric_item.go b/clients/apiclient/model_in_state_output_metric_item.go new file mode 100644 index 0000000000..3b4fbd71b6 --- /dev/null +++ b/clients/apiclient/model_in_state_output_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the InStateOutputMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InStateOutputMetricItem{} + +// InStateOutputMetricItem struct for InStateOutputMetricItem +type InStateOutputMetricItem struct { + LastMessage InStateOutput `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewInStateOutputMetricItem instantiates a new InStateOutputMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInStateOutputMetricItem(lastMessage InStateOutput, messages uint32, timestamp time.Time) *InStateOutputMetricItem { + this := InStateOutputMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewInStateOutputMetricItemWithDefaults instantiates a new InStateOutputMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInStateOutputMetricItemWithDefaults() *InStateOutputMetricItem { + this := InStateOutputMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *InStateOutputMetricItem) GetLastMessage() InStateOutput { + if o == nil { + var ret InStateOutput + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *InStateOutputMetricItem) GetLastMessageOk() (*InStateOutput, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *InStateOutputMetricItem) SetLastMessage(v InStateOutput) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *InStateOutputMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *InStateOutputMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *InStateOutputMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *InStateOutputMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *InStateOutputMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *InStateOutputMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o InStateOutputMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InStateOutputMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableInStateOutputMetricItem struct { + value *InStateOutputMetricItem + isSet bool +} + +func (v NullableInStateOutputMetricItem) Get() *InStateOutputMetricItem { + return v.value +} + +func (v *NullableInStateOutputMetricItem) Set(val *InStateOutputMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableInStateOutputMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableInStateOutputMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInStateOutputMetricItem(val *InStateOutputMetricItem) *NullableInStateOutputMetricItem { + return &NullableInStateOutputMetricItem{value: val, isSet: true} +} + +func (v NullableInStateOutputMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInStateOutputMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_info_response.go b/clients/apiclient/model_info_response.go new file mode 100644 index 0000000000..3681141679 --- /dev/null +++ b/clients/apiclient/model_info_response.go @@ -0,0 +1,201 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the InfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InfoResponse{} + +// InfoResponse struct for InfoResponse +type InfoResponse struct { + L1Params L1Params `json:"l1Params"` + // The net id of the node + NetID string `json:"netID"` + // The public key of the node (Hex) + PublicKey string `json:"publicKey"` + // The version of the node + Version string `json:"version"` +} + +// NewInfoResponse instantiates a new InfoResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInfoResponse(l1Params L1Params, netID string, publicKey string, version string) *InfoResponse { + this := InfoResponse{} + this.L1Params = l1Params + this.NetID = netID + this.PublicKey = publicKey + this.Version = version + return &this +} + +// NewInfoResponseWithDefaults instantiates a new InfoResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInfoResponseWithDefaults() *InfoResponse { + this := InfoResponse{} + return &this +} + +// GetL1Params returns the L1Params field value +func (o *InfoResponse) GetL1Params() L1Params { + if o == nil { + var ret L1Params + return ret + } + + return o.L1Params +} + +// GetL1ParamsOk returns a tuple with the L1Params field value +// and a boolean to check if the value has been set. +func (o *InfoResponse) GetL1ParamsOk() (*L1Params, bool) { + if o == nil { + return nil, false + } + return &o.L1Params, true +} + +// SetL1Params sets field value +func (o *InfoResponse) SetL1Params(v L1Params) { + o.L1Params = v +} + +// GetNetID returns the NetID field value +func (o *InfoResponse) GetNetID() string { + if o == nil { + var ret string + return ret + } + + return o.NetID +} + +// GetNetIDOk returns a tuple with the NetID field value +// and a boolean to check if the value has been set. +func (o *InfoResponse) GetNetIDOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetID, true +} + +// SetNetID sets field value +func (o *InfoResponse) SetNetID(v string) { + o.NetID = v +} + +// GetPublicKey returns the PublicKey field value +func (o *InfoResponse) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *InfoResponse) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *InfoResponse) SetPublicKey(v string) { + o.PublicKey = v +} + +// GetVersion returns the Version field value +func (o *InfoResponse) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *InfoResponse) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *InfoResponse) SetVersion(v string) { + o.Version = v +} + +func (o InfoResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["l1Params"] = o.L1Params + toSerialize["netID"] = o.NetID + toSerialize["publicKey"] = o.PublicKey + toSerialize["version"] = o.Version + return toSerialize, nil +} + +type NullableInfoResponse struct { + value *InfoResponse + isSet bool +} + +func (v NullableInfoResponse) Get() *InfoResponse { + return v.value +} + +func (v *NullableInfoResponse) Set(val *InfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInfoResponse(val *InfoResponse) *NullableInfoResponse { + return &NullableInfoResponse{value: val, isSet: true} +} + +func (v NullableInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_interface_metric_item.go b/clients/apiclient/model_interface_metric_item.go new file mode 100644 index 0000000000..96cec1e0cb --- /dev/null +++ b/clients/apiclient/model_interface_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the InterfaceMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InterfaceMetricItem{} + +// InterfaceMetricItem struct for InterfaceMetricItem +type InterfaceMetricItem struct { + LastMessage string `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewInterfaceMetricItem instantiates a new InterfaceMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewInterfaceMetricItem(lastMessage string, messages uint32, timestamp time.Time) *InterfaceMetricItem { + this := InterfaceMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewInterfaceMetricItemWithDefaults instantiates a new InterfaceMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewInterfaceMetricItemWithDefaults() *InterfaceMetricItem { + this := InterfaceMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *InterfaceMetricItem) GetLastMessage() string { + if o == nil { + var ret string + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *InterfaceMetricItem) GetLastMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *InterfaceMetricItem) SetLastMessage(v string) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *InterfaceMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *InterfaceMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *InterfaceMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *InterfaceMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *InterfaceMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *InterfaceMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o InterfaceMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InterfaceMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableInterfaceMetricItem struct { + value *InterfaceMetricItem + isSet bool +} + +func (v NullableInterfaceMetricItem) Get() *InterfaceMetricItem { + return v.value +} + +func (v *NullableInterfaceMetricItem) Set(val *InterfaceMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableInterfaceMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableInterfaceMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInterfaceMetricItem(val *InterfaceMetricItem) *NullableInterfaceMetricItem { + return &NullableInterfaceMetricItem{value: val, isSet: true} +} + +func (v NullableInterfaceMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInterfaceMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_item.go b/clients/apiclient/model_item.go new file mode 100644 index 0000000000..811b3e675f --- /dev/null +++ b/clients/apiclient/model_item.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the Item type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Item{} + +// Item struct for Item +type Item struct { + // key (hex-encoded) + Key string `json:"key"` + // value (hex-encoded) + Value string `json:"value"` +} + +// NewItem instantiates a new Item object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewItem(key string, value string) *Item { + this := Item{} + this.Key = key + this.Value = value + return &this +} + +// NewItemWithDefaults instantiates a new Item object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewItemWithDefaults() *Item { + this := Item{} + return &this +} + +// GetKey returns the Key field value +func (o *Item) GetKey() string { + if o == nil { + var ret string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *Item) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Key, true +} + +// SetKey sets field value +func (o *Item) SetKey(v string) { + o.Key = v +} + +// GetValue returns the Value field value +func (o *Item) GetValue() string { + if o == nil { + var ret string + return ret + } + + return o.Value +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *Item) GetValueOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Value, true +} + +// SetValue sets field value +func (o *Item) SetValue(v string) { + o.Value = v +} + +func (o Item) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Item) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["key"] = o.Key + toSerialize["value"] = o.Value + return toSerialize, nil +} + +type NullableItem struct { + value *Item + isSet bool +} + +func (v NullableItem) Get() *Item { + return v.value +} + +func (v *NullableItem) Set(val *Item) { + v.value = val + v.isSet = true +} + +func (v NullableItem) IsSet() bool { + return v.isSet +} + +func (v *NullableItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableItem(val *Item) *NullableItem { + return &NullableItem{value: val, isSet: true} +} + +func (v NullableItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_json_dict.go b/clients/apiclient/model_json_dict.go new file mode 100644 index 0000000000..001c262dc9 --- /dev/null +++ b/clients/apiclient/model_json_dict.go @@ -0,0 +1,126 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the JSONDict type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &JSONDict{} + +// JSONDict struct for JSONDict +type JSONDict struct { + Items []Item `json:"Items,omitempty"` +} + +// NewJSONDict instantiates a new JSONDict object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewJSONDict() *JSONDict { + this := JSONDict{} + return &this +} + +// NewJSONDictWithDefaults instantiates a new JSONDict object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewJSONDictWithDefaults() *JSONDict { + this := JSONDict{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *JSONDict) GetItems() []Item { + if o == nil || isNil(o.Items) { + var ret []Item + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *JSONDict) GetItemsOk() ([]Item, bool) { + if o == nil || isNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *JSONDict) HasItems() bool { + if o != nil && !isNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []Item and assigns it to the Items field. +func (o *JSONDict) SetItems(v []Item) { + o.Items = v +} + +func (o JSONDict) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o JSONDict) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Items) { + toSerialize["Items"] = o.Items + } + return toSerialize, nil +} + +type NullableJSONDict struct { + value *JSONDict + isSet bool +} + +func (v NullableJSONDict) Get() *JSONDict { + return v.value +} + +func (v *NullableJSONDict) Set(val *JSONDict) { + v.value = val + v.isSet = true +} + +func (v NullableJSONDict) IsSet() bool { + return v.isSet +} + +func (v *NullableJSONDict) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableJSONDict(val *JSONDict) *NullableJSONDict { + return &NullableJSONDict{value: val, isSet: true} +} + +func (v NullableJSONDict) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableJSONDict) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_l1_params.go b/clients/apiclient/model_l1_params.go new file mode 100644 index 0000000000..0804298c85 --- /dev/null +++ b/clients/apiclient/model_l1_params.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the L1Params type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &L1Params{} + +// L1Params struct for L1Params +type L1Params struct { + BaseToken BaseToken `json:"baseToken"` + // The max payload size + MaxPayloadSize int32 `json:"maxPayloadSize"` + Protocol ProtocolParameters `json:"protocol"` +} + +// NewL1Params instantiates a new L1Params object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewL1Params(baseToken BaseToken, maxPayloadSize int32, protocol ProtocolParameters) *L1Params { + this := L1Params{} + this.BaseToken = baseToken + this.MaxPayloadSize = maxPayloadSize + this.Protocol = protocol + return &this +} + +// NewL1ParamsWithDefaults instantiates a new L1Params object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewL1ParamsWithDefaults() *L1Params { + this := L1Params{} + return &this +} + +// GetBaseToken returns the BaseToken field value +func (o *L1Params) GetBaseToken() BaseToken { + if o == nil { + var ret BaseToken + return ret + } + + return o.BaseToken +} + +// GetBaseTokenOk returns a tuple with the BaseToken field value +// and a boolean to check if the value has been set. +func (o *L1Params) GetBaseTokenOk() (*BaseToken, bool) { + if o == nil { + return nil, false + } + return &o.BaseToken, true +} + +// SetBaseToken sets field value +func (o *L1Params) SetBaseToken(v BaseToken) { + o.BaseToken = v +} + +// GetMaxPayloadSize returns the MaxPayloadSize field value +func (o *L1Params) GetMaxPayloadSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxPayloadSize +} + +// GetMaxPayloadSizeOk returns a tuple with the MaxPayloadSize field value +// and a boolean to check if the value has been set. +func (o *L1Params) GetMaxPayloadSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxPayloadSize, true +} + +// SetMaxPayloadSize sets field value +func (o *L1Params) SetMaxPayloadSize(v int32) { + o.MaxPayloadSize = v +} + +// GetProtocol returns the Protocol field value +func (o *L1Params) GetProtocol() ProtocolParameters { + if o == nil { + var ret ProtocolParameters + return ret + } + + return o.Protocol +} + +// GetProtocolOk returns a tuple with the Protocol field value +// and a boolean to check if the value has been set. +func (o *L1Params) GetProtocolOk() (*ProtocolParameters, bool) { + if o == nil { + return nil, false + } + return &o.Protocol, true +} + +// SetProtocol sets field value +func (o *L1Params) SetProtocol(v ProtocolParameters) { + o.Protocol = v +} + +func (o L1Params) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o L1Params) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["baseToken"] = o.BaseToken + toSerialize["maxPayloadSize"] = o.MaxPayloadSize + toSerialize["protocol"] = o.Protocol + return toSerialize, nil +} + +type NullableL1Params struct { + value *L1Params + isSet bool +} + +func (v NullableL1Params) Get() *L1Params { + return v.value +} + +func (v *NullableL1Params) Set(val *L1Params) { + v.value = val + v.isSet = true +} + +func (v NullableL1Params) IsSet() bool { + return v.isSet +} + +func (v *NullableL1Params) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableL1Params(val *L1Params) *NullableL1Params { + return &NullableL1Params{value: val, isSet: true} +} + +func (v NullableL1Params) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableL1Params) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_login_request.go b/clients/apiclient/model_login_request.go new file mode 100644 index 0000000000..558ab2f3c0 --- /dev/null +++ b/clients/apiclient/model_login_request.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the LoginRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoginRequest{} + +// LoginRequest struct for LoginRequest +type LoginRequest struct { + Password string `json:"password"` + Username string `json:"username"` +} + +// NewLoginRequest instantiates a new LoginRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLoginRequest(password string, username string) *LoginRequest { + this := LoginRequest{} + this.Password = password + this.Username = username + return &this +} + +// NewLoginRequestWithDefaults instantiates a new LoginRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLoginRequestWithDefaults() *LoginRequest { + this := LoginRequest{} + return &this +} + +// GetPassword returns the Password field value +func (o *LoginRequest) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *LoginRequest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *LoginRequest) SetPassword(v string) { + o.Password = v +} + +// GetUsername returns the Username field value +func (o *LoginRequest) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *LoginRequest) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *LoginRequest) SetUsername(v string) { + o.Username = v +} + +func (o LoginRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoginRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["password"] = o.Password + toSerialize["username"] = o.Username + return toSerialize, nil +} + +type NullableLoginRequest struct { + value *LoginRequest + isSet bool +} + +func (v NullableLoginRequest) Get() *LoginRequest { + return v.value +} + +func (v *NullableLoginRequest) Set(val *LoginRequest) { + v.value = val + v.isSet = true +} + +func (v NullableLoginRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableLoginRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoginRequest(val *LoginRequest) *NullableLoginRequest { + return &NullableLoginRequest{value: val, isSet: true} +} + +func (v NullableLoginRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoginRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_login_response.go b/clients/apiclient/model_login_response.go new file mode 100644 index 0000000000..d9f776d6a6 --- /dev/null +++ b/clients/apiclient/model_login_response.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the LoginResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoginResponse{} + +// LoginResponse struct for LoginResponse +type LoginResponse struct { + Error string `json:"error"` + Jwt string `json:"jwt"` +} + +// NewLoginResponse instantiates a new LoginResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewLoginResponse(error_ string, jwt string) *LoginResponse { + this := LoginResponse{} + this.Error = error_ + this.Jwt = jwt + return &this +} + +// NewLoginResponseWithDefaults instantiates a new LoginResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewLoginResponseWithDefaults() *LoginResponse { + this := LoginResponse{} + return &this +} + +// GetError returns the Error field value +func (o *LoginResponse) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *LoginResponse) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *LoginResponse) SetError(v string) { + o.Error = v +} + +// GetJwt returns the Jwt field value +func (o *LoginResponse) GetJwt() string { + if o == nil { + var ret string + return ret + } + + return o.Jwt +} + +// GetJwtOk returns a tuple with the Jwt field value +// and a boolean to check if the value has been set. +func (o *LoginResponse) GetJwtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Jwt, true +} + +// SetJwt sets field value +func (o *LoginResponse) SetJwt(v string) { + o.Jwt = v +} + +func (o LoginResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoginResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + toSerialize["jwt"] = o.Jwt + return toSerialize, nil +} + +type NullableLoginResponse struct { + value *LoginResponse + isSet bool +} + +func (v NullableLoginResponse) Get() *LoginResponse { + return v.value +} + +func (v *NullableLoginResponse) Set(val *LoginResponse) { + v.value = val + v.isSet = true +} + +func (v NullableLoginResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableLoginResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLoginResponse(val *LoginResponse) *NullableLoginResponse { + return &NullableLoginResponse{value: val, isSet: true} +} + +func (v NullableLoginResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLoginResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_milestone_info.go b/clients/apiclient/model_milestone_info.go new file mode 100644 index 0000000000..7788349e0c --- /dev/null +++ b/clients/apiclient/model_milestone_info.go @@ -0,0 +1,198 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the MilestoneInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MilestoneInfo{} + +// MilestoneInfo struct for MilestoneInfo +type MilestoneInfo struct { + Index *uint32 `json:"index,omitempty"` + MilestoneId *string `json:"milestoneId,omitempty"` + Timestamp *uint32 `json:"timestamp,omitempty"` +} + +// NewMilestoneInfo instantiates a new MilestoneInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMilestoneInfo() *MilestoneInfo { + this := MilestoneInfo{} + return &this +} + +// NewMilestoneInfoWithDefaults instantiates a new MilestoneInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMilestoneInfoWithDefaults() *MilestoneInfo { + this := MilestoneInfo{} + return &this +} + +// GetIndex returns the Index field value if set, zero value otherwise. +func (o *MilestoneInfo) GetIndex() uint32 { + if o == nil || isNil(o.Index) { + var ret uint32 + return ret + } + return *o.Index +} + +// GetIndexOk returns a tuple with the Index field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MilestoneInfo) GetIndexOk() (*uint32, bool) { + if o == nil || isNil(o.Index) { + return nil, false + } + return o.Index, true +} + +// HasIndex returns a boolean if a field has been set. +func (o *MilestoneInfo) HasIndex() bool { + if o != nil && !isNil(o.Index) { + return true + } + + return false +} + +// SetIndex gets a reference to the given uint32 and assigns it to the Index field. +func (o *MilestoneInfo) SetIndex(v uint32) { + o.Index = &v +} + +// GetMilestoneId returns the MilestoneId field value if set, zero value otherwise. +func (o *MilestoneInfo) GetMilestoneId() string { + if o == nil || isNil(o.MilestoneId) { + var ret string + return ret + } + return *o.MilestoneId +} + +// GetMilestoneIdOk returns a tuple with the MilestoneId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MilestoneInfo) GetMilestoneIdOk() (*string, bool) { + if o == nil || isNil(o.MilestoneId) { + return nil, false + } + return o.MilestoneId, true +} + +// HasMilestoneId returns a boolean if a field has been set. +func (o *MilestoneInfo) HasMilestoneId() bool { + if o != nil && !isNil(o.MilestoneId) { + return true + } + + return false +} + +// SetMilestoneId gets a reference to the given string and assigns it to the MilestoneId field. +func (o *MilestoneInfo) SetMilestoneId(v string) { + o.MilestoneId = &v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *MilestoneInfo) GetTimestamp() uint32 { + if o == nil || isNil(o.Timestamp) { + var ret uint32 + return ret + } + return *o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MilestoneInfo) GetTimestampOk() (*uint32, bool) { + if o == nil || isNil(o.Timestamp) { + return nil, false + } + return o.Timestamp, true +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *MilestoneInfo) HasTimestamp() bool { + if o != nil && !isNil(o.Timestamp) { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given uint32 and assigns it to the Timestamp field. +func (o *MilestoneInfo) SetTimestamp(v uint32) { + o.Timestamp = &v +} + +func (o MilestoneInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MilestoneInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !isNil(o.Index) { + toSerialize["index"] = o.Index + } + if !isNil(o.MilestoneId) { + toSerialize["milestoneId"] = o.MilestoneId + } + if !isNil(o.Timestamp) { + toSerialize["timestamp"] = o.Timestamp + } + return toSerialize, nil +} + +type NullableMilestoneInfo struct { + value *MilestoneInfo + isSet bool +} + +func (v NullableMilestoneInfo) Get() *MilestoneInfo { + return v.value +} + +func (v *NullableMilestoneInfo) Set(val *MilestoneInfo) { + v.value = val + v.isSet = true +} + +func (v NullableMilestoneInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableMilestoneInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMilestoneInfo(val *MilestoneInfo) *NullableMilestoneInfo { + return &NullableMilestoneInfo{value: val, isSet: true} +} + +func (v NullableMilestoneInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMilestoneInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_milestone_metric_item.go b/clients/apiclient/model_milestone_metric_item.go new file mode 100644 index 0000000000..3545b54274 --- /dev/null +++ b/clients/apiclient/model_milestone_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the MilestoneMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MilestoneMetricItem{} + +// MilestoneMetricItem struct for MilestoneMetricItem +type MilestoneMetricItem struct { + LastMessage MilestoneInfo `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewMilestoneMetricItem instantiates a new MilestoneMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMilestoneMetricItem(lastMessage MilestoneInfo, messages uint32, timestamp time.Time) *MilestoneMetricItem { + this := MilestoneMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewMilestoneMetricItemWithDefaults instantiates a new MilestoneMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMilestoneMetricItemWithDefaults() *MilestoneMetricItem { + this := MilestoneMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *MilestoneMetricItem) GetLastMessage() MilestoneInfo { + if o == nil { + var ret MilestoneInfo + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *MilestoneMetricItem) GetLastMessageOk() (*MilestoneInfo, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *MilestoneMetricItem) SetLastMessage(v MilestoneInfo) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *MilestoneMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *MilestoneMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *MilestoneMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *MilestoneMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *MilestoneMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *MilestoneMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o MilestoneMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MilestoneMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableMilestoneMetricItem struct { + value *MilestoneMetricItem + isSet bool +} + +func (v NullableMilestoneMetricItem) Get() *MilestoneMetricItem { + return v.value +} + +func (v *NullableMilestoneMetricItem) Set(val *MilestoneMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableMilestoneMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableMilestoneMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMilestoneMetricItem(val *MilestoneMetricItem) *NullableMilestoneMetricItem { + return &NullableMilestoneMetricItem{value: val, isSet: true} +} + +func (v NullableMilestoneMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMilestoneMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_native_token.go b/clients/apiclient/model_native_token.go new file mode 100644 index 0000000000..ce7292cd78 --- /dev/null +++ b/clients/apiclient/model_native_token.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the NativeToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NativeToken{} + +// NativeToken struct for NativeToken +type NativeToken struct { + Amount string `json:"amount"` + Id string `json:"id"` +} + +// NewNativeToken instantiates a new NativeToken object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNativeToken(amount string, id string) *NativeToken { + this := NativeToken{} + this.Amount = amount + this.Id = id + return &this +} + +// NewNativeTokenWithDefaults instantiates a new NativeToken object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNativeTokenWithDefaults() *NativeToken { + this := NativeToken{} + return &this +} + +// GetAmount returns the Amount field value +func (o *NativeToken) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *NativeToken) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *NativeToken) SetAmount(v string) { + o.Amount = v +} + +// GetId returns the Id field value +func (o *NativeToken) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *NativeToken) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *NativeToken) SetId(v string) { + o.Id = v +} + +func (o NativeToken) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NativeToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["amount"] = o.Amount + toSerialize["id"] = o.Id + return toSerialize, nil +} + +type NullableNativeToken struct { + value *NativeToken + isSet bool +} + +func (v NullableNativeToken) Get() *NativeToken { + return v.value +} + +func (v *NullableNativeToken) Set(val *NativeToken) { + v.value = val + v.isSet = true +} + +func (v NullableNativeToken) IsSet() bool { + return v.isSet +} + +func (v *NullableNativeToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNativeToken(val *NativeToken) *NullableNativeToken { + return &NullableNativeToken{value: val, isSet: true} +} + +func (v NullableNativeToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNativeToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_native_token_id_registry_response.go b/clients/apiclient/model_native_token_id_registry_response.go new file mode 100644 index 0000000000..310abdc330 --- /dev/null +++ b/clients/apiclient/model_native_token_id_registry_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the NativeTokenIDRegistryResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NativeTokenIDRegistryResponse{} + +// NativeTokenIDRegistryResponse struct for NativeTokenIDRegistryResponse +type NativeTokenIDRegistryResponse struct { + NativeTokenRegistryIds []string `json:"nativeTokenRegistryIds"` +} + +// NewNativeTokenIDRegistryResponse instantiates a new NativeTokenIDRegistryResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNativeTokenIDRegistryResponse(nativeTokenRegistryIds []string) *NativeTokenIDRegistryResponse { + this := NativeTokenIDRegistryResponse{} + this.NativeTokenRegistryIds = nativeTokenRegistryIds + return &this +} + +// NewNativeTokenIDRegistryResponseWithDefaults instantiates a new NativeTokenIDRegistryResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNativeTokenIDRegistryResponseWithDefaults() *NativeTokenIDRegistryResponse { + this := NativeTokenIDRegistryResponse{} + return &this +} + +// GetNativeTokenRegistryIds returns the NativeTokenRegistryIds field value +func (o *NativeTokenIDRegistryResponse) GetNativeTokenRegistryIds() []string { + if o == nil { + var ret []string + return ret + } + + return o.NativeTokenRegistryIds +} + +// GetNativeTokenRegistryIdsOk returns a tuple with the NativeTokenRegistryIds field value +// and a boolean to check if the value has been set. +func (o *NativeTokenIDRegistryResponse) GetNativeTokenRegistryIdsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.NativeTokenRegistryIds, true +} + +// SetNativeTokenRegistryIds sets field value +func (o *NativeTokenIDRegistryResponse) SetNativeTokenRegistryIds(v []string) { + o.NativeTokenRegistryIds = v +} + +func (o NativeTokenIDRegistryResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NativeTokenIDRegistryResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nativeTokenRegistryIds"] = o.NativeTokenRegistryIds + return toSerialize, nil +} + +type NullableNativeTokenIDRegistryResponse struct { + value *NativeTokenIDRegistryResponse + isSet bool +} + +func (v NullableNativeTokenIDRegistryResponse) Get() *NativeTokenIDRegistryResponse { + return v.value +} + +func (v *NullableNativeTokenIDRegistryResponse) Set(val *NativeTokenIDRegistryResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNativeTokenIDRegistryResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNativeTokenIDRegistryResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNativeTokenIDRegistryResponse(val *NativeTokenIDRegistryResponse) *NullableNativeTokenIDRegistryResponse { + return &NullableNativeTokenIDRegistryResponse{value: val, isSet: true} +} + +func (v NullableNativeTokenIDRegistryResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNativeTokenIDRegistryResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_nft_data_response.go b/clients/apiclient/model_nft_data_response.go new file mode 100644 index 0000000000..aed23a2ca3 --- /dev/null +++ b/clients/apiclient/model_nft_data_response.go @@ -0,0 +1,198 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the NFTDataResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NFTDataResponse{} + +// NFTDataResponse struct for NFTDataResponse +type NFTDataResponse struct { + Id string `json:"id"` + Issuer string `json:"issuer"` + Metadata string `json:"metadata"` + Owner string `json:"owner"` +} + +// NewNFTDataResponse instantiates a new NFTDataResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNFTDataResponse(id string, issuer string, metadata string, owner string) *NFTDataResponse { + this := NFTDataResponse{} + this.Id = id + this.Issuer = issuer + this.Metadata = metadata + this.Owner = owner + return &this +} + +// NewNFTDataResponseWithDefaults instantiates a new NFTDataResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNFTDataResponseWithDefaults() *NFTDataResponse { + this := NFTDataResponse{} + return &this +} + +// GetId returns the Id field value +func (o *NFTDataResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *NFTDataResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *NFTDataResponse) SetId(v string) { + o.Id = v +} + +// GetIssuer returns the Issuer field value +func (o *NFTDataResponse) GetIssuer() string { + if o == nil { + var ret string + return ret + } + + return o.Issuer +} + +// GetIssuerOk returns a tuple with the Issuer field value +// and a boolean to check if the value has been set. +func (o *NFTDataResponse) GetIssuerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Issuer, true +} + +// SetIssuer sets field value +func (o *NFTDataResponse) SetIssuer(v string) { + o.Issuer = v +} + +// GetMetadata returns the Metadata field value +func (o *NFTDataResponse) GetMetadata() string { + if o == nil { + var ret string + return ret + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +func (o *NFTDataResponse) GetMetadataOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Metadata, true +} + +// SetMetadata sets field value +func (o *NFTDataResponse) SetMetadata(v string) { + o.Metadata = v +} + +// GetOwner returns the Owner field value +func (o *NFTDataResponse) GetOwner() string { + if o == nil { + var ret string + return ret + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +func (o *NFTDataResponse) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Owner, true +} + +// SetOwner sets field value +func (o *NFTDataResponse) SetOwner(v string) { + o.Owner = v +} + +func (o NFTDataResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NFTDataResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["issuer"] = o.Issuer + toSerialize["metadata"] = o.Metadata + toSerialize["owner"] = o.Owner + return toSerialize, nil +} + +type NullableNFTDataResponse struct { + value *NFTDataResponse + isSet bool +} + +func (v NullableNFTDataResponse) Get() *NFTDataResponse { + return v.value +} + +func (v *NullableNFTDataResponse) Set(val *NFTDataResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNFTDataResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNFTDataResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNFTDataResponse(val *NFTDataResponse) *NullableNFTDataResponse { + return &NullableNFTDataResponse{value: val, isSet: true} +} + +func (v NullableNFTDataResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNFTDataResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_node_owner_certificate_request.go b/clients/apiclient/model_node_owner_certificate_request.go new file mode 100644 index 0000000000..9c06ab95a0 --- /dev/null +++ b/clients/apiclient/model_node_owner_certificate_request.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the NodeOwnerCertificateRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodeOwnerCertificateRequest{} + +// NodeOwnerCertificateRequest struct for NodeOwnerCertificateRequest +type NodeOwnerCertificateRequest struct { + // Node owner address. (Bech32) + OwnerAddress string `json:"ownerAddress"` + // The public key of the node (Hex) + PublicKey string `json:"publicKey"` +} + +// NewNodeOwnerCertificateRequest instantiates a new NodeOwnerCertificateRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodeOwnerCertificateRequest(ownerAddress string, publicKey string) *NodeOwnerCertificateRequest { + this := NodeOwnerCertificateRequest{} + this.OwnerAddress = ownerAddress + this.PublicKey = publicKey + return &this +} + +// NewNodeOwnerCertificateRequestWithDefaults instantiates a new NodeOwnerCertificateRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeOwnerCertificateRequestWithDefaults() *NodeOwnerCertificateRequest { + this := NodeOwnerCertificateRequest{} + return &this +} + +// GetOwnerAddress returns the OwnerAddress field value +func (o *NodeOwnerCertificateRequest) GetOwnerAddress() string { + if o == nil { + var ret string + return ret + } + + return o.OwnerAddress +} + +// GetOwnerAddressOk returns a tuple with the OwnerAddress field value +// and a boolean to check if the value has been set. +func (o *NodeOwnerCertificateRequest) GetOwnerAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OwnerAddress, true +} + +// SetOwnerAddress sets field value +func (o *NodeOwnerCertificateRequest) SetOwnerAddress(v string) { + o.OwnerAddress = v +} + +// GetPublicKey returns the PublicKey field value +func (o *NodeOwnerCertificateRequest) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *NodeOwnerCertificateRequest) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *NodeOwnerCertificateRequest) SetPublicKey(v string) { + o.PublicKey = v +} + +func (o NodeOwnerCertificateRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodeOwnerCertificateRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ownerAddress"] = o.OwnerAddress + toSerialize["publicKey"] = o.PublicKey + return toSerialize, nil +} + +type NullableNodeOwnerCertificateRequest struct { + value *NodeOwnerCertificateRequest + isSet bool +} + +func (v NullableNodeOwnerCertificateRequest) Get() *NodeOwnerCertificateRequest { + return v.value +} + +func (v *NullableNodeOwnerCertificateRequest) Set(val *NodeOwnerCertificateRequest) { + v.value = val + v.isSet = true +} + +func (v NullableNodeOwnerCertificateRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeOwnerCertificateRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeOwnerCertificateRequest(val *NodeOwnerCertificateRequest) *NullableNodeOwnerCertificateRequest { + return &NullableNodeOwnerCertificateRequest{value: val, isSet: true} +} + +func (v NullableNodeOwnerCertificateRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeOwnerCertificateRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_node_owner_certificate_response.go b/clients/apiclient/model_node_owner_certificate_response.go new file mode 100644 index 0000000000..58cf929b4b --- /dev/null +++ b/clients/apiclient/model_node_owner_certificate_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the NodeOwnerCertificateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NodeOwnerCertificateResponse{} + +// NodeOwnerCertificateResponse struct for NodeOwnerCertificateResponse +type NodeOwnerCertificateResponse struct { + // Certificate stating the ownership. (Hex) + Certificate string `json:"certificate"` +} + +// NewNodeOwnerCertificateResponse instantiates a new NodeOwnerCertificateResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNodeOwnerCertificateResponse(certificate string) *NodeOwnerCertificateResponse { + this := NodeOwnerCertificateResponse{} + this.Certificate = certificate + return &this +} + +// NewNodeOwnerCertificateResponseWithDefaults instantiates a new NodeOwnerCertificateResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNodeOwnerCertificateResponseWithDefaults() *NodeOwnerCertificateResponse { + this := NodeOwnerCertificateResponse{} + return &this +} + +// GetCertificate returns the Certificate field value +func (o *NodeOwnerCertificateResponse) GetCertificate() string { + if o == nil { + var ret string + return ret + } + + return o.Certificate +} + +// GetCertificateOk returns a tuple with the Certificate field value +// and a boolean to check if the value has been set. +func (o *NodeOwnerCertificateResponse) GetCertificateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Certificate, true +} + +// SetCertificate sets field value +func (o *NodeOwnerCertificateResponse) SetCertificate(v string) { + o.Certificate = v +} + +func (o NodeOwnerCertificateResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NodeOwnerCertificateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["certificate"] = o.Certificate + return toSerialize, nil +} + +type NullableNodeOwnerCertificateResponse struct { + value *NodeOwnerCertificateResponse + isSet bool +} + +func (v NullableNodeOwnerCertificateResponse) Get() *NodeOwnerCertificateResponse { + return v.value +} + +func (v *NullableNodeOwnerCertificateResponse) Set(val *NodeOwnerCertificateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNodeOwnerCertificateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNodeOwnerCertificateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNodeOwnerCertificateResponse(val *NodeOwnerCertificateResponse) *NullableNodeOwnerCertificateResponse { + return &NullableNodeOwnerCertificateResponse{value: val, isSet: true} +} + +func (v NullableNodeOwnerCertificateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNodeOwnerCertificateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_off_ledger_request.go b/clients/apiclient/model_off_ledger_request.go new file mode 100644 index 0000000000..43ae11d35a --- /dev/null +++ b/clients/apiclient/model_off_ledger_request.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the OffLedgerRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OffLedgerRequest{} + +// OffLedgerRequest struct for OffLedgerRequest +type OffLedgerRequest struct { + // The chain id + ChainId string `json:"chainId"` + // Offledger Request (Hex) + Request string `json:"request"` +} + +// NewOffLedgerRequest instantiates a new OffLedgerRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOffLedgerRequest(chainId string, request string) *OffLedgerRequest { + this := OffLedgerRequest{} + this.ChainId = chainId + this.Request = request + return &this +} + +// NewOffLedgerRequestWithDefaults instantiates a new OffLedgerRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOffLedgerRequestWithDefaults() *OffLedgerRequest { + this := OffLedgerRequest{} + return &this +} + +// GetChainId returns the ChainId field value +func (o *OffLedgerRequest) GetChainId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainId +} + +// GetChainIdOk returns a tuple with the ChainId field value +// and a boolean to check if the value has been set. +func (o *OffLedgerRequest) GetChainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainId, true +} + +// SetChainId sets field value +func (o *OffLedgerRequest) SetChainId(v string) { + o.ChainId = v +} + +// GetRequest returns the Request field value +func (o *OffLedgerRequest) GetRequest() string { + if o == nil { + var ret string + return ret + } + + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *OffLedgerRequest) GetRequestOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value +func (o *OffLedgerRequest) SetRequest(v string) { + o.Request = v +} + +func (o OffLedgerRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OffLedgerRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["chainId"] = o.ChainId + toSerialize["request"] = o.Request + return toSerialize, nil +} + +type NullableOffLedgerRequest struct { + value *OffLedgerRequest + isSet bool +} + +func (v NullableOffLedgerRequest) Get() *OffLedgerRequest { + return v.value +} + +func (v *NullableOffLedgerRequest) Set(val *OffLedgerRequest) { + v.value = val + v.isSet = true +} + +func (v NullableOffLedgerRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableOffLedgerRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOffLedgerRequest(val *OffLedgerRequest) *NullableOffLedgerRequest { + return &NullableOffLedgerRequest{value: val, isSet: true} +} + +func (v NullableOffLedgerRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOffLedgerRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_on_ledger_request.go b/clients/apiclient/model_on_ledger_request.go new file mode 100644 index 0000000000..27bcfd5cbe --- /dev/null +++ b/clients/apiclient/model_on_ledger_request.go @@ -0,0 +1,201 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the OnLedgerRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OnLedgerRequest{} + +// OnLedgerRequest struct for OnLedgerRequest +type OnLedgerRequest struct { + // The request ID + Id string `json:"id"` + Output Output `json:"output"` + // The output ID + OutputId string `json:"outputId"` + // The raw data of the request (Hex) + Raw string `json:"raw"` +} + +// NewOnLedgerRequest instantiates a new OnLedgerRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOnLedgerRequest(id string, output Output, outputId string, raw string) *OnLedgerRequest { + this := OnLedgerRequest{} + this.Id = id + this.Output = output + this.OutputId = outputId + this.Raw = raw + return &this +} + +// NewOnLedgerRequestWithDefaults instantiates a new OnLedgerRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOnLedgerRequestWithDefaults() *OnLedgerRequest { + this := OnLedgerRequest{} + return &this +} + +// GetId returns the Id field value +func (o *OnLedgerRequest) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *OnLedgerRequest) SetId(v string) { + o.Id = v +} + +// GetOutput returns the Output field value +func (o *OnLedgerRequest) GetOutput() Output { + if o == nil { + var ret Output + return ret + } + + return o.Output +} + +// GetOutputOk returns a tuple with the Output field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequest) GetOutputOk() (*Output, bool) { + if o == nil { + return nil, false + } + return &o.Output, true +} + +// SetOutput sets field value +func (o *OnLedgerRequest) SetOutput(v Output) { + o.Output = v +} + +// GetOutputId returns the OutputId field value +func (o *OnLedgerRequest) GetOutputId() string { + if o == nil { + var ret string + return ret + } + + return o.OutputId +} + +// GetOutputIdOk returns a tuple with the OutputId field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequest) GetOutputIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OutputId, true +} + +// SetOutputId sets field value +func (o *OnLedgerRequest) SetOutputId(v string) { + o.OutputId = v +} + +// GetRaw returns the Raw field value +func (o *OnLedgerRequest) GetRaw() string { + if o == nil { + var ret string + return ret + } + + return o.Raw +} + +// GetRawOk returns a tuple with the Raw field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequest) GetRawOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Raw, true +} + +// SetRaw sets field value +func (o *OnLedgerRequest) SetRaw(v string) { + o.Raw = v +} + +func (o OnLedgerRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OnLedgerRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["output"] = o.Output + toSerialize["outputId"] = o.OutputId + toSerialize["raw"] = o.Raw + return toSerialize, nil +} + +type NullableOnLedgerRequest struct { + value *OnLedgerRequest + isSet bool +} + +func (v NullableOnLedgerRequest) Get() *OnLedgerRequest { + return v.value +} + +func (v *NullableOnLedgerRequest) Set(val *OnLedgerRequest) { + v.value = val + v.isSet = true +} + +func (v NullableOnLedgerRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableOnLedgerRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOnLedgerRequest(val *OnLedgerRequest) *NullableOnLedgerRequest { + return &NullableOnLedgerRequest{value: val, isSet: true} +} + +func (v NullableOnLedgerRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOnLedgerRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_on_ledger_request_metric_item.go b/clients/apiclient/model_on_ledger_request_metric_item.go new file mode 100644 index 0000000000..195838f75a --- /dev/null +++ b/clients/apiclient/model_on_ledger_request_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the OnLedgerRequestMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OnLedgerRequestMetricItem{} + +// OnLedgerRequestMetricItem struct for OnLedgerRequestMetricItem +type OnLedgerRequestMetricItem struct { + LastMessage OnLedgerRequest `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewOnLedgerRequestMetricItem instantiates a new OnLedgerRequestMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOnLedgerRequestMetricItem(lastMessage OnLedgerRequest, messages uint32, timestamp time.Time) *OnLedgerRequestMetricItem { + this := OnLedgerRequestMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewOnLedgerRequestMetricItemWithDefaults instantiates a new OnLedgerRequestMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOnLedgerRequestMetricItemWithDefaults() *OnLedgerRequestMetricItem { + this := OnLedgerRequestMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *OnLedgerRequestMetricItem) GetLastMessage() OnLedgerRequest { + if o == nil { + var ret OnLedgerRequest + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequestMetricItem) GetLastMessageOk() (*OnLedgerRequest, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *OnLedgerRequestMetricItem) SetLastMessage(v OnLedgerRequest) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *OnLedgerRequestMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequestMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *OnLedgerRequestMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *OnLedgerRequestMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *OnLedgerRequestMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *OnLedgerRequestMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o OnLedgerRequestMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OnLedgerRequestMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableOnLedgerRequestMetricItem struct { + value *OnLedgerRequestMetricItem + isSet bool +} + +func (v NullableOnLedgerRequestMetricItem) Get() *OnLedgerRequestMetricItem { + return v.value +} + +func (v *NullableOnLedgerRequestMetricItem) Set(val *OnLedgerRequestMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableOnLedgerRequestMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableOnLedgerRequestMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOnLedgerRequestMetricItem(val *OnLedgerRequestMetricItem) *NullableOnLedgerRequestMetricItem { + return &NullableOnLedgerRequestMetricItem{value: val, isSet: true} +} + +func (v NullableOnLedgerRequestMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOnLedgerRequestMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_output.go b/clients/apiclient/model_output.go new file mode 100644 index 0000000000..3106771bbb --- /dev/null +++ b/clients/apiclient/model_output.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the Output type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Output{} + +// Output struct for Output +type Output struct { + // The output type + OutputType int32 `json:"outputType"` + // The raw data of the output (Hex) + Raw string `json:"raw"` +} + +// NewOutput instantiates a new Output object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOutput(outputType int32, raw string) *Output { + this := Output{} + this.OutputType = outputType + this.Raw = raw + return &this +} + +// NewOutputWithDefaults instantiates a new Output object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOutputWithDefaults() *Output { + this := Output{} + return &this +} + +// GetOutputType returns the OutputType field value +func (o *Output) GetOutputType() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.OutputType +} + +// GetOutputTypeOk returns a tuple with the OutputType field value +// and a boolean to check if the value has been set. +func (o *Output) GetOutputTypeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.OutputType, true +} + +// SetOutputType sets field value +func (o *Output) SetOutputType(v int32) { + o.OutputType = v +} + +// GetRaw returns the Raw field value +func (o *Output) GetRaw() string { + if o == nil { + var ret string + return ret + } + + return o.Raw +} + +// GetRawOk returns a tuple with the Raw field value +// and a boolean to check if the value has been set. +func (o *Output) GetRawOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Raw, true +} + +// SetRaw sets field value +func (o *Output) SetRaw(v string) { + o.Raw = v +} + +func (o Output) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Output) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["outputType"] = o.OutputType + toSerialize["raw"] = o.Raw + return toSerialize, nil +} + +type NullableOutput struct { + value *Output + isSet bool +} + +func (v NullableOutput) Get() *Output { + return v.value +} + +func (v *NullableOutput) Set(val *Output) { + v.value = val + v.isSet = true +} + +func (v NullableOutput) IsSet() bool { + return v.isSet +} + +func (v *NullableOutput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOutput(val *Output) *NullableOutput { + return &NullableOutput{value: val, isSet: true} +} + +func (v NullableOutput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOutput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_output_id.go b/clients/apiclient/model_output_id.go new file mode 100644 index 0000000000..e28f964889 --- /dev/null +++ b/clients/apiclient/model_output_id.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the OutputID type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OutputID{} + +// OutputID struct for OutputID +type OutputID struct { + // The output ID + OutputId string `json:"outputId"` +} + +// NewOutputID instantiates a new OutputID object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOutputID(outputId string) *OutputID { + this := OutputID{} + this.OutputId = outputId + return &this +} + +// NewOutputIDWithDefaults instantiates a new OutputID object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOutputIDWithDefaults() *OutputID { + this := OutputID{} + return &this +} + +// GetOutputId returns the OutputId field value +func (o *OutputID) GetOutputId() string { + if o == nil { + var ret string + return ret + } + + return o.OutputId +} + +// GetOutputIdOk returns a tuple with the OutputId field value +// and a boolean to check if the value has been set. +func (o *OutputID) GetOutputIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OutputId, true +} + +// SetOutputId sets field value +func (o *OutputID) SetOutputId(v string) { + o.OutputId = v +} + +func (o OutputID) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OutputID) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["outputId"] = o.OutputId + return toSerialize, nil +} + +type NullableOutputID struct { + value *OutputID + isSet bool +} + +func (v NullableOutputID) Get() *OutputID { + return v.value +} + +func (v *NullableOutputID) Set(val *OutputID) { + v.value = val + v.isSet = true +} + +func (v NullableOutputID) IsSet() bool { + return v.isSet +} + +func (v *NullableOutputID) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOutputID(val *OutputID) *NullableOutputID { + return &NullableOutputID{value: val, isSet: true} +} + +func (v NullableOutputID) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOutputID) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_peering_node_identity_response.go b/clients/apiclient/model_peering_node_identity_response.go new file mode 100644 index 0000000000..18c0a5dabd --- /dev/null +++ b/clients/apiclient/model_peering_node_identity_response.go @@ -0,0 +1,173 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the PeeringNodeIdentityResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PeeringNodeIdentityResponse{} + +// PeeringNodeIdentityResponse struct for PeeringNodeIdentityResponse +type PeeringNodeIdentityResponse struct { + IsTrusted bool `json:"isTrusted"` + // The NetID of the peer + NetId string `json:"netId"` + // The peers public key encoded in Hex + PublicKey string `json:"publicKey"` +} + +// NewPeeringNodeIdentityResponse instantiates a new PeeringNodeIdentityResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPeeringNodeIdentityResponse(isTrusted bool, netId string, publicKey string) *PeeringNodeIdentityResponse { + this := PeeringNodeIdentityResponse{} + this.IsTrusted = isTrusted + this.NetId = netId + this.PublicKey = publicKey + return &this +} + +// NewPeeringNodeIdentityResponseWithDefaults instantiates a new PeeringNodeIdentityResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPeeringNodeIdentityResponseWithDefaults() *PeeringNodeIdentityResponse { + this := PeeringNodeIdentityResponse{} + return &this +} + +// GetIsTrusted returns the IsTrusted field value +func (o *PeeringNodeIdentityResponse) GetIsTrusted() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsTrusted +} + +// GetIsTrustedOk returns a tuple with the IsTrusted field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeIdentityResponse) GetIsTrustedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsTrusted, true +} + +// SetIsTrusted sets field value +func (o *PeeringNodeIdentityResponse) SetIsTrusted(v bool) { + o.IsTrusted = v +} + +// GetNetId returns the NetId field value +func (o *PeeringNodeIdentityResponse) GetNetId() string { + if o == nil { + var ret string + return ret + } + + return o.NetId +} + +// GetNetIdOk returns a tuple with the NetId field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeIdentityResponse) GetNetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetId, true +} + +// SetNetId sets field value +func (o *PeeringNodeIdentityResponse) SetNetId(v string) { + o.NetId = v +} + +// GetPublicKey returns the PublicKey field value +func (o *PeeringNodeIdentityResponse) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeIdentityResponse) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *PeeringNodeIdentityResponse) SetPublicKey(v string) { + o.PublicKey = v +} + +func (o PeeringNodeIdentityResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PeeringNodeIdentityResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["isTrusted"] = o.IsTrusted + toSerialize["netId"] = o.NetId + toSerialize["publicKey"] = o.PublicKey + return toSerialize, nil +} + +type NullablePeeringNodeIdentityResponse struct { + value *PeeringNodeIdentityResponse + isSet bool +} + +func (v NullablePeeringNodeIdentityResponse) Get() *PeeringNodeIdentityResponse { + return v.value +} + +func (v *NullablePeeringNodeIdentityResponse) Set(val *PeeringNodeIdentityResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePeeringNodeIdentityResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePeeringNodeIdentityResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePeeringNodeIdentityResponse(val *PeeringNodeIdentityResponse) *NullablePeeringNodeIdentityResponse { + return &NullablePeeringNodeIdentityResponse{value: val, isSet: true} +} + +func (v NullablePeeringNodeIdentityResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePeeringNodeIdentityResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_peering_node_status_response.go b/clients/apiclient/model_peering_node_status_response.go new file mode 100644 index 0000000000..60026daa3d --- /dev/null +++ b/clients/apiclient/model_peering_node_status_response.go @@ -0,0 +1,229 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the PeeringNodeStatusResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PeeringNodeStatusResponse{} + +// PeeringNodeStatusResponse struct for PeeringNodeStatusResponse +type PeeringNodeStatusResponse struct { + // Whether or not the peer is activated + IsAlive bool `json:"isAlive"` + IsTrusted bool `json:"isTrusted"` + // The NetID of the peer + NetId string `json:"netId"` + // The amount of users attached to the peer + NumUsers int32 `json:"numUsers"` + // The peers public key encoded in Hex + PublicKey string `json:"publicKey"` +} + +// NewPeeringNodeStatusResponse instantiates a new PeeringNodeStatusResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPeeringNodeStatusResponse(isAlive bool, isTrusted bool, netId string, numUsers int32, publicKey string) *PeeringNodeStatusResponse { + this := PeeringNodeStatusResponse{} + this.IsAlive = isAlive + this.IsTrusted = isTrusted + this.NetId = netId + this.NumUsers = numUsers + this.PublicKey = publicKey + return &this +} + +// NewPeeringNodeStatusResponseWithDefaults instantiates a new PeeringNodeStatusResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPeeringNodeStatusResponseWithDefaults() *PeeringNodeStatusResponse { + this := PeeringNodeStatusResponse{} + return &this +} + +// GetIsAlive returns the IsAlive field value +func (o *PeeringNodeStatusResponse) GetIsAlive() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsAlive +} + +// GetIsAliveOk returns a tuple with the IsAlive field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeStatusResponse) GetIsAliveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsAlive, true +} + +// SetIsAlive sets field value +func (o *PeeringNodeStatusResponse) SetIsAlive(v bool) { + o.IsAlive = v +} + +// GetIsTrusted returns the IsTrusted field value +func (o *PeeringNodeStatusResponse) GetIsTrusted() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsTrusted +} + +// GetIsTrustedOk returns a tuple with the IsTrusted field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeStatusResponse) GetIsTrustedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsTrusted, true +} + +// SetIsTrusted sets field value +func (o *PeeringNodeStatusResponse) SetIsTrusted(v bool) { + o.IsTrusted = v +} + +// GetNetId returns the NetId field value +func (o *PeeringNodeStatusResponse) GetNetId() string { + if o == nil { + var ret string + return ret + } + + return o.NetId +} + +// GetNetIdOk returns a tuple with the NetId field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeStatusResponse) GetNetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetId, true +} + +// SetNetId sets field value +func (o *PeeringNodeStatusResponse) SetNetId(v string) { + o.NetId = v +} + +// GetNumUsers returns the NumUsers field value +func (o *PeeringNodeStatusResponse) GetNumUsers() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NumUsers +} + +// GetNumUsersOk returns a tuple with the NumUsers field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeStatusResponse) GetNumUsersOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NumUsers, true +} + +// SetNumUsers sets field value +func (o *PeeringNodeStatusResponse) SetNumUsers(v int32) { + o.NumUsers = v +} + +// GetPublicKey returns the PublicKey field value +func (o *PeeringNodeStatusResponse) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *PeeringNodeStatusResponse) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *PeeringNodeStatusResponse) SetPublicKey(v string) { + o.PublicKey = v +} + +func (o PeeringNodeStatusResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PeeringNodeStatusResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["isAlive"] = o.IsAlive + toSerialize["isTrusted"] = o.IsTrusted + toSerialize["netId"] = o.NetId + toSerialize["numUsers"] = o.NumUsers + toSerialize["publicKey"] = o.PublicKey + return toSerialize, nil +} + +type NullablePeeringNodeStatusResponse struct { + value *PeeringNodeStatusResponse + isSet bool +} + +func (v NullablePeeringNodeStatusResponse) Get() *PeeringNodeStatusResponse { + return v.value +} + +func (v *NullablePeeringNodeStatusResponse) Set(val *PeeringNodeStatusResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePeeringNodeStatusResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePeeringNodeStatusResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePeeringNodeStatusResponse(val *PeeringNodeStatusResponse) *NullablePeeringNodeStatusResponse { + return &NullablePeeringNodeStatusResponse{value: val, isSet: true} +} + +func (v NullablePeeringNodeStatusResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePeeringNodeStatusResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_peering_trust_request.go b/clients/apiclient/model_peering_trust_request.go new file mode 100644 index 0000000000..6857446fd7 --- /dev/null +++ b/clients/apiclient/model_peering_trust_request.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the PeeringTrustRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PeeringTrustRequest{} + +// PeeringTrustRequest struct for PeeringTrustRequest +type PeeringTrustRequest struct { + // The NetID of the peer + NetId string `json:"netId"` + // The peers public key encoded in Hex + PublicKey string `json:"publicKey"` +} + +// NewPeeringTrustRequest instantiates a new PeeringTrustRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPeeringTrustRequest(netId string, publicKey string) *PeeringTrustRequest { + this := PeeringTrustRequest{} + this.NetId = netId + this.PublicKey = publicKey + return &this +} + +// NewPeeringTrustRequestWithDefaults instantiates a new PeeringTrustRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPeeringTrustRequestWithDefaults() *PeeringTrustRequest { + this := PeeringTrustRequest{} + return &this +} + +// GetNetId returns the NetId field value +func (o *PeeringTrustRequest) GetNetId() string { + if o == nil { + var ret string + return ret + } + + return o.NetId +} + +// GetNetIdOk returns a tuple with the NetId field value +// and a boolean to check if the value has been set. +func (o *PeeringTrustRequest) GetNetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetId, true +} + +// SetNetId sets field value +func (o *PeeringTrustRequest) SetNetId(v string) { + o.NetId = v +} + +// GetPublicKey returns the PublicKey field value +func (o *PeeringTrustRequest) GetPublicKey() string { + if o == nil { + var ret string + return ret + } + + return o.PublicKey +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *PeeringTrustRequest) GetPublicKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.PublicKey, true +} + +// SetPublicKey sets field value +func (o *PeeringTrustRequest) SetPublicKey(v string) { + o.PublicKey = v +} + +func (o PeeringTrustRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PeeringTrustRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["netId"] = o.NetId + toSerialize["publicKey"] = o.PublicKey + return toSerialize, nil +} + +type NullablePeeringTrustRequest struct { + value *PeeringTrustRequest + isSet bool +} + +func (v NullablePeeringTrustRequest) Get() *PeeringTrustRequest { + return v.value +} + +func (v *NullablePeeringTrustRequest) Set(val *PeeringTrustRequest) { + v.value = val + v.isSet = true +} + +func (v NullablePeeringTrustRequest) IsSet() bool { + return v.isSet +} + +func (v *NullablePeeringTrustRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePeeringTrustRequest(val *PeeringTrustRequest) *NullablePeeringTrustRequest { + return &NullablePeeringTrustRequest{value: val, isSet: true} +} + +func (v NullablePeeringTrustRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePeeringTrustRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_protocol_parameters.go b/clients/apiclient/model_protocol_parameters.go new file mode 100644 index 0000000000..f4334ef408 --- /dev/null +++ b/clients/apiclient/model_protocol_parameters.go @@ -0,0 +1,285 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ProtocolParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtocolParameters{} + +// ProtocolParameters struct for ProtocolParameters +type ProtocolParameters struct { + // The human readable network prefix + Bech32Hrp string `json:"bech32Hrp"` + // The networks max depth + BelowMaxDepth uint32 `json:"belowMaxDepth"` + // The minimal PoW score + MinPowScore uint32 `json:"minPowScore"` + // The network name + NetworkName string `json:"networkName"` + RentStructure RentStructure `json:"rentStructure"` + // The token supply + TokenSupply string `json:"tokenSupply"` + // The protocol version + Version int32 `json:"version"` +} + +// NewProtocolParameters instantiates a new ProtocolParameters object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProtocolParameters(bech32Hrp string, belowMaxDepth uint32, minPowScore uint32, networkName string, rentStructure RentStructure, tokenSupply string, version int32) *ProtocolParameters { + this := ProtocolParameters{} + this.Bech32Hrp = bech32Hrp + this.BelowMaxDepth = belowMaxDepth + this.MinPowScore = minPowScore + this.NetworkName = networkName + this.RentStructure = rentStructure + this.TokenSupply = tokenSupply + this.Version = version + return &this +} + +// NewProtocolParametersWithDefaults instantiates a new ProtocolParameters object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProtocolParametersWithDefaults() *ProtocolParameters { + this := ProtocolParameters{} + return &this +} + +// GetBech32Hrp returns the Bech32Hrp field value +func (o *ProtocolParameters) GetBech32Hrp() string { + if o == nil { + var ret string + return ret + } + + return o.Bech32Hrp +} + +// GetBech32HrpOk returns a tuple with the Bech32Hrp field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetBech32HrpOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Bech32Hrp, true +} + +// SetBech32Hrp sets field value +func (o *ProtocolParameters) SetBech32Hrp(v string) { + o.Bech32Hrp = v +} + +// GetBelowMaxDepth returns the BelowMaxDepth field value +func (o *ProtocolParameters) GetBelowMaxDepth() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.BelowMaxDepth +} + +// GetBelowMaxDepthOk returns a tuple with the BelowMaxDepth field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetBelowMaxDepthOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.BelowMaxDepth, true +} + +// SetBelowMaxDepth sets field value +func (o *ProtocolParameters) SetBelowMaxDepth(v uint32) { + o.BelowMaxDepth = v +} + +// GetMinPowScore returns the MinPowScore field value +func (o *ProtocolParameters) GetMinPowScore() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.MinPowScore +} + +// GetMinPowScoreOk returns a tuple with the MinPowScore field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetMinPowScoreOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.MinPowScore, true +} + +// SetMinPowScore sets field value +func (o *ProtocolParameters) SetMinPowScore(v uint32) { + o.MinPowScore = v +} + +// GetNetworkName returns the NetworkName field value +func (o *ProtocolParameters) GetNetworkName() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkName +} + +// GetNetworkNameOk returns a tuple with the NetworkName field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetNetworkNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkName, true +} + +// SetNetworkName sets field value +func (o *ProtocolParameters) SetNetworkName(v string) { + o.NetworkName = v +} + +// GetRentStructure returns the RentStructure field value +func (o *ProtocolParameters) GetRentStructure() RentStructure { + if o == nil { + var ret RentStructure + return ret + } + + return o.RentStructure +} + +// GetRentStructureOk returns a tuple with the RentStructure field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetRentStructureOk() (*RentStructure, bool) { + if o == nil { + return nil, false + } + return &o.RentStructure, true +} + +// SetRentStructure sets field value +func (o *ProtocolParameters) SetRentStructure(v RentStructure) { + o.RentStructure = v +} + +// GetTokenSupply returns the TokenSupply field value +func (o *ProtocolParameters) GetTokenSupply() string { + if o == nil { + var ret string + return ret + } + + return o.TokenSupply +} + +// GetTokenSupplyOk returns a tuple with the TokenSupply field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetTokenSupplyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TokenSupply, true +} + +// SetTokenSupply sets field value +func (o *ProtocolParameters) SetTokenSupply(v string) { + o.TokenSupply = v +} + +// GetVersion returns the Version field value +func (o *ProtocolParameters) GetVersion() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *ProtocolParameters) GetVersionOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *ProtocolParameters) SetVersion(v int32) { + o.Version = v +} + +func (o ProtocolParameters) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProtocolParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bech32Hrp"] = o.Bech32Hrp + toSerialize["belowMaxDepth"] = o.BelowMaxDepth + toSerialize["minPowScore"] = o.MinPowScore + toSerialize["networkName"] = o.NetworkName + toSerialize["rentStructure"] = o.RentStructure + toSerialize["tokenSupply"] = o.TokenSupply + toSerialize["version"] = o.Version + return toSerialize, nil +} + +type NullableProtocolParameters struct { + value *ProtocolParameters + isSet bool +} + +func (v NullableProtocolParameters) Get() *ProtocolParameters { + return v.value +} + +func (v *NullableProtocolParameters) Set(val *ProtocolParameters) { + v.value = val + v.isSet = true +} + +func (v NullableProtocolParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocolParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocolParameters(val *ProtocolParameters) *NullableProtocolParameters { + return &NullableProtocolParameters{value: val, isSet: true} +} + +func (v NullableProtocolParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocolParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_publisher_state_transaction_item.go b/clients/apiclient/model_publisher_state_transaction_item.go new file mode 100644 index 0000000000..9c0b00e281 --- /dev/null +++ b/clients/apiclient/model_publisher_state_transaction_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the PublisherStateTransactionItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublisherStateTransactionItem{} + +// PublisherStateTransactionItem struct for PublisherStateTransactionItem +type PublisherStateTransactionItem struct { + LastMessage StateTransaction `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewPublisherStateTransactionItem instantiates a new PublisherStateTransactionItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPublisherStateTransactionItem(lastMessage StateTransaction, messages uint32, timestamp time.Time) *PublisherStateTransactionItem { + this := PublisherStateTransactionItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewPublisherStateTransactionItemWithDefaults instantiates a new PublisherStateTransactionItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPublisherStateTransactionItemWithDefaults() *PublisherStateTransactionItem { + this := PublisherStateTransactionItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *PublisherStateTransactionItem) GetLastMessage() StateTransaction { + if o == nil { + var ret StateTransaction + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *PublisherStateTransactionItem) GetLastMessageOk() (*StateTransaction, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *PublisherStateTransactionItem) SetLastMessage(v StateTransaction) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *PublisherStateTransactionItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *PublisherStateTransactionItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *PublisherStateTransactionItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *PublisherStateTransactionItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *PublisherStateTransactionItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *PublisherStateTransactionItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o PublisherStateTransactionItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PublisherStateTransactionItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullablePublisherStateTransactionItem struct { + value *PublisherStateTransactionItem + isSet bool +} + +func (v NullablePublisherStateTransactionItem) Get() *PublisherStateTransactionItem { + return v.value +} + +func (v *NullablePublisherStateTransactionItem) Set(val *PublisherStateTransactionItem) { + v.value = val + v.isSet = true +} + +func (v NullablePublisherStateTransactionItem) IsSet() bool { + return v.isSet +} + +func (v *NullablePublisherStateTransactionItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublisherStateTransactionItem(val *PublisherStateTransactionItem) *NullablePublisherStateTransactionItem { + return &NullablePublisherStateTransactionItem{value: val, isSet: true} +} + +func (v NullablePublisherStateTransactionItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublisherStateTransactionItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_receipt_error.go b/clients/apiclient/model_receipt_error.go new file mode 100644 index 0000000000..ca7ab33036 --- /dev/null +++ b/clients/apiclient/model_receipt_error.go @@ -0,0 +1,253 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ReceiptError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReceiptError{} + +// ReceiptError struct for ReceiptError +type ReceiptError struct { + // The contract hname (Hex) + ContractHName string `json:"contractHName"` + ErrorCode string `json:"errorCode"` + ErrorId uint32 `json:"errorId"` + Message string `json:"message"` + MessageFormat string `json:"messageFormat"` + Parameters []string `json:"parameters"` +} + +// NewReceiptError instantiates a new ReceiptError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReceiptError(contractHName string, errorCode string, errorId uint32, message string, messageFormat string, parameters []string) *ReceiptError { + this := ReceiptError{} + this.ContractHName = contractHName + this.ErrorCode = errorCode + this.ErrorId = errorId + this.Message = message + this.MessageFormat = messageFormat + this.Parameters = parameters + return &this +} + +// NewReceiptErrorWithDefaults instantiates a new ReceiptError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReceiptErrorWithDefaults() *ReceiptError { + this := ReceiptError{} + return &this +} + +// GetContractHName returns the ContractHName field value +func (o *ReceiptError) GetContractHName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractHName +} + +// GetContractHNameOk returns a tuple with the ContractHName field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetContractHNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractHName, true +} + +// SetContractHName sets field value +func (o *ReceiptError) SetContractHName(v string) { + o.ContractHName = v +} + +// GetErrorCode returns the ErrorCode field value +func (o *ReceiptError) GetErrorCode() string { + if o == nil { + var ret string + return ret + } + + return o.ErrorCode +} + +// GetErrorCodeOk returns a tuple with the ErrorCode field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetErrorCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ErrorCode, true +} + +// SetErrorCode sets field value +func (o *ReceiptError) SetErrorCode(v string) { + o.ErrorCode = v +} + +// GetErrorId returns the ErrorId field value +func (o *ReceiptError) GetErrorId() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.ErrorId +} + +// GetErrorIdOk returns a tuple with the ErrorId field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetErrorIdOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.ErrorId, true +} + +// SetErrorId sets field value +func (o *ReceiptError) SetErrorId(v uint32) { + o.ErrorId = v +} + +// GetMessage returns the Message field value +func (o *ReceiptError) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ReceiptError) SetMessage(v string) { + o.Message = v +} + +// GetMessageFormat returns the MessageFormat field value +func (o *ReceiptError) GetMessageFormat() string { + if o == nil { + var ret string + return ret + } + + return o.MessageFormat +} + +// GetMessageFormatOk returns a tuple with the MessageFormat field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetMessageFormatOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MessageFormat, true +} + +// SetMessageFormat sets field value +func (o *ReceiptError) SetMessageFormat(v string) { + o.MessageFormat = v +} + +// GetParameters returns the Parameters field value +func (o *ReceiptError) GetParameters() []string { + if o == nil { + var ret []string + return ret + } + + return o.Parameters +} + +// GetParametersOk returns a tuple with the Parameters field value +// and a boolean to check if the value has been set. +func (o *ReceiptError) GetParametersOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Parameters, true +} + +// SetParameters sets field value +func (o *ReceiptError) SetParameters(v []string) { + o.Parameters = v +} + +func (o ReceiptError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReceiptError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contractHName"] = o.ContractHName + toSerialize["errorCode"] = o.ErrorCode + toSerialize["errorId"] = o.ErrorId + toSerialize["message"] = o.Message + toSerialize["messageFormat"] = o.MessageFormat + toSerialize["parameters"] = o.Parameters + return toSerialize, nil +} + +type NullableReceiptError struct { + value *ReceiptError + isSet bool +} + +func (v NullableReceiptError) Get() *ReceiptError { + return v.value +} + +func (v *NullableReceiptError) Set(val *ReceiptError) { + v.value = val + v.isSet = true +} + +func (v NullableReceiptError) IsSet() bool { + return v.isSet +} + +func (v *NullableReceiptError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReceiptError(val *ReceiptError) *NullableReceiptError { + return &NullableReceiptError{value: val, isSet: true} +} + +func (v NullableReceiptError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReceiptError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_receipt_response.go b/clients/apiclient/model_receipt_response.go new file mode 100644 index 0000000000..6baeeae5ce --- /dev/null +++ b/clients/apiclient/model_receipt_response.go @@ -0,0 +1,318 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ReceiptResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReceiptResponse{} + +// ReceiptResponse struct for ReceiptResponse +type ReceiptResponse struct { + BlockIndex uint32 `json:"blockIndex"` + Error *ReceiptError `json:"error,omitempty"` + // The gas budget (uint64 as string) + GasBudget string `json:"gasBudget"` + GasBurnLog []BurnRecord `json:"gasBurnLog"` + // The burned gas (uint64 as string) + GasBurned string `json:"gasBurned"` + // The charged gas fee (uint64 as string) + GasFeeCharged string `json:"gasFeeCharged"` + Request string `json:"request"` + RequestIndex uint32 `json:"requestIndex"` +} + +// NewReceiptResponse instantiates a new ReceiptResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReceiptResponse(blockIndex uint32, gasBudget string, gasBurnLog []BurnRecord, gasBurned string, gasFeeCharged string, request string, requestIndex uint32) *ReceiptResponse { + this := ReceiptResponse{} + this.BlockIndex = blockIndex + this.GasBudget = gasBudget + this.GasBurnLog = gasBurnLog + this.GasBurned = gasBurned + this.GasFeeCharged = gasFeeCharged + this.Request = request + this.RequestIndex = requestIndex + return &this +} + +// NewReceiptResponseWithDefaults instantiates a new ReceiptResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReceiptResponseWithDefaults() *ReceiptResponse { + this := ReceiptResponse{} + return &this +} + +// GetBlockIndex returns the BlockIndex field value +func (o *ReceiptResponse) GetBlockIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.BlockIndex +} + +// GetBlockIndexOk returns a tuple with the BlockIndex field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetBlockIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.BlockIndex, true +} + +// SetBlockIndex sets field value +func (o *ReceiptResponse) SetBlockIndex(v uint32) { + o.BlockIndex = v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *ReceiptResponse) GetError() ReceiptError { + if o == nil || isNil(o.Error) { + var ret ReceiptError + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetErrorOk() (*ReceiptError, bool) { + if o == nil || isNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *ReceiptResponse) HasError() bool { + if o != nil && !isNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given ReceiptError and assigns it to the Error field. +func (o *ReceiptResponse) SetError(v ReceiptError) { + o.Error = &v +} + +// GetGasBudget returns the GasBudget field value +func (o *ReceiptResponse) GetGasBudget() string { + if o == nil { + var ret string + return ret + } + + return o.GasBudget +} + +// GetGasBudgetOk returns a tuple with the GasBudget field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetGasBudgetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasBudget, true +} + +// SetGasBudget sets field value +func (o *ReceiptResponse) SetGasBudget(v string) { + o.GasBudget = v +} + +// GetGasBurnLog returns the GasBurnLog field value +func (o *ReceiptResponse) GetGasBurnLog() []BurnRecord { + if o == nil { + var ret []BurnRecord + return ret + } + + return o.GasBurnLog +} + +// GetGasBurnLogOk returns a tuple with the GasBurnLog field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetGasBurnLogOk() ([]BurnRecord, bool) { + if o == nil { + return nil, false + } + return o.GasBurnLog, true +} + +// SetGasBurnLog sets field value +func (o *ReceiptResponse) SetGasBurnLog(v []BurnRecord) { + o.GasBurnLog = v +} + +// GetGasBurned returns the GasBurned field value +func (o *ReceiptResponse) GetGasBurned() string { + if o == nil { + var ret string + return ret + } + + return o.GasBurned +} + +// GetGasBurnedOk returns a tuple with the GasBurned field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetGasBurnedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasBurned, true +} + +// SetGasBurned sets field value +func (o *ReceiptResponse) SetGasBurned(v string) { + o.GasBurned = v +} + +// GetGasFeeCharged returns the GasFeeCharged field value +func (o *ReceiptResponse) GetGasFeeCharged() string { + if o == nil { + var ret string + return ret + } + + return o.GasFeeCharged +} + +// GetGasFeeChargedOk returns a tuple with the GasFeeCharged field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetGasFeeChargedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasFeeCharged, true +} + +// SetGasFeeCharged sets field value +func (o *ReceiptResponse) SetGasFeeCharged(v string) { + o.GasFeeCharged = v +} + +// GetRequest returns the Request field value +func (o *ReceiptResponse) GetRequest() string { + if o == nil { + var ret string + return ret + } + + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetRequestOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value +func (o *ReceiptResponse) SetRequest(v string) { + o.Request = v +} + +// GetRequestIndex returns the RequestIndex field value +func (o *ReceiptResponse) GetRequestIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.RequestIndex +} + +// GetRequestIndexOk returns a tuple with the RequestIndex field value +// and a boolean to check if the value has been set. +func (o *ReceiptResponse) GetRequestIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.RequestIndex, true +} + +// SetRequestIndex sets field value +func (o *ReceiptResponse) SetRequestIndex(v uint32) { + o.RequestIndex = v +} + +func (o ReceiptResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReceiptResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["blockIndex"] = o.BlockIndex + if !isNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["gasBudget"] = o.GasBudget + toSerialize["gasBurnLog"] = o.GasBurnLog + toSerialize["gasBurned"] = o.GasBurned + toSerialize["gasFeeCharged"] = o.GasFeeCharged + toSerialize["request"] = o.Request + toSerialize["requestIndex"] = o.RequestIndex + return toSerialize, nil +} + +type NullableReceiptResponse struct { + value *ReceiptResponse + isSet bool +} + +func (v NullableReceiptResponse) Get() *ReceiptResponse { + return v.value +} + +func (v *NullableReceiptResponse) Set(val *ReceiptResponse) { + v.value = val + v.isSet = true +} + +func (v NullableReceiptResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableReceiptResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReceiptResponse(val *ReceiptResponse) *NullableReceiptResponse { + return &NullableReceiptResponse{value: val, isSet: true} +} + +func (v NullableReceiptResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReceiptResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_rent_structure.go b/clients/apiclient/model_rent_structure.go new file mode 100644 index 0000000000..733386365d --- /dev/null +++ b/clients/apiclient/model_rent_structure.go @@ -0,0 +1,174 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RentStructure type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RentStructure{} + +// RentStructure struct for RentStructure +type RentStructure struct { + // The virtual byte cost + VByteCost uint32 `json:"vByteCost"` + // The virtual byte factor for data fields + VByteFactorData int32 `json:"vByteFactorData"` + // The virtual byte factor for key/lookup generating fields + VByteFactorKey int32 `json:"vByteFactorKey"` +} + +// NewRentStructure instantiates a new RentStructure object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRentStructure(vByteCost uint32, vByteFactorData int32, vByteFactorKey int32) *RentStructure { + this := RentStructure{} + this.VByteCost = vByteCost + this.VByteFactorData = vByteFactorData + this.VByteFactorKey = vByteFactorKey + return &this +} + +// NewRentStructureWithDefaults instantiates a new RentStructure object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRentStructureWithDefaults() *RentStructure { + this := RentStructure{} + return &this +} + +// GetVByteCost returns the VByteCost field value +func (o *RentStructure) GetVByteCost() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.VByteCost +} + +// GetVByteCostOk returns a tuple with the VByteCost field value +// and a boolean to check if the value has been set. +func (o *RentStructure) GetVByteCostOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.VByteCost, true +} + +// SetVByteCost sets field value +func (o *RentStructure) SetVByteCost(v uint32) { + o.VByteCost = v +} + +// GetVByteFactorData returns the VByteFactorData field value +func (o *RentStructure) GetVByteFactorData() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.VByteFactorData +} + +// GetVByteFactorDataOk returns a tuple with the VByteFactorData field value +// and a boolean to check if the value has been set. +func (o *RentStructure) GetVByteFactorDataOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.VByteFactorData, true +} + +// SetVByteFactorData sets field value +func (o *RentStructure) SetVByteFactorData(v int32) { + o.VByteFactorData = v +} + +// GetVByteFactorKey returns the VByteFactorKey field value +func (o *RentStructure) GetVByteFactorKey() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.VByteFactorKey +} + +// GetVByteFactorKeyOk returns a tuple with the VByteFactorKey field value +// and a boolean to check if the value has been set. +func (o *RentStructure) GetVByteFactorKeyOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.VByteFactorKey, true +} + +// SetVByteFactorKey sets field value +func (o *RentStructure) SetVByteFactorKey(v int32) { + o.VByteFactorKey = v +} + +func (o RentStructure) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RentStructure) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["vByteCost"] = o.VByteCost + toSerialize["vByteFactorData"] = o.VByteFactorData + toSerialize["vByteFactorKey"] = o.VByteFactorKey + return toSerialize, nil +} + +type NullableRentStructure struct { + value *RentStructure + isSet bool +} + +func (v NullableRentStructure) Get() *RentStructure { + return v.value +} + +func (v *NullableRentStructure) Set(val *RentStructure) { + v.value = val + v.isSet = true +} + +func (v NullableRentStructure) IsSet() bool { + return v.isSet +} + +func (v *NullableRentStructure) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRentStructure(val *RentStructure) *NullableRentStructure { + return &NullableRentStructure{value: val, isSet: true} +} + +func (v NullableRentStructure) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRentStructure) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_request_detail.go b/clients/apiclient/model_request_detail.go new file mode 100644 index 0000000000..b1792f1756 --- /dev/null +++ b/clients/apiclient/model_request_detail.go @@ -0,0 +1,388 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RequestDetail type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestDetail{} + +// RequestDetail struct for RequestDetail +type RequestDetail struct { + Allowance Assets `json:"allowance"` + CallTarget CallTarget `json:"callTarget"` + FungibleTokens Assets `json:"fungibleTokens"` + // The gas budget (uint64 as string) + GasGudget string `json:"gasGudget"` + IsEVM bool `json:"isEVM"` + IsOffLedger bool `json:"isOffLedger"` + Nft NFTDataResponse `json:"nft"` + Params JSONDict `json:"params"` + RequestId string `json:"requestId"` + SenderAccount string `json:"senderAccount"` + TargetAddress string `json:"targetAddress"` +} + +// NewRequestDetail instantiates a new RequestDetail object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestDetail(allowance Assets, callTarget CallTarget, fungibleTokens Assets, gasGudget string, isEVM bool, isOffLedger bool, nft NFTDataResponse, params JSONDict, requestId string, senderAccount string, targetAddress string) *RequestDetail { + this := RequestDetail{} + this.Allowance = allowance + this.CallTarget = callTarget + this.FungibleTokens = fungibleTokens + this.GasGudget = gasGudget + this.IsEVM = isEVM + this.IsOffLedger = isOffLedger + this.Nft = nft + this.Params = params + this.RequestId = requestId + this.SenderAccount = senderAccount + this.TargetAddress = targetAddress + return &this +} + +// NewRequestDetailWithDefaults instantiates a new RequestDetail object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestDetailWithDefaults() *RequestDetail { + this := RequestDetail{} + return &this +} + +// GetAllowance returns the Allowance field value +func (o *RequestDetail) GetAllowance() Assets { + if o == nil { + var ret Assets + return ret + } + + return o.Allowance +} + +// GetAllowanceOk returns a tuple with the Allowance field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetAllowanceOk() (*Assets, bool) { + if o == nil { + return nil, false + } + return &o.Allowance, true +} + +// SetAllowance sets field value +func (o *RequestDetail) SetAllowance(v Assets) { + o.Allowance = v +} + +// GetCallTarget returns the CallTarget field value +func (o *RequestDetail) GetCallTarget() CallTarget { + if o == nil { + var ret CallTarget + return ret + } + + return o.CallTarget +} + +// GetCallTargetOk returns a tuple with the CallTarget field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetCallTargetOk() (*CallTarget, bool) { + if o == nil { + return nil, false + } + return &o.CallTarget, true +} + +// SetCallTarget sets field value +func (o *RequestDetail) SetCallTarget(v CallTarget) { + o.CallTarget = v +} + +// GetFungibleTokens returns the FungibleTokens field value +func (o *RequestDetail) GetFungibleTokens() Assets { + if o == nil { + var ret Assets + return ret + } + + return o.FungibleTokens +} + +// GetFungibleTokensOk returns a tuple with the FungibleTokens field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetFungibleTokensOk() (*Assets, bool) { + if o == nil { + return nil, false + } + return &o.FungibleTokens, true +} + +// SetFungibleTokens sets field value +func (o *RequestDetail) SetFungibleTokens(v Assets) { + o.FungibleTokens = v +} + +// GetGasGudget returns the GasGudget field value +func (o *RequestDetail) GetGasGudget() string { + if o == nil { + var ret string + return ret + } + + return o.GasGudget +} + +// GetGasGudgetOk returns a tuple with the GasGudget field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetGasGudgetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasGudget, true +} + +// SetGasGudget sets field value +func (o *RequestDetail) SetGasGudget(v string) { + o.GasGudget = v +} + +// GetIsEVM returns the IsEVM field value +func (o *RequestDetail) GetIsEVM() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsEVM +} + +// GetIsEVMOk returns a tuple with the IsEVM field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetIsEVMOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsEVM, true +} + +// SetIsEVM sets field value +func (o *RequestDetail) SetIsEVM(v bool) { + o.IsEVM = v +} + +// GetIsOffLedger returns the IsOffLedger field value +func (o *RequestDetail) GetIsOffLedger() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsOffLedger +} + +// GetIsOffLedgerOk returns a tuple with the IsOffLedger field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetIsOffLedgerOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsOffLedger, true +} + +// SetIsOffLedger sets field value +func (o *RequestDetail) SetIsOffLedger(v bool) { + o.IsOffLedger = v +} + +// GetNft returns the Nft field value +func (o *RequestDetail) GetNft() NFTDataResponse { + if o == nil { + var ret NFTDataResponse + return ret + } + + return o.Nft +} + +// GetNftOk returns a tuple with the Nft field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetNftOk() (*NFTDataResponse, bool) { + if o == nil { + return nil, false + } + return &o.Nft, true +} + +// SetNft sets field value +func (o *RequestDetail) SetNft(v NFTDataResponse) { + o.Nft = v +} + +// GetParams returns the Params field value +func (o *RequestDetail) GetParams() JSONDict { + if o == nil { + var ret JSONDict + return ret + } + + return o.Params +} + +// GetParamsOk returns a tuple with the Params field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetParamsOk() (*JSONDict, bool) { + if o == nil { + return nil, false + } + return &o.Params, true +} + +// SetParams sets field value +func (o *RequestDetail) SetParams(v JSONDict) { + o.Params = v +} + +// GetRequestId returns the RequestId field value +func (o *RequestDetail) GetRequestId() string { + if o == nil { + var ret string + return ret + } + + return o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetRequestIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RequestId, true +} + +// SetRequestId sets field value +func (o *RequestDetail) SetRequestId(v string) { + o.RequestId = v +} + +// GetSenderAccount returns the SenderAccount field value +func (o *RequestDetail) GetSenderAccount() string { + if o == nil { + var ret string + return ret + } + + return o.SenderAccount +} + +// GetSenderAccountOk returns a tuple with the SenderAccount field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetSenderAccountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SenderAccount, true +} + +// SetSenderAccount sets field value +func (o *RequestDetail) SetSenderAccount(v string) { + o.SenderAccount = v +} + +// GetTargetAddress returns the TargetAddress field value +func (o *RequestDetail) GetTargetAddress() string { + if o == nil { + var ret string + return ret + } + + return o.TargetAddress +} + +// GetTargetAddressOk returns a tuple with the TargetAddress field value +// and a boolean to check if the value has been set. +func (o *RequestDetail) GetTargetAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TargetAddress, true +} + +// SetTargetAddress sets field value +func (o *RequestDetail) SetTargetAddress(v string) { + o.TargetAddress = v +} + +func (o RequestDetail) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestDetail) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["allowance"] = o.Allowance + toSerialize["callTarget"] = o.CallTarget + toSerialize["fungibleTokens"] = o.FungibleTokens + toSerialize["gasGudget"] = o.GasGudget + toSerialize["isEVM"] = o.IsEVM + toSerialize["isOffLedger"] = o.IsOffLedger + toSerialize["nft"] = o.Nft + toSerialize["params"] = o.Params + toSerialize["requestId"] = o.RequestId + toSerialize["senderAccount"] = o.SenderAccount + toSerialize["targetAddress"] = o.TargetAddress + return toSerialize, nil +} + +type NullableRequestDetail struct { + value *RequestDetail + isSet bool +} + +func (v NullableRequestDetail) Get() *RequestDetail { + return v.value +} + +func (v *NullableRequestDetail) Set(val *RequestDetail) { + v.value = val + v.isSet = true +} + +func (v NullableRequestDetail) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestDetail) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestDetail(val *RequestDetail) *NullableRequestDetail { + return &NullableRequestDetail{value: val, isSet: true} +} + +func (v NullableRequestDetail) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestDetail) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_request_id_response.go b/clients/apiclient/model_request_id_response.go new file mode 100644 index 0000000000..97218c758a --- /dev/null +++ b/clients/apiclient/model_request_id_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RequestIDResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestIDResponse{} + +// RequestIDResponse struct for RequestIDResponse +type RequestIDResponse struct { + // The request ID of the given transaction ID. (Hex) + RequestId string `json:"requestId"` +} + +// NewRequestIDResponse instantiates a new RequestIDResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestIDResponse(requestId string) *RequestIDResponse { + this := RequestIDResponse{} + this.RequestId = requestId + return &this +} + +// NewRequestIDResponseWithDefaults instantiates a new RequestIDResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestIDResponseWithDefaults() *RequestIDResponse { + this := RequestIDResponse{} + return &this +} + +// GetRequestId returns the RequestId field value +func (o *RequestIDResponse) GetRequestId() string { + if o == nil { + var ret string + return ret + } + + return o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value +// and a boolean to check if the value has been set. +func (o *RequestIDResponse) GetRequestIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RequestId, true +} + +// SetRequestId sets field value +func (o *RequestIDResponse) SetRequestId(v string) { + o.RequestId = v +} + +func (o RequestIDResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestIDResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["requestId"] = o.RequestId + return toSerialize, nil +} + +type NullableRequestIDResponse struct { + value *RequestIDResponse + isSet bool +} + +func (v NullableRequestIDResponse) Get() *RequestIDResponse { + return v.value +} + +func (v *NullableRequestIDResponse) Set(val *RequestIDResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRequestIDResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestIDResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestIDResponse(val *RequestIDResponse) *NullableRequestIDResponse { + return &NullableRequestIDResponse{value: val, isSet: true} +} + +func (v NullableRequestIDResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestIDResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_request_ids_response.go b/clients/apiclient/model_request_ids_response.go new file mode 100644 index 0000000000..2ab4aea7c1 --- /dev/null +++ b/clients/apiclient/model_request_ids_response.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RequestIDsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestIDsResponse{} + +// RequestIDsResponse struct for RequestIDsResponse +type RequestIDsResponse struct { + RequestIds []string `json:"requestIds"` +} + +// NewRequestIDsResponse instantiates a new RequestIDsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestIDsResponse(requestIds []string) *RequestIDsResponse { + this := RequestIDsResponse{} + this.RequestIds = requestIds + return &this +} + +// NewRequestIDsResponseWithDefaults instantiates a new RequestIDsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestIDsResponseWithDefaults() *RequestIDsResponse { + this := RequestIDsResponse{} + return &this +} + +// GetRequestIds returns the RequestIds field value +func (o *RequestIDsResponse) GetRequestIds() []string { + if o == nil { + var ret []string + return ret + } + + return o.RequestIds +} + +// GetRequestIdsOk returns a tuple with the RequestIds field value +// and a boolean to check if the value has been set. +func (o *RequestIDsResponse) GetRequestIdsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.RequestIds, true +} + +// SetRequestIds sets field value +func (o *RequestIDsResponse) SetRequestIds(v []string) { + o.RequestIds = v +} + +func (o RequestIDsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestIDsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["requestIds"] = o.RequestIds + return toSerialize, nil +} + +type NullableRequestIDsResponse struct { + value *RequestIDsResponse + isSet bool +} + +func (v NullableRequestIDsResponse) Get() *RequestIDsResponse { + return v.value +} + +func (v *NullableRequestIDsResponse) Set(val *RequestIDsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRequestIDsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestIDsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestIDsResponse(val *RequestIDsResponse) *NullableRequestIDsResponse { + return &NullableRequestIDsResponse{value: val, isSet: true} +} + +func (v NullableRequestIDsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestIDsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_request_processed_response.go b/clients/apiclient/model_request_processed_response.go new file mode 100644 index 0000000000..c02e6ee64b --- /dev/null +++ b/clients/apiclient/model_request_processed_response.go @@ -0,0 +1,171 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RequestProcessedResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestProcessedResponse{} + +// RequestProcessedResponse struct for RequestProcessedResponse +type RequestProcessedResponse struct { + ChainId string `json:"chainId"` + IsProcessed bool `json:"isProcessed"` + RequestId string `json:"requestId"` +} + +// NewRequestProcessedResponse instantiates a new RequestProcessedResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestProcessedResponse(chainId string, isProcessed bool, requestId string) *RequestProcessedResponse { + this := RequestProcessedResponse{} + this.ChainId = chainId + this.IsProcessed = isProcessed + this.RequestId = requestId + return &this +} + +// NewRequestProcessedResponseWithDefaults instantiates a new RequestProcessedResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestProcessedResponseWithDefaults() *RequestProcessedResponse { + this := RequestProcessedResponse{} + return &this +} + +// GetChainId returns the ChainId field value +func (o *RequestProcessedResponse) GetChainId() string { + if o == nil { + var ret string + return ret + } + + return o.ChainId +} + +// GetChainIdOk returns a tuple with the ChainId field value +// and a boolean to check if the value has been set. +func (o *RequestProcessedResponse) GetChainIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChainId, true +} + +// SetChainId sets field value +func (o *RequestProcessedResponse) SetChainId(v string) { + o.ChainId = v +} + +// GetIsProcessed returns the IsProcessed field value +func (o *RequestProcessedResponse) GetIsProcessed() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsProcessed +} + +// GetIsProcessedOk returns a tuple with the IsProcessed field value +// and a boolean to check if the value has been set. +func (o *RequestProcessedResponse) GetIsProcessedOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsProcessed, true +} + +// SetIsProcessed sets field value +func (o *RequestProcessedResponse) SetIsProcessed(v bool) { + o.IsProcessed = v +} + +// GetRequestId returns the RequestId field value +func (o *RequestProcessedResponse) GetRequestId() string { + if o == nil { + var ret string + return ret + } + + return o.RequestId +} + +// GetRequestIdOk returns a tuple with the RequestId field value +// and a boolean to check if the value has been set. +func (o *RequestProcessedResponse) GetRequestIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RequestId, true +} + +// SetRequestId sets field value +func (o *RequestProcessedResponse) SetRequestId(v string) { + o.RequestId = v +} + +func (o RequestProcessedResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestProcessedResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["chainId"] = o.ChainId + toSerialize["isProcessed"] = o.IsProcessed + toSerialize["requestId"] = o.RequestId + return toSerialize, nil +} + +type NullableRequestProcessedResponse struct { + value *RequestProcessedResponse + isSet bool +} + +func (v NullableRequestProcessedResponse) Get() *RequestProcessedResponse { + return v.value +} + +func (v *NullableRequestProcessedResponse) Set(val *RequestProcessedResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRequestProcessedResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestProcessedResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestProcessedResponse(val *RequestProcessedResponse) *NullableRequestProcessedResponse { + return &NullableRequestProcessedResponse{value: val, isSet: true} +} + +func (v NullableRequestProcessedResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestProcessedResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_request_receipt_response.go b/clients/apiclient/model_request_receipt_response.go new file mode 100644 index 0000000000..202b5a257a --- /dev/null +++ b/clients/apiclient/model_request_receipt_response.go @@ -0,0 +1,318 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the RequestReceiptResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestReceiptResponse{} + +// RequestReceiptResponse struct for RequestReceiptResponse +type RequestReceiptResponse struct { + BlockIndex uint32 `json:"blockIndex"` + Error *BlockReceiptError `json:"error,omitempty"` + // The gas budget (uint64 as string) + GasBudget string `json:"gasBudget"` + GasBurnLog BurnLog `json:"gasBurnLog"` + // The burned gas (uint64 as string) + GasBurned string `json:"gasBurned"` + // The charged gas fee (uint64 as string) + GasFeeCharged string `json:"gasFeeCharged"` + Request RequestDetail `json:"request"` + RequestIndex uint32 `json:"requestIndex"` +} + +// NewRequestReceiptResponse instantiates a new RequestReceiptResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestReceiptResponse(blockIndex uint32, gasBudget string, gasBurnLog BurnLog, gasBurned string, gasFeeCharged string, request RequestDetail, requestIndex uint32) *RequestReceiptResponse { + this := RequestReceiptResponse{} + this.BlockIndex = blockIndex + this.GasBudget = gasBudget + this.GasBurnLog = gasBurnLog + this.GasBurned = gasBurned + this.GasFeeCharged = gasFeeCharged + this.Request = request + this.RequestIndex = requestIndex + return &this +} + +// NewRequestReceiptResponseWithDefaults instantiates a new RequestReceiptResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestReceiptResponseWithDefaults() *RequestReceiptResponse { + this := RequestReceiptResponse{} + return &this +} + +// GetBlockIndex returns the BlockIndex field value +func (o *RequestReceiptResponse) GetBlockIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.BlockIndex +} + +// GetBlockIndexOk returns a tuple with the BlockIndex field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetBlockIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.BlockIndex, true +} + +// SetBlockIndex sets field value +func (o *RequestReceiptResponse) SetBlockIndex(v uint32) { + o.BlockIndex = v +} + +// GetError returns the Error field value if set, zero value otherwise. +func (o *RequestReceiptResponse) GetError() BlockReceiptError { + if o == nil || isNil(o.Error) { + var ret BlockReceiptError + return ret + } + return *o.Error +} + +// GetErrorOk returns a tuple with the Error field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetErrorOk() (*BlockReceiptError, bool) { + if o == nil || isNil(o.Error) { + return nil, false + } + return o.Error, true +} + +// HasError returns a boolean if a field has been set. +func (o *RequestReceiptResponse) HasError() bool { + if o != nil && !isNil(o.Error) { + return true + } + + return false +} + +// SetError gets a reference to the given BlockReceiptError and assigns it to the Error field. +func (o *RequestReceiptResponse) SetError(v BlockReceiptError) { + o.Error = &v +} + +// GetGasBudget returns the GasBudget field value +func (o *RequestReceiptResponse) GetGasBudget() string { + if o == nil { + var ret string + return ret + } + + return o.GasBudget +} + +// GetGasBudgetOk returns a tuple with the GasBudget field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetGasBudgetOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasBudget, true +} + +// SetGasBudget sets field value +func (o *RequestReceiptResponse) SetGasBudget(v string) { + o.GasBudget = v +} + +// GetGasBurnLog returns the GasBurnLog field value +func (o *RequestReceiptResponse) GetGasBurnLog() BurnLog { + if o == nil { + var ret BurnLog + return ret + } + + return o.GasBurnLog +} + +// GetGasBurnLogOk returns a tuple with the GasBurnLog field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetGasBurnLogOk() (*BurnLog, bool) { + if o == nil { + return nil, false + } + return &o.GasBurnLog, true +} + +// SetGasBurnLog sets field value +func (o *RequestReceiptResponse) SetGasBurnLog(v BurnLog) { + o.GasBurnLog = v +} + +// GetGasBurned returns the GasBurned field value +func (o *RequestReceiptResponse) GetGasBurned() string { + if o == nil { + var ret string + return ret + } + + return o.GasBurned +} + +// GetGasBurnedOk returns a tuple with the GasBurned field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetGasBurnedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasBurned, true +} + +// SetGasBurned sets field value +func (o *RequestReceiptResponse) SetGasBurned(v string) { + o.GasBurned = v +} + +// GetGasFeeCharged returns the GasFeeCharged field value +func (o *RequestReceiptResponse) GetGasFeeCharged() string { + if o == nil { + var ret string + return ret + } + + return o.GasFeeCharged +} + +// GetGasFeeChargedOk returns a tuple with the GasFeeCharged field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetGasFeeChargedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.GasFeeCharged, true +} + +// SetGasFeeCharged sets field value +func (o *RequestReceiptResponse) SetGasFeeCharged(v string) { + o.GasFeeCharged = v +} + +// GetRequest returns the Request field value +func (o *RequestReceiptResponse) GetRequest() RequestDetail { + if o == nil { + var ret RequestDetail + return ret + } + + return o.Request +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetRequestOk() (*RequestDetail, bool) { + if o == nil { + return nil, false + } + return &o.Request, true +} + +// SetRequest sets field value +func (o *RequestReceiptResponse) SetRequest(v RequestDetail) { + o.Request = v +} + +// GetRequestIndex returns the RequestIndex field value +func (o *RequestReceiptResponse) GetRequestIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.RequestIndex +} + +// GetRequestIndexOk returns a tuple with the RequestIndex field value +// and a boolean to check if the value has been set. +func (o *RequestReceiptResponse) GetRequestIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.RequestIndex, true +} + +// SetRequestIndex sets field value +func (o *RequestReceiptResponse) SetRequestIndex(v uint32) { + o.RequestIndex = v +} + +func (o RequestReceiptResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestReceiptResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["blockIndex"] = o.BlockIndex + if !isNil(o.Error) { + toSerialize["error"] = o.Error + } + toSerialize["gasBudget"] = o.GasBudget + toSerialize["gasBurnLog"] = o.GasBurnLog + toSerialize["gasBurned"] = o.GasBurned + toSerialize["gasFeeCharged"] = o.GasFeeCharged + toSerialize["request"] = o.Request + toSerialize["requestIndex"] = o.RequestIndex + return toSerialize, nil +} + +type NullableRequestReceiptResponse struct { + value *RequestReceiptResponse + isSet bool +} + +func (v NullableRequestReceiptResponse) Get() *RequestReceiptResponse { + return v.value +} + +func (v *NullableRequestReceiptResponse) Set(val *RequestReceiptResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRequestReceiptResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestReceiptResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestReceiptResponse(val *RequestReceiptResponse) *NullableRequestReceiptResponse { + return &NullableRequestReceiptResponse{value: val, isSet: true} +} + +func (v NullableRequestReceiptResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestReceiptResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_state_response.go b/clients/apiclient/model_state_response.go new file mode 100644 index 0000000000..cc6f783b83 --- /dev/null +++ b/clients/apiclient/model_state_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the StateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StateResponse{} + +// StateResponse struct for StateResponse +type StateResponse struct { + // The state of the requested key (Hex-encoded) + State string `json:"state"` +} + +// NewStateResponse instantiates a new StateResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewStateResponse(state string) *StateResponse { + this := StateResponse{} + this.State = state + return &this +} + +// NewStateResponseWithDefaults instantiates a new StateResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewStateResponseWithDefaults() *StateResponse { + this := StateResponse{} + return &this +} + +// GetState returns the State field value +func (o *StateResponse) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *StateResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *StateResponse) SetState(v string) { + o.State = v +} + +func (o StateResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["state"] = o.State + return toSerialize, nil +} + +type NullableStateResponse struct { + value *StateResponse + isSet bool +} + +func (v NullableStateResponse) Get() *StateResponse { + return v.value +} + +func (v *NullableStateResponse) Set(val *StateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableStateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableStateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStateResponse(val *StateResponse) *NullableStateResponse { + return &NullableStateResponse{value: val, isSet: true} +} + +func (v NullableStateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_state_transaction.go b/clients/apiclient/model_state_transaction.go new file mode 100644 index 0000000000..f183cc2840 --- /dev/null +++ b/clients/apiclient/model_state_transaction.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the StateTransaction type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StateTransaction{} + +// StateTransaction struct for StateTransaction +type StateTransaction struct { + // The state index + StateIndex uint32 `json:"stateIndex"` + // The transaction ID + TxId string `json:"txId"` +} + +// NewStateTransaction instantiates a new StateTransaction object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewStateTransaction(stateIndex uint32, txId string) *StateTransaction { + this := StateTransaction{} + this.StateIndex = stateIndex + this.TxId = txId + return &this +} + +// NewStateTransactionWithDefaults instantiates a new StateTransaction object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewStateTransactionWithDefaults() *StateTransaction { + this := StateTransaction{} + return &this +} + +// GetStateIndex returns the StateIndex field value +func (o *StateTransaction) GetStateIndex() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.StateIndex +} + +// GetStateIndexOk returns a tuple with the StateIndex field value +// and a boolean to check if the value has been set. +func (o *StateTransaction) GetStateIndexOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.StateIndex, true +} + +// SetStateIndex sets field value +func (o *StateTransaction) SetStateIndex(v uint32) { + o.StateIndex = v +} + +// GetTxId returns the TxId field value +func (o *StateTransaction) GetTxId() string { + if o == nil { + var ret string + return ret + } + + return o.TxId +} + +// GetTxIdOk returns a tuple with the TxId field value +// and a boolean to check if the value has been set. +func (o *StateTransaction) GetTxIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TxId, true +} + +// SetTxId sets field value +func (o *StateTransaction) SetTxId(v string) { + o.TxId = v +} + +func (o StateTransaction) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StateTransaction) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["stateIndex"] = o.StateIndex + toSerialize["txId"] = o.TxId + return toSerialize, nil +} + +type NullableStateTransaction struct { + value *StateTransaction + isSet bool +} + +func (v NullableStateTransaction) Get() *StateTransaction { + return v.value +} + +func (v *NullableStateTransaction) Set(val *StateTransaction) { + v.value = val + v.isSet = true +} + +func (v NullableStateTransaction) IsSet() bool { + return v.isSet +} + +func (v *NullableStateTransaction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStateTransaction(val *StateTransaction) *NullableStateTransaction { + return &NullableStateTransaction{value: val, isSet: true} +} + +func (v NullableStateTransaction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStateTransaction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_transaction.go b/clients/apiclient/model_transaction.go new file mode 100644 index 0000000000..336887f07b --- /dev/null +++ b/clients/apiclient/model_transaction.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the Transaction type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Transaction{} + +// Transaction struct for Transaction +type Transaction struct { + // The transaction ID + TxId string `json:"txId"` +} + +// NewTransaction instantiates a new Transaction object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransaction(txId string) *Transaction { + this := Transaction{} + this.TxId = txId + return &this +} + +// NewTransactionWithDefaults instantiates a new Transaction object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransactionWithDefaults() *Transaction { + this := Transaction{} + return &this +} + +// GetTxId returns the TxId field value +func (o *Transaction) GetTxId() string { + if o == nil { + var ret string + return ret + } + + return o.TxId +} + +// GetTxIdOk returns a tuple with the TxId field value +// and a boolean to check if the value has been set. +func (o *Transaction) GetTxIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TxId, true +} + +// SetTxId sets field value +func (o *Transaction) SetTxId(v string) { + o.TxId = v +} + +func (o Transaction) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Transaction) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["txId"] = o.TxId + return toSerialize, nil +} + +type NullableTransaction struct { + value *Transaction + isSet bool +} + +func (v NullableTransaction) Get() *Transaction { + return v.value +} + +func (v *NullableTransaction) Set(val *Transaction) { + v.value = val + v.isSet = true +} + +func (v NullableTransaction) IsSet() bool { + return v.isSet +} + +func (v *NullableTransaction) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransaction(val *Transaction) *NullableTransaction { + return &NullableTransaction{value: val, isSet: true} +} + +func (v NullableTransaction) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransaction) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_transaction_id_metric_item.go b/clients/apiclient/model_transaction_id_metric_item.go new file mode 100644 index 0000000000..8385fa3ed6 --- /dev/null +++ b/clients/apiclient/model_transaction_id_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the TransactionIDMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TransactionIDMetricItem{} + +// TransactionIDMetricItem struct for TransactionIDMetricItem +type TransactionIDMetricItem struct { + LastMessage Transaction `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewTransactionIDMetricItem instantiates a new TransactionIDMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransactionIDMetricItem(lastMessage Transaction, messages uint32, timestamp time.Time) *TransactionIDMetricItem { + this := TransactionIDMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewTransactionIDMetricItemWithDefaults instantiates a new TransactionIDMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransactionIDMetricItemWithDefaults() *TransactionIDMetricItem { + this := TransactionIDMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *TransactionIDMetricItem) GetLastMessage() Transaction { + if o == nil { + var ret Transaction + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *TransactionIDMetricItem) GetLastMessageOk() (*Transaction, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *TransactionIDMetricItem) SetLastMessage(v Transaction) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *TransactionIDMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *TransactionIDMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *TransactionIDMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *TransactionIDMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *TransactionIDMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *TransactionIDMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o TransactionIDMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TransactionIDMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableTransactionIDMetricItem struct { + value *TransactionIDMetricItem + isSet bool +} + +func (v NullableTransactionIDMetricItem) Get() *TransactionIDMetricItem { + return v.value +} + +func (v *NullableTransactionIDMetricItem) Set(val *TransactionIDMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableTransactionIDMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableTransactionIDMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransactionIDMetricItem(val *TransactionIDMetricItem) *NullableTransactionIDMetricItem { + return &NullableTransactionIDMetricItem{value: val, isSet: true} +} + +func (v NullableTransactionIDMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransactionIDMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_transaction_metric_item.go b/clients/apiclient/model_transaction_metric_item.go new file mode 100644 index 0000000000..5db3bb546e --- /dev/null +++ b/clients/apiclient/model_transaction_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the TransactionMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TransactionMetricItem{} + +// TransactionMetricItem struct for TransactionMetricItem +type TransactionMetricItem struct { + LastMessage Transaction `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewTransactionMetricItem instantiates a new TransactionMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTransactionMetricItem(lastMessage Transaction, messages uint32, timestamp time.Time) *TransactionMetricItem { + this := TransactionMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewTransactionMetricItemWithDefaults instantiates a new TransactionMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTransactionMetricItemWithDefaults() *TransactionMetricItem { + this := TransactionMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *TransactionMetricItem) GetLastMessage() Transaction { + if o == nil { + var ret Transaction + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *TransactionMetricItem) GetLastMessageOk() (*Transaction, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *TransactionMetricItem) SetLastMessage(v Transaction) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *TransactionMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *TransactionMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *TransactionMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *TransactionMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *TransactionMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *TransactionMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o TransactionMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TransactionMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableTransactionMetricItem struct { + value *TransactionMetricItem + isSet bool +} + +func (v NullableTransactionMetricItem) Get() *TransactionMetricItem { + return v.value +} + +func (v *NullableTransactionMetricItem) Set(val *TransactionMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableTransactionMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableTransactionMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTransactionMetricItem(val *TransactionMetricItem) *NullableTransactionMetricItem { + return &NullableTransactionMetricItem{value: val, isSet: true} +} + +func (v NullableTransactionMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTransactionMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_tx_inclusion_state_msg.go b/clients/apiclient/model_tx_inclusion_state_msg.go new file mode 100644 index 0000000000..5b4d029c11 --- /dev/null +++ b/clients/apiclient/model_tx_inclusion_state_msg.go @@ -0,0 +1,146 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the TxInclusionStateMsg type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TxInclusionStateMsg{} + +// TxInclusionStateMsg struct for TxInclusionStateMsg +type TxInclusionStateMsg struct { + // The inclusion state + State string `json:"state"` + // The transaction ID + TxId string `json:"txId"` +} + +// NewTxInclusionStateMsg instantiates a new TxInclusionStateMsg object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTxInclusionStateMsg(state string, txId string) *TxInclusionStateMsg { + this := TxInclusionStateMsg{} + this.State = state + this.TxId = txId + return &this +} + +// NewTxInclusionStateMsgWithDefaults instantiates a new TxInclusionStateMsg object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTxInclusionStateMsgWithDefaults() *TxInclusionStateMsg { + this := TxInclusionStateMsg{} + return &this +} + +// GetState returns the State field value +func (o *TxInclusionStateMsg) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *TxInclusionStateMsg) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *TxInclusionStateMsg) SetState(v string) { + o.State = v +} + +// GetTxId returns the TxId field value +func (o *TxInclusionStateMsg) GetTxId() string { + if o == nil { + var ret string + return ret + } + + return o.TxId +} + +// GetTxIdOk returns a tuple with the TxId field value +// and a boolean to check if the value has been set. +func (o *TxInclusionStateMsg) GetTxIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TxId, true +} + +// SetTxId sets field value +func (o *TxInclusionStateMsg) SetTxId(v string) { + o.TxId = v +} + +func (o TxInclusionStateMsg) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TxInclusionStateMsg) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["state"] = o.State + toSerialize["txId"] = o.TxId + return toSerialize, nil +} + +type NullableTxInclusionStateMsg struct { + value *TxInclusionStateMsg + isSet bool +} + +func (v NullableTxInclusionStateMsg) Get() *TxInclusionStateMsg { + return v.value +} + +func (v *NullableTxInclusionStateMsg) Set(val *TxInclusionStateMsg) { + v.value = val + v.isSet = true +} + +func (v NullableTxInclusionStateMsg) IsSet() bool { + return v.isSet +} + +func (v *NullableTxInclusionStateMsg) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTxInclusionStateMsg(val *TxInclusionStateMsg) *NullableTxInclusionStateMsg { + return &NullableTxInclusionStateMsg{value: val, isSet: true} +} + +func (v NullableTxInclusionStateMsg) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTxInclusionStateMsg) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_tx_inclusion_state_msg_metric_item.go b/clients/apiclient/model_tx_inclusion_state_msg_metric_item.go new file mode 100644 index 0000000000..e1a3dda6e8 --- /dev/null +++ b/clients/apiclient/model_tx_inclusion_state_msg_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the TxInclusionStateMsgMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TxInclusionStateMsgMetricItem{} + +// TxInclusionStateMsgMetricItem struct for TxInclusionStateMsgMetricItem +type TxInclusionStateMsgMetricItem struct { + LastMessage TxInclusionStateMsg `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewTxInclusionStateMsgMetricItem instantiates a new TxInclusionStateMsgMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTxInclusionStateMsgMetricItem(lastMessage TxInclusionStateMsg, messages uint32, timestamp time.Time) *TxInclusionStateMsgMetricItem { + this := TxInclusionStateMsgMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewTxInclusionStateMsgMetricItemWithDefaults instantiates a new TxInclusionStateMsgMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTxInclusionStateMsgMetricItemWithDefaults() *TxInclusionStateMsgMetricItem { + this := TxInclusionStateMsgMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *TxInclusionStateMsgMetricItem) GetLastMessage() TxInclusionStateMsg { + if o == nil { + var ret TxInclusionStateMsg + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *TxInclusionStateMsgMetricItem) GetLastMessageOk() (*TxInclusionStateMsg, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *TxInclusionStateMsgMetricItem) SetLastMessage(v TxInclusionStateMsg) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *TxInclusionStateMsgMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *TxInclusionStateMsgMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *TxInclusionStateMsgMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *TxInclusionStateMsgMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *TxInclusionStateMsgMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *TxInclusionStateMsgMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o TxInclusionStateMsgMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TxInclusionStateMsgMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableTxInclusionStateMsgMetricItem struct { + value *TxInclusionStateMsgMetricItem + isSet bool +} + +func (v NullableTxInclusionStateMsgMetricItem) Get() *TxInclusionStateMsgMetricItem { + return v.value +} + +func (v *NullableTxInclusionStateMsgMetricItem) Set(val *TxInclusionStateMsgMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableTxInclusionStateMsgMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableTxInclusionStateMsgMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTxInclusionStateMsgMetricItem(val *TxInclusionStateMsgMetricItem) *NullableTxInclusionStateMsgMetricItem { + return &NullableTxInclusionStateMsgMetricItem{value: val, isSet: true} +} + +func (v NullableTxInclusionStateMsgMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTxInclusionStateMsgMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_update_user_password_request.go b/clients/apiclient/model_update_user_password_request.go new file mode 100644 index 0000000000..d778378a9b --- /dev/null +++ b/clients/apiclient/model_update_user_password_request.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the UpdateUserPasswordRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateUserPasswordRequest{} + +// UpdateUserPasswordRequest struct for UpdateUserPasswordRequest +type UpdateUserPasswordRequest struct { + Password string `json:"password"` +} + +// NewUpdateUserPasswordRequest instantiates a new UpdateUserPasswordRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateUserPasswordRequest(password string) *UpdateUserPasswordRequest { + this := UpdateUserPasswordRequest{} + this.Password = password + return &this +} + +// NewUpdateUserPasswordRequestWithDefaults instantiates a new UpdateUserPasswordRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateUserPasswordRequestWithDefaults() *UpdateUserPasswordRequest { + this := UpdateUserPasswordRequest{} + return &this +} + +// GetPassword returns the Password field value +func (o *UpdateUserPasswordRequest) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *UpdateUserPasswordRequest) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *UpdateUserPasswordRequest) SetPassword(v string) { + o.Password = v +} + +func (o UpdateUserPasswordRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateUserPasswordRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["password"] = o.Password + return toSerialize, nil +} + +type NullableUpdateUserPasswordRequest struct { + value *UpdateUserPasswordRequest + isSet bool +} + +func (v NullableUpdateUserPasswordRequest) Get() *UpdateUserPasswordRequest { + return v.value +} + +func (v *NullableUpdateUserPasswordRequest) Set(val *UpdateUserPasswordRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateUserPasswordRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateUserPasswordRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateUserPasswordRequest(val *UpdateUserPasswordRequest) *NullableUpdateUserPasswordRequest { + return &NullableUpdateUserPasswordRequest{value: val, isSet: true} +} + +func (v NullableUpdateUserPasswordRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateUserPasswordRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_update_user_permissions_request.go b/clients/apiclient/model_update_user_permissions_request.go new file mode 100644 index 0000000000..e349ec4635 --- /dev/null +++ b/clients/apiclient/model_update_user_permissions_request.go @@ -0,0 +1,117 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the UpdateUserPermissionsRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateUserPermissionsRequest{} + +// UpdateUserPermissionsRequest struct for UpdateUserPermissionsRequest +type UpdateUserPermissionsRequest struct { + Permissions []string `json:"permissions"` +} + +// NewUpdateUserPermissionsRequest instantiates a new UpdateUserPermissionsRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateUserPermissionsRequest(permissions []string) *UpdateUserPermissionsRequest { + this := UpdateUserPermissionsRequest{} + this.Permissions = permissions + return &this +} + +// NewUpdateUserPermissionsRequestWithDefaults instantiates a new UpdateUserPermissionsRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateUserPermissionsRequestWithDefaults() *UpdateUserPermissionsRequest { + this := UpdateUserPermissionsRequest{} + return &this +} + +// GetPermissions returns the Permissions field value +func (o *UpdateUserPermissionsRequest) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *UpdateUserPermissionsRequest) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *UpdateUserPermissionsRequest) SetPermissions(v []string) { + o.Permissions = v +} + +func (o UpdateUserPermissionsRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateUserPermissionsRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["permissions"] = o.Permissions + return toSerialize, nil +} + +type NullableUpdateUserPermissionsRequest struct { + value *UpdateUserPermissionsRequest + isSet bool +} + +func (v NullableUpdateUserPermissionsRequest) Get() *UpdateUserPermissionsRequest { + return v.value +} + +func (v *NullableUpdateUserPermissionsRequest) Set(val *UpdateUserPermissionsRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateUserPermissionsRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateUserPermissionsRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateUserPermissionsRequest(val *UpdateUserPermissionsRequest) *NullableUpdateUserPermissionsRequest { + return &NullableUpdateUserPermissionsRequest{value: val, isSet: true} +} + +func (v NullableUpdateUserPermissionsRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateUserPermissionsRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_user.go b/clients/apiclient/model_user.go new file mode 100644 index 0000000000..c82e3cd5e1 --- /dev/null +++ b/clients/apiclient/model_user.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + +// User struct for User +type User struct { + Permissions []string `json:"permissions"` + Username string `json:"username"` +} + +// NewUser instantiates a new User object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUser(permissions []string, username string) *User { + this := User{} + this.Permissions = permissions + this.Username = username + return &this +} + +// NewUserWithDefaults instantiates a new User object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUserWithDefaults() *User { + this := User{} + return &this +} + +// GetPermissions returns the Permissions field value +func (o *User) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *User) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *User) SetPermissions(v []string) { + o.Permissions = v +} + +// GetUsername returns the Username field value +func (o *User) GetUsername() string { + if o == nil { + var ret string + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +func (o *User) GetUsernameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *User) SetUsername(v string) { + o.Username = v +} + +func (o User) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o User) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["permissions"] = o.Permissions + toSerialize["username"] = o.Username + return toSerialize, nil +} + +type NullableUser struct { + value *User + isSet bool +} + +func (v NullableUser) Get() *User { + return v.value +} + +func (v *NullableUser) Set(val *User) { + v.value = val + v.isSet = true +} + +func (v NullableUser) IsSet() bool { + return v.isSet +} + +func (v *NullableUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUser(val *User) *NullableUser { + return &NullableUser{value: val, isSet: true} +} + +func (v NullableUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_utxo_input_metric_item.go b/clients/apiclient/model_utxo_input_metric_item.go new file mode 100644 index 0000000000..abf603200b --- /dev/null +++ b/clients/apiclient/model_utxo_input_metric_item.go @@ -0,0 +1,172 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "time" +) + +// checks if the UTXOInputMetricItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UTXOInputMetricItem{} + +// UTXOInputMetricItem struct for UTXOInputMetricItem +type UTXOInputMetricItem struct { + LastMessage OutputID `json:"lastMessage"` + Messages uint32 `json:"messages"` + Timestamp time.Time `json:"timestamp"` +} + +// NewUTXOInputMetricItem instantiates a new UTXOInputMetricItem object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUTXOInputMetricItem(lastMessage OutputID, messages uint32, timestamp time.Time) *UTXOInputMetricItem { + this := UTXOInputMetricItem{} + this.LastMessage = lastMessage + this.Messages = messages + this.Timestamp = timestamp + return &this +} + +// NewUTXOInputMetricItemWithDefaults instantiates a new UTXOInputMetricItem object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUTXOInputMetricItemWithDefaults() *UTXOInputMetricItem { + this := UTXOInputMetricItem{} + return &this +} + +// GetLastMessage returns the LastMessage field value +func (o *UTXOInputMetricItem) GetLastMessage() OutputID { + if o == nil { + var ret OutputID + return ret + } + + return o.LastMessage +} + +// GetLastMessageOk returns a tuple with the LastMessage field value +// and a boolean to check if the value has been set. +func (o *UTXOInputMetricItem) GetLastMessageOk() (*OutputID, bool) { + if o == nil { + return nil, false + } + return &o.LastMessage, true +} + +// SetLastMessage sets field value +func (o *UTXOInputMetricItem) SetLastMessage(v OutputID) { + o.LastMessage = v +} + +// GetMessages returns the Messages field value +func (o *UTXOInputMetricItem) GetMessages() uint32 { + if o == nil { + var ret uint32 + return ret + } + + return o.Messages +} + +// GetMessagesOk returns a tuple with the Messages field value +// and a boolean to check if the value has been set. +func (o *UTXOInputMetricItem) GetMessagesOk() (*uint32, bool) { + if o == nil { + return nil, false + } + return &o.Messages, true +} + +// SetMessages sets field value +func (o *UTXOInputMetricItem) SetMessages(v uint32) { + o.Messages = v +} + +// GetTimestamp returns the Timestamp field value +func (o *UTXOInputMetricItem) GetTimestamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Timestamp +} + +// GetTimestampOk returns a tuple with the Timestamp field value +// and a boolean to check if the value has been set. +func (o *UTXOInputMetricItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Timestamp, true +} + +// SetTimestamp sets field value +func (o *UTXOInputMetricItem) SetTimestamp(v time.Time) { + o.Timestamp = v +} + +func (o UTXOInputMetricItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UTXOInputMetricItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["lastMessage"] = o.LastMessage + toSerialize["messages"] = o.Messages + toSerialize["timestamp"] = o.Timestamp + return toSerialize, nil +} + +type NullableUTXOInputMetricItem struct { + value *UTXOInputMetricItem + isSet bool +} + +func (v NullableUTXOInputMetricItem) Get() *UTXOInputMetricItem { + return v.value +} + +func (v *NullableUTXOInputMetricItem) Set(val *UTXOInputMetricItem) { + v.value = val + v.isSet = true +} + +func (v NullableUTXOInputMetricItem) IsSet() bool { + return v.isSet +} + +func (v *NullableUTXOInputMetricItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUTXOInputMetricItem(val *UTXOInputMetricItem) *NullableUTXOInputMetricItem { + return &NullableUTXOInputMetricItem{value: val, isSet: true} +} + +func (v NullableUTXOInputMetricItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUTXOInputMetricItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_validation_error.go b/clients/apiclient/model_validation_error.go new file mode 100644 index 0000000000..63ecdf16ad --- /dev/null +++ b/clients/apiclient/model_validation_error.go @@ -0,0 +1,144 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the ValidationError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationError{} + +// ValidationError struct for ValidationError +type ValidationError struct { + Error string `json:"error"` + MissingPermission string `json:"missingPermission"` +} + +// NewValidationError instantiates a new ValidationError object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewValidationError(error_ string, missingPermission string) *ValidationError { + this := ValidationError{} + this.Error = error_ + this.MissingPermission = missingPermission + return &this +} + +// NewValidationErrorWithDefaults instantiates a new ValidationError object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewValidationErrorWithDefaults() *ValidationError { + this := ValidationError{} + return &this +} + +// GetError returns the Error field value +func (o *ValidationError) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *ValidationError) SetError(v string) { + o.Error = v +} + +// GetMissingPermission returns the MissingPermission field value +func (o *ValidationError) GetMissingPermission() string { + if o == nil { + var ret string + return ret + } + + return o.MissingPermission +} + +// GetMissingPermissionOk returns a tuple with the MissingPermission field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetMissingPermissionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MissingPermission, true +} + +// SetMissingPermission sets field value +func (o *ValidationError) SetMissingPermission(v string) { + o.MissingPermission = v +} + +func (o ValidationError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ValidationError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + toSerialize["missingPermission"] = o.MissingPermission + return toSerialize, nil +} + +type NullableValidationError struct { + value *ValidationError + isSet bool +} + +func (v NullableValidationError) Get() *ValidationError { + return v.value +} + +func (v *NullableValidationError) Set(val *ValidationError) { + v.value = val + v.isSet = true +} + +func (v NullableValidationError) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationError(val *ValidationError) *NullableValidationError { + return &NullableValidationError{value: val, isSet: true} +} + +func (v NullableValidationError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/model_version_response.go b/clients/apiclient/model_version_response.go new file mode 100644 index 0000000000..804d6e82e6 --- /dev/null +++ b/clients/apiclient/model_version_response.go @@ -0,0 +1,118 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" +) + +// checks if the VersionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VersionResponse{} + +// VersionResponse struct for VersionResponse +type VersionResponse struct { + // The version of the node + Version string `json:"version"` +} + +// NewVersionResponse instantiates a new VersionResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVersionResponse(version string) *VersionResponse { + this := VersionResponse{} + this.Version = version + return &this +} + +// NewVersionResponseWithDefaults instantiates a new VersionResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVersionResponseWithDefaults() *VersionResponse { + this := VersionResponse{} + return &this +} + +// GetVersion returns the Version field value +func (o *VersionResponse) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *VersionResponse) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *VersionResponse) SetVersion(v string) { + o.Version = v +} + +func (o VersionResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VersionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["version"] = o.Version + return toSerialize, nil +} + +type NullableVersionResponse struct { + value *VersionResponse + isSet bool +} + +func (v NullableVersionResponse) Get() *VersionResponse { + return v.value +} + +func (v *NullableVersionResponse) Set(val *VersionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVersionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionResponse(val *VersionResponse) *NullableVersionResponse { + return &NullableVersionResponse{value: val, isSet: true} +} + +func (v NullableVersionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/clients/apiclient/response.go b/clients/apiclient/response.go new file mode 100644 index 0000000000..a12348cba2 --- /dev/null +++ b/clients/apiclient/response.go @@ -0,0 +1,47 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/clients/apiclient/utils.go b/clients/apiclient/utils.go new file mode 100644 index 0000000000..6f6f128824 --- /dev/null +++ b/clients/apiclient/utils.go @@ -0,0 +1,347 @@ +/* +Wasp API + +REST API for the Wasp node + +API version: 0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package apiclient + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// isNil checks if an input is nil +func isNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/clients/apiextensions/apierror.go b/clients/apiextensions/apierror.go new file mode 100644 index 0000000000..a7ac16c45b --- /dev/null +++ b/clients/apiextensions/apierror.go @@ -0,0 +1,36 @@ +package apiextensions + +import ( + "encoding/json" + + "github.com/iotaledger/wasp/clients/apiclient" +) + +type APIDetailError struct { + Message string + Error string +} + +type APIError struct { + Error string + DetailError *APIDetailError +} + +func AsAPIError(err error) (*APIError, bool) { + genericError, ok := err.(*apiclient.GenericOpenAPIError) + + if !ok { + return nil, false + } + + apiError := APIError{ + Error: genericError.Error(), + } + + var detailError APIDetailError + if json.Unmarshal(genericError.Body(), &detailError) == nil { + apiError.DetailError = &detailError + } + + return &apiError, true +} diff --git a/clients/apiextensions/assets.go b/clients/apiextensions/assets.go new file mode 100644 index 0000000000..c415286d8d --- /dev/null +++ b/clients/apiextensions/assets.go @@ -0,0 +1,42 @@ +package apiextensions + +import ( + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/packages/isc" +) + +func NewAssetsFromAPIResponse(assetsResponse *apiclient.AssetsResponse) (*isc.Assets, error) { + assets := isc.NewEmptyAssets() + + baseTokens, err := iotago.DecodeUint64(assetsResponse.BaseTokens) + if err != nil { + return nil, err + } + + assets.BaseTokens = baseTokens + + for _, nativeToken := range assetsResponse.NativeTokens { + nativeTokenIDHex, err := iotago.DecodeHex(nativeToken.Id) + if err != nil { + return nil, err + } + + nativeTokenID, err := isc.NativeTokenIDFromBytes(nativeTokenIDHex) + if err != nil { + return nil, err + } + + amount, err := iotago.DecodeUint256(nativeToken.Amount) + if err != nil { + return nil, err + } + + assets.NativeTokens = append(assets.NativeTokens, &iotago.NativeToken{ + ID: nativeTokenID, + Amount: amount, + }) + } + + return assets, err +} diff --git a/clients/apiextensions/client.go b/clients/apiextensions/client.go new file mode 100644 index 0000000000..4c1f3ae2f4 --- /dev/null +++ b/clients/apiextensions/client.go @@ -0,0 +1,36 @@ +package apiextensions + +import ( + "context" + "net/url" + + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/packages/kv/dict" +) + +func WaspAPIClientByHostName(hostname string) (*apiclient.APIClient, error) { + parsed, err := url.Parse(hostname) + if err != nil { + return nil, err + } + + config := apiclient.NewConfiguration() + config.Host = parsed.Host + config.Scheme = parsed.Scheme + + return apiclient.NewAPIClient(config), nil +} + +func CallView(context context.Context, client *apiclient.APIClient, request apiclient.ContractCallViewRequest) (dict.Dict, error) { + result, _, err := client.RequestsApi. + CallView(context). + ContractCallViewRequest(request). + Execute() + if err != nil { + return nil, err + } + + dictResult, err := APIJsonDictToDict(*result) + + return dictResult, err +} diff --git a/clients/apiextensions/dict.go b/clients/apiextensions/dict.go new file mode 100644 index 0000000000..3c2d02c9b8 --- /dev/null +++ b/clients/apiextensions/dict.go @@ -0,0 +1,70 @@ +package apiextensions + +import ( + "context" + "time" + + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/packages/kv/dict" +) + +func JSONDictToAPIJSONDict(jsonDict dict.JSONDict) apiclient.JSONDict { + apiJSONDict := apiclient.NewJSONDict() + apiJSONDict.Items = make([]apiclient.Item, len(jsonDict.Items)) + + for k, v := range jsonDict.Items { + apiJSONDict.Items[k] = apiclient.Item{ + Key: v.Key, + Value: v.Value, + } + } + + return *apiJSONDict +} + +func DictToAPIJsonDict(dict dict.Dict) apiclient.JSONDict { + return JSONDictToAPIJSONDict(dict.JSONDict()) +} + +func APIJsonDictToJSONDict(apiJSONDict apiclient.JSONDict) dict.JSONDict { + jsonDict := dict.JSONDict{ + Items: make([]dict.Item, len(apiJSONDict.Items)), + } + + for k, v := range apiJSONDict.Items { + jsonDict.Items[k] = dict.Item{ + Key: v.Key, + Value: v.Value, + } + } + + return jsonDict +} + +func APIJsonDictToDict(apiJSONDict apiclient.JSONDict) (dict.Dict, error) { + jsonDict := APIJsonDictToJSONDict(apiJSONDict) + + return dict.FromJSONDict(jsonDict) +} + +func APIWaitUntilAllRequestsProcessed(client *apiclient.APIClient, chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*apiclient.ReceiptResponse, error) { + reqs, err := isc.RequestsInTransaction(tx) + if err != nil { + return nil, err + } + ret := make([]*apiclient.ReceiptResponse, len(reqs)) + for i, req := range reqs[chainID] { + receipt, _, err := client.RequestsApi. + WaitForRequest(context.Background(), chainID.String(), req.ID().String()). + TimeoutSeconds(int32(timeout.Seconds())). + Execute() + if err != nil { + return nil, err + } + + ret[i] = receipt + } + return ret, nil +} diff --git a/clients/chainclient/callview.go b/clients/chainclient/callview.go new file mode 100644 index 0000000000..d5e2a5a47a --- /dev/null +++ b/clients/chainclient/callview.go @@ -0,0 +1,22 @@ +package chainclient + +import ( + "context" + + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/packages/kv/dict" +) + +// CallView sends a request to call a view function of a given contract, and returns the result of the call +func (c *Client) CallView(ctx context.Context, hContract isc.Hname, functionName string, args dict.Dict) (dict.Dict, error) { + request := apiclient.ContractCallViewRequest{ + ChainId: c.ChainID.String(), + ContractHName: hContract.String(), + FunctionName: functionName, + Arguments: apiextensions.JSONDictToAPIJSONDict(args.JSONDict()), + } + + return apiextensions.CallView(ctx, c.WaspClient, request) +} diff --git a/client/chainclient/chainclient.go b/clients/chainclient/chainclient.go similarity index 93% rename from client/chainclient/chainclient.go rename to clients/chainclient/chainclient.go index c77bc25868..8472a32ab0 100644 --- a/client/chainclient/chainclient.go +++ b/clients/chainclient/chainclient.go @@ -1,10 +1,11 @@ package chainclient import ( + "context" "sync" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" @@ -18,7 +19,7 @@ import ( // Client allows to interact with a specific chain in the node, for example to send on-ledger or off-ledger requests type Client struct { Layer1Client l1connection.Client - WaspClient *client.WaspClient + WaspClient *apiclient.APIClient ChainID isc.ChainID KeyPair *cryptolib.KeyPair nonces map[string]uint64 @@ -28,7 +29,7 @@ type Client struct { // New creates a new chainclient.Client func New( layer1Client l1connection.Client, - waspClient *client.WaspClient, + waspClient *apiclient.APIClient, chainID isc.ChainID, keyPair *cryptolib.KeyPair, ) *Client { @@ -152,7 +153,7 @@ func (c *Client) post1RequestWithOutputs( } // PostOffLedgerRequest sends an off-ledger tx via the wasp node web api -func (c *Client) PostOffLedgerRequest( +func (c *Client) PostOffLedgerRequest(context context.Context, contractHname isc.Hname, entrypoint isc.Hname, params ...PostRequestParams, @@ -177,7 +178,19 @@ func (c *Client) PostOffLedgerRequest( } req.WithNonce(par.Nonce) signed := req.Sign(c.KeyPair) - return signed, c.WaspClient.PostOffLedgerRequest(c.ChainID, signed) + + request := iotago.EncodeHex(signed.Bytes()) + + offLedgerRequest := apiclient.OffLedgerRequest{ + ChainId: c.ChainID.String(), + Request: request, + } + _, err := c.WaspClient.RequestsApi. + OffLedger(context). + OffLedgerRequest(offLedgerRequest). + Execute() + + return signed, err } func (c *Client) DepositFunds(n uint64) (*iotago.Transaction, error) { diff --git a/clients/chainclient/chainrecord.go b/clients/chainclient/chainrecord.go new file mode 100644 index 0000000000..65c9674232 --- /dev/null +++ b/clients/chainclient/chainrecord.go @@ -0,0 +1,14 @@ +package chainclient + +import ( + "context" + + "github.com/iotaledger/wasp/clients/apiclient" +) + +// GetChainRecord fetches the chain's Record +func (c *Client) GetChainRecord(ctx context.Context) (*apiclient.ChainInfoResponse, error) { + chainInfo, _, err := c.WaspClient.ChainsApi.GetChainInfo(ctx, c.ChainID.String()).Execute() + + return chainInfo, err +} diff --git a/clients/chainclient/checkrequest.go b/clients/chainclient/checkrequest.go new file mode 100644 index 0000000000..0b9818c12a --- /dev/null +++ b/clients/chainclient/checkrequest.go @@ -0,0 +1,24 @@ +package chainclient + +import ( + "context" + "errors" + "fmt" + + "github.com/iotaledger/wasp/packages/isc" +) + +// CheckRequestResult fetches the receipt for the given request ID, and returns +// an error indicating whether the request was processed successfully. +func (c *Client) CheckRequestResult(ctx context.Context, reqID isc.RequestID) error { + receipt, _, err := c.WaspClient.CorecontractsApi.BlocklogGetRequestReceipt(ctx, c.ChainID.String(), reqID.String()).Execute() + if err != nil { + return errors.New("could not fetch receipt for request: not found in blocklog") + } + + if receipt.Error != nil { + return fmt.Errorf("the request was rejected: %v", receipt.Error.ErrorMessage) + } + + return nil +} diff --git a/clients/chainclient/evm.go b/clients/chainclient/evm.go new file mode 100644 index 0000000000..b60640b167 --- /dev/null +++ b/clients/chainclient/evm.go @@ -0,0 +1,20 @@ +package chainclient + +import ( + "context" + + "github.com/ethereum/go-ethereum/common" + + "github.com/iotaledger/wasp/packages/isc" +) + +func (c *Client) RequestIDByEVMTransactionHash(ctx context.Context, txHash common.Hash) (isc.RequestID, error) { + requestIDStr, _, err := c.WaspClient.ChainsApi.GetRequestIDFromEVMTransactionID(ctx, c.ChainID.String(), txHash.Hex()).Execute() + if err != nil { + return isc.RequestID{}, err + } + + requestID, err := isc.RequestIDFromString(requestIDStr.RequestId) + + return requestID, err +} diff --git a/clients/chainclient/stateget.go b/clients/chainclient/stateget.go new file mode 100644 index 0000000000..8193510815 --- /dev/null +++ b/clients/chainclient/stateget.go @@ -0,0 +1,19 @@ +package chainclient + +import ( + "context" + + iotago "github.com/iotaledger/iota.go/v3" +) + +// StateGet fetches the raw value associated with the given key in the chain state +func (c *Client) StateGet(ctx context.Context, key string) ([]byte, error) { + stateResponse, _, err := c.WaspClient.ChainsApi.GetStateValue(ctx, c.ChainID.String(), iotago.EncodeHex([]byte(key))).Execute() + if err != nil { + return nil, err + } + + hexBytes, err := iotago.DecodeHex(stateResponse.State) + + return hexBytes, err +} diff --git a/client/chainclient/uploadblob.go b/clients/chainclient/uploadblob.go similarity index 60% rename from client/chainclient/uploadblob.go rename to clients/chainclient/uploadblob.go index cfd29021a7..3d19133934 100644 --- a/client/chainclient/uploadblob.go +++ b/clients/chainclient/uploadblob.go @@ -1,8 +1,9 @@ package chainclient import ( - "time" + "context" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" @@ -10,12 +11,13 @@ import ( ) // UploadBlob sends an off-ledger request to call 'store' in the blob contract. -func (c *Client) UploadBlob(fields dict.Dict) (hashing.HashValue, isc.OffLedgerRequest, *isc.Receipt, error) { +func (c *Client) UploadBlob(ctx context.Context, fields dict.Dict) (hashing.HashValue, isc.OffLedgerRequest, *apiclient.ReceiptResponse, error) { blobHash := blob.MustGetBlobHash(fields) - req, err := c.PostOffLedgerRequest( + req, err := c.PostOffLedgerRequest(ctx, blob.Contract.Hname(), blob.FuncStoreBlob.Hname(), + PostRequestParams{ Args: fields, }, @@ -24,6 +26,7 @@ func (c *Client) UploadBlob(fields dict.Dict) (hashing.HashValue, isc.OffLedgerR return hashing.NilHash, nil, nil, err } - receipt, err := c.WaspClient.WaitUntilRequestProcessed(c.ChainID, req.ID(), 2*time.Minute) + receipt, _, err := c.WaspClient.RequestsApi.WaitForRequest(ctx, c.ChainID.String(), req.ID().String()).Execute() + return blobHash, req, receipt, err } diff --git a/clients/multiclient/activate.go b/clients/multiclient/activate.go new file mode 100644 index 0000000000..0e5b1fafcb --- /dev/null +++ b/clients/multiclient/activate.go @@ -0,0 +1,24 @@ +package multiclient + +import ( + "context" + + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/packages/isc" +) + +// ActivateChain sends a request to activate a chain in all wasp nodes +func (m *MultiClient) ActivateChain(chainID isc.ChainID) error { + return m.Do(func(i int, w *apiclient.APIClient) error { + _, err := w.ChainsApi.ActivateChain(context.Background(), chainID.String()).Execute() + return err + }) +} + +// DeactivateChain sends a request to deactivate a chain in all wasp nodes +func (m *MultiClient) DeactivateChain(chainID isc.ChainID) error { + return m.Do(func(i int, w *apiclient.APIClient) error { + _, err := w.ChainsApi.DeactivateChain(context.Background(), chainID.String()).Execute() + return err + }) +} diff --git a/clients/multiclient/chain_record.go b/clients/multiclient/chain_record.go new file mode 100644 index 0000000000..b014091b45 --- /dev/null +++ b/clients/multiclient/chain_record.go @@ -0,0 +1,26 @@ +package multiclient + +import ( + "context" + + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/packages/registry" +) + +// PutChainRecord calls PutChainRecord in all wasp nodes +func (m *MultiClient) PutChainRecord(bd *registry.ChainRecord) error { + return m.Do(func(i int, w *apiclient.APIClient) error { + accessNodes := make([]string, len(bd.AccessNodes)) + + for k, v := range bd.AccessNodes { + accessNodes[k] = v.String() + } + + _, err := w.ChainsApi.SetChainRecord(context.Background(), bd.ChainID().String()).ChainRecord(apiclient.ChainRecord{ + IsActive: true, + AccessNodes: accessNodes, + }).Execute() + + return err + }) +} diff --git a/clients/multiclient/dkshares.go b/clients/multiclient/dkshares.go new file mode 100644 index 0000000000..8133a1a8d8 --- /dev/null +++ b/clients/multiclient/dkshares.go @@ -0,0 +1,19 @@ +package multiclient + +import ( + "context" + + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" +) + +// DKSharesGet retrieves distributed key info with specific ChainID from multiple hosts. +func (m *MultiClient) DKSharesGet(sharedAddress iotago.Address) ([]*apiclient.DKSharesInfo, error) { + ret := make([]*apiclient.DKSharesInfo, len(m.nodes)) + err := m.Do(func(i int, w *apiclient.APIClient) error { + sharesInfo, _, err := w.NodeApi.GetDKSInfo(context.Background(), sharedAddress.String()).Execute() + ret[i] = sharesInfo + return err + }) + return ret, err +} diff --git a/client/multiclient/multiclient.go b/clients/multiclient/multiclient.go similarity index 53% rename from client/multiclient/multiclient.go rename to clients/multiclient/multiclient.go index e5943ec85a..3a6e000fcc 100644 --- a/client/multiclient/multiclient.go +++ b/clients/multiclient/multiclient.go @@ -1,48 +1,32 @@ package multiclient import ( - "net/http" "time" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/util/multicall" ) +type ClientResolver func(apiHost string) *apiclient.APIClient + // MultiClient allows to send webapi requests in parallel to multiple wasp nodes type MultiClient struct { - nodes []*client.WaspClient + nodes []*apiclient.APIClient Timeout time.Duration } // New creates a new instance of MultiClient -func New(hosts []string, httpClient ...func() http.Client) *MultiClient { +func New(resolver ClientResolver, hosts []string) *MultiClient { m := &MultiClient{ - nodes: make([]*client.WaspClient, len(hosts)), - } - for i, host := range hosts { - if len(httpClient) > 0 { - m.nodes[i] = client.NewWaspClient(host, httpClient[0]()) - } else { - m.nodes[i] = client.NewWaspClient(host) - } + nodes: make([]*apiclient.APIClient, len(hosts)), } - m.Timeout = 30 * time.Second - return m -} -func (m *MultiClient) WithToken(token string) *MultiClient { - for _, v := range m.nodes { - v.WithToken(token) + for i, host := range hosts { + m.nodes[i] = resolver(host) } - return m -} - -func (m *MultiClient) WithLogFunc(logFunc func(msg string, args ...interface{})) *MultiClient { - for i, node := range m.nodes { - m.nodes[i] = node.WithLogFunc(logFunc) - } + m.Timeout = 30 * time.Second return m } @@ -51,12 +35,12 @@ func (m *MultiClient) Len() int { } // Do executes a callback once for each node in parallel, then wraps all error results into a single one -func (m *MultiClient) Do(f func(int, *client.WaspClient) error) error { +func (m *MultiClient) Do(f func(int, *apiclient.APIClient) error) error { return m.DoWithQuorum(f, len(m.nodes)) } // Do executes a callback once for each node in parallel, then wraps all error results into a single one -func (m *MultiClient) DoWithQuorum(f func(int, *client.WaspClient) error, quorum int) error { +func (m *MultiClient) DoWithQuorum(f func(int, *apiclient.APIClient) error, quorum int) error { funs := make([]func() error, len(m.nodes)) for i := range m.nodes { j := i // duplicate variable for closure diff --git a/client/multiclient/reqstatus.go b/clients/multiclient/reqstatus.go similarity index 65% rename from client/multiclient/reqstatus.go rename to clients/multiclient/reqstatus.go index 5fe06ccaf7..6798aff692 100644 --- a/client/multiclient/reqstatus.go +++ b/clients/multiclient/reqstatus.go @@ -1,25 +1,27 @@ package multiclient import ( + "context" "fmt" "time" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/packages/isc" ) // WaitUntilRequestProcessed blocks until the request has been processed by all nodes -func (m *MultiClient) WaitUntilRequestProcessed(chainID isc.ChainID, reqID isc.RequestID, timeout time.Duration) (*isc.Receipt, error) { +func (m *MultiClient) WaitUntilRequestProcessed(chainID isc.ChainID, reqID isc.RequestID, timeout time.Duration) (*apiclient.ReceiptResponse, error) { oldTimeout := m.Timeout defer func() { m.Timeout = oldTimeout }() m.Timeout = timeout - var receipt *isc.Receipt + var receipt *apiclient.ReceiptResponse var err error - err = m.Do(func(i int, w *client.WaspClient) error { - receipt, err = w.WaitUntilRequestProcessed(chainID, reqID, timeout) + err = m.Do(func(i int, w *apiclient.APIClient) error { + receipt, _, err = w.RequestsApi.WaitForRequest(context.Background(), chainID.String(), reqID.String()).Execute() return err }) return receipt, err @@ -27,43 +29,45 @@ func (m *MultiClient) WaitUntilRequestProcessed(chainID isc.ChainID, reqID isc.R // WaitUntilRequestProcessedSuccessfully is similar to WaitUntilRequestProcessed, // but also checks the receipt and return an error if the request was processed with an error -func (m *MultiClient) WaitUntilRequestProcessedSuccessfully(chainID isc.ChainID, reqID isc.RequestID, timeout time.Duration) (*isc.Receipt, error) { +func (m *MultiClient) WaitUntilRequestProcessedSuccessfully(chainID isc.ChainID, reqID isc.RequestID, timeout time.Duration) (*apiclient.ReceiptResponse, error) { receipt, err := m.WaitUntilRequestProcessed(chainID, reqID, timeout) if err != nil { return receipt, err } - if receipt.ResolvedError != "" { - return receipt, fmt.Errorf("request processed with an error: %s", receipt.ResolvedError) + if receipt.Error != nil { + return receipt, fmt.Errorf("request processed with an error: %s", receipt.Error.Message) } return receipt, nil } // WaitUntilAllRequestsProcessed blocks until all requests in the given transaction have been processed // by all nodes -func (m *MultiClient) WaitUntilAllRequestsProcessed(chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*isc.Receipt, error) { +func (m *MultiClient) WaitUntilAllRequestsProcessed(chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*apiclient.ReceiptResponse, error) { oldTimeout := m.Timeout defer func() { m.Timeout = oldTimeout }() m.Timeout = timeout - var receipts []*isc.Receipt + + var receipts []*apiclient.ReceiptResponse var err error - err = m.Do(func(i int, w *client.WaspClient) error { - receipts, err = w.WaitUntilAllRequestsProcessed(chainID, tx, timeout) + err = m.Do(func(i int, w *apiclient.APIClient) error { + receipts, err = apiextensions.APIWaitUntilAllRequestsProcessed(w, chainID, tx, timeout) return err }) + return receipts, err } // WaitUntilAllRequestsProcessedSuccessfully is similar to WaitUntilAllRequestsProcessed // but also checks the receipts and return an error if any of the requests was processed with an error -func (m *MultiClient) WaitUntilAllRequestsProcessedSuccessfully(chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*isc.Receipt, error) { +func (m *MultiClient) WaitUntilAllRequestsProcessedSuccessfully(chainID isc.ChainID, tx *iotago.Transaction, timeout time.Duration) ([]*apiclient.ReceiptResponse, error) { receipts, err := m.WaitUntilAllRequestsProcessed(chainID, tx, timeout) if err != nil { return receipts, err } for i, receipt := range receipts { - if receipt.ResolvedError != "" { - return receipts, fmt.Errorf("error found on receipt #%d: %s", i, receipt.ResolvedError) + if receipt.Error != nil { + return receipts, fmt.Errorf("error found on receipt #%d: %s", i, receipt.Error.Message) } } return receipts, nil diff --git a/clients/scclient/callview.go b/clients/scclient/callview.go new file mode 100644 index 0000000000..ee64343753 --- /dev/null +++ b/clients/scclient/callview.go @@ -0,0 +1,11 @@ +package scclient + +import ( + "context" + + "github.com/iotaledger/wasp/packages/kv/dict" +) + +func (c *SCClient) CallView(context context.Context, functionName string, args dict.Dict) (dict.Dict, error) { + return c.ChainClient.CallView(context, c.ContractHname, functionName, args) +} diff --git a/client/scclient/postrequest.go b/clients/scclient/postrequest.go similarity index 79% rename from client/scclient/postrequest.go rename to clients/scclient/postrequest.go index ed33010783..9bd1511a27 100644 --- a/client/scclient/postrequest.go +++ b/clients/scclient/postrequest.go @@ -1,8 +1,10 @@ package scclient import ( + "context" + iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" ) @@ -15,5 +17,5 @@ func (c *SCClient) PostNRequests(fname string, n int, params ...chainclient.Post } func (c *SCClient) PostOffLedgerRequest(fname string, params ...chainclient.PostRequestParams) (isc.OffLedgerRequest, error) { - return c.ChainClient.PostOffLedgerRequest(c.ContractHname, isc.Hn(fname), params...) + return c.ChainClient.PostOffLedgerRequest(context.Background(), c.ContractHname, isc.Hn(fname), params...) } diff --git a/client/scclient/scclient.go b/clients/scclient/scclient.go similarity index 89% rename from client/scclient/scclient.go rename to clients/scclient/scclient.go index 26b9219b11..d6bf33b765 100644 --- a/client/scclient/scclient.go +++ b/clients/scclient/scclient.go @@ -1,7 +1,7 @@ package scclient import ( - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" ) diff --git a/clients/scclient/stateget.go b/clients/scclient/stateget.go new file mode 100644 index 0000000000..1d74d95c2f --- /dev/null +++ b/clients/scclient/stateget.go @@ -0,0 +1,8 @@ +package scclient + +import "context" + +// StateGet fetches the raw value associated with the given key in the smart contract state +func (c *SCClient) StateGet(ctx context.Context, key string) ([]byte, error) { + return c.ChainClient.StateGet(ctx, string(c.ContractHname.Bytes())+key) +} diff --git a/contracts/wasm/testwasmlib/test/testwasmlib_client_test.go b/contracts/wasm/testwasmlib/test/testwasmlib_client_test.go index 2913f3bb7e..553b277dec 100644 --- a/contracts/wasm/testwasmlib/test/testwasmlib_client_test.go +++ b/contracts/wasm/testwasmlib/test/testwasmlib_client_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/require" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/wasm/testwasmlib/go/testwasmlib" "github.com/iotaledger/wasp/contracts/wasm/testwasmlib/go/testwasmlibimpl" "github.com/iotaledger/wasp/packages/cryptolib" diff --git a/packages/apilib/deploychain.go b/packages/apilib/deploychain.go index 95eaccc458..b1edb07e78 100644 --- a/packages/apilib/deploychain.go +++ b/packages/apilib/deploychain.go @@ -10,7 +10,7 @@ import ( "time" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/multiclient" + "github.com/iotaledger/wasp/clients/multiclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" @@ -34,14 +34,13 @@ type CreateChainParams struct { Prefix string InitParams dict.Dict GovernanceController iotago.Address - AuthenticationToken string } // DeployChainWithDKG performs all actions needed to deploy the chain // TODO: [KP] Shouldn't that be in the client packages? -func DeployChainWithDKG(par CreateChainParams) (isc.ChainID, iotago.Address, error) { +func DeployChainWithDKG(clientResolver multiclient.ClientResolver, par CreateChainParams) (isc.ChainID, iotago.Address, error) { dkgInitiatorIndex := uint16(rand.Intn(len(par.CommitteeAPIHosts))) - stateControllerAddr, err := RunDKG(par.AuthenticationToken, par.CommitteeAPIHosts, par.CommitteePubKeys, par.T, dkgInitiatorIndex) + stateControllerAddr, err := RunDKG(clientResolver, par.CommitteeAPIHosts, par.CommitteePubKeys, par.T, dkgInitiatorIndex) if err != nil { return isc.ChainID{}, nil, err } @@ -49,7 +48,7 @@ func DeployChainWithDKG(par CreateChainParams) (isc.ChainID, iotago.Address, err if par.GovernanceController != nil { govControllerAddr = par.GovernanceController } - chainID, err := DeployChain(par, stateControllerAddr, govControllerAddr) + chainID, err := DeployChain(clientResolver, par, stateControllerAddr, govControllerAddr) if err != nil { return isc.ChainID{}, nil, err } @@ -59,7 +58,7 @@ func DeployChainWithDKG(par CreateChainParams) (isc.ChainID, iotago.Address, err // DeployChain creates a new chain on specified committee address // noinspection ALL -func DeployChain(par CreateChainParams, stateControllerAddr, govControllerAddr iotago.Address) (isc.ChainID, error) { +func DeployChain(clientResolver multiclient.ClientResolver, par CreateChainParams, stateControllerAddr, govControllerAddr iotago.Address) (isc.ChainID, error) { var err error textout := io.Discard if par.Textout != nil { @@ -93,7 +92,7 @@ func DeployChain(par CreateChainParams, stateControllerAddr, govControllerAddr i fmt.Fprintf(textout, "creating chain origin and init transaction %s.. OK\n", txID.ToHex()) fmt.Fprint(textout, "sending committee record to nodes.. OK\n") - err = ActivateChainOnNodes(par.AuthenticationToken, par.CommitteeAPIHosts, chainID) + err = ActivateChainOnNodes(clientResolver, par.CommitteeAPIHosts, chainID) fmt.Fprint(textout, par.Prefix) if err != nil { fmt.Fprintf(textout, "activating chain %s.. FAILED: %v\n", chainID.String(), err) @@ -102,9 +101,9 @@ func DeployChain(par CreateChainParams, stateControllerAddr, govControllerAddr i fmt.Fprintf(textout, "activating chain %s.. OK.\n", chainID.String()) // ---------- wait until the request is processed at least in all committee nodes - _, err = multiclient.New(par.CommitteeAPIHosts). - WithToken(par.AuthenticationToken). + _, err = multiclient.New(clientResolver, par.CommitteeAPIHosts). WaitUntilAllRequestsProcessedSuccessfully(chainID, initRequestTx, 30*time.Second) + if err != nil { fmt.Fprintf(textout, "waiting root init request transaction.. FAILED: %v\n", err) return isc.ChainID{}, fmt.Errorf("DeployChain: %w", err) @@ -188,8 +187,8 @@ func CreateChainOrigin( } // ActivateChainOnNodes puts chain records into nodes and activates its -func ActivateChainOnNodes(authToken string, apiHosts []string, chainID isc.ChainID) error { - nodes := multiclient.New(apiHosts).WithToken(authToken) +func ActivateChainOnNodes(clientResolver multiclient.ClientResolver, apiHosts []string, chainID isc.ChainID) error { + nodes := multiclient.New(clientResolver, apiHosts) // ------------ put chain records to hosts return nodes.PutChainRecord(registry.NewChainRecord(chainID, true, []*cryptolib.PublicKey{})) } diff --git a/packages/apilib/rundkg.go b/packages/apilib/rundkg.go index 1df39a4c25..d67f15d6a9 100644 --- a/packages/apilib/rundkg.go +++ b/packages/apilib/rundkg.go @@ -4,19 +4,20 @@ package apilib import ( + "context" "errors" "fmt" "math" "time" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/packages/webapi/v1/model" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/multiclient" ) // RunDKG runs DKG procedure on specific Wasp hosts: generates new keys and puts corresponding committee records // into nodes. In case of success, generated address is returned -func RunDKG(authToken string, apiHosts, peerPubKeys []string, threshold, initiatorIndex uint16, timeout ...time.Duration) (iotago.Address, error) { +func RunDKG(clientResolver multiclient.ClientResolver, apiHosts, peerPubKeys []string, threshold, initiatorIndex uint16, timeout ...time.Duration) (iotago.Address, error) { to := uint32(60 * 1000) if len(timeout) > 0 { n := timeout[0].Milliseconds() @@ -27,14 +28,17 @@ func RunDKG(authToken string, apiHosts, peerPubKeys []string, threshold, initiat if int(initiatorIndex) >= len(apiHosts) { return nil, errors.New("RunDKG: wrong initiator index") } - dkShares, err := client.NewWaspClient(apiHosts[initiatorIndex]).WithToken(authToken).DKSharesPost(&model.DKSharesPostRequest{ - PeerPubKeys: peerPubKeys, - Threshold: threshold, - TimeoutMS: to, // 1 min - }) + + client := clientResolver(apiHosts[initiatorIndex]) + dkShares, _, err := client.NodeApi.GenerateDKS(context.Background()).DKSharesPostRequest(apiclient.DKSharesPostRequest{ + Threshold: uint32(threshold), + TimeoutMS: to, + PeerIdentities: peerPubKeys, + }).Execute() if err != nil { return nil, err } + _, addr, err := iotago.ParseBech32(dkShares.Address) if err != nil { return nil, fmt.Errorf("RunDKG: invalid address returned from DKG: %w", err) diff --git a/packages/dashboard/base.go b/packages/dashboard/base.go index e7f60827e1..eb15e7b6e9 100644 --- a/packages/dashboard/base.go +++ b/packages/dashboard/base.go @@ -18,7 +18,6 @@ import ( "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/metrics/nodeconnmetrics" "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" ) //go:embed templates/base.tmpl @@ -106,6 +105,10 @@ func (d *Dashboard) BaseParams(c echo.Context, breadcrumbs ...Tab) BaseTemplateP } } +func EVMJSONRPC(chainIDBech32 string) string { + return "/chains/" + chainIDBech32 + "/evm/jsonrpc" +} + func (d *Dashboard) makeTemplate(e *echo.Echo, parts ...string) *template.Template { t := template.New("").Funcs(template.FuncMap{ "formatTimestamp": formatTimestamp, @@ -130,7 +133,7 @@ func (d *Dashboard) makeTemplate(e *echo.Echo, parts ...string) *template.Templa "hex": iotago.EncodeHex, "replace": strings.Replace, "webapiPort": d.wasp.WebAPIPort, - "evmJSONRPCEndpoint": routes.EVMJSONRPC, + "evmJSONRPCEndpoint": EVMJSONRPC, "uri": func(s string, p ...interface{}) string { return e.Reverse(s, p...) }, "href": func(s string) string { return s }, }) diff --git a/packages/dashboard/dashboard_test.go b/packages/dashboard/dashboard_test.go index 62d41f96f1..049f352b9d 100644 --- a/packages/dashboard/dashboard_test.go +++ b/packages/dashboard/dashboard_test.go @@ -8,11 +8,11 @@ import ( "github.com/PuerkitoBio/goquery" "github.com/stretchr/testify/require" + "github.com/iotaledger/wasp/packages/dashboard/testutil" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/solo" "github.com/iotaledger/wasp/packages/vm/core/accounts" - "github.com/iotaledger/wasp/packages/webapi/v1/testutil" ) func checkProperConversionsToString(t *testing.T, html *goquery.Document) { diff --git a/packages/webapi/v1/testutil/httptest.go b/packages/dashboard/testutil/httptest.go similarity index 95% rename from packages/webapi/v1/testutil/httptest.go rename to packages/dashboard/testutil/httptest.go index 57dfeb1c96..f73ff90a90 100644 --- a/packages/webapi/v1/testutil/httptest.go +++ b/packages/dashboard/testutil/httptest.go @@ -12,8 +12,6 @@ import ( "github.com/PuerkitoBio/goquery" "github.com/labstack/echo/v4" "github.com/stretchr/testify/require" - - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" ) func buildRequest(t *testing.T, method string, body interface{}) *http.Request { @@ -75,7 +73,8 @@ func CallWebAPIRequestHandler( err := handler(c) if exptectedStatus >= 400 { require.Error(t, err) - require.Equal(t, exptectedStatus, err.(*httperrors.HTTPError).Code) + // TODO: Add error declaration + // require.Equal(t, exptectedStatus, err.(*httperrors.HTTPError).Code) } else { require.NoError(t, err) require.Equal(t, exptectedStatus, rec.Code) diff --git a/packages/webapi/v1/testutil/mockchain.go b/packages/dashboard/testutil/mockchain.go similarity index 100% rename from packages/webapi/v1/testutil/mockchain.go rename to packages/dashboard/testutil/mockchain.go diff --git a/packages/isc/request_target.go b/packages/isc/request_target.go index f08d409272..707d4e16dd 100644 --- a/packages/isc/request_target.go +++ b/packages/isc/request_target.go @@ -2,8 +2,8 @@ package isc // CallTarget the target representation of the request type CallTarget struct { - Contract Hname `json:"contract" swagger:"required"` - EntryPoint Hname `json:"entryPoint" swagger:"required"` + Contract Hname `json:"contract"` + EntryPoint Hname `json:"entryPoint"` } func NewCallTarget(contract, entryPoint Hname) CallTarget { diff --git a/packages/wasmvm/wasmclient/go/wasmclient/wasmclientservice.go b/packages/wasmvm/wasmclient/go/wasmclient/wasmclientservice.go index 0753154227..ab22f7a1d8 100644 --- a/packages/wasmvm/wasmclient/go/wasmclient/wasmclientservice.go +++ b/packages/wasmvm/wasmclient/go/wasmclient/wasmclientservice.go @@ -4,9 +4,12 @@ package wasmclient import ( + "context" "time" - "github.com/iotaledger/wasp/client" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" @@ -23,14 +26,19 @@ type IClientService interface { } type WasmClientService struct { - waspClient *client.WaspClient + waspClient *apiclient.APIClient eventPort string } var _ IClientService = new(WasmClientService) func NewWasmClientService(waspAPI, eventPort string) *WasmClientService { - return &WasmClientService{waspClient: client.NewWaspClient(waspAPI), eventPort: eventPort} + client, err := apiextensions.WaspAPIClientByHostName(waspAPI) + if err != nil { + panic(err.Error()) + } + + return &WasmClientService{waspClient: client, eventPort: eventPort} } func DefaultWasmClientService() *WasmClientService { @@ -45,11 +53,22 @@ func (sc *WasmClientService) CallViewByHname(chainID wasmtypes.ScChainID, hContr if err != nil { return nil, err } - res, err := sc.waspClient.CallViewByHname(iscChainID, iscContract, iscFunction, params) + res, _, err := sc.waspClient.RequestsApi.CallView(context.Background()).ContractCallViewRequest(apiclient.ContractCallViewRequest{ + ContractHName: iscContract.String(), + FunctionHName: iscFunction.String(), + ChainId: iscChainID.String(), + Arguments: apiextensions.JSONDictToAPIJSONDict(params.JSONDict()), + }).Execute() + if err != nil { + return nil, err + } + + decodedParams, err := apiextensions.APIJsonDictToDict(*res) if err != nil { return nil, err } - return res.Bytes(), nil + + return decodedParams.Bytes(), nil } func (sc *WasmClientService) PostRequest(chainID wasmtypes.ScChainID, hContract, hFunction wasmtypes.ScHname, args []byte, allowance *wasmlib.ScAssets, keyPair *cryptolib.KeyPair, nonce uint64) (reqID wasmtypes.ScRequestID, err error) { @@ -65,7 +84,12 @@ func (sc *WasmClientService) PostRequest(chainID wasmtypes.ScChainID, hContract, req.WithAllowance(iscAllowance) signed := req.Sign(keyPair) reqID = cvt.ScRequestID(signed.ID()) - err = sc.waspClient.PostOffLedgerRequest(iscChainID, signed) + + _, err = sc.waspClient.RequestsApi.OffLedger(context.Background()).OffLedgerRequest(apiclient.OffLedgerRequest{ + ChainId: iscChainID.String(), + Request: iotago.EncodeHex(signed.Bytes()), + }).Execute() + return reqID, err } @@ -76,6 +100,11 @@ func (sc *WasmClientService) SubscribeEvents(msg chan []string, done chan bool) func (sc *WasmClientService) WaitUntilRequestProcessed(chainID wasmtypes.ScChainID, reqID wasmtypes.ScRequestID, timeout time.Duration) error { iscChainID := cvt.IscChainID(&chainID) iscReqID := cvt.IscRequestID(&reqID) - _, err := sc.waspClient.WaitUntilRequestProcessed(iscChainID, iscReqID, timeout) + + _, _, err := sc.waspClient.RequestsApi. + WaitForRequest(context.Background(), iscChainID.String(), iscReqID.String()). + TimeoutSeconds(int32(timeout.Seconds())). + Execute() + return err } diff --git a/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/codec.ts b/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/codec.ts index 3e22f5a3f5..3e6537d0a4 100644 --- a/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/codec.ts +++ b/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/codec.ts @@ -14,6 +14,18 @@ export class JsonReq { Items: JsonItem[] = []; } +export interface APICallViewRequest { + contractHName: string; + functionHName: string; + chainId: string; + arguments: JsonReq; +} + +export interface APIOffLedgerRequest { + chainId: string; + request: string; +} + export class JsonResp { Items: JsonItem[] = []; Message = ''; diff --git a/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/waspclient.ts b/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/waspclient.ts index 2a59c0dc57..1185add57b 100644 --- a/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/waspclient.ts +++ b/packages/wasmvm/wasmclient/ts/wasmclient/lib/isc/waspclient.ts @@ -5,7 +5,8 @@ import {Base64} from '@iota/util.js'; import * as wasmlib from 'wasmlib'; import {SyncRequestClient} from './ts-sync-request'; import {OffLedgerRequest} from './offledgerrequest'; -import {Codec, JsonReq, JsonResp} from './codec'; +import {APICallViewRequest, APIOffLedgerRequest, Codec, JsonReq, JsonResp} from './codec'; +import { encode, decode } from 'as-hex'; export type Error = string | null; @@ -20,12 +21,19 @@ export class WaspClient { } public callViewByHname(chainID: wasmlib.ScChainID, hContract: wasmlib.ScHname, hFunction: wasmlib.ScHname, args: Uint8Array): [Uint8Array, Error] { - const url = this.baseURL + '/chain/' + chainID.toString() + '/contract/' + hContract.toString() + '/callviewbyhname/' + hFunction.toString(); + const url = this.baseURL + '/requests/callview'; const req = new SyncRequestClient(); req.addHeader('Content-Type', 'application/json'); - const body = Codec.jsonEncode(args); + + const callViewRequest: APICallViewRequest = { + contractHName: hContract.toString(), + functionHName: hFunction.toString(), + chainId: chainID.toString(), + arguments: Codec.jsonEncode(args), + }; + try { - const resp = req.post(url, body); + const resp = req.post(url, callViewRequest); const result = Codec.jsonDecode(resp); return [result, null]; } catch (error) { @@ -36,13 +44,21 @@ export class WaspClient { } } + + public postOffLedgerRequest(chainID: wasmlib.ScChainID, signed: OffLedgerRequest): Error { - const url = this.baseURL + '/chain/' + chainID.toString() + '/request'; + const url = this.baseURL + '/requests/offledger'; const req = new SyncRequestClient(); req.addHeader('Content-Type', 'application/json'); - const body = {Request: Base64.encode(signed.bytes())}; + + const offLedgerRequest: APIOffLedgerRequest = { + chainId: chainID.toString(), + // Validate if this is actually valid to do. This byte array needs to be sent as hex. + request: encode(signed.bytes().toString()), + }; + try { - req.post(url, body); + req.post(url, offLedgerRequest); return null; } catch (error) { let message; @@ -53,7 +69,8 @@ export class WaspClient { } public waitUntilRequestProcessed(chainID: wasmlib.ScChainID, reqID: wasmlib.ScRequestID, timeout: u32): Error { - const url = this.baseURL + '/chain/' + chainID.toString() + '/request/' + reqID.toString() + '/wait'; + // Timeout of the wait can be set with `/wait?timeoutSeconds=`. Max seconds are 60secs. + const url = this.baseURL + '/chains/' + chainID.toString() + '/requests/' + reqID.toString() + '/wait'; const response = new SyncRequestClient().get(url); return null; } diff --git a/packages/wasmvm/wasmclient/ts/wasmclient/package-lock.json b/packages/wasmvm/wasmclient/ts/wasmclient/package-lock.json index 9988b770ad..f3476a39d9 100644 --- a/packages/wasmvm/wasmclient/ts/wasmclient/package-lock.json +++ b/packages/wasmvm/wasmclient/ts/wasmclient/package-lock.json @@ -8,6 +8,9 @@ "name": "wasmclient", "version": "1.0.0", "license": "ISC", + "dependencies": { + "as-hex": "^1.0.1" + }, "devDependencies": { "@babel/types": "^7.20.0", "@iota/iota.js": "^2.0.0-rc.1", @@ -1810,6 +1813,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/as-hex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/as-hex/-/as-hex-1.0.1.tgz", + "integrity": "sha512-bafVzM51AYyLzS2uQ2rsWfnWJARqGVxuiuLF7r3tIvi1UxHXy0FfHLtzo7o4F3Kk+uJhK9mLVaFmuFIa9C84GQ==" + }, "node_modules/asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", diff --git a/packages/wasmvm/wasmclient/ts/wasmclient/package.json b/packages/wasmvm/wasmclient/ts/wasmclient/package.json index 0002794255..c09b59168e 100644 --- a/packages/wasmvm/wasmclient/ts/wasmclient/package.json +++ b/packages/wasmvm/wasmclient/ts/wasmclient/package.json @@ -35,5 +35,6 @@ "typescript": "^4.8.4" }, "dependencies": { + "as-hex": "^1.0.1" } } diff --git a/packages/wasmvm/wasmclient/ts/wasmclient/test/wasmclient_test.go b/packages/wasmvm/wasmclient/ts/wasmclient/test/wasmclient_test.go index e4fb7f0b4e..9208b359b5 100644 --- a/packages/wasmvm/wasmclient/ts/wasmclient/test/wasmclient_test.go +++ b/packages/wasmvm/wasmclient/ts/wasmclient/test/wasmclient_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/tools/cluster/templates" clustertests "github.com/iotaledger/wasp/tools/cluster/tests" diff --git a/packages/webapi/v2/CLIENT_LIBRARY_CODE_GEN.md b/packages/webapi/CLIENT_LIBRARY_CODE_GEN.md similarity index 100% rename from packages/webapi/v2/CLIENT_LIBRARY_CODE_GEN.md rename to packages/webapi/CLIENT_LIBRARY_CODE_GEN.md diff --git a/packages/webapi/WEBAPI_OVERVIEW.md b/packages/webapi/WEBAPI_OVERVIEW.md new file mode 100644 index 0000000000..88ab201ef4 --- /dev/null +++ b/packages/webapi/WEBAPI_OVERVIEW.md @@ -0,0 +1,129 @@ +This page contains requirements to create a proper API documentation and client generation. + +# Setup / Workflow + +The webapi uses Swagger to document all routes, http codes and request/response models. + +This gives an overview of the whole API on a separate website, which is to be found on `http://localhost:9090/doc`. + +Furthermore, the Swagger standard allows the generation of client libraries. + +It's not required to create an API client manually. + +Inside the Wasp repository, the generated client can be found inside `clients/apiclient`. + +It is mainly used by the cluster tests and the `wasp-cli`. + +## Ensuring consistency + +The API uses `echoswagger` which wraps around the Echo routing system. It automatically adds a new documentation for each (`.GET`|`.POST`...) definition. + +Request and response models, returned status codes, query and path variables _need_ to be defined manually. + +If this definition is missing, it will result in an incomplete api client and the new feature is unusable from generated clients. + +Adding the documentation is simple though. See: `controllers/chains/controller.go`: `RegisterAdmin`: `adminAPI.GET("chains", c.getChainList,` + +### Model declaration + +Whenever a new request or response model is required, make sure to follow this layout: + +```go +type ContractInfoResponse struct { + Description string `json:"description" swagger:"desc(The description of the contract.),required"` + HName string `json:"hName" swagger:"desc(The id (HName as Hex)) of the contract.),required"` + Name string `json:"name" swagger:"desc(The name of the contract.),required"` + ProgramHash string `json:"programHash" swagger:"desc(The hash of the contract. (Hex encoded)),required"` +} +``` +Adding the `json` tag is mandatory. Always define the name in camelCase. + +The `required` tag is needed when the returned property is not nullable, which is mostly the case in the API. + + +If possible, add a description (`desc`) to the property. + +`uint` types have a special tag requirement which, if missed, will be interpreted as `int`. See [#Uints](#Uints)) + +`int64`, `uint64` and types above are unsupported, as JavaScript does not offer the precision required to parse it from JSON. + +They need to be sent as `string`, and the documentation should point that out: + +```go +type AssetsResponse struct { + BaseTokens string `json:"baseTokens" swagger:"required,desc(The base tokens (uint64 as string))"` + NativeTokens []*NativeToken `json:"nativeTokens" swagger:"required"` +} +``` + + +## Regenerating the client + +If the webapi was changed, a regeneration of the client libraries is required. + +To be able to generate the client, `openapi-generator` is required to be installed on your system. + +Temporarily this version of the generator is mandatory: https://github.com/lmoe/openapi-generator/tree/feature/go_gen_unsigned_int + +After installing, the api client can be regenerated by calling `clients/apiclient/generate_client.sh`. + +# Swagger documentation pitfalls + +To ensure a properly generated api client, a few common pitfalls are documented here and need to be considered when changing the API. + +## Uints + +UInts are unsupported by the Swagger standard. It only knows signed integers and decimals. + +Usually openapi api generators will treat swagger integers as uint types, if the documented property contains a min value of at least 0. +This allows generation of clients with proper uint typing. + +Therefore, all Uints (8-32) need to have a min(0) or min(1) documented. See: `models/chain.go` => `ChainInfoResponse`: `MaxBlobSize` + +Example model: + +```go +type StateTransaction struct { + StateIndex uint32 `json:"stateIndex" swagger:"desc(The state index),required,min(1)"` + TransactionID string `json:"txId" swagger:"desc(The transaction ID),required"` +} +``` + +### uints in path parameters + +Paths like `/accounts/account/:id` are mostly documented with `.AddParamPath`. It automatically gets the proper type and documents it. + +The only exception are uints. If the query path requires uints, it is mandatory to use `.AddParamPathNested` instead. + +Those properties also require a `min(0)` or `min(1)`. + +See: `controllers/corecontracts/controller.go` at route `chains/:chainID/core/blocklog/blocks/:blockIndex` => `getBlockInfo`: `blockIndex`. + +Those properties need to be named the same way as the parameters in the route. The linter will complain about unused properties. +Therefore, a `//nolint:unused` is required in these cases. + +### (u)int 64 / big.Int + +All number types above 58 bit are unsupported in JavaScript when consumed via JSON. Therefore, those types need to be sent as strings by the server. + +Unfortunately, this means the client has to decode these string numbers as a proper integer type. + +The documentation should point out that these strings are actually numbers and should be treated as such. + +See: `models/core_accounts.go` => `AccountNonceResponse`: `Nonce` + +## Pointers and 'required' + +By default, all properties are generated as pointers. Even if the webapi models are only using references. + +This can be changed by supplying a 'required' tag in the swagger section. + +See: `models/vm.go` => `ReceiptResponse`: `Request` (string) + +Sometimes having an explicit nullable type is required though. + +In this example, the receipt response sometimes has an error, sometimes not. + +See: `models/vm.go` => `ReceiptResponse`: `Error` (*ReceiptError) + +By omitting the `required` tag, the property is marked as nullable and the error can be properly checked by `Error == nil` by the client. \ No newline at end of file diff --git a/packages/webapi/v2/api.go b/packages/webapi/api.go similarity index 81% rename from packages/webapi/v2/api.go rename to packages/webapi/api.go index 792f9e171e..e50227f7cd 100644 --- a/packages/webapi/v2/api.go +++ b/packages/webapi/api.go @@ -1,4 +1,4 @@ -package v2 +package webapi import ( "time" @@ -15,19 +15,19 @@ import ( "github.com/iotaledger/wasp/packages/peering" "github.com/iotaledger/wasp/packages/registry" userspkg "github.com/iotaledger/wasp/packages/users" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/chain" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/corecontracts" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/metrics" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/node" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/requests" - "github.com/iotaledger/wasp/packages/webapi/v2/controllers/users" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/services" + "github.com/iotaledger/wasp/packages/webapi/controllers/chain" + "github.com/iotaledger/wasp/packages/webapi/controllers/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/controllers/metrics" + "github.com/iotaledger/wasp/packages/webapi/controllers/node" + "github.com/iotaledger/wasp/packages/webapi/controllers/requests" + "github.com/iotaledger/wasp/packages/webapi/controllers/users" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/services" ) func loadControllers(server echoswagger.ApiRoot, mocker *Mocker, controllersToLoad []interfaces.APIController) { for _, controller := range controllersToLoad { - group := server.Group(controller.Name(), "/v2/") + group := server.Group(controller.Name(), "/") controller.RegisterPublic(group, mocker) @@ -60,8 +60,8 @@ func Init( mocker := NewMocker() mocker.LoadMockFiles() - vmService := services.NewVMService(chainsProvider) - chainService := services.NewChainService(chainsProvider, nodeConnectionMetrics, chainRecordRegistryProvider, vmService) + vmService := services.NewVMService(chainsProvider, chainRecordRegistryProvider) + chainService := services.NewChainService(logger, chainsProvider, nodeConnectionMetrics, chainRecordRegistryProvider, vmService) committeeService := services.NewCommitteeService(chainsProvider, networkProvider, dkShareRegistryProvider) registryService := services.NewRegistryService(chainsProvider, chainRecordRegistryProvider) offLedgerService := services.NewOffLedgerService(chainService, networkProvider, requestCacheTTL) diff --git a/packages/webapi/v2/apierrors/errorhandler.go b/packages/webapi/apierrors/errorhandler.go similarity index 73% rename from packages/webapi/v2/apierrors/errorhandler.go rename to packages/webapi/apierrors/errorhandler.go index 2239ff823c..82a93886df 100644 --- a/packages/webapi/v2/apierrors/errorhandler.go +++ b/packages/webapi/apierrors/errorhandler.go @@ -4,6 +4,8 @@ import ( "net/http" "github.com/labstack/echo/v4" + + "github.com/iotaledger/hive.go/core/logger" ) type GenericError struct { @@ -12,7 +14,7 @@ type GenericError struct { // HTTPErrorHandler must be hooked to an echo server to render instances // of HTTPError as JSON -func HTTPErrorHandler(err error, c echo.Context) error { +func HTTPErrorHandler(logger *logger.Logger, err error, c echo.Context) error { if echoError, ok := err.(*echo.HTTPError); ok { mappedError := HTTPErrorFromEchoError(echoError) return c.JSON(mappedError.HTTPCode, mappedError.GetErrorResult()) @@ -23,6 +25,7 @@ func HTTPErrorHandler(err error, c echo.Context) error { if c.Request().Method == http.MethodHead { // Issue #608 return c.NoContent(apiError.HTTPCode) } + logger.Errorf("HTTP Error: code:[%v], msg:[%v], detail:[%v]", apiError.HTTPCode, apiError.Message, apiError.AdditionalError) return c.JSON(apiError.HTTPCode, apiError.GetErrorResult()) } } diff --git a/packages/webapi/v2/apierrors/errors.go b/packages/webapi/apierrors/errors.go similarity index 93% rename from packages/webapi/v2/apierrors/errors.go rename to packages/webapi/apierrors/errors.go index 8dbd25c735..818e011e0b 100644 --- a/packages/webapi/v2/apierrors/errors.go +++ b/packages/webapi/apierrors/errors.go @@ -42,6 +42,10 @@ func InvalidOffLedgerRequestError(err error) *HTTPError { return NewHTTPError(http.StatusBadRequest, "Supplied offledger request is invalid", err) } +func NoRecordFoundErrror(err error) *HTTPError { + return NewHTTPError(http.StatusNotFound, "Record not found", err) +} + func ReceiptError(err error) *HTTPError { return NewHTTPError(http.StatusBadRequest, "Failed to get receipt", err) } diff --git a/packages/webapi/v2/apierrors/httperror.go b/packages/webapi/apierrors/httperror.go similarity index 100% rename from packages/webapi/v2/apierrors/httperror.go rename to packages/webapi/apierrors/httperror.go diff --git a/packages/webapi/compatibility_error_handler.go b/packages/webapi/compatibility_error_handler.go index 17ec3fef36..f1c8fa57ef 100644 --- a/packages/webapi/compatibility_error_handler.go +++ b/packages/webapi/compatibility_error_handler.go @@ -4,22 +4,14 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/hive.go/core/logger" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" + "github.com/iotaledger/wasp/packages/webapi/apierrors" ) // CompatibilityHTTPErrorHandler differentiates V1/V2 error types and uses their respective handler functions. func CompatibilityHTTPErrorHandler(logger *logger.Logger) func(error, echo.Context) { return func(err error, c echo.Context) { logger.Errorf("Compatibility Error Handler: %v", err) - - // Use V1 error handler, if error is a V1 error - if _, ok := err.(*httperrors.HTTPError); ok { - httperrors.HTTPErrorHandler(err, c) - return - } - // Use V2 error handler otherwise. This is also a catch-all for any other error type. - _ = apierrors.HTTPErrorHandler(err, c) + _ = apierrors.HTTPErrorHandler(logger, err, c) } } diff --git a/packages/webapi/v2/controllers/chain/access_nodes.go b/packages/webapi/controllers/chain/access_nodes.go similarity index 86% rename from packages/webapi/v2/controllers/chain/access_nodes.go rename to packages/webapi/controllers/chain/access_nodes.go index 98027c1608..fc5b87f9bc 100644 --- a/packages/webapi/v2/controllers/chain/access_nodes.go +++ b/packages/webapi/controllers/chain/access_nodes.go @@ -8,9 +8,9 @@ import ( "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/params" ) func decodeAccessNodeRequest(e echo.Context) (isc.ChainID, *cryptolib.PublicKey, error) { diff --git a/packages/webapi/v2/controllers/chain/chain.go b/packages/webapi/controllers/chain/chain.go similarity index 68% rename from packages/webapi/v2/controllers/chain/chain.go rename to packages/webapi/controllers/chain/chain.go index 6e5d68eb71..71a2f6c02c 100644 --- a/packages/webapi/v2/controllers/chain/chain.go +++ b/packages/webapi/controllers/chain/chain.go @@ -1,14 +1,16 @@ package chain import ( + "errors" "net/http" "github.com/labstack/echo/v4" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getCommitteeInfo(e echo.Context) error { @@ -46,13 +48,18 @@ func (c *Controller) getChainInfo(e echo.Context) error { } chainInfo, err := c.chainService.GetChainInfoByChainID(chainID) - if err != nil { + if errors.Is(err, interfaces.ErrChainNotFound) { + return e.NoContent(http.StatusNotFound) + } else if err != nil { return err } - evmChainID, err := c.chainService.GetEVMChainID(chainID) - if err != nil { - return err + evmChainID := uint16(0) + if chainInfo.IsActive { + evmChainID, err = c.chainService.GetEVMChainID(chainID) + if err != nil { + return err + } } chainInfoResponse := models.MapChainInfoResponse(chainInfo, evmChainID) @@ -62,6 +69,7 @@ func (c *Controller) getChainInfo(e echo.Context) error { func (c *Controller) getChainList(e echo.Context) error { chainIDs, err := c.chainService.GetAllChainIDs() + c.log.Info("After allChainIDS %v", err) if err != nil { return err } @@ -70,16 +78,31 @@ func (c *Controller) getChainList(e echo.Context) error { for _, chainID := range chainIDs { chainInfo, err := c.chainService.GetChainInfoByChainID(chainID) - if err != nil { + c.log.Info("getchaininfo %v", err) + + if errors.Is(err, interfaces.ErrChainNotFound) { + // TODO: Validate this logic here. Is it possible to still get more chain info? + chainList = append(chainList, models.ChainInfoResponse{ + IsActive: false, + ChainID: chainID.String(), + }) + continue + } else if err != nil { return err } - evmChainID, err := c.chainService.GetEVMChainID(chainID) - if err != nil { - return err + evmChainID := uint16(0) + if chainInfo.IsActive { + evmChainID, err = c.chainService.GetEVMChainID(chainID) + c.log.Info("getevmchainid %v", err) + + if err != nil { + return err + } } chainInfoResponse := models.MapChainInfoResponse(chainInfo, evmChainID) + c.log.Info("mapchaininfo %v", err) chainList = append(chainList, chainInfoResponse) } diff --git a/packages/webapi/v2/controllers/chain/contracts.go b/packages/webapi/controllers/chain/contracts.go similarity index 81% rename from packages/webapi/v2/controllers/chain/contracts.go rename to packages/webapi/controllers/chain/contracts.go index 3fc040d8ff..b09a487ea0 100644 --- a/packages/webapi/v2/controllers/chain/contracts.go +++ b/packages/webapi/controllers/chain/contracts.go @@ -5,8 +5,8 @@ import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getContracts(e echo.Context) error { @@ -27,7 +27,7 @@ func (c *Controller) getContracts(e echo.Context) error { Description: contract.Description, HName: hName.String(), Name: contract.Name, - ProgramHash: contract.ProgramHash, + ProgramHash: contract.ProgramHash.String(), } contractList = append(contractList, contractInfo) diff --git a/packages/webapi/v2/controllers/chain/controller.go b/packages/webapi/controllers/chain/controller.go similarity index 85% rename from packages/webapi/v2/controllers/chain/controller.go rename to packages/webapi/controllers/chain/controller.go index 6373039ba3..ae0ff7d4f6 100644 --- a/packages/webapi/v2/controllers/chain/controller.go +++ b/packages/webapi/controllers/chain/controller.go @@ -9,8 +9,8 @@ import ( "github.com/iotaledger/wasp/packages/authentication" "github.com/iotaledger/wasp/packages/authentication/shared/permissions" "github.com/iotaledger/wasp/packages/publisher/publisherws" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type Controller struct { @@ -46,13 +46,23 @@ func (c *Controller) Name() string { } func (c *Controller) RegisterPublic(publicAPI echoswagger.ApiGroup, mocker interfaces.Mocker) { - publicAPI.EchoGroup().Any("chains/:chainID/evm", c.handleJSONRPC) + // Echoswagger does not support ANY, so create a fake route, and overwrite it with Echo ANY afterwords. + evmURL := "chains/:chainID/evm" + publicAPI. + GET(evmURL, c.handleJSONRPC). + AddParamPath("", "chainID", "ChainID (Bech32)"). + AddResponse(http.StatusOK, "The evm json RPC", "", nil). + AddResponse(http.StatusNotFound, "The evm json RPC failure", "", nil) + + publicAPI. + EchoGroup().Any("chains/:chainID/evm", c.handleJSONRPC) + publicAPI.GET("chains/:chainID/evm/tx/:txHash", c.getRequestID). SetSummary("Get the ISC request ID for the given Ethereum transaction hash"). SetOperationId("getRequestIDFromEVMTransactionID"). AddParamPath("", "chainID", "ChainID (Bech32)"). AddParamPath("", "txHash", "Transaction hash (Hex-encoded)"). - AddResponse(http.StatusOK, "Request ID", "", nil). + AddResponse(http.StatusOK, "Request ID", mocker.Get(models.RequestIDResponse{}), nil). AddResponse(http.StatusNotFound, "Request ID not found", "", nil) publicAPI.GET("chains/:chainID/state/:stateKey", c.getState). @@ -111,6 +121,14 @@ func (c *Controller) RegisterAdmin(adminAPI echoswagger.ApiGroup, mocker interfa SetOperationId("getContracts"). SetSummary("Get all available chain contracts") + adminAPI.POST("chains/:chainID/chainrecord", c.setChainRecord, authentication.ValidatePermissions([]string{permissions.Write})). + AddParamPath("", "chainID", "ChainID (Bech32)"). + AddParamBody(mocker.Get(models.ChainRecord{}), "ChainRecord", "Chain Record", true). + AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). + AddResponse(http.StatusCreated, "Chain record was saved", nil, nil). + SetSummary("Sets the chain record."). + SetOperationId("setChainRecord") + adminAPI.PUT("chains/:chainID/access-node/:publicKey", c.addAccessNode, authentication.ValidatePermissions([]string{permissions.Write})). AddParamPath("", "chainID", "ChainID (Bech32)"). AddParamPath("", "publicKey", "Nodes public key (Hex)"). diff --git a/packages/webapi/v2/controllers/chain/evm.go b/packages/webapi/controllers/chain/evm.go similarity index 64% rename from packages/webapi/v2/controllers/chain/evm.go rename to packages/webapi/controllers/chain/evm.go index 15fad52935..1ef6a3e7bb 100644 --- a/packages/webapi/v2/controllers/chain/evm.go +++ b/packages/webapi/controllers/chain/evm.go @@ -5,8 +5,10 @@ import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) handleJSONRPC(e echo.Context) error { @@ -30,5 +32,7 @@ func (c *Controller) getRequestID(e echo.Context) error { return apierrors.InvalidPropertyError("txHash", err) } - return e.JSON(http.StatusOK, requestID) + return e.JSON(http.StatusOK, models.RequestIDResponse{ + RequestID: iotago.EncodeHex(requestID.Bytes()), + }) } diff --git a/packages/webapi/controllers/chain/management.go b/packages/webapi/controllers/chain/management.go new file mode 100644 index 0000000000..49a656ae9f --- /dev/null +++ b/packages/webapi/controllers/chain/management.go @@ -0,0 +1,68 @@ +package chain + +import ( + "net/http" + + "github.com/labstack/echo/v4" + + "github.com/iotaledger/wasp/packages/cryptolib" + "github.com/iotaledger/wasp/packages/registry" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" +) + +func (c *Controller) activateChain(e echo.Context) error { + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + if err := c.chainService.ActivateChain(chainID); err != nil { + return err + } + + return e.NoContent(http.StatusOK) +} + +func (c *Controller) deactivateChain(e echo.Context) error { + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + if err := c.chainService.DeactivateChain(chainID); err != nil { + return err + } + + return e.NoContent(http.StatusOK) +} + +func (c *Controller) setChainRecord(e echo.Context) error { + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + var request models.ChainRecord + if err := e.Bind(&request); err != nil { + return apierrors.InvalidPropertyError("body", err) + } + + record := registry.NewChainRecord(chainID, request.IsActive, []*cryptolib.PublicKey{}) + + for _, publicKeyStr := range request.AccessNodes { + publicKey, err := cryptolib.NewPublicKeyFromString(publicKeyStr) + if err != nil { + return apierrors.InvalidPropertyError("accessNode", err) + } + + record.AccessNodes = append(record.AccessNodes, publicKey) + } + + if err := c.chainService.SetChainRecord(record); err != nil { + return err + } + + return e.NoContent(http.StatusOK) +} diff --git a/packages/webapi/v2/controllers/chain/websocket.go b/packages/webapi/controllers/chain/websocket.go similarity index 82% rename from packages/webapi/v2/controllers/chain/websocket.go rename to packages/webapi/controllers/chain/websocket.go index bfa36e882e..110df5abe9 100644 --- a/packages/webapi/v2/controllers/chain/websocket.go +++ b/packages/webapi/controllers/chain/websocket.go @@ -3,7 +3,7 @@ package chain import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) handleWebSocket(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/corecontracts/accounts.go b/packages/webapi/controllers/corecontracts/accounts.go similarity index 91% rename from packages/webapi/v2/controllers/corecontracts/accounts.go rename to packages/webapi/controllers/corecontracts/accounts.go index a938b3c3b6..21bdb2b572 100644 --- a/packages/webapi/v2/controllers/corecontracts/accounts.go +++ b/packages/webapi/controllers/corecontracts/accounts.go @@ -5,9 +5,10 @@ import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getAccounts(e echo.Context) error { @@ -44,7 +45,7 @@ func (c *Controller) getTotalAssets(e echo.Context) error { } assetsResponse := &models.AssetsResponse{ - BaseTokens: assets.BaseTokens, + BaseTokens: iotago.EncodeUint64(assets.BaseTokens), NativeTokens: models.MapNativeTokens(assets.NativeTokens), } @@ -68,7 +69,7 @@ func (c *Controller) getAccountBalance(e echo.Context) error { } assetsResponse := &models.AssetsResponse{ - BaseTokens: assets.BaseTokens, + BaseTokens: iotago.EncodeUint64(assets.BaseTokens), NativeTokens: models.MapNativeTokens(assets.NativeTokens), } @@ -119,7 +120,7 @@ func (c *Controller) getAccountNonce(e echo.Context) error { } nonceResponse := &models.AccountNonceResponse{ - Nonce: nonce, + Nonce: iotago.EncodeUint64(nonce), } return e.JSON(http.StatusOK, nonceResponse) @@ -192,7 +193,7 @@ func (c *Controller) getFoundryOutput(e echo.Context) error { foundryOutputResponse := &models.FoundryOutputResponse{ FoundryID: foundryOutputID.ToHex(), Assets: models.AssetsResponse{ - BaseTokens: foundryOutput.Amount, + BaseTokens: iotago.EncodeUint64(foundryOutput.Amount), NativeTokens: models.MapNativeTokens(foundryOutput.NativeTokens), }, } diff --git a/packages/webapi/v2/controllers/corecontracts/blob.go b/packages/webapi/controllers/corecontracts/blob.go similarity index 75% rename from packages/webapi/v2/controllers/corecontracts/blob.go rename to packages/webapi/controllers/corecontracts/blob.go index edbe27702c..6db25c3ec0 100644 --- a/packages/webapi/v2/controllers/corecontracts/blob.go +++ b/packages/webapi/controllers/corecontracts/blob.go @@ -1,18 +1,19 @@ package corecontracts import ( + "fmt" "net/http" "github.com/labstack/echo/v4" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/params" ) type Blob struct { Hash string `json:"hash" swagger:"required"` - Size uint32 `json:"size" swagger:"required"` + Size uint32 `json:"size" swagger:"required,min(1)"` } type BlobListResponse struct { @@ -45,7 +46,7 @@ func (c *Controller) listBlobs(e echo.Context) error { } type BlobValueResponse struct { - ValueData string `json:"valueData" swagger:"required"` + ValueData string `json:"valueData" swagger:"required,desc(The blob data (Hex))"` } func (c *Controller) getBlobValue(e echo.Context) error { @@ -74,10 +75,12 @@ func (c *Controller) getBlobValue(e echo.Context) error { } type BlobInfoResponse struct { - Fields map[string]uint32 `json:"fields" swagger:"required"` + Fields map[string]uint32 `json:"fields" swagger:"required,min(1)"` } func (c *Controller) getBlobInfo(e echo.Context) error { + fmt.Println("GET BLOB INFO") + chainID, err := params.DecodeChainID(e) if err != nil { return err @@ -93,14 +96,18 @@ func (c *Controller) getBlobInfo(e echo.Context) error { return apierrors.ContractExecutionError(err) } - if !ok { - return e.NoContent(http.StatusNotFound) - } + fmt.Printf("GET BLOB INFO: ok:%v, err:%v", ok, err) blobInfoResponse := &BlobInfoResponse{ Fields: map[string]uint32{}, } + // TODO: Validate this logic. Should an empty blob info result in a different http error code? + if !ok { + fmt.Printf("GET BLOB INFO return empty blobInfoResponse") + return e.JSON(http.StatusOK, blobInfoResponse) + } + for k, v := range blobInfo { blobInfoResponse.Fields[k] = v } diff --git a/packages/webapi/v2/controllers/corecontracts/blocklog.go b/packages/webapi/controllers/corecontracts/blocklog.go similarity index 92% rename from packages/webapi/v2/controllers/corecontracts/blocklog.go rename to packages/webapi/controllers/corecontracts/blocklog.go index cd5f4082f4..d439152e87 100644 --- a/packages/webapi/v2/controllers/corecontracts/blocklog.go +++ b/packages/webapi/controllers/corecontracts/blocklog.go @@ -1,21 +1,24 @@ package corecontracts import ( + goerrors "errors" "net/http" "strconv" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/labstack/echo/v4" + iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/vm/core/blocklog" "github.com/iotaledger/wasp/packages/vm/core/errors" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getControlAddresses(e echo.Context) error { @@ -106,10 +109,10 @@ func (c *Controller) getRequestIDsForBlock(e echo.Context) error { func MapRequestReceiptResponse(vmService interfaces.VMService, chainID isc.ChainID, receipt *blocklog.RequestReceipt) (*models.RequestReceiptResponse, error) { response := &models.RequestReceiptResponse{ BlockIndex: receipt.BlockIndex, - GasBudget: receipt.GasBudget, + GasBudget: iotago.EncodeUint64(receipt.GasBudget), GasBurnLog: receipt.GasBurnLog, - GasBurned: receipt.GasBurned, - GasFeeCharged: receipt.GasFeeCharged, + GasBurned: iotago.EncodeUint64(receipt.GasBurned), + GasFeeCharged: iotago.EncodeUint64(receipt.GasFeeCharged), Request: models.MapRequestDetail(receipt.Request), RequestIndex: receipt.RequestIndex, } @@ -144,6 +147,9 @@ func (c *Controller) getRequestReceipt(e echo.Context) error { receipt, err := c.blocklog.GetRequestReceipt(chainID, requestID) if err != nil { + if goerrors.Is(err, corecontracts.ErrNoRecord) { + return apierrors.NoRecordFoundErrror(err) + } return apierrors.ContractExecutionError(err) } diff --git a/packages/webapi/v2/controllers/corecontracts/controller.go b/packages/webapi/controllers/corecontracts/controller.go similarity index 87% rename from packages/webapi/v2/controllers/corecontracts/controller.go rename to packages/webapi/controllers/corecontracts/controller.go index c72a947321..fd27ada02e 100644 --- a/packages/webapi/v2/controllers/corecontracts/controller.go +++ b/packages/webapi/controllers/corecontracts/controller.go @@ -6,9 +6,9 @@ import ( "github.com/pangpanglabs/echoswagger/v2" "github.com/iotaledger/wasp/packages/authentication" - "github.com/iotaledger/wasp/packages/webapi/v2/corecontracts" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type Controller struct { @@ -82,9 +82,14 @@ func (c *Controller) addAccountContractRoutes(api echoswagger.ApiGroup, mocker i SetOperationId("accountsGetNativeTokenIDRegistry"). SetSummary("Get a list of all registries") - api.GET("chains/:chainID/core/accounts/foundry_output", c.getFoundryOutput). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath(uint32(0), "serialNumber", "Serial Number (uint32)"). + //nolint:unused + type foundryOutputParams struct { + chainID string `swagger:"required,desc(ChainID (Bech32))"` + serialNumber uint32 `swagger:"required,min(1),desc(Serial Number (uint32))"` + } + + api.GET("chains/:chainID/core/accounts/foundry_output/:serialNumber", c.getFoundryOutput). + AddParamPathNested(foundryOutputParams{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "The foundry output", mocker.Get(models.FoundryOutputResponse{}), nil). SetOperationId("accountsGetFoundryOutput"). @@ -125,10 +130,15 @@ func (c *Controller) addBlobContractRoutes(api echoswagger.ApiGroup, mocker inte } func (c *Controller) addErrorContractRoutes(api echoswagger.ApiGroup, mocker interfaces.Mocker) { + //nolint:unused + type errorMessageFormat struct { + chainID string `swagger:"required,desc(ChainID (Bech32))"` + contractHname string `swagger:"required,desc(Contract (Hname as Hex))"` + errorID uint16 `swagger:"required,min(1),desc(Error Id (uint16))"` + } + api.GET("chains/:chainID/core/errors/:contractHname/message/:errorID", c.getErrorMessageFormat). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath("", "contractHname", "Contract (Hname as Hex)"). - AddParamPath(uint16(0), "errorID", "Error Id (uint16)"). + AddParamPathNested(errorMessageFormat{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "The error message format", mocker.Get(ErrorMessageFormatResponse{}), nil). SetOperationId("errorsGetErrorMessageFormat"). @@ -143,6 +153,22 @@ func (c *Controller) addGovernanceContractRoutes(api echoswagger.ApiGroup, mocke SetOperationId("governanceGetChainInfo"). SetDescription("If you are using the common API functions, you most likely rather want to use '/chains/:chainID' to get information about a chain."). SetSummary("Get the chain info") + + api.GET("chains/:chainID/core/governance/chainowner", c.getChainOwner). + AddParamPath("", "chainID", "ChainID (Bech32)"). + AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). + AddResponse(http.StatusOK, "The chain owner", mocker.Get(GovChainOwnerResponse{}), nil). + SetOperationId("governanceGetChainOwner"). + SetDescription("Returns the chain owner"). + SetSummary("Get the chain owner") + + api.GET("chains/:chainID/core/governance/allowedstatecontrollers", c.getAllowedStateControllerAddresses). + AddParamPath("", "chainID", "ChainID (Bech32)"). + AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). + AddResponse(http.StatusOK, "The state controller addresses", mocker.Get(GovAllowedStateControllerAddressesResponse{}), nil). + SetOperationId("governanceGetAllowedStateControllerAddresses"). + SetDescription("Returns the allowed state controller addresses"). + SetSummary("Get the allowed state controller addresses") } func (c *Controller) addBlockLogContractRoutes(api echoswagger.ApiGroup, mocker interfaces.Mocker) { @@ -153,9 +179,14 @@ func (c *Controller) addBlockLogContractRoutes(api echoswagger.ApiGroup, mocker SetOperationId("blocklogGetControlAddresses"). SetSummary("Get the control addresses") + //nolint:unused + type blocks struct { + chainID string `swagger:"required,desc(ChainID (Bech32))"` + blockIndex uint32 `swagger:"required,min(1),desc(BlockIndex (uint32))"` + } + api.GET("chains/:chainID/core/blocklog/blocks/:blockIndex", c.getBlockInfo). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath(uint32(0), "blockIndex", "Block Index (uint32)"). + AddParamPathNested(blocks{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "The block info", mocker.Get(models.BlockInfoResponse{}), nil). SetOperationId("blocklogGetBlockInfo"). @@ -169,8 +200,7 @@ func (c *Controller) addBlockLogContractRoutes(api echoswagger.ApiGroup, mocker SetSummary("Get the block info of the latest block") api.GET("chains/:chainID/core/blocklog/blocks/:blockIndex/requestids", c.getRequestIDsForBlock). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath(uint32(0), "blockIndex", "Block Index (uint32)"). + AddParamPathNested(blocks{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "A list of request ids (ISCRequestID[])", mocker.Get(models.RequestIDsResponse{}), nil). SetOperationId("blocklogGetRequestIDsForBlock"). @@ -184,8 +214,7 @@ func (c *Controller) addBlockLogContractRoutes(api echoswagger.ApiGroup, mocker SetSummary("Get the request ids for the latest block") api.GET("chains/:chainID/core/blocklog/blocks/:blockIndex/receipts", c.getRequestReceiptsForBlock). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath(0, "blockIndex", "Block Index (uint32)"). + AddParamPathNested(blocks{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "The receipts", mocker.Get(models.BlockReceiptsResponse{}), nil). SetOperationId("blocklogGetRequestReceiptsOfBlock"). @@ -215,8 +244,7 @@ func (c *Controller) addBlockLogContractRoutes(api echoswagger.ApiGroup, mocker SetSummary("Get the request processing status") api.GET("chains/:chainID/core/blocklog/events/block/:blockIndex", c.getBlockEvents). - AddParamPath("", "chainID", "ChainID (Bech32)"). - AddParamPath(0, "blockIndex", "Block Index (uint32)"). + AddParamPathNested(blocks{}). AddResponse(http.StatusUnauthorized, "Unauthorized (Wrong permissions, missing token)", authentication.ValidationError{}, nil). AddResponse(http.StatusOK, "The events", mocker.Get(models.EventsResponse{}), nil). SetOperationId("blocklogGetEventsOfBlock"). diff --git a/packages/webapi/v2/controllers/corecontracts/errors.go b/packages/webapi/controllers/corecontracts/errors.go similarity index 87% rename from packages/webapi/v2/controllers/corecontracts/errors.go rename to packages/webapi/controllers/corecontracts/errors.go index 4db9f33cf0..9c2c90613c 100644 --- a/packages/webapi/v2/controllers/corecontracts/errors.go +++ b/packages/webapi/controllers/corecontracts/errors.go @@ -5,8 +5,8 @@ import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/params" ) type ErrorMessageFormatResponse struct { diff --git a/packages/webapi/v2/controllers/corecontracts/governance.go b/packages/webapi/controllers/corecontracts/governance.go similarity index 57% rename from packages/webapi/v2/controllers/corecontracts/governance.go rename to packages/webapi/controllers/corecontracts/governance.go index fb078adbfa..cbd3f1fa2e 100644 --- a/packages/webapi/v2/controllers/corecontracts/governance.go +++ b/packages/webapi/controllers/corecontracts/governance.go @@ -5,15 +5,17 @@ import ( "github.com/labstack/echo/v4" + iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/params" ) type gasFeePolicy struct { GasFeeTokenID string `json:"gasFeeTokenId" swagger:"desc(The gas fee token id. Empty if base token.),required"` - GasPerToken uint64 `json:"gasPerToken" swagger:"desc(The amount of gas per token.),required"` + GasPerToken string `json:"gasPerToken" swagger:"desc(The amount of gas per token. (uint64 as string)),min(0),required"` ValidatorFeeShare uint8 `json:"validatorFeeShare" swagger:"desc(The validator fee share.),required"` } @@ -27,6 +29,14 @@ type GovChainInfoResponse struct { MaxEventsPerReq uint16 `json:"maxEventsPerReq" swagger:"desc(The maximum amount of events per request.),required"` // TODO: Clarify } +type GovAllowedStateControllerAddressesResponse struct { + Addresses []string `json:"addresses" swagger:"desc(The allowed state controller addresses (Bech32-encoded))"` +} + +type GovChainOwnerResponse struct { + ChainOwner string `json:"chainOwner" swagger:"desc(The chain owner (Bech32-encoded))"` +} + func MapGovChainInfoResponse(chainInfo *governance.ChainInfo) GovChainInfoResponse { gasFeeTokenID := "" @@ -40,7 +50,7 @@ func MapGovChainInfoResponse(chainInfo *governance.ChainInfo) GovChainInfoRespon Description: chainInfo.Description, GasFeePolicy: gasFeePolicy{ GasFeeTokenID: gasFeeTokenID, - GasPerToken: chainInfo.GasFeePolicy.GasPerToken, + GasPerToken: iotago.EncodeUint64(chainInfo.GasFeePolicy.GasPerToken), ValidatorFeeShare: chainInfo.GasFeePolicy.ValidatorFeeShare, }, MaxBlobSize: chainInfo.MaxBlobSize, @@ -66,3 +76,45 @@ func (c *Controller) getChainInfo(e echo.Context) error { return e.JSON(http.StatusOK, chainInfoResponse) } + +func (c *Controller) getChainOwner(e echo.Context) error { + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + chainOwner, err := c.governance.GetChainOwner(chainID) + if err != nil { + return apierrors.ContractExecutionError(err) + } + + chainOwnerResponse := GovChainOwnerResponse{ + ChainOwner: chainOwner.String(), + } + + return e.JSON(http.StatusOK, chainOwnerResponse) +} + +func (c *Controller) getAllowedStateControllerAddresses(e echo.Context) error { + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + addresses, err := c.governance.GetAllowedStateControllerAddresses(chainID) + if err != nil { + return apierrors.ContractExecutionError(err) + } + + encodedAddresses := make([]string, len(addresses)) + + for k, v := range addresses { + encodedAddresses[k] = v.Bech32(parameters.L1().Protocol.Bech32HRP) + } + + addressesResponse := GovAllowedStateControllerAddressesResponse{ + Addresses: encodedAddresses, + } + + return e.JSON(http.StatusOK, addressesResponse) +} diff --git a/packages/webapi/v2/controllers/metrics/chain.go b/packages/webapi/controllers/metrics/chain.go similarity index 90% rename from packages/webapi/v2/controllers/metrics/chain.go rename to packages/webapi/controllers/metrics/chain.go index 467955e4af..e2c089c027 100644 --- a/packages/webapi/v2/controllers/metrics/chain.go +++ b/packages/webapi/controllers/metrics/chain.go @@ -5,8 +5,8 @@ import ( "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getL1Metrics(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/metrics/controller.go b/packages/webapi/controllers/metrics/controller.go similarity index 95% rename from packages/webapi/v2/controllers/metrics/controller.go rename to packages/webapi/controllers/metrics/controller.go index 240d4d13d6..7d32429cf1 100644 --- a/packages/webapi/v2/controllers/metrics/controller.go +++ b/packages/webapi/controllers/metrics/controller.go @@ -7,8 +7,8 @@ import ( "github.com/iotaledger/wasp/packages/authentication" "github.com/iotaledger/wasp/packages/authentication/shared/permissions" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type Controller struct { diff --git a/packages/webapi/v2/controllers/node/controller.go b/packages/webapi/controllers/node/controller.go similarity index 96% rename from packages/webapi/v2/controllers/node/controller.go rename to packages/webapi/controllers/node/controller.go index 52c9de41bf..9a88609572 100644 --- a/packages/webapi/v2/controllers/node/controller.go +++ b/packages/webapi/controllers/node/controller.go @@ -8,9 +8,9 @@ import ( "github.com/iotaledger/hive.go/core/configuration" "github.com/iotaledger/wasp/packages/authentication" "github.com/iotaledger/wasp/packages/authentication/shared/permissions" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/services" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/services" ) type Controller struct { @@ -37,7 +37,7 @@ func (c *Controller) Name() string { func (c *Controller) RegisterPublic(publicAPI echoswagger.ApiGroup, mocker interfaces.Mocker) { publicAPI.GET("node/version", c.getPublicInfo). - AddResponse(http.StatusOK, "Returns the version of the node.", "", nil). + AddResponse(http.StatusOK, "Returns the version of the node.", mocker.Get(models.VersionResponse{}), nil). SetOperationId("getVersion"). SetSummary("Returns the node version.") } diff --git a/packages/webapi/v2/controllers/node/dkg.go b/packages/webapi/controllers/node/dkg.go similarity index 94% rename from packages/webapi/v2/controllers/node/dkg.go rename to packages/webapi/controllers/node/dkg.go index af13dacac8..c22f37c68e 100644 --- a/packages/webapi/v2/controllers/node/dkg.go +++ b/packages/webapi/controllers/node/dkg.go @@ -9,8 +9,8 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" ) func parsePeerPublicKeys(dkgRequestModel models.DKSharesPostRequest) ([]*cryptolib.PublicKey, error) { diff --git a/packages/webapi/v2/controllers/node/info.go b/packages/webapi/controllers/node/info.go similarity index 85% rename from packages/webapi/v2/controllers/node/info.go rename to packages/webapi/controllers/node/info.go index ccff7c852f..47468fafe3 100644 --- a/packages/webapi/v2/controllers/node/info.go +++ b/packages/webapi/controllers/node/info.go @@ -7,7 +7,7 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/models" ) func (c *Controller) getConfiguration(e echo.Context) error { @@ -23,7 +23,7 @@ func (c *Controller) getConfiguration(e echo.Context) error { } func (c *Controller) getPublicInfo(e echo.Context) error { - return e.JSON(http.StatusOK, c.waspVersion) + return e.JSON(http.StatusOK, models.VersionResponse{Version: c.waspVersion}) } func (c *Controller) getInfo(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/node/management.go b/packages/webapi/controllers/node/management.go similarity index 91% rename from packages/webapi/v2/controllers/node/management.go rename to packages/webapi/controllers/node/management.go index c579b93fdc..114c6c6250 100644 --- a/packages/webapi/v2/controllers/node/management.go +++ b/packages/webapi/controllers/node/management.go @@ -4,12 +4,12 @@ import ( "net/http" "github.com/iotaledger/wasp/packages/cryptolib" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" "github.com/labstack/echo/v4" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" ) func (c *Controller) setNodeOwner(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/node/peering.go b/packages/webapi/controllers/node/peering.go similarity index 95% rename from packages/webapi/v2/controllers/node/peering.go rename to packages/webapi/controllers/node/peering.go index f4b8d303b6..512f489576 100644 --- a/packages/webapi/v2/controllers/node/peering.go +++ b/packages/webapi/controllers/node/peering.go @@ -6,8 +6,8 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" ) func (c *Controller) getRegisteredPeers(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/requests/callview.go b/packages/webapi/controllers/requests/callview.go similarity index 66% rename from packages/webapi/v2/controllers/requests/callview.go rename to packages/webapi/controllers/requests/callview.go index ea7c785909..e5543f9584 100644 --- a/packages/webapi/v2/controllers/requests/callview.go +++ b/packages/webapi/controllers/requests/callview.go @@ -4,12 +4,12 @@ import ( "net/http" "github.com/iotaledger/wasp/packages/kv/dict" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" "github.com/labstack/echo/v4" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" ) func (c *Controller) executeCallView(e echo.Context) error { @@ -25,22 +25,25 @@ func (c *Controller) executeCallView(e echo.Context) error { } // Get contract and function. The request model supports HName and common string names. HNames are preferred. - contractHName, err := isc.HnameFromHexString(callViewRequest.ContractHName) - if err != nil { - return apierrors.InvalidPropertyError("contractHName", err) - } - - functionHName, err := isc.HnameFromHexString(callViewRequest.FunctionHName) - if err != nil { - return apierrors.InvalidPropertyError("functionHName", err) - } + var contractHName isc.Hname + var functionHName isc.Hname - if contractHName == 0 { + if callViewRequest.ContractHName == "" { contractHName = isc.Hn(callViewRequest.ContractName) + } else { + contractHName, err = isc.HnameFromHexString(callViewRequest.ContractHName) + if err != nil { + return apierrors.InvalidPropertyError("contractHName", err) + } } - if functionHName == 0 { + if callViewRequest.FunctionHName == "" { functionHName = isc.Hn(callViewRequest.FunctionName) + } else { + functionHName, err = isc.HnameFromHexString(callViewRequest.FunctionHName) + if err != nil { + return apierrors.InvalidPropertyError("contractHName", err) + } } args, err := dict.FromJSONDict(callViewRequest.Arguments) diff --git a/packages/webapi/v2/controllers/requests/controller.go b/packages/webapi/controllers/requests/controller.go similarity index 93% rename from packages/webapi/v2/controllers/requests/controller.go rename to packages/webapi/controllers/requests/controller.go index 47d1e8cfb2..b3137d273c 100644 --- a/packages/webapi/v2/controllers/requests/controller.go +++ b/packages/webapi/controllers/requests/controller.go @@ -6,8 +6,8 @@ import ( "github.com/pangpanglabs/echoswagger/v2" "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type Controller struct { @@ -64,6 +64,7 @@ func (c *Controller) RegisterPublic(publicAPI echoswagger.ApiGroup, mocker inter SetOperationId("waitForRequest"). AddParamPath("", "chainID", "ChainID (Bech32)"). AddParamPath("", "requestID", "RequestID (Hex)"). + AddParamQuery(0, "timeoutSeconds", "The timeout in seconds", false). AddResponse(http.StatusNotFound, "The chain or request id is invalid", nil, nil). AddResponse(http.StatusRequestTimeout, "The waiting time has reached the defined limit", nil, nil). AddResponse(http.StatusOK, "The request receipt", mocker.Get(models.ReceiptResponse{}), nil) diff --git a/packages/webapi/v2/controllers/requests/offledger.go b/packages/webapi/controllers/requests/offledger.go similarity index 87% rename from packages/webapi/v2/controllers/requests/offledger.go rename to packages/webapi/controllers/requests/offledger.go index 581aaec4b2..ecac89646d 100644 --- a/packages/webapi/v2/controllers/requests/offledger.go +++ b/packages/webapi/controllers/requests/offledger.go @@ -7,8 +7,8 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" ) func (c *Controller) handleOffLedgerRequest(e echo.Context) error { diff --git a/packages/webapi/v2/controllers/requests/receipt.go b/packages/webapi/controllers/requests/receipt.go similarity index 61% rename from packages/webapi/v2/controllers/requests/receipt.go rename to packages/webapi/controllers/requests/receipt.go index 63fad72247..c741a7138b 100644 --- a/packages/webapi/v2/controllers/requests/receipt.go +++ b/packages/webapi/controllers/requests/receipt.go @@ -1,13 +1,15 @@ package requests import ( + "errors" "net/http" "github.com/labstack/echo/v4" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" ) func (c *Controller) getReceipt(e echo.Context) error { @@ -23,6 +25,9 @@ func (c *Controller) getReceipt(e echo.Context) error { receipt, vmError, err := c.vmService.GetReceipt(chainID, requestID) if err != nil { + if errors.Is(err, corecontracts.ErrNoRecord) { + return apierrors.NoRecordFoundErrror(err) + } return apierrors.ReceiptError(err) } diff --git a/packages/webapi/controllers/requests/waitforrequest.go b/packages/webapi/controllers/requests/waitforrequest.go new file mode 100644 index 0000000000..1286680cc8 --- /dev/null +++ b/packages/webapi/controllers/requests/waitforrequest.go @@ -0,0 +1,51 @@ +package requests + +import ( + "net/http" + "strconv" + "time" + + "github.com/labstack/echo/v4" + + "github.com/iotaledger/wasp/packages/webapi/models" + "github.com/iotaledger/wasp/packages/webapi/params" +) + +func (c *Controller) waitForRequestToFinish(e echo.Context) error { + const maximumTimeoutSeconds = 60 + const defaultTimeoutSeconds = 30 + + chainID, err := params.DecodeChainID(e) + if err != nil { + return err + } + + requestID, err := params.DecodeRequestID(e) + if err != nil { + return err + } + + timeout := defaultTimeoutSeconds * time.Second + + timeoutInSeconds := e.QueryParam("timeoutSeconds") + if len(timeoutInSeconds) > 0 { + parsedTimeout, _ := strconv.Atoi(timeoutInSeconds) + + if err != nil { + if parsedTimeout > maximumTimeoutSeconds { + parsedTimeout = maximumTimeoutSeconds + } + + timeout = time.Duration(parsedTimeout) * time.Second + } + } + + receipt, vmError, err := c.chainService.WaitForRequestProcessed(e.Request().Context(), chainID, requestID, timeout) + if err != nil { + return err + } + + mappedReceipt := models.MapReceiptResponse(receipt, vmError) + + return e.JSON(http.StatusOK, mappedReceipt) +} diff --git a/packages/webapi/v2/controllers/users/controller.go b/packages/webapi/controllers/users/controller.go similarity index 97% rename from packages/webapi/v2/controllers/users/controller.go rename to packages/webapi/controllers/users/controller.go index bf207f525e..b7efdd7d38 100644 --- a/packages/webapi/v2/controllers/users/controller.go +++ b/packages/webapi/controllers/users/controller.go @@ -7,8 +7,8 @@ import ( "github.com/iotaledger/wasp/packages/authentication" "github.com/iotaledger/wasp/packages/authentication/shared/permissions" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type Controller struct { diff --git a/packages/webapi/v2/controllers/users/user.go b/packages/webapi/controllers/users/user.go similarity index 96% rename from packages/webapi/v2/controllers/users/user.go rename to packages/webapi/controllers/users/user.go index 6c02e381e6..fc839e60da 100644 --- a/packages/webapi/v2/controllers/users/user.go +++ b/packages/webapi/controllers/users/user.go @@ -7,8 +7,8 @@ import ( "github.com/labstack/echo/v4" "github.com/iotaledger/wasp/packages/authentication" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/apierrors" + "github.com/iotaledger/wasp/packages/webapi/models" ) func (c *Controller) addUser(e echo.Context) error { diff --git a/packages/webapi/v2/corecontracts/README.md b/packages/webapi/corecontracts/README.md similarity index 100% rename from packages/webapi/v2/corecontracts/README.md rename to packages/webapi/corecontracts/README.md diff --git a/packages/webapi/v2/corecontracts/accounts.go b/packages/webapi/corecontracts/accounts.go similarity index 98% rename from packages/webapi/v2/corecontracts/accounts.go rename to packages/webapi/corecontracts/accounts.go index e0d58f02be..e17f658bf1 100644 --- a/packages/webapi/v2/corecontracts/accounts.go +++ b/packages/webapi/corecontracts/accounts.go @@ -9,7 +9,7 @@ import ( "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/collections" "github.com/iotaledger/wasp/packages/vm/core/accounts" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type Accounts struct { diff --git a/packages/webapi/v2/corecontracts/blob.go b/packages/webapi/corecontracts/blob.go similarity index 86% rename from packages/webapi/v2/corecontracts/blob.go rename to packages/webapi/corecontracts/blob.go index 2f94d3655e..0a73c8f747 100644 --- a/packages/webapi/v2/corecontracts/blob.go +++ b/packages/webapi/corecontracts/blob.go @@ -5,7 +5,7 @@ import ( "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/vm/core/blob" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type Blob struct { @@ -20,7 +20,7 @@ func NewBlob(vmService interfaces.VMService) *Blob { func (b *Blob) GetBlobInfo(chainID isc.ChainID, blobHash hashing.HashValue) (map[string]uint32, bool, error) { ret, err := b.vmService.CallViewByChainID(chainID, blob.Contract.Hname(), blob.ViewGetBlobInfo.Hname(), codec.MakeDict(map[string]interface{}{ - blob.ParamHash: blobHash[:], + blob.ParamHash: blobHash.Bytes(), })) if err != nil { return nil, false, err @@ -39,8 +39,8 @@ func (b *Blob) GetBlobInfo(chainID isc.ChainID, blobHash hashing.HashValue) (map } func (b *Blob) GetBlobValue(chainID isc.ChainID, blobHash hashing.HashValue, key string) ([]byte, error) { - ret, err := b.vmService.CallViewByChainID(chainID, blob.Contract.Hname(), blob.ViewGetBlobInfo.Hname(), codec.MakeDict(map[string]interface{}{ - blob.ParamHash: blobHash[:], + ret, err := b.vmService.CallViewByChainID(chainID, blob.Contract.Hname(), blob.ViewGetBlobField.Hname(), codec.MakeDict(map[string]interface{}{ + blob.ParamHash: blobHash.Bytes(), blob.ParamField: []byte(key), })) if err != nil { diff --git a/packages/webapi/v2/corecontracts/blocklog.go b/packages/webapi/corecontracts/blocklog.go similarity index 97% rename from packages/webapi/v2/corecontracts/blocklog.go rename to packages/webapi/corecontracts/blocklog.go index 90b3b17d02..674816b118 100644 --- a/packages/webapi/v2/corecontracts/blocklog.go +++ b/packages/webapi/corecontracts/blocklog.go @@ -1,13 +1,15 @@ package corecontracts import ( + "errors" + "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/collections" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/kv/kvdecoder" "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type BlockLog struct { @@ -137,6 +139,8 @@ func (b *BlockLog) GetRequestIDsForBlock(chainID isc.ChainID, blockIndex uint32) return handleRequestIDs(ret) } +var ErrNoRecord = errors.New("no request record") + func (b *BlockLog) GetRequestReceipt(chainID isc.ChainID, requestID isc.RequestID) (*blocklog.RequestReceipt, error) { ret, err := b.vmService.CallViewByChainID(chainID, blocklog.Contract.Hname(), blocklog.ViewGetRequestReceipt.Hname(), codec.MakeDict(map[string]interface{}{ blocklog.ParamRequestID: requestID, @@ -148,7 +152,7 @@ func (b *BlockLog) GetRequestReceipt(chainID isc.ChainID, requestID isc.RequestI resultDecoder := kvdecoder.New(ret) binRec, err := resultDecoder.GetBytes(blocklog.ParamRequestRecord) if err != nil || binRec == nil { - return nil, err + return nil, ErrNoRecord } requestReceipt, err := blocklog.RequestReceiptFromBytes(binRec) @@ -244,7 +248,7 @@ func eventsFromViewResult(viewResult dict.Dict) ([]string, error) { func (b *BlockLog) GetEventsForRequest(chainID isc.ChainID, requestID isc.RequestID) ([]string, error) { ret, err := b.vmService.CallViewByChainID(chainID, blocklog.Contract.Hname(), blocklog.ViewGetEventsForRequest.Hname(), codec.MakeDict(map[string]interface{}{ - blocklog.ParamRequestRecord: requestID, + blocklog.ParamRequestID: requestID, })) if err != nil { return nil, err diff --git a/packages/webapi/v2/corecontracts/errors.go b/packages/webapi/corecontracts/errors.go similarity index 94% rename from packages/webapi/v2/corecontracts/errors.go rename to packages/webapi/corecontracts/errors.go index d6403134d0..e38c418c93 100644 --- a/packages/webapi/v2/corecontracts/errors.go +++ b/packages/webapi/corecontracts/errors.go @@ -5,7 +5,7 @@ import ( "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/kvdecoder" "github.com/iotaledger/wasp/packages/vm/core/errors" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type Errors struct { diff --git a/packages/webapi/v2/corecontracts/governance.go b/packages/webapi/corecontracts/governance.go similarity index 97% rename from packages/webapi/v2/corecontracts/governance.go rename to packages/webapi/corecontracts/governance.go index adc3f06921..9fb21ee03a 100644 --- a/packages/webapi/v2/corecontracts/governance.go +++ b/packages/webapi/corecontracts/governance.go @@ -6,7 +6,7 @@ import ( "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/collections" "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type Governance struct { diff --git a/packages/webapi/v2/dto/chain.go b/packages/webapi/dto/chain.go similarity index 100% rename from packages/webapi/v2/dto/chain.go rename to packages/webapi/dto/chain.go diff --git a/packages/webapi/v2/dto/metrics.go b/packages/webapi/dto/metrics.go similarity index 100% rename from packages/webapi/v2/dto/metrics.go rename to packages/webapi/dto/metrics.go diff --git a/packages/webapi/v2/dto/node.go b/packages/webapi/dto/node.go similarity index 100% rename from packages/webapi/v2/dto/node.go rename to packages/webapi/dto/node.go diff --git a/packages/webapi/v2/dto/peering.go b/packages/webapi/dto/peering.go similarity index 100% rename from packages/webapi/v2/dto/peering.go rename to packages/webapi/dto/peering.go diff --git a/packages/webapi/v2/interfaces/interfaces.go b/packages/webapi/interfaces/interfaces.go similarity index 87% rename from packages/webapi/v2/interfaces/interfaces.go rename to packages/webapi/interfaces/interfaces.go index f1ca476e33..0e7a59c4a3 100644 --- a/packages/webapi/v2/interfaces/interfaces.go +++ b/packages/webapi/interfaces/interfaces.go @@ -8,6 +8,8 @@ import ( "github.com/iotaledger/wasp/packages/state" "github.com/iotaledger/wasp/packages/vm/core/blocklog" + "github.com/iotaledger/wasp/packages/webapi/dto" + "github.com/iotaledger/wasp/packages/webapi/models" "github.com/labstack/echo/v4" "github.com/pangpanglabs/echoswagger/v2" @@ -19,8 +21,15 @@ import ( "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" - "github.com/iotaledger/wasp/packages/webapi/v2/models" +) + +var ( + ErrUnableToGetLatestState = errors.New("unable to get latest state") + ErrUnableToGetReceipt = errors.New("unable to get request receipt from block state") + ErrAlreadyProcessed = errors.New("request already processed") + ErrNoBalanceOnAccount = errors.New("no balance on account") + ErrInvalidNonce = errors.New("invalid nonce") + ErrChainNotFound = errors.New("chain not found") ) type APIController interface { @@ -31,6 +40,7 @@ type APIController interface { type ChainService interface { ActivateChain(chainID isc.ChainID) error + SetChainRecord(chainRecord *registry.ChainRecord) error DeactivateChain(chainID isc.ChainID) error GetAllChainIDs() ([]isc.ChainID, error) HasChain(chainID isc.ChainID) bool diff --git a/packages/webapi/v2/mocker.go b/packages/webapi/mocker.go similarity index 99% rename from packages/webapi/v2/mocker.go rename to packages/webapi/mocker.go index f63a65378d..5fc9be9ec8 100644 --- a/packages/webapi/v2/mocker.go +++ b/packages/webapi/mocker.go @@ -1,4 +1,4 @@ -package v2 +package webapi import ( "embed" diff --git a/packages/webapi/v2/models/L1.go b/packages/webapi/models/L1.go similarity index 97% rename from packages/webapi/v2/models/L1.go rename to packages/webapi/models/L1.go index 5477255588..5b2170a6a9 100644 --- a/packages/webapi/v2/models/L1.go +++ b/packages/webapi/models/L1.go @@ -113,8 +113,8 @@ func TxInclusionStateMsgFromISCTxInclusionStateMsg(inclusionState *nodeconnmetri } type MilestoneInfo struct { - Index uint32 `json:"index"` - Timestamp uint32 `json:"timestamp"` + Index uint32 `json:"index" swagger:"min(0)"` + Timestamp uint32 `json:"timestamp" swagger:"min(0)"` MilestoneID string `json:"milestoneId"` } diff --git a/packages/webapi/v2/models/chain.go b/packages/webapi/models/chain.go similarity index 71% rename from packages/webapi/v2/models/chain.go rename to packages/webapi/models/chain.go index 417360d61a..953429a4c9 100644 --- a/packages/webapi/v2/models/chain.go +++ b/packages/webapi/models/chain.go @@ -1,9 +1,9 @@ package models import ( - "github.com/iotaledger/wasp/packages/hashing" + iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" + "github.com/iotaledger/wasp/packages/webapi/dto" ) type CommitteeNode struct { @@ -44,15 +44,15 @@ type CommitteeInfoResponse struct { } type ContractInfoResponse struct { - Description string `json:"description" swagger:"desc(The description of the contract.),required"` - HName string `json:"hName" swagger:"desc(The id (HName as Hex)) of the contract.),required"` - Name string `json:"name" swagger:"desc(The name of the contract.),required"` - ProgramHash hashing.HashValue `json:"programHash" swagger:"desc(The hash of the contract.),required"` + Description string `json:"description" swagger:"desc(The description of the contract.),required"` + HName string `json:"hName" swagger:"desc(The id (HName as Hex)) of the contract.),required"` + Name string `json:"name" swagger:"desc(The name of the contract.),required"` + ProgramHash string `json:"programHash" swagger:"desc(The hash of the contract. (Hex encoded)),required"` } type gasFeePolicy struct { GasFeeTokenID string `json:"gasFeeTokenId" swagger:"desc(The gas fee token id. Empty if base token.),required"` - GasPerToken uint64 `json:"gasPerToken" swagger:"desc(The amount of gas per token.),required"` + GasPerToken string `json:"gasPerToken" swagger:"desc(The amount of gas per token. (uint64 as string)),required"` ValidatorFeeShare uint8 `json:"validatorFeeShare" swagger:"desc(The validator fee share.),required,min(1)"` } @@ -73,31 +73,42 @@ type StateResponse struct { } func MapChainInfoResponse(chainInfo *dto.ChainInfo, evmChainID uint16) ChainInfoResponse { - gasFeeTokenID := "" + chainInfoResponse := ChainInfoResponse{ + IsActive: chainInfo.IsActive, + ChainID: chainInfo.ChainID.String(), + EVMChainID: evmChainID, + Description: chainInfo.Description, + MaxBlobSize: chainInfo.MaxBlobSize, + MaxEventSize: chainInfo.MaxEventSize, + MaxEventsPerReq: chainInfo.MaxEventsPerReq, + } - if !isc.IsEmptyNativeTokenID(chainInfo.GasFeePolicy.GasFeeTokenID) { - gasFeeTokenID = chainInfo.GasFeePolicy.GasFeeTokenID.String() + if chainInfo.ChainOwnerID != nil { + chainInfoResponse.ChainOwnerID = chainInfo.ChainOwnerID.String() } - chainInfoResponse := ChainInfoResponse{ - IsActive: chainInfo.IsActive, - ChainID: chainInfo.ChainID.String(), - EVMChainID: evmChainID, - ChainOwnerID: chainInfo.ChainOwnerID.String(), - Description: chainInfo.Description, - GasFeePolicy: gasFeePolicy{ + if chainInfo.GasFeePolicy != nil { + gasFeeTokenID := "" + + if !isc.IsEmptyNativeTokenID(chainInfo.GasFeePolicy.GasFeeTokenID) { + gasFeeTokenID = chainInfo.GasFeePolicy.GasFeeTokenID.String() + } + + chainInfoResponse.GasFeePolicy = gasFeePolicy{ GasFeeTokenID: gasFeeTokenID, - GasPerToken: chainInfo.GasFeePolicy.GasPerToken, + GasPerToken: iotago.EncodeUint64(chainInfo.GasFeePolicy.GasPerToken), ValidatorFeeShare: chainInfo.GasFeePolicy.ValidatorFeeShare, - }, - MaxBlobSize: chainInfo.MaxBlobSize, - MaxEventSize: chainInfo.MaxEventSize, - MaxEventsPerReq: chainInfo.MaxEventsPerReq, + } } return chainInfoResponse } type RequestIDResponse struct { - RequestID string `json:"requestId" swagger:"desc(The request ID of the given transaction ID.)"` + RequestID string `json:"requestId" swagger:"desc(The request ID of the given transaction ID. (Hex)),required"` +} + +type ChainRecord struct { + IsActive bool `json:"isActive" swagger:"required"` + AccessNodes []string `json:"accessNodes" swagger:"required"` } diff --git a/packages/webapi/v2/models/core_accounts.go b/packages/webapi/models/core_accounts.go similarity index 90% rename from packages/webapi/v2/models/core_accounts.go rename to packages/webapi/models/core_accounts.go index 547f581d0c..b318116028 100644 --- a/packages/webapi/v2/models/core_accounts.go +++ b/packages/webapi/models/core_accounts.go @@ -19,7 +19,7 @@ type NativeToken struct { } type AssetsResponse struct { - BaseTokens uint64 `json:"baseTokens" swagger:"required"` + BaseTokens string `json:"baseTokens" swagger:"required,desc(The base tokens (uint64 as string))"` NativeTokens []*NativeToken `json:"nativeTokens" swagger:"required"` } @@ -45,7 +45,7 @@ type AccountNFTsResponse struct { } type AccountNonceResponse struct { - Nonce uint64 `json:"nonce" swagger:"required"` + Nonce string `json:"nonce" swagger:"required,desc(The nonce (uint64 as string))"` } type NFTDataResponse struct { diff --git a/packages/webapi/v2/models/core_blocklog.go b/packages/webapi/models/core_blocklog.go similarity index 68% rename from packages/webapi/v2/models/core_blocklog.go rename to packages/webapi/models/core_blocklog.go index 65f5e99948..fb05c2fac5 100644 --- a/packages/webapi/v2/models/core_blocklog.go +++ b/packages/webapi/models/core_blocklog.go @@ -12,24 +12,24 @@ import ( ) type ControlAddressesResponse struct { - GoverningAddress string `json:"governingAddress" swagger:"required"` - SinceBlockIndex uint32 `json:"sinceBlockIndex" swagger:"required,min(1)"` - StateAddress string `json:"stateAddress" swagger:"required"` + GoverningAddress string `json:"governingAddress" swagger:"required,desc(The governing address (Bech32))"` + SinceBlockIndex uint32 `json:"sinceBlockIndex" swagger:"required,min(1),desc(The block index (uint32)"` + StateAddress string `json:"stateAddress" swagger:"required,desc(The state address (Bech32))"` } type BlockInfoResponse struct { AnchorTransactionID string `json:"anchorTransactionId" swagger:"required"` BlockIndex uint32 `json:"blockIndex" swagger:"required,min(1)"` - GasBurned uint64 `json:"gasBurned" swagger:"required"` - GasFeeCharged uint64 `json:"gasFeeCharged" swagger:"required"` + GasBurned string `json:"gasBurned" swagger:"required,desc(The burned gas (uint64 as string))"` + GasFeeCharged string `json:"gasFeeCharged" swagger:"required,desc(The charged gas fee (uint64 as string))"` L1CommitmentHash string `json:"l1CommitmentHash" swagger:"required"` NumOffLedgerRequests uint16 `json:"numOffLedgerRequests" swagger:"required,min(1)"` NumSuccessfulRequests uint16 `json:"numSuccessfulRequests" swagger:"required,min(1)"` PreviousL1CommitmentHash string `json:"previousL1CommitmentHash" swagger:"required"` Timestamp time.Time `json:"timestamp" swagger:"required"` - TotalBaseTokensInL2Accounts uint64 `json:"totalBaseTokensInL2Accounts" swagger:"required"` + TotalBaseTokensInL2Accounts string `json:"totalBaseTokensInL2Accounts" swagger:"required,desc(The total L2 base tokens (uint64 as string))"` TotalRequests uint16 `json:"totalRequests" swagger:"required,min(1)"` - TotalStorageDeposit uint64 `json:"totalStorageDeposit" swagger:"required"` + TotalStorageDeposit string `json:"totalStorageDeposit" swagger:"required,desc(The total storage deposit (uint64 as string))"` TransactionSubEssenceHash string `json:"transactionSubEssenceHash" swagger:"required"` } @@ -44,16 +44,16 @@ func MapBlockInfoResponse(info *blocklog.BlockInfo) *BlockInfoResponse { return &BlockInfoResponse{ AnchorTransactionID: info.AnchorTransactionID.ToHex(), BlockIndex: info.BlockIndex, - GasBurned: info.GasBurned, - GasFeeCharged: info.GasFeeCharged, + GasBurned: iotago.EncodeUint64(info.GasBurned), + GasFeeCharged: iotago.EncodeUint64(info.GasFeeCharged), L1CommitmentHash: commitmentHash, NumOffLedgerRequests: info.NumOffLedgerRequests, NumSuccessfulRequests: info.NumSuccessfulRequests, PreviousL1CommitmentHash: info.PreviousL1Commitment.BlockHash().String(), Timestamp: info.Timestamp, - TotalBaseTokensInL2Accounts: info.TotalBaseTokensInL2Accounts, + TotalBaseTokensInL2Accounts: iotago.EncodeUint64(info.TotalBaseTokensInL2Accounts), TotalRequests: info.TotalRequests, - TotalStorageDeposit: info.TotalStorageDeposit, + TotalStorageDeposit: iotago.EncodeUint64(info.TotalStorageDeposit), TransactionSubEssenceHash: transactionEssenceHash, } } @@ -68,7 +68,7 @@ type BlockReceiptError struct { } type Assets struct { - BaseTokens uint64 `json:"baseTokens" swagger:"required"` + BaseTokens string `json:"baseTokens" swagger:"required,desc(The base tokens (uint64 as string))"` NativeTokens []*NativeToken `json:"nativeTokens" swagger:"required"` NFTs []string `json:"nfts" swagger:"required"` } @@ -79,7 +79,7 @@ func mapAssets(assets *isc.Assets) *Assets { } ret := &Assets{ - BaseTokens: assets.BaseTokens, + BaseTokens: iotago.EncodeUint64(assets.BaseTokens), NativeTokens: MapNativeTokens(assets.NativeTokens), NFTs: make([]string, len(assets.NFTs)), } @@ -90,11 +90,23 @@ func mapAssets(assets *isc.Assets) *Assets { return ret } +type CallTarget struct { + ContractHName string `json:"contractHName" swagger:"desc(The contract name as HName (Hex)),required"` + FunctionHName string `json:"functionHName" swagger:"desc(The function name as HName (Hex)),required"` +} + +func MapCallTarget(target isc.CallTarget) CallTarget { + return CallTarget{ + ContractHName: target.Contract.String(), + FunctionHName: target.EntryPoint.String(), + } +} + type RequestDetail struct { Allowance *Assets `json:"allowance" swagger:"required"` - CallTarget isc.CallTarget `json:"callTarget" swagger:"required"` + CallTarget CallTarget `json:"callTarget" swagger:"required"` Assets *Assets `json:"fungibleTokens" swagger:"required"` - GasGudget uint64 `json:"gasGudget" swagger:"required"` + GasGudget string `json:"gasGudget,string" swagger:"required,desc(The gas budget (uint64 as string))"` IsEVM bool `json:"isEVM" swagger:"required"` IsOffLedger bool `json:"isOffLedger" swagger:"required"` NFT *NFTDataResponse `json:"nft" swagger:"required"` @@ -109,9 +121,9 @@ func MapRequestDetail(request isc.Request) *RequestDetail { return &RequestDetail{ Allowance: mapAssets(request.Allowance()), - CallTarget: request.CallTarget(), + CallTarget: MapCallTarget(request.CallTarget()), Assets: mapAssets(request.Assets()), - GasGudget: gasBudget, + GasGudget: iotago.EncodeUint64(gasBudget), IsEVM: isEVM, IsOffLedger: request.IsOffLedger(), NFT: MapNFTDataResponse(request.NFT()), @@ -125,10 +137,10 @@ func MapRequestDetail(request isc.Request) *RequestDetail { type RequestReceiptResponse struct { BlockIndex uint32 `json:"blockIndex" swagger:"required,min(1)"` Error *BlockReceiptError `json:"error" swagger:""` - GasBudget uint64 `json:"gasBudget" swagger:"required"` + GasBudget string `json:"gasBudget" swagger:"required,desc(The gas budget (uint64 as string))"` GasBurnLog *gas.BurnLog `json:"gasBurnLog" swagger:"required"` - GasBurned uint64 `json:"gasBurned" swagger:"required"` - GasFeeCharged uint64 `json:"gasFeeCharged" swagger:"required"` + GasBurned string `json:"gasBurned" swagger:"required,desc(The burned gas (uint64 as string))"` + GasFeeCharged string `json:"gasFeeCharged" swagger:"required,desc(The charged gas fee (uint64 as string))"` Request *RequestDetail `json:"request" swagger:"required"` RequestIndex uint16 `json:"requestIndex" swagger:"required,min(1)"` } diff --git a/packages/webapi/v2/models/dks.go b/packages/webapi/models/dks.go similarity index 100% rename from packages/webapi/v2/models/dks.go rename to packages/webapi/models/dks.go diff --git a/packages/webapi/v2/models/metrics.go b/packages/webapi/models/metrics.go similarity index 99% rename from packages/webapi/v2/models/metrics.go rename to packages/webapi/models/metrics.go index e2007b9b42..5745f5f44a 100644 --- a/packages/webapi/v2/models/metrics.go +++ b/packages/webapi/models/metrics.go @@ -5,7 +5,7 @@ import ( "github.com/iotaledger/wasp/packages/chain" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" + "github.com/iotaledger/wasp/packages/webapi/dto" ) type MetricItem[T interface{}] struct { diff --git a/packages/webapi/v2/models/mock/ChainInfoResponse.json b/packages/webapi/models/mock/ChainInfoResponse.json similarity index 93% rename from packages/webapi/v2/models/mock/ChainInfoResponse.json rename to packages/webapi/models/mock/ChainInfoResponse.json index 5584984575..5eb832c1c6 100644 --- a/packages/webapi/v2/models/mock/ChainInfoResponse.json +++ b/packages/webapi/models/mock/ChainInfoResponse.json @@ -5,7 +5,7 @@ "description": "", "gasFeePolicy": { "gasFeeTokenId": "", - "gasPerToken": 100, + "gasPerToken": "100", "validatorFeeShare": 0 }, "maxBlobSize": 2000000, diff --git a/packages/webapi/v2/models/mock/ChainInfoResponse[].json b/packages/webapi/models/mock/ChainInfoResponse[].json similarity index 93% rename from packages/webapi/v2/models/mock/ChainInfoResponse[].json rename to packages/webapi/models/mock/ChainInfoResponse[].json index da94f4f63f..bb310f6616 100644 --- a/packages/webapi/v2/models/mock/ChainInfoResponse[].json +++ b/packages/webapi/models/mock/ChainInfoResponse[].json @@ -6,7 +6,7 @@ "description": "", "gasFeePolicy": { "gasFeeTokenId": "", - "gasPerToken": 100, + "gasPerToken": "100", "validatorFeeShare": 0 }, "maxBlobSize": 2000000, diff --git a/packages/webapi/v2/models/mock/CommitteeInfoResponse.json b/packages/webapi/models/mock/CommitteeInfoResponse.json similarity index 100% rename from packages/webapi/v2/models/mock/CommitteeInfoResponse.json rename to packages/webapi/models/mock/CommitteeInfoResponse.json diff --git a/packages/webapi/v2/models/mock/ContractInfoResponse[].json b/packages/webapi/models/mock/ContractInfoResponse[].json similarity index 100% rename from packages/webapi/v2/models/mock/ContractInfoResponse[].json rename to packages/webapi/models/mock/ContractInfoResponse[].json diff --git a/packages/webapi/v2/models/mock/InfoResponse.json b/packages/webapi/models/mock/InfoResponse.json similarity index 100% rename from packages/webapi/v2/models/mock/InfoResponse.json rename to packages/webapi/models/mock/InfoResponse.json diff --git a/packages/webapi/v2/models/mock/PeeringNodeIdentityResponse.json b/packages/webapi/models/mock/PeeringNodeIdentityResponse.json similarity index 100% rename from packages/webapi/v2/models/mock/PeeringNodeIdentityResponse.json rename to packages/webapi/models/mock/PeeringNodeIdentityResponse.json diff --git a/packages/webapi/v2/models/mock/PeeringNodeIdentityResponse[].json b/packages/webapi/models/mock/PeeringNodeIdentityResponse[].json similarity index 100% rename from packages/webapi/v2/models/mock/PeeringNodeIdentityResponse[].json rename to packages/webapi/models/mock/PeeringNodeIdentityResponse[].json diff --git a/packages/webapi/v2/models/mock/PeeringNodeStatusResponse.json b/packages/webapi/models/mock/PeeringNodeStatusResponse.json similarity index 100% rename from packages/webapi/v2/models/mock/PeeringNodeStatusResponse.json rename to packages/webapi/models/mock/PeeringNodeStatusResponse.json diff --git a/packages/webapi/v2/models/mock/PeeringNodeStatusResponse[].json b/packages/webapi/models/mock/PeeringNodeStatusResponse[].json similarity index 100% rename from packages/webapi/v2/models/mock/PeeringNodeStatusResponse[].json rename to packages/webapi/models/mock/PeeringNodeStatusResponse[].json diff --git a/packages/webapi/v2/models/mock/PeeringTrustRequest.json b/packages/webapi/models/mock/PeeringTrustRequest.json similarity index 100% rename from packages/webapi/v2/models/mock/PeeringTrustRequest.json rename to packages/webapi/models/mock/PeeringTrustRequest.json diff --git a/packages/webapi/v2/models/node.go b/packages/webapi/models/node.go similarity index 97% rename from packages/webapi/v2/models/node.go rename to packages/webapi/models/node.go index c77a3e0f88..b92a07efb3 100644 --- a/packages/webapi/v2/models/node.go +++ b/packages/webapi/models/node.go @@ -76,6 +76,10 @@ func MapL1Params(l1 *parameters.L1Params) *L1Params { return params } +type VersionResponse struct { + Version string `json:"version" swagger:"desc(The version of the node),required"` +} + type InfoResponse struct { Version string `json:"version" swagger:"desc(The version of the node),required"` PublicKey string `json:"publicKey" swagger:"desc(The public key of the node (Hex)),required"` diff --git a/packages/webapi/v2/models/peering.go b/packages/webapi/models/peering.go similarity index 100% rename from packages/webapi/v2/models/peering.go rename to packages/webapi/models/peering.go diff --git a/packages/webapi/v2/models/requests.go b/packages/webapi/models/requests.go similarity index 100% rename from packages/webapi/v2/models/requests.go rename to packages/webapi/models/requests.go diff --git a/packages/webapi/v2/models/user.go b/packages/webapi/models/user.go similarity index 100% rename from packages/webapi/v2/models/user.go rename to packages/webapi/models/user.go diff --git a/packages/webapi/v2/models/vm.go b/packages/webapi/models/vm.go similarity index 71% rename from packages/webapi/v2/models/vm.go rename to packages/webapi/models/vm.go index 7d3dc641db..4d0a027586 100644 --- a/packages/webapi/v2/models/vm.go +++ b/packages/webapi/models/vm.go @@ -7,7 +7,7 @@ import ( ) type ReceiptError struct { - ContractID isc.Hname `json:"contractId" swagger:"required"` + ContractHName string `json:"contractHName" swagger:"required,desc(The contract hname (Hex))"` ErrorID uint16 `json:"errorId" swagger:"required,min(1)"` ErrorCode string `json:"errorCode" swagger:"required"` Message string `json:"message" swagger:"required"` @@ -21,7 +21,7 @@ func MapReceiptError(err *isc.VMError) *ReceiptError { } return &ReceiptError{ - ContractID: err.Code().ContractID, + ContractHName: err.Code().ContractID.String(), ErrorID: err.Code().ID, ErrorCode: err.Code().String(), Message: err.Error(), @@ -33,9 +33,9 @@ func MapReceiptError(err *isc.VMError) *ReceiptError { type ReceiptResponse struct { Request string `json:"request" swagger:"required"` Error *ReceiptError `json:"error"` - GasBudget uint64 `json:"gasBudget" swagger:"required"` - GasBurned uint64 `json:"gasBurned" swagger:"required"` - GasFeeCharged uint64 `json:"gasFeeCharged" swagger:"required"` + GasBudget string `json:"gasBudget" swagger:"required,desc(The gas budget (uint64 as string))"` + GasBurned string `json:"gasBurned" swagger:"required,desc(The burned gas (uint64 as string))"` + GasFeeCharged string `json:"gasFeeCharged" swagger:"required,desc(The charged gas fee (uint64 as string))"` BlockIndex uint32 `json:"blockIndex" swagger:"required,min(1)"` RequestIndex uint16 `json:"requestIndex" swagger:"required,min(1)"` GasBurnLog []gas.BurnRecord `json:"gasBurnLog" swagger:"required"` @@ -53,9 +53,9 @@ func MapReceiptResponse(receipt *isc.Receipt, resolvedError *isc.VMError) *Recei Error: MapReceiptError(resolvedError), BlockIndex: receipt.BlockIndex, RequestIndex: receipt.RequestIndex, - GasBudget: receipt.GasBudget, - GasBurned: receipt.GasBurned, - GasFeeCharged: receipt.GasFeeCharged, + GasBudget: iotago.EncodeUint64(receipt.GasBudget), + GasBurned: iotago.EncodeUint64(receipt.GasBurned), + GasFeeCharged: iotago.EncodeUint64(receipt.GasFeeCharged), GasBurnLog: burnRecords, } } diff --git a/packages/webapi/v2/params/decoder.go b/packages/webapi/params/decoder.go similarity index 97% rename from packages/webapi/v2/params/decoder.go rename to packages/webapi/params/decoder.go index f7cee1fd59..d059b0831a 100644 --- a/packages/webapi/v2/params/decoder.go +++ b/packages/webapi/params/decoder.go @@ -10,7 +10,7 @@ import ( "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/apierrors" + "github.com/iotaledger/wasp/packages/webapi/apierrors" ) func DecodeChainID(e echo.Context) (isc.ChainID, error) { diff --git a/packages/webapi/v2/services/chain.go b/packages/webapi/services/chain.go similarity index 70% rename from packages/webapi/v2/services/chain.go rename to packages/webapi/services/chain.go index b2da36f23f..4a375fe583 100644 --- a/packages/webapi/v2/services/chain.go +++ b/packages/webapi/services/chain.go @@ -5,6 +5,7 @@ import ( "errors" "time" + "github.com/iotaledger/hive.go/core/logger" chainpkg "github.com/iotaledger/wasp/packages/chain" "github.com/iotaledger/wasp/packages/chains" "github.com/iotaledger/wasp/packages/isc" @@ -15,14 +16,13 @@ import ( "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/vm/core/evm" "github.com/iotaledger/wasp/packages/vm/core/root" - "github.com/iotaledger/wasp/packages/webapi/v2/corecontracts" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/dto" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) -const MaxTimeout = 30 * time.Second - type ChainService struct { + log *logger.Logger governance *corecontracts.Governance chainsProvider chains.Provider nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics @@ -30,8 +30,9 @@ type ChainService struct { vmService interfaces.VMService } -func NewChainService(chainsProvider chains.Provider, nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics, chainRecordRegistryProvider registry.ChainRecordRegistryProvider, vmService interfaces.VMService) interfaces.ChainService { +func NewChainService(logger *logger.Logger, chainsProvider chains.Provider, nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics, chainRecordRegistryProvider registry.ChainRecordRegistryProvider, vmService interfaces.VMService) interfaces.ChainService { return &ChainService{ + log: logger, governance: corecontracts.NewGovernance(vmService), chainsProvider: chainsProvider, nodeConnectionMetrics: nodeConnectionMetrics, @@ -58,6 +59,52 @@ func (c *ChainService) DeactivateChain(chainID isc.ChainID) error { return c.chainsProvider().Deactivate(chainID) } +func (c *ChainService) SetChainRecord(chainRecord *registry.ChainRecord) error { + storedChainRec, err := c.chainRecordRegistryProvider.ChainRecord(chainRecord.ChainID()) + if err != nil { + return err + } + + c.log.Infof("StoredChainRec %v %v", storedChainRec, err) + + if storedChainRec != nil { + _, err = c.chainRecordRegistryProvider.UpdateChainRecord( + chainRecord.ChainID(), + func(rec *registry.ChainRecord) bool { + rec.AccessNodes = chainRecord.AccessNodes + rec.Active = chainRecord.Active + return true + }, + ) + c.log.Infof("UpdatechainRec %v %v", chainRecord, err) + + if err != nil { + return err + } + } else { + if err := c.chainRecordRegistryProvider.AddChainRecord(chainRecord); err != nil { + c.log.Infof("AddChainRec %v %v", chainRecord, err) + + return err + } + } + + // Activate/deactivate the chain accordingly. + c.log.Infof("Chainrecord active %v", chainRecord.Active) + + if chainRecord.Active { + if err := c.chainsProvider().Activate(chainRecord.ChainID()); err != nil { + return err + } + } else if storedChainRec != nil { + if err := c.chainsProvider().Deactivate(chainRecord.ChainID()); err != nil { + return err + } + } + + return nil +} + func (c *ChainService) HasChain(chainID isc.ChainID) bool { return c.GetChainByID(chainID) != nil } @@ -91,13 +138,17 @@ func (c *ChainService) GetAllChainIDs() ([]isc.ChainID, error) { } func (c *ChainService) GetChainInfoByChainID(chainID isc.ChainID) (*dto.ChainInfo, error) { - governanceChainInfo, err := c.governance.GetChainInfo(chainID) + chainRecord, err := c.chainRecordRegistryProvider.ChainRecord(chainID) if err != nil { return nil, err } - chainRecord, err := c.chainRecordRegistryProvider.ChainRecord(chainID) + governanceChainInfo, err := c.governance.GetChainInfo(chainID) if err != nil { + if chainRecord != nil && errors.Is(err, interfaces.ErrChainNotFound) { + return &dto.ChainInfo{ChainID: chainID, IsActive: false}, nil + } + return nil, err } @@ -143,13 +194,7 @@ func (c *ChainService) WaitForRequestProcessed(ctx context.Context, chainID isc. return receipt, vmError, nil } - adjustedTimeout := timeout - - if timeout > MaxTimeout { - adjustedTimeout = MaxTimeout - } - - timeoutCtx, cancelCtx := context.WithTimeout(ctx, adjustedTimeout) + timeoutCtx, cancelCtx := context.WithTimeout(ctx, timeout) defer cancelCtx() receiptResponse := <-chain.AwaitRequestProcessed(timeoutCtx, requestID, true) diff --git a/packages/webapi/v2/services/committee.go b/packages/webapi/services/committee.go similarity index 98% rename from packages/webapi/v2/services/committee.go rename to packages/webapi/services/committee.go index 31f408e07d..3d1e01a580 100644 --- a/packages/webapi/v2/services/committee.go +++ b/packages/webapi/services/committee.go @@ -10,8 +10,8 @@ import ( "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/tcrypto" "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/dto" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type CommitteeService struct { diff --git a/packages/webapi/v2/services/dkg.go b/packages/webapi/services/dkg.go similarity index 97% rename from packages/webapi/v2/services/dkg.go rename to packages/webapi/services/dkg.go index 45eee1a2b7..a5a1491e8c 100644 --- a/packages/webapi/v2/services/dkg.go +++ b/packages/webapi/services/dkg.go @@ -9,7 +9,7 @@ import ( "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/tcrypto" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/models" ) const ( diff --git a/packages/webapi/v2/services/evm.go b/packages/webapi/services/evm.go similarity index 94% rename from packages/webapi/v2/services/evm.go rename to packages/webapi/services/evm.go index 2d2e85cb01..73030f32a0 100644 --- a/packages/webapi/v2/services/evm.go +++ b/packages/webapi/services/evm.go @@ -13,7 +13,7 @@ import ( "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type chainServer struct { @@ -32,6 +32,8 @@ type EVMService struct { func NewEVMService(chainService interfaces.ChainService, networkProvider peering.NetworkProvider) interfaces.EVMService { return &EVMService{ chainService: chainService, + evmChainServers: map[isc.ChainID]*chainServer{}, + evmBackendMutex: sync.Mutex{}, networkProvider: networkProvider, } } diff --git a/packages/webapi/v2/services/metrics.go b/packages/webapi/services/metrics.go similarity index 95% rename from packages/webapi/v2/services/metrics.go rename to packages/webapi/services/metrics.go index 01fbe91ec5..300df83710 100644 --- a/packages/webapi/v2/services/metrics.go +++ b/packages/webapi/services/metrics.go @@ -3,9 +3,9 @@ package services import ( "github.com/iotaledger/wasp/packages/chains" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/dto" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type MetricsService struct { diff --git a/packages/webapi/v2/services/node.go b/packages/webapi/services/node.go similarity index 98% rename from packages/webapi/v2/services/node.go rename to packages/webapi/services/node.go index 095a1c8d97..16cc5e1aa4 100644 --- a/packages/webapi/v2/services/node.go +++ b/packages/webapi/services/node.go @@ -13,7 +13,7 @@ import ( "github.com/iotaledger/wasp/packages/peering" "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type NodeService struct { diff --git a/packages/webapi/v2/services/offledger.go b/packages/webapi/services/offledger.go similarity index 84% rename from packages/webapi/v2/services/offledger.go rename to packages/webapi/services/offledger.go index 5eb9a0d4e2..4edd5c3f1a 100644 --- a/packages/webapi/v2/services/offledger.go +++ b/packages/webapi/services/offledger.go @@ -15,8 +15,7 @@ import ( "github.com/iotaledger/wasp/packages/vm/core/accounts" "github.com/iotaledger/wasp/packages/vm/core/blocklog" "github.com/iotaledger/wasp/packages/vm/vmcontext" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type OffLedgerService struct { @@ -87,30 +86,41 @@ func (c *OffLedgerService) EnqueueOffLedgerRequest(chainID isc.ChainID, binaryRe } // implemented this way so we can re-use the same state, and avoid the overhead of calling views -// TODO exported just to be used by V1 API until that gets deprecated at once. func ShouldBeProcessed(ch chain.ChainCore, req isc.OffLedgerRequest) error { state, err := ch.LatestState(chain.ActiveOrCommittedState) if err != nil { - return httperrors.ServerError("unable to get latest state") + // ServerError + return interfaces.ErrUnableToGetLatestState } // query blocklog contract + processed, err := blocklog.IsRequestProcessed(state, req.ID()) if err != nil { - return httperrors.ServerError("unable to get request receipt from block state") + // ServerError + + return interfaces.ErrUnableToGetReceipt } if processed { - return httperrors.BadRequest("request already processed") + // BadRequest + + return interfaces.ErrAlreadyProcessed } // query accounts contract accountsPartition := subrealm.NewReadOnly(state, kv.Key(accounts.Contract.Hname().Bytes())) // check user has on-chain balance if !accounts.AccountExists(accountsPartition, req.SenderAccount()) { - return httperrors.BadRequest(fmt.Sprintf("No balance on account %s", req.SenderAccount().String())) + // BadRequest + + return interfaces.ErrNoBalanceOnAccount } + accountNonce := accounts.GetMaxAssumedNonce(accountsPartition, req.SenderAccount()) if err := vmcontext.CheckNonce(req, accountNonce); err != nil { - return httperrors.BadRequest(fmt.Sprintf("invalid nonce, %v", err)) + // BadRequest + + return interfaces.ErrInvalidNonce } + return nil } diff --git a/packages/webapi/v2/services/peering.go b/packages/webapi/services/peering.go similarity index 98% rename from packages/webapi/v2/services/peering.go rename to packages/webapi/services/peering.go index 21804faead..7844a09295 100644 --- a/packages/webapi/v2/services/peering.go +++ b/packages/webapi/services/peering.go @@ -4,7 +4,7 @@ import ( "github.com/iotaledger/wasp/packages/chains" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/webapi/v2/dto" + "github.com/iotaledger/wasp/packages/webapi/dto" ) type PeeringService struct { diff --git a/packages/webapi/v2/services/registry.go b/packages/webapi/services/registry.go similarity index 92% rename from packages/webapi/v2/services/registry.go rename to packages/webapi/services/registry.go index 8fd85be9f4..23f8429ef1 100644 --- a/packages/webapi/v2/services/registry.go +++ b/packages/webapi/services/registry.go @@ -4,7 +4,7 @@ import ( "github.com/iotaledger/wasp/packages/chains" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type RegistryService struct { diff --git a/packages/webapi/v2/services/user.go b/packages/webapi/services/user.go similarity index 95% rename from packages/webapi/v2/services/user.go rename to packages/webapi/services/user.go index da5d396ee1..d9b95e805b 100644 --- a/packages/webapi/v2/services/user.go +++ b/packages/webapi/services/user.go @@ -4,8 +4,8 @@ import ( "golang.org/x/exp/maps" "github.com/iotaledger/wasp/packages/users" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi/interfaces" + "github.com/iotaledger/wasp/packages/webapi/models" ) type UserService struct { diff --git a/packages/webapi/v2/services/vm.go b/packages/webapi/services/vm.go similarity index 77% rename from packages/webapi/v2/services/vm.go rename to packages/webapi/services/vm.go index 43ff7700c0..f279909b10 100644 --- a/packages/webapi/v2/services/vm.go +++ b/packages/webapi/services/vm.go @@ -8,19 +8,22 @@ import ( "github.com/iotaledger/wasp/packages/chainutil" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" + "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/state" "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/webapi/v2/corecontracts" - "github.com/iotaledger/wasp/packages/webapi/v2/interfaces" + "github.com/iotaledger/wasp/packages/webapi/corecontracts" + "github.com/iotaledger/wasp/packages/webapi/interfaces" ) type VMService struct { - chainsProvider chains.Provider + chainsProvider chains.Provider + chainRecordRegistryProvider registry.ChainRecordRegistryProvider } -func NewVMService(chainsProvider chains.Provider) interfaces.VMService { +func NewVMService(chainsProvider chains.Provider, chainRecordRegistryProvider registry.ChainRecordRegistryProvider) interfaces.VMService { return &VMService{ - chainsProvider: chainsProvider, + chainsProvider: chainsProvider, + chainRecordRegistryProvider: chainRecordRegistryProvider, } } @@ -52,8 +55,9 @@ func (v *VMService) GetReceipt(chainID isc.ChainID, requestID isc.RequestID) (*i func (v *VMService) CallViewByChainID(chainID isc.ChainID, contractName, functionName isc.Hname, params dict.Dict) (dict.Dict, error) { ch := v.chainsProvider().Get(chainID) + if ch == nil { - return nil, errors.New("chain not found") + return nil, interfaces.ErrChainNotFound } // TODO: should blockIndex be an optional parameter of this endpoint? diff --git a/packages/webapi/v2/test/mock_test.go b/packages/webapi/test/mock_test.go similarity index 83% rename from packages/webapi/v2/test/mock_test.go rename to packages/webapi/test/mock_test.go index 2f7181e0be..32e5fe845c 100644 --- a/packages/webapi/v2/test/mock_test.go +++ b/packages/webapi/test/mock_test.go @@ -6,12 +6,12 @@ import ( "github.com/stretchr/testify/require" - v2 "github.com/iotaledger/wasp/packages/webapi/v2" - "github.com/iotaledger/wasp/packages/webapi/v2/models" + "github.com/iotaledger/wasp/packages/webapi" + "github.com/iotaledger/wasp/packages/webapi/models" ) func TestMockingOfPtrStructure(t *testing.T) { - mock := v2.NewMocker() + mock := webapi.NewMocker() mock.LoadMockFiles() mockedChainInfoResponse := mock.Get(&models.PeeringNodeStatusResponse{}) @@ -20,7 +20,7 @@ func TestMockingOfPtrStructure(t *testing.T) { } func TestMockingOfStructure(t *testing.T) { - mock := v2.NewMocker() + mock := webapi.NewMocker() mock.LoadMockFiles() mockedChainInfoResponse := mock.Get(models.PeeringNodeStatusResponse{}) @@ -29,7 +29,7 @@ func TestMockingOfStructure(t *testing.T) { } func TestMockingOfStructureArray(t *testing.T) { - mock := v2.NewMocker() + mock := webapi.NewMocker() mock.LoadMockFiles() mockedChainInfoResponse := mock.Get([]models.PeeringNodeStatusResponse{}) @@ -38,7 +38,7 @@ func TestMockingOfStructureArray(t *testing.T) { } func TestMockingOfChainInfo(t *testing.T) { - mock := v2.NewMocker() + mock := webapi.NewMocker() mock.LoadMockFiles() mockedChainInfoResponse := mock.Get([]models.ChainInfoResponse{}) @@ -47,7 +47,7 @@ func TestMockingOfChainInfo(t *testing.T) { } func TestMockingOfCommitteeInfo(t *testing.T) { - mock := v2.NewMocker() + mock := webapi.NewMocker() mock.LoadMockFiles() mockedChainInfoResponse := mock.Get(models.CommitteeInfoResponse{}) diff --git a/packages/webapi/v1/admapi/accessnodes.go b/packages/webapi/v1/admapi/accessnodes.go deleted file mode 100644 index 94a44ab95d..0000000000 --- a/packages/webapi/v1/admapi/accessnodes.go +++ /dev/null @@ -1,92 +0,0 @@ -package admapi - -import ( - "fmt" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - "github.com/samber/lo" - - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func addAccessNodesEndpoints( - adm echoswagger.ApiGroup, - chainRecordRegistryProvider registry.ChainRecordRegistryProvider, - tnm peering.TrustedNetworkManager, -) { - a := &accessNodesService{ - chainRecordRegistryProvider: chainRecordRegistryProvider, - networkMgr: tnm, - } - adm.PUT(routes.AdmAccessNode(":chainID", ":pubKey"), a.handleAddAccessNode). - AddParamPath("", "chainID", "ChainID (bech32))"). - AddParamPath("", "pubKey", "PublicKey (hex string)"). - SetSummary("Add an access node to a chain") - - adm.DELETE(routes.AdmAccessNode(":chainID", ":pubKey"), a.handleRemoveAccessNode). - AddParamPath("", "chainID", "ChainID (bech32))"). - AddParamPath("", "pubKey", "PublicKey (hex string)"). - SetSummary("Remove an access node from a chain") -} - -type accessNodesService struct { - chainRecordRegistryProvider registry.ChainRecordRegistryProvider - networkMgr peering.TrustedNetworkManager -} - -func paramsPubKey(c echo.Context) (*cryptolib.PublicKey, error) { - return cryptolib.NewPublicKeyFromString(c.Param("pubKey")) -} - -func (a *accessNodesService) handleAddAccessNode(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest("invalid chainID") - } - pubKey, err := paramsPubKey(c) - if err != nil { - return httperrors.BadRequest("invalid pub key") - } - peers, err := a.networkMgr.TrustedPeers() - if err != nil { - return httperrors.ServerError("error getting trusted peers") - } - _, ok := lo.Find(peers, func(p *peering.TrustedPeer) bool { - return p.PubKey().Equals(pubKey) - }) - if !ok { - return httperrors.NotFound(fmt.Sprintf("couldn't find peer with public key %s", pubKey)) - } - _, err = a.chainRecordRegistryProvider.UpdateChainRecord(chainID, func(rec *registry.ChainRecord) bool { - return rec.AddAccessNode(pubKey) - }) - if err != nil { - return httperrors.ServerError("error saving chain record.") - } - return c.NoContent(http.StatusOK) -} - -func (a *accessNodesService) handleRemoveAccessNode(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest("invalid chainID") - } - pubKey, err := paramsPubKey(c) - if err != nil { - return httperrors.BadRequest("invalid pub key") - } - _, err = a.chainRecordRegistryProvider.UpdateChainRecord(chainID, func(rec *registry.ChainRecord) bool { - return rec.RemoveAccessNode(pubKey) - }) - if err != nil { - return httperrors.ServerError("error saving chain record.") - } - return c.NoContent(http.StatusOK) -} diff --git a/packages/webapi/v1/admapi/activatechain.go b/packages/webapi/v1/admapi/activatechain.go deleted file mode 100644 index 64555e91cb..0000000000 --- a/packages/webapi/v1/admapi/activatechain.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package admapi - -import ( - "fmt" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/metrics/nodeconnmetrics" - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/tcrypto" - "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type chainWebAPI struct { - chainRecordRegistryProvider registry.ChainRecordRegistryProvider - dkShareRegistryProvider registry.DKShareRegistryProvider - nodeIdentityProvider registry.NodeIdentityProvider - chains chains.Provider - network peering.NetworkProvider - nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics -} - -func addChainEndpoints(adm echoswagger.ApiGroup, c *chainWebAPI) { - adm.POST(routes.ActivateChain(":chainID"), c.handleActivateChain). - SetDeprecated(). - AddParamPath("", "chainID", "ChainID (bech32))"). - SetSummary("Activate a chain") - - adm.POST(routes.DeactivateChain(":chainID"), c.handleDeactivateChain). - SetDeprecated(). - AddParamPath("", "chainID", "ChainID (bech32))"). - SetSummary("Deactivate a chain") - - adm.GET(routes.GetChainInfo(":chainID"), c.handleGetChainInfo). - SetDeprecated(). - AddParamPath("", "chainID", "ChainID (bech32))"). - SetSummary("Get basic chain info.") -} - -func (w *chainWebAPI) handleActivateChain(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return err - } - - if err := w.chains().Activate(chainID); err != nil { - return err - } - - return c.NoContent(http.StatusOK) -} - -func (w *chainWebAPI) handleDeactivateChain(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return err - } - - err = w.chains().Deactivate(chainID) - if err != nil { - return err - } - - return c.NoContent(http.StatusOK) -} - -func (w *chainWebAPI) handleGetChainInfo(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid chain id: %s", c.Param("chainID"))) - } - - chainRecord, err := w.chainRecordRegistryProvider.ChainRecord(chainID) - if err != nil { - return err - } - if chainRecord == nil { - return httperrors.NotFound("") - } - if !chainRecord.Active { - return c.JSON(http.StatusOK, model.ChainInfo{ - ChainID: model.ChainIDBech32(chainID.String()), - Active: false, - }) - } - chain := w.chains().Get(chainID) - committeeInfo := chain.GetCommitteeInfo() - var dkShare tcrypto.DKShare - if committeeInfo != nil { - // Consider the committee as empty, if there is no current active committee. - dkShare, err = w.dkShareRegistryProvider.LoadDKShare(committeeInfo.Address) - if err != nil { - return err - } - } - - peeringStatus := peeringStatusIncludeSelf(w.network) - candidateNodes, err := getCandidateNodesAccessNodeInfo(chain.GetCandidateNodes()) - if err != nil { - return err - } - chainNodes := chain.GetChainNodes() - inChainNodes := make(map[cryptolib.PublicKeyKey]bool) - - // - // Committee nodes. - cmtNodes := makeCmtNodes(dkShare, peeringStatus, candidateNodes, inChainNodes) - - // - // Access nodes: accepted as access nodes and not included in the committee. - acnNodes := makeAcnNodes(dkShare, chainNodes, peeringStatus, candidateNodes, inChainNodes) - - // - // Candidate nodes have supplied applications, but are not included - // in the committee and to the set of the access nodes. - cndNodes, err := makeCndNodes(peeringStatus, candidateNodes, inChainNodes) - if err != nil { - return err - } - - res := model.ChainInfo{ - ChainID: model.ChainIDBech32(chainID.String()), - Active: chainRecord.Active, - CommitteeNodes: cmtNodes, - AccessNodes: acnNodes, - CandidateNodes: cndNodes, - } - if committeeInfo.Address != nil { - stateAddr := model.NewAddress(committeeInfo.Address) - res.StateAddress = &stateAddr - } - - return c.JSON(http.StatusOK, res) -} - -func peeringStatusIncludeSelf(networkProvider peering.NetworkProvider) map[cryptolib.PublicKeyKey]peering.PeerStatusProvider { - peeringStatus := make(map[cryptolib.PublicKeyKey]peering.PeerStatusProvider) - for _, n := range networkProvider.PeerStatus() { - peeringStatus[n.PubKey().AsKey()] = n - } - peeringStatus[networkProvider.Self().PubKey().AsKey()] = networkProvider.Self().Status() - return peeringStatus -} - -func makeCmtNodes( - dkShare tcrypto.DKShare, - peeringStatus map[cryptolib.PublicKeyKey]peering.PeerStatusProvider, - candidateNodes map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo, - inChainNodes map[cryptolib.PublicKeyKey]bool, -) []*model.ChainNodeStatus { - cmtNodes := make([]*model.ChainNodeStatus, 0) - if dkShare != nil { - for _, cmtNodePubKey := range dkShare.GetNodePubKeys() { - cmtNodes = append(cmtNodes, makeChainNodeStatus(cmtNodePubKey, peeringStatus, candidateNodes)) - inChainNodes[cmtNodePubKey.AsKey()] = true - } - } - return cmtNodes -} - -func makeAcnNodes( - dkShare tcrypto.DKShare, - chainNodes []peering.PeerStatusProvider, - peeringStatus map[cryptolib.PublicKeyKey]peering.PeerStatusProvider, - candidateNodes map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo, - inChainNodes map[cryptolib.PublicKeyKey]bool, -) []*model.ChainNodeStatus { - acnNodes := make([]*model.ChainNodeStatus, 0) - for _, chainNode := range chainNodes { - acnPubKey := chainNode.PubKey() - skip := false - if dkShare != nil { - for _, cmtNodePubKey := range dkShare.GetNodePubKeys() { - if acnPubKey.AsKey() == cmtNodePubKey.AsKey() { - skip = true - break - } - } - } - if skip { - continue - } - acnNodes = append(acnNodes, makeChainNodeStatus(acnPubKey, peeringStatus, candidateNodes)) - inChainNodes[acnPubKey.AsKey()] = true - } - return acnNodes -} - -func makeCndNodes( - peeringStatus map[cryptolib.PublicKeyKey]peering.PeerStatusProvider, - candidateNodes map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo, - inChainNodes map[cryptolib.PublicKeyKey]bool, -) ([]*model.ChainNodeStatus, error) { - cndNodes := make([]*model.ChainNodeStatus, 0) - for _, c := range candidateNodes { - pubKey, err := cryptolib.NewPublicKeyFromBytes(c.NodePubKey) - if err != nil { - return nil, err - } - if _, ok := inChainNodes[pubKey.AsKey()]; ok { - continue // Only include unused candidates here. - } - cndNodes = append(cndNodes, makeChainNodeStatus(pubKey, peeringStatus, candidateNodes)) - } - return cndNodes, nil -} - -func getCandidateNodesAccessNodeInfo(chainCandidateNodes []*governance.AccessNodeInfo) (map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo, error) { - candidateNodes := make(map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo) - for _, chainCandidateNode := range chainCandidateNodes { - pubKey, err := cryptolib.NewPublicKeyFromBytes(chainCandidateNode.NodePubKey) - if err != nil { - return nil, err - } - candidateNodes[pubKey.AsKey()] = chainCandidateNode - } - - return candidateNodes, nil -} - -func makeChainNodeStatus( - pubKey *cryptolib.PublicKey, - peeringStatus map[cryptolib.PublicKeyKey]peering.PeerStatusProvider, - candidateNodes map[cryptolib.PublicKeyKey]*governance.AccessNodeInfo, -) *model.ChainNodeStatus { - cns := model.ChainNodeStatus{ - Node: model.PeeringNodeStatus{ - PubKey: pubKey.String(), - }, - } - if n, ok := peeringStatus[pubKey.AsKey()]; ok { - cns.Node.NetID = n.NetID() - cns.Node.IsAlive = n.IsAlive() - cns.Node.NumUsers = n.NumUsers() - } - if n, ok := candidateNodes[pubKey.AsKey()]; ok { - cns.ForCommittee = n.ForCommittee - cns.ForAccess = true - cns.AccessAPI = n.AccessAPI - } - return &cns -} diff --git a/packages/webapi/v1/admapi/chainmetrics.go b/packages/webapi/v1/admapi/chainmetrics.go deleted file mode 100644 index 8d20912444..0000000000 --- a/packages/webapi/v1/admapi/chainmetrics.go +++ /dev/null @@ -1,244 +0,0 @@ -package admapi - -import ( - "fmt" - "net/http" - "time" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func addChainMetricsEndpoints(adm echoswagger.ApiGroup, chainsProvider chains.Provider) { - cms := &chainMetricsService{ - chainsProvider, - } - addChainNodeConnMetricsEndpoints(adm, cms) - addChainConsensusMetricsEndpoints(adm, cms) - addChainConcensusPipeMetricsEndpoints(adm, cms) -} - -func addChainNodeConnMetricsEndpoints(adm echoswagger.ApiGroup, cms *chainMetricsService) { - chainExample := &model.NodeConnectionMessagesMetrics{ - OutPublishStateTransaction: &model.NodeConnectionMessageMetrics{ - Total: 3, - LastEvent: time.Now().Add(-2 * time.Millisecond), - LastMessage: "Last sent PublishStateTransaction message structure", - }, - OutPublishGovernanceTransaction: &model.NodeConnectionMessageMetrics{ - Total: 0, - LastEvent: time.Time{}, - LastMessage: "Last sent PublishGovernanceTransaction message structure", - }, - OutPullLatestOutput: &model.NodeConnectionMessageMetrics{ - Total: 15, - LastEvent: time.Now().Add(-10 * time.Second), - LastMessage: "Last sent PullLatestOutput message structure", - }, - OutPullTxInclusionState: &model.NodeConnectionMessageMetrics{ - Total: 28, - LastEvent: time.Now().Add(-5 * time.Second), - LastMessage: "Last sent PullTxInclusionState message structure", - }, - OutPullOutputByID: &model.NodeConnectionMessageMetrics{ - Total: 132, - LastEvent: time.Now().Add(100 * time.Second), - LastMessage: "Last sent PullOutputByID message structure", - }, - InStateOutput: &model.NodeConnectionMessageMetrics{ - Total: 101, - LastEvent: time.Now().Add(-8 * time.Second), - LastMessage: "Last received State output message structure", - }, - InAliasOutput: &model.NodeConnectionMessageMetrics{ - Total: 203, - LastEvent: time.Now().Add(-123 * time.Millisecond), - LastMessage: "Last received AliasOutput message structure", - }, - InOutput: &model.NodeConnectionMessageMetrics{ - Total: 101, - LastEvent: time.Now().Add(-8 * time.Second), - LastMessage: "Last received Output message structure", - }, - InOnLedgerRequest: &model.NodeConnectionMessageMetrics{ - Total: 85, - LastEvent: time.Now().Add(-2 * time.Second), - LastMessage: "Last received OnLedgerRequest message structure", - }, - InTxInclusionState: &model.NodeConnectionMessageMetrics{ - Total: 999, - LastEvent: time.Now().Add(-1 * time.Second), - LastMessage: "Last received TxInclusionState message structure", - }, - } - - example := &model.NodeConnectionMetrics{ - NodeConnectionMessagesMetrics: *chainExample, - InMilestone: &model.NodeConnectionMessageMetrics{ - Total: 1234, - LastEvent: time.Now().Add(1 * time.Second), - LastMessage: "Last received Milestone message structure", - }, - Registered: []model.ChainIDBech32{ - model.NewChainIDBech32(isc.RandomChainID()), - model.NewChainIDBech32(isc.RandomChainID()), - }, - } - - adm.GET(routes.GetChainsNodeConnectionMetrics(), cms.handleGetChainsNodeConnMetrics). - SetDeprecated(). - SetSummary("Get cummulative chains node connection metrics"). - AddResponse(http.StatusOK, "Cummulative chains metrics", example, nil) - - adm.GET(routes.GetChainNodeConnectionMetrics(":chainID"), cms.handleGetChainNodeConnMetrics). - SetDeprecated(). - SetSummary("Get chain node connection metrics for the given chain ID"). - AddParamPath("", "chainID", "ChainID (bech32)"). - AddResponse(http.StatusOK, "Chain metrics", chainExample, nil) -} - -func addChainConsensusMetricsEndpoints(adm echoswagger.ApiGroup, cms *chainMetricsService) { - example := &model.ConsensusWorkflowStatus{ - FlagStateReceived: true, - FlagBatchProposalSent: true, - FlagConsensusBatchKnown: true, - FlagVMStarted: false, - FlagVMResultSigned: false, - FlagTransactionFinalized: false, - FlagTransactionPosted: false, - FlagTransactionSeen: false, - FlagInProgress: true, - - TimeBatchProposalSent: time.Now().Add(-10 * time.Second), - TimeConsensusBatchKnown: time.Now().Add(-5 * time.Second), - TimeVMStarted: time.Time{}, - TimeVMResultSigned: time.Time{}, - TimeTransactionFinalized: time.Time{}, - TimeTransactionPosted: time.Time{}, - TimeTransactionSeen: time.Time{}, - TimeCompleted: time.Time{}, - - CurrentStateIndex: 0, - } - - adm.GET(routes.GetChainConsensusWorkflowStatus(":chainID"), cms.handleGetChainConsensusWorkflowStatus). - SetDeprecated(). - SetSummary("Get chain state statistics for the given chain ID"). - AddParamPath("", "chainID", "ChainID (bech32)"). - AddResponse(http.StatusOK, "Chain consensus stats", example, nil). - AddResponse(http.StatusNotFound, "Chain consensus hasn't been created", nil, nil) -} - -func addChainConcensusPipeMetricsEndpoints(adm echoswagger.ApiGroup, cms *chainMetricsService) { - example := &model.ConsensusPipeMetrics{ - EventStateTransitionMsgPipeSize: 0, - EventPeerLogIndexMsgPipeSize: 0, - EventACSMsgPipeSize: 0, - EventVMResultMsgPipeSize: 0, - EventTimerMsgPipeSize: 0, - } - - adm.GET(routes.GetChainConsensusPipeMetrics(":chainID"), cms.handleGetChainConsensusPipeMetrics). - SetDeprecated(). - SetSummary("Get consensus pipe metrics"). - AddParamPath("", "chainID", "chainID"). - AddResponse(http.StatusOK, "Chain consensus pipe metrics", example, nil). - AddResponse(http.StatusNotFound, "Chain consensus hasn't been created", nil, nil) -} - -type chainMetricsService struct { - chains chains.Provider -} - -func (cssT *chainMetricsService) handleGetChainsNodeConnMetrics(c echo.Context) error { - metrics := cssT.chains().GetNodeConnectionMetrics() - metricsModel := model.NewNodeConnectionMetrics(metrics) - - return c.JSON(http.StatusOK, metricsModel) -} - -func (cssT *chainMetricsService) handleGetChainNodeConnMetrics(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - theChain := cssT.chains().Get(chainID) - if theChain == nil { - return httperrors.NotFound(fmt.Sprintf("Active chain %s not found", chainID)) - } - metrics := theChain.GetNodeConnectionMetrics() - metricsModel := model.NewNodeConnectionMessagesMetrics(metrics) - - return c.JSON(http.StatusOK, metricsModel) -} - -func (cssT *chainMetricsService) handleGetChainConsensusWorkflowStatus(c echo.Context) error { - theChain, err := cssT.getChain(c) - if err != nil { - return err - } - status := theChain.GetConsensusWorkflowStatus() - if status == nil { - return c.NoContent(http.StatusNotFound) - } - - return c.JSON(http.StatusOK, &model.ConsensusWorkflowStatus{ - FlagStateReceived: status.IsStateReceived(), - FlagBatchProposalSent: status.IsBatchProposalSent(), - FlagConsensusBatchKnown: status.IsConsensusBatchKnown(), - FlagVMStarted: status.IsVMStarted(), - FlagVMResultSigned: status.IsVMResultSigned(), - FlagTransactionFinalized: status.IsTransactionFinalized(), - FlagTransactionPosted: status.IsTransactionPosted(), - FlagTransactionSeen: status.IsTransactionSeen(), - FlagInProgress: status.IsInProgress(), - - TimeBatchProposalSent: status.GetBatchProposalSentTime(), - TimeConsensusBatchKnown: status.GetConsensusBatchKnownTime(), - TimeVMStarted: status.GetVMStartedTime(), - TimeVMResultSigned: status.GetVMResultSignedTime(), - TimeTransactionFinalized: status.GetTransactionFinalizedTime(), - TimeTransactionPosted: status.GetTransactionPostedTime(), - TimeTransactionSeen: status.GetTransactionSeenTime(), - TimeCompleted: status.GetCompletedTime(), - - CurrentStateIndex: status.GetCurrentStateIndex(), - }) -} - -func (cssT *chainMetricsService) handleGetChainConsensusPipeMetrics(c echo.Context) error { - theChain, err := cssT.getChain(c) - if err != nil { - return err - } - pipeMetrics := theChain.GetConsensusPipeMetrics() - if pipeMetrics == nil { - return c.NoContent(http.StatusNotFound) - } - return c.JSON(http.StatusOK, &model.ConsensusPipeMetrics{ - EventStateTransitionMsgPipeSize: pipeMetrics.GetEventStateTransitionMsgPipeSize(), - EventPeerLogIndexMsgPipeSize: pipeMetrics.GetEventPeerLogIndexMsgPipeSize(), - EventACSMsgPipeSize: pipeMetrics.GetEventACSMsgPipeSize(), - EventVMResultMsgPipeSize: pipeMetrics.GetEventVMResultMsgPipeSize(), - EventTimerMsgPipeSize: pipeMetrics.GetEventTimerMsgPipeSize(), - }) -} - -func (cssT *chainMetricsService) getChain(c echo.Context) (chain.Chain, error) { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return nil, httperrors.BadRequest(err.Error()) - } - theChain := cssT.chains().Get(chainID) - if theChain == nil { - return nil, httperrors.NotFound(fmt.Sprintf("Active chain %s not found", chainID)) - } - return theChain, nil -} diff --git a/packages/webapi/v1/admapi/chainrecord.go b/packages/webapi/v1/admapi/chainrecord.go deleted file mode 100644 index 313d47e92a..0000000000 --- a/packages/webapi/v1/admapi/chainrecord.go +++ /dev/null @@ -1,124 +0,0 @@ -package admapi - -import ( - "fmt" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func addChainRecordEndpoints(adm echoswagger.ApiGroup, chainRecordRegistryProvider registry.ChainRecordRegistryProvider, chainsProvider chains.Provider) { - rnd1 := isc.RandomChainID() - example := model.ChainRecord{ - ChainID: model.NewChainIDBech32(rnd1), - Active: false, - } - - s := &chainRecordService{chainRecordRegistryProvider, chainsProvider} - - adm.POST(routes.PutChainRecord(), s.handlePutChainRecord). - SetDeprecated(). - SetSummary("Create a new chain record"). - AddParamBody(example, "Record", "Chain record", true) - - adm.GET(routes.GetChainRecord(":chainID"), s.handleGetChainRecord). - SetDeprecated(). - SetSummary("Find the chain record for the given chain ID"). - AddParamPath("", "chainID", "ChainID (bech32)"). - AddResponse(http.StatusOK, "Chain Record", example, nil) - - adm.GET(routes.ListChainRecords(), s.handleGetChainRecordList). - SetDeprecated(). - SetSummary("Get the list of chain records in the node"). - AddResponse(http.StatusOK, "Chain Record", []model.ChainRecord{example}, nil) -} - -type chainRecordService struct { - chainRecordRegistryProvider registry.ChainRecordRegistryProvider - chainsProvider chains.Provider -} - -func (s *chainRecordService) handlePutChainRecord(c echo.Context) error { - var req model.ChainRecord - - if err := c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body") - } - - requestChainRec, err := req.Record() - if err != nil { - return httperrors.BadRequest("Error parsing chain record") - } - - storedChainRec, err := s.chainRecordRegistryProvider.ChainRecord(requestChainRec.ChainID()) - if err != nil { - return err - } - returnStatus := http.StatusAccepted - if storedChainRec != nil { - _, err = s.chainRecordRegistryProvider.UpdateChainRecord( - requestChainRec.ChainID(), - func(rec *registry.ChainRecord) bool { - rec.AccessNodes = requestChainRec.AccessNodes - rec.Active = requestChainRec.Active - return true - }, - ) - if err != nil { - return err - } - } else { - if err := s.chainRecordRegistryProvider.AddChainRecord(requestChainRec); err != nil { - return err - } - returnStatus = http.StatusCreated - } - - // Activate/deactivate the chain accordingly. - if requestChainRec.Active { - if err := s.chainsProvider().Activate(requestChainRec.ChainID()); err != nil { - return err - } - } else if storedChainRec != nil { - if err := s.chainsProvider().Deactivate(requestChainRec.ChainID()); err != nil { - return err - } - } - - return c.NoContent(returnStatus) -} - -func (s *chainRecordService) handleGetChainRecord(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - bd, err := s.chainRecordRegistryProvider.ChainRecord(chainID) - if err != nil { - return err - } - if bd == nil { - return httperrors.NotFound(fmt.Sprintf("Record not found: %s", chainID)) - } - return c.JSON(http.StatusOK, model.NewChainRecord(bd)) -} - -func (s *chainRecordService) handleGetChainRecordList(c echo.Context) error { - lst, err := s.chainRecordRegistryProvider.ChainRecords() - if err != nil { - return err - } - ret := make([]*model.ChainRecord, len(lst)) - for i := range ret { - ret[i] = model.NewChainRecord(lst[i]) - } - return c.JSON(http.StatusOK, ret) -} diff --git a/packages/webapi/v1/admapi/dkshares.go b/packages/webapi/v1/admapi/dkshares.go deleted file mode 100644 index 3ec51045cf..0000000000 --- a/packages/webapi/v1/admapi/dkshares.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package admapi - -// Endpoints for creating and getting Distributed key shares. - -import ( - "encoding/base64" - "fmt" - "net/http" - "time" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/dkg" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/tcrypto" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func addDKSharesEndpoints(adm echoswagger.ApiGroup, dkShareRegistryProvider registry.DKShareRegistryProvider, nodeProvider dkg.NodeProvider) { - requestExample := model.DKSharesPostRequest{ - PeerPubKeys: []string{base64.StdEncoding.EncodeToString([]byte("key"))}, - Threshold: 3, - TimeoutMS: 10000, - } - addr1 := isc.RandomChainID().AsAddress() - infoExample := model.DKSharesInfo{ - Address: addr1.Bech32(parameters.L1().Protocol.Bech32HRP), - SharedPubKey: base64.StdEncoding.EncodeToString([]byte("key")), - PubKeyShares: []string{base64.StdEncoding.EncodeToString([]byte("key"))}, - PeerPubKeys: []string{base64.StdEncoding.EncodeToString([]byte("key"))}, - Threshold: 3, - PeerIndex: nil, - } - - s := &dkSharesService{ - dkShareRegistryProvider: dkShareRegistryProvider, - dkgNode: nodeProvider, - } - - adm.POST(routes.DKSharesPost(), s.handleDKSharesPost). - SetDeprecated(). - AddParamBody(requestExample, "DKSharesPostRequest", "Request parameters", true). - AddResponse(http.StatusOK, "DK shares info", infoExample, nil). - SetSummary("Generate a new distributed key") - - adm.GET(routes.DKSharesGet(":sharedAddress"), s.handleDKSharesGet). - SetDeprecated(). - AddParamPath("", "sharedAddress", "Address of the DK share (hex)"). - AddResponse(http.StatusOK, "DK shares info", infoExample, nil). - SetSummary("Get distributed key properties") -} - -type dkSharesService struct { - dkShareRegistryProvider registry.DKShareRegistryProvider - dkgNode dkg.NodeProvider -} - -func (s *dkSharesService) handleDKSharesPost(c echo.Context) error { - var req model.DKSharesPostRequest - var err error - - if err = c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body.") - } - - if req.PeerPubKeys == nil || len(req.PeerPubKeys) < 1 { - return httperrors.BadRequest("PeerPubKeys are mandatory") - } - - var peerPubKeys []*cryptolib.PublicKey - if req.PeerPubKeys != nil { - peerPubKeys = make([]*cryptolib.PublicKey, len(req.PeerPubKeys)) - for i := range req.PeerPubKeys { - peerPubKey, err := cryptolib.NewPublicKeyFromString(req.PeerPubKeys[i]) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid PeerPubKeys[%v]=%v", i, req.PeerPubKeys[i])) - } - peerPubKeys[i] = peerPubKey - } - } - - dkShare, err := s.dkgNode().GenerateDistributedKey( - peerPubKeys, - req.Threshold, - 1*time.Second, - 3*time.Second, - time.Duration(req.TimeoutMS)*time.Millisecond, - ) - if err != nil { - if _, ok := err.(dkg.InvalidParamsError); ok { - return httperrors.BadRequest(err.Error()) - } - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - - var response *model.DKSharesInfo - if response, err = makeDKSharesInfo(dkShare); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - return c.JSON(http.StatusOK, response) -} - -func (s *dkSharesService) handleDKSharesGet(c echo.Context) error { - var err error - var dkShare tcrypto.DKShare - var sharedAddress iotago.Address - if _, sharedAddress, err = iotago.ParseBech32(c.Param("sharedAddress")); err != nil { - return echo.NewHTTPError(http.StatusBadRequest, err) - } - if dkShare, err = s.dkShareRegistryProvider.LoadDKShare(sharedAddress); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - var response *model.DKSharesInfo - if response, err = makeDKSharesInfo(dkShare); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - return c.JSON(http.StatusOK, response) -} - -func makeDKSharesInfo(dkShare tcrypto.DKShare) (*model.DKSharesInfo, error) { - var err error - - b, err := dkShare.DSSSharedPublic().MarshalBinary() - if err != nil { - return nil, err - } - sharedPubKey := base64.StdEncoding.EncodeToString(b) - - pubKeyShares := make([]string, len(dkShare.DSSPublicShares())) - for i := range dkShare.DSSPublicShares() { - b, err := dkShare.DSSPublicShares()[i].MarshalBinary() - if err != nil { - return nil, err - } - pubKeyShares[i] = base64.StdEncoding.EncodeToString(b) - } - - peerPubKeys := make([]string, len(dkShare.GetNodePubKeys())) - for i := range dkShare.GetNodePubKeys() { - peerPubKeys[i] = base64.StdEncoding.EncodeToString(dkShare.GetNodePubKeys()[i].AsBytes()) - } - - return &model.DKSharesInfo{ - Address: dkShare.GetAddress().Bech32(parameters.L1().Protocol.Bech32HRP), - SharedPubKey: sharedPubKey, - PubKeyShares: pubKeyShares, - PeerPubKeys: peerPubKeys, - Threshold: dkShare.GetT(), - PeerIndex: dkShare.GetIndex(), - }, nil -} diff --git a/packages/webapi/v1/admapi/endpoints.go b/packages/webapi/v1/admapi/endpoints.go deleted file mode 100644 index 39990d33f1..0000000000 --- a/packages/webapi/v1/admapi/endpoints.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package admapi - -import ( - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/authentication" - "github.com/iotaledger/wasp/packages/authentication/shared/permissions" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/dkg" - "github.com/iotaledger/wasp/packages/metrics/nodeconnmetrics" - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/users" -) - -func AddEndpoints( - adm echoswagger.ApiGroup, - network peering.NetworkProvider, - tnm peering.TrustedNetworkManager, - userManager *users.UserManager, - chainRecordRegistryProvider registry.ChainRecordRegistryProvider, - dkShareRegistryProvider registry.DKShareRegistryProvider, - nodeIdentityProvider registry.NodeIdentityProvider, - chainsProvider chains.Provider, - nodeProvider dkg.NodeProvider, - shutdownFunc ShutdownFunc, - nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics, - authConfig authentication.AuthConfiguration, - nodeOwnerAddresses []string, -) { - claimValidator := func(claims *authentication.WaspClaims) bool { - // The API will be accessible if the token has an 'API' claim - return claims.HasPermission(permissions.API) - } - - authentication.AddV1Authentication(adm.EchoGroup(), userManager, nodeIdentityProvider, authConfig, claimValidator) - addShutdownEndpoint(adm, shutdownFunc) - addNodeOwnerEndpoints(adm, nodeIdentityProvider, nodeOwnerAddresses) - addChainRecordEndpoints(adm, chainRecordRegistryProvider, chainsProvider) - addChainMetricsEndpoints(adm, chainsProvider) - addChainEndpoints(adm, &chainWebAPI{ - chainRecordRegistryProvider: chainRecordRegistryProvider, - dkShareRegistryProvider: dkShareRegistryProvider, - nodeIdentityProvider: nodeIdentityProvider, - chains: chainsProvider, - network: network, - // TODO: what happened to the metrics? - nodeConnectionMetrics: nodeConnectionMetrics, - }) - addDKSharesEndpoints(adm, dkShareRegistryProvider, nodeProvider) - addPeeringEndpoints(adm, chainRecordRegistryProvider, network, tnm) - addAccessNodesEndpoints(adm, chainRecordRegistryProvider, tnm) -} diff --git a/packages/webapi/v1/admapi/node_owner.go b/packages/webapi/v1/admapi/node_owner.go deleted file mode 100644 index 8ce51c7987..0000000000 --- a/packages/webapi/v1/admapi/node_owner.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package admapi - -import ( - "bytes" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -func addNodeOwnerEndpoints(adm echoswagger.ApiGroup, nodeIdentityProvider registry.NodeIdentityProvider, nodeOwnerAddresses []string) { - nos := &nodeOwnerService{ - nodeOwnerAddresses: nodeOwnerAddresses, - } - addCtx := func(next echo.HandlerFunc) echo.HandlerFunc { - return func(c echo.Context) error { - c.Set("reg", nodeIdentityProvider) - return next(c) - } - } - reqExample := model.NodeOwnerCertificateRequest{ - NodePubKey: model.NewBytes([]byte{0, 1, 17}), - OwnerAddress: model.Address("any_address"), - } - resExample := model.NodeOwnerCertificateResponse{ - Certificate: model.NewBytes([]byte{0, 1, 17, 19}), - } - adm.POST(routes.AdmNodeOwnerCertificate(), nos.handleAdmNodeOwnerCertificate, addCtx). - SetDeprecated(). - AddParamBody(reqExample, "Request", "Certificate request", true). - AddResponse(http.StatusOK, "Generated certificate.", resExample, nil). - SetSummary("Provides a certificate, if the node recognizes the owner.") -} - -type nodeOwnerService struct { - nodeOwnerAddresses []string -} - -func (n *nodeOwnerService) handleAdmNodeOwnerCertificate(c echo.Context) error { - nodeIdentityProvider := c.Get("reg").(registry.NodeIdentityProvider) - - var req model.NodeOwnerCertificateRequest - if err := c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body") - } - reqOwnerAddress := req.OwnerAddress.Address() - reqNodePubKeyBytes := req.NodePubKey.Bytes() - - nodeIdentity := nodeIdentityProvider.NodeIdentity() - - // - // Check, if supplied node PubKey matches. - if !bytes.Equal(nodeIdentity.GetPublicKey().AsBytes(), reqNodePubKeyBytes) { - return &httperrors.HTTPError{Code: 400, Message: "Wrong NodePubKey"} - } - - // - // Check, if owner is presented in the configuration. - ownerAuthorized := false - for _, nodeOwnerAddressStr := range n.nodeOwnerAddresses { - _, nodeOwnerAddress, err := iotago.ParseBech32(nodeOwnerAddressStr) - if err != nil { - continue - } - if bytes.Equal(isc.BytesFromAddress(reqOwnerAddress), isc.BytesFromAddress(nodeOwnerAddress)) { - ownerAuthorized = true - break - } - } - if !ownerAuthorized { - return &httperrors.HTTPError{Code: 403, Message: "unauthorized"} - } - - // - // Create the certificate. It consists of signature only. The data is not included. - cert := governance.NewNodeOwnershipCertificate(nodeIdentity, reqOwnerAddress) - resp := model.NodeOwnerCertificateResponse{ - Certificate: model.NewBytes(cert.Bytes()), - } - - return c.JSON(http.StatusOK, resp) -} diff --git a/packages/webapi/v1/admapi/peering.go b/packages/webapi/v1/admapi/peering.go deleted file mode 100644 index ab334fbb6a..0000000000 --- a/packages/webapi/v1/admapi/peering.go +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package admapi - -import ( - "fmt" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - "github.com/samber/lo" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type peeringService struct { - chainRecordRegistryProvider registry.ChainRecordRegistryProvider - network peering.NetworkProvider - networkMgr peering.TrustedNetworkManager -} - -func addPeeringEndpoints(adm echoswagger.ApiGroup, chainRecordRegistryProvider registry.ChainRecordRegistryProvider, network peering.NetworkProvider, tnm peering.TrustedNetworkManager) { - listExample := []*model.PeeringTrustedNode{ - {PubKey: "8mcS4hUaiiedX3jRud41Zuu1ZcRUZZ8zY9SuJJgXHuiQ", NetID: "some-host:9081"}, - {PubKey: "8mcS4hUaiiedX3jRud41Zuu1ZcRUZZ8zY9SuJJgXHuiR", NetID: "some-host:9082"}, - } - peeringStatusExample := []*model.PeeringNodeStatus{ - {PubKey: "8mcS4hUaiiedX3jRud41Zuu1ZcRUZZ8zY9SuJJgXHuiQ", IsAlive: true, NumUsers: 1, NetID: "some-host:9081"}, - {PubKey: "8mcS4hUaiiedX3jRud41Zuu1ZcRUZZ8zY9SuJJgXHuiR", IsAlive: true, NumUsers: 1, NetID: "some-host:9082"}, - } - p := &peeringService{ - chainRecordRegistryProvider: chainRecordRegistryProvider, - network: network, - networkMgr: tnm, - } - - adm.GET(routes.PeeringSelfGet(), p.handlePeeringSelfGet). - SetDeprecated(). - AddResponse(http.StatusOK, "This node as a peer.", listExample[0], nil). - SetSummary("Basic peer info of the current node.") - - adm.GET(routes.PeeringTrustedList(), p.handlePeeringTrustedList). - SetDeprecated(). - AddResponse(http.StatusOK, "A list of trusted peers.", listExample, nil). - SetSummary("Get a list of trusted peers.") - - adm.GET(routes.PeeringTrustedGet(":pubKey"), p.handlePeeringTrustedGet). - SetDeprecated(). - AddParamPath(listExample[0].PubKey, "pubKey", "Public key of the trusted peer (hex)."). - AddResponse(http.StatusOK, "Trusted peer info.", listExample[0], nil). - SetSummary("Get details on a particular trusted peer.") - - adm.PUT(routes.PeeringTrustedPut(":pubKey"), p.handlePeeringTrustedPut). - SetDeprecated(). - AddParamPath(listExample[0].PubKey, "pubKey", "Public key of the trusted peer (hex)."). - AddParamBody(listExample[0], "PeeringTrustedNode", "Info of the peer to trust.", true). - AddResponse(http.StatusOK, "Trusted peer info.", listExample[0], nil). - SetSummary("Trust the specified peer, the pub key is passed via the path.") - - adm.GET(routes.PeeringGetStatus(), p.handlePeeringGetStatus). - SetDeprecated(). - AddResponse(http.StatusOK, "A list of all peers.", peeringStatusExample, nil). - SetSummary("Basic information about all configured peers.") - - adm.POST(routes.PeeringTrustedPost(), p.handlePeeringTrustedPost). - SetDeprecated(). - AddParamBody(listExample[0], "PeeringTrustedNode", "Info of the peer to trust.", true). - AddResponse(http.StatusOK, "Trusted peer info.", listExample[0], nil). - SetSummary("Trust the specified peer.") - - adm.DELETE(routes.PeeringTrustedDelete(":pubKey"), p.handlePeeringTrustedDelete). - SetDeprecated(). - AddParamPath(listExample[0].PubKey, "pubKey", "Public key of the trusted peer (hex)."). - SetSummary("Distrust the specified peer.") -} - -func (p *peeringService) handlePeeringSelfGet(c echo.Context) error { - resp := model.PeeringTrustedNode{ - PubKey: iotago.EncodeHex(p.network.Self().PubKey().AsBytes()), - NetID: p.network.Self().NetID(), - } - return c.JSON(http.StatusOK, resp) -} - -func (p *peeringService) handlePeeringGetStatus(c echo.Context) error { - peeringStatus := p.network.PeerStatus() - - peers := make([]model.PeeringNodeStatus, len(peeringStatus)) - - for k, v := range peeringStatus { - peers[k] = model.PeeringNodeStatus{ - PubKey: iotago.EncodeHex(v.PubKey().AsBytes()), - NetID: v.NetID(), - IsAlive: v.IsAlive(), - NumUsers: v.NumUsers(), - } - } - - return c.JSON(http.StatusOK, peers) -} - -func (p *peeringService) handlePeeringTrustedList(c echo.Context) error { - trustedPeers, err := p.networkMgr.TrustedPeers() - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - response := make([]*model.PeeringTrustedNode, len(trustedPeers)) - for i := range trustedPeers { - response[i] = model.NewPeeringTrustedNode(trustedPeers[i]) - } - return c.JSON(http.StatusOK, response) -} - -func (p *peeringService) handlePeeringTrustedPut(c echo.Context) error { - var err error - pubKeyStr := c.Param("pubKey") - req := model.PeeringTrustedNode{} - if err = c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body.") - } - if req.PubKey == "" { - req.PubKey = pubKeyStr - } - if req.PubKey != pubKeyStr { - return httperrors.BadRequest("Pub keys do not match.") - } - pubKey, err := cryptolib.NewPublicKeyFromString(req.PubKey) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - tp, err := p.networkMgr.TrustPeer(pubKey, req.NetID) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - return c.JSON(http.StatusOK, model.NewPeeringTrustedNode(tp)) -} - -func (p *peeringService) handlePeeringTrustedPost(c echo.Context) error { - var err error - req := model.PeeringTrustedNode{} - if err = c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body.") - } - pubKey, err := cryptolib.NewPublicKeyFromString(req.PubKey) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - tp, err := p.networkMgr.TrustPeer(pubKey, req.NetID) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - return c.JSON(http.StatusOK, model.NewPeeringTrustedNode(tp)) -} - -func (p *peeringService) handlePeeringTrustedGet(c echo.Context) error { - var err error - pubKeyStr := c.Param("pubKey") - pubKey, err := cryptolib.NewPublicKeyFromString(pubKeyStr) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - tps, err := p.networkMgr.TrustedPeers() - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - for _, tp := range tps { - if tp.PubKey().Equals(pubKey) { - return c.JSON(http.StatusOK, model.NewPeeringTrustedNode(tp)) - } - } - return httperrors.NotFound("peer not trusted") -} - -func (p *peeringService) handlePeeringTrustedDelete(c echo.Context) error { - var err error - pubKeyStr := c.Param("pubKey") - pubKey, err := cryptolib.NewPublicKeyFromString(pubKeyStr) - if err != nil { - return httperrors.BadRequest(err.Error()) - } - tp, err := p.networkMgr.DistrustPeer(pubKey) - if err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err) - } - if tp == nil { - return c.NoContent(http.StatusOK) - } - // remove any access nodes for the distrusted peer - chainRecs, err := p.chainRecordRegistryProvider.ChainRecords() - if err != nil { - return httperrors.ServerError("Peer trust removed, but errored when trying to get chain list from registry") - } - chainRecsToModify := lo.Filter(chainRecs, func(r *registry.ChainRecord, _ int) bool { - return lo.ContainsBy(r.AccessNodes, func(p *cryptolib.PublicKey) bool { - return p.Equals(pubKey) - }) - }) - for _, r := range chainRecsToModify { - _, err = p.chainRecordRegistryProvider.UpdateChainRecord(r.ID(), func(rec *registry.ChainRecord) bool { - return rec.RemoveAccessNode(pubKey) - }) - if err != nil { - return httperrors.ServerError(fmt.Sprintf("Peer trust removed, but errored when trying to save chain record %s", r.ChainID())) - } - } - return c.JSON(http.StatusOK, model.NewPeeringTrustedNode(tp)) -} diff --git a/packages/webapi/v1/admapi/shutdown.go b/packages/webapi/v1/admapi/shutdown.go deleted file mode 100644 index 23bd35e33e..0000000000 --- a/packages/webapi/v1/admapi/shutdown.go +++ /dev/null @@ -1,32 +0,0 @@ -package admapi - -import ( - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type ShutdownFunc func() - -type shutdownService struct { - shutdownFunc ShutdownFunc -} - -func addShutdownEndpoint(adm echoswagger.ApiGroup, shutdown ShutdownFunc) { - s := &shutdownService{shutdown} - - adm.GET(routes.Shutdown(), s.handleShutdown). - SetDeprecated(). - SetSummary("Shut down the node") -} - -// handleShutdown gracefully shuts down the server. -// This endpoint is needed for integration tests, because shutting down via an interrupt -// signal does not work on Windows. -func (s *shutdownService) handleShutdown(c echo.Context) error { - s.shutdownFunc() - return c.String(http.StatusOK, "Shutting down...") -} diff --git a/packages/webapi/v1/endpoints.go b/packages/webapi/v1/endpoints.go deleted file mode 100644 index 78d5193378..0000000000 --- a/packages/webapi/v1/endpoints.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package v1 - -import ( - "time" - - "github.com/pangpanglabs/echoswagger/v2" - - loggerpkg "github.com/iotaledger/hive.go/core/logger" - "github.com/iotaledger/wasp/packages/authentication" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/dkg" - "github.com/iotaledger/wasp/packages/metrics/nodeconnmetrics" - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/packages/users" - "github.com/iotaledger/wasp/packages/webapi/v1/admapi" - "github.com/iotaledger/wasp/packages/webapi/v1/evm" - "github.com/iotaledger/wasp/packages/webapi/v1/info" - "github.com/iotaledger/wasp/packages/webapi/v1/reqstatus" - "github.com/iotaledger/wasp/packages/webapi/v1/request" - "github.com/iotaledger/wasp/packages/webapi/v1/state" -) - -func Init( - logger *loggerpkg.Logger, - server echoswagger.ApiRoot, - waspVersion string, - network peering.NetworkProvider, - tnm peering.TrustedNetworkManager, - userManager *users.UserManager, - chainRecordRegistryProvider registry.ChainRecordRegistryProvider, - dkShareRegistryProvider registry.DKShareRegistryProvider, - nodeIdentityProvider registry.NodeIdentityProvider, - chainsProvider chains.Provider, - dkgNodeProvider dkg.NodeProvider, - shutdownFunc admapi.ShutdownFunc, - nodeConnectionMetrics nodeconnmetrics.NodeConnectionMetrics, - authConfig authentication.AuthConfiguration, - nodeOwnerAddresses []string, - apiCacheTTL time.Duration, - publisherPort int, -) { - pub := server.Group("public", "").SetDescription("Public endpoints") - addWebSocketEndpoint(pub, logger) - - info.AddEndpoints(pub, waspVersion, network, publisherPort) - reqstatus.AddEndpoints(pub, chainsProvider.ChainProvider()) - state.AddEndpoints(pub, chainsProvider) - evm.AddEndpoints(pub, chainsProvider, network.Self().PubKey) - request.AddEndpoints( - pub, - chainsProvider.ChainProvider(), - network.Self().PubKey(), - apiCacheTTL, - ) - - adm := server.Group("admin", "").SetDescription("Admin endpoints") - - admapi.AddEndpoints( - adm, - network, - tnm, - userManager, - chainRecordRegistryProvider, - dkShareRegistryProvider, - nodeIdentityProvider, - chainsProvider, - dkgNodeProvider, - shutdownFunc, - nodeConnectionMetrics, - authConfig, - nodeOwnerAddresses, - ) - - logger.Infof("added web api endpoints") -} diff --git a/packages/webapi/v1/evm/jsonrpc.go b/packages/webapi/v1/evm/jsonrpc.go deleted file mode 100644 index d1f373bbcf..0000000000 --- a/packages/webapi/v1/evm/jsonrpc.go +++ /dev/null @@ -1,126 +0,0 @@ -package evm - -import ( - "errors" - "fmt" - "net/http" - "sync" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc" - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/evm/evmtypes" - "github.com/iotaledger/wasp/packages/evm/jsonrpc" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/packages/vm/core/evm" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type jsonRPCService struct { - chains chains.Provider - nodePubKey func() *cryptolib.PublicKey - chainServers map[isc.ChainID]*chainServer - chainServersMutex sync.Mutex -} - -type chainServer struct { - backend *jsonrpc.WaspEVMBackend - rpc *rpc.Server -} - -func AddEndpoints(server echoswagger.ApiGroup, allChains chains.Provider, nodePubKey func() *cryptolib.PublicKey) { - j := &jsonRPCService{ - chains: allChains, - nodePubKey: nodePubKey, - chainServers: make(map[isc.ChainID]*chainServer), - } - server.EchoGroup().Any(routes.EVMJSONRPC(":chainID"), j.handleJSONRPC) - - reqid := model.NewRequestID(isc.NewRequestID(iotago.TransactionID{}, 0)) - - server.GET(routes.RequestIDByEVMTransactionHash(":chainID", ":txHash"), j.handleRequestID). - SetDeprecated(). - SetSummary("Get the ISC request ID for the given Ethereum transaction hash"). - AddParamPath("", "chainID", "ChainID (bech32-encoded)"). - AddParamPath("", "txHash", "Transaction hash (hex-encoded)"). - AddResponse(http.StatusOK, "Request ID", "", nil). - AddResponse(http.StatusNotFound, "Request ID not found", reqid, nil) -} - -func (j *jsonRPCService) getChainServer(c echo.Context) (*chainServer, error) { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return nil, httperrors.BadRequest(fmt.Sprintf("Invalid chain ID: %+v", c.Param("chainID"))) - } - - j.chainServersMutex.Lock() - defer j.chainServersMutex.Unlock() - - if j.chainServers[chainID] == nil { - chain := j.chains().Get(chainID) - if chain == nil { - return nil, httperrors.NotFound(fmt.Sprintf("Chain not found: %+v", c.Param("chainID"))) - } - - nodePubKey := j.nodePubKey() - if nodePubKey == nil { - return nil, errors.New("node is not authenticated") - } - - backend := jsonrpc.NewWaspEVMBackend(chain, nodePubKey, parameters.L1().BaseToken) - - var evmChainID uint16 - { - r, err := backend.ISCCallView(backend.ISCLatestState(), evm.Contract.Name, evm.FuncGetChainID.Name, nil) - if err != nil { - return nil, err - } - evmChainID, err = evmtypes.DecodeChainID(r.MustGet(evm.FieldResult)) - if err != nil { - return nil, err - } - } - - j.chainServers[chainID] = &chainServer{ - backend: backend, - rpc: jsonrpc.NewServer( - jsonrpc.NewEVMChain(backend, evmChainID), - jsonrpc.NewAccountManager(nil), - ), - } - } - - return j.chainServers[chainID], nil -} - -func (j *jsonRPCService) handleJSONRPC(c echo.Context) error { - server, err := j.getChainServer(c) - if err != nil { - return err - } - server.rpc.ServeHTTP(c.Response(), c.Request()) - return nil -} - -func (j *jsonRPCService) handleRequestID(c echo.Context) error { - server, err := j.getChainServer(c) - if err != nil { - return err - } - - txHash := common.HexToHash(c.Param("txHash")) - - reqID, ok := server.backend.RequestIDByTransactionHash(txHash) - if !ok { - return httperrors.NotFound("not found") - } - return c.JSON(http.StatusOK, model.NewRequestID(reqID)) -} diff --git a/packages/webapi/v1/httperrors/errorhandler.go b/packages/webapi/v1/httperrors/errorhandler.go deleted file mode 100644 index aa8e73906a..0000000000 --- a/packages/webapi/v1/httperrors/errorhandler.go +++ /dev/null @@ -1,23 +0,0 @@ -package httperrors - -import ( - "net/http" - - "github.com/labstack/echo/v4" -) - -// HTTPErrorHandler must be hooked to an echo server to render instances -// of HTTPError as JSON -func HTTPErrorHandler(err error, c echo.Context) { - he, ok := err.(*HTTPError) - if ok { - if !c.Response().Committed { - if c.Request().Method == http.MethodHead { // Issue #608 - err = c.NoContent(he.Code) - } else { - err = c.JSON(he.Code, he) - } - } - } - c.Echo().DefaultHTTPErrorHandler(err, c) -} diff --git a/packages/webapi/v1/httperrors/errors.go b/packages/webapi/v1/httperrors/errors.go deleted file mode 100644 index 4288fd26c6..0000000000 --- a/packages/webapi/v1/httperrors/errors.go +++ /dev/null @@ -1,37 +0,0 @@ -package httperrors - -import ( - "net/http" -) - -// HTTPError implements the Go error interface, and includes an HTTP response code. -// Any webapi endpoint can return an instance of HTTPError, and it will be rendered -// as JSON in the response. -type HTTPError struct { - Code int - Message string -} - -func (he *HTTPError) Error() string { - return he.Message -} - -func BadRequest(message string) *HTTPError { - return &HTTPError{Code: http.StatusBadRequest, Message: message} -} - -func NotFound(message string) *HTTPError { - return &HTTPError{Code: http.StatusNotFound, Message: message} -} - -func Conflict(message string) *HTTPError { - return &HTTPError{Code: http.StatusConflict, Message: message} -} - -func Timeout(message string) *HTTPError { - return &HTTPError{Code: http.StatusRequestTimeout, Message: message} -} - -func ServerError(message string) *HTTPError { - return &HTTPError{Code: http.StatusInternalServerError, Message: message} -} diff --git a/packages/webapi/v1/info/info.go b/packages/webapi/v1/info/info.go deleted file mode 100644 index db3bba96c4..0000000000 --- a/packages/webapi/v1/info/info.go +++ /dev/null @@ -1,39 +0,0 @@ -package info - -import ( - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type infoService struct { - waspVersion string - network peering.NetworkProvider - publisherPort int -} - -func AddEndpoints(server echoswagger.ApiRouter, waspVersion string, network peering.NetworkProvider, publisherPort int) { - s := &infoService{ - waspVersion: waspVersion, - network: network, - publisherPort: publisherPort, - } - - server.GET(routes.Info(), s.handleInfo). - SetDeprecated(). - SetSummary("Get information about the node"). - AddResponse(http.StatusOK, "Node properties", model.InfoResponse{}, nil) -} - -func (s *infoService) handleInfo(c echo.Context) error { - return c.JSON(http.StatusOK, model.InfoResponse{ - Version: s.waspVersion, - NetworkID: s.network.Self().NetID(), - PublisherPort: s.publisherPort, - }) -} diff --git a/packages/webapi/v1/model/address.go b/packages/webapi/v1/model/address.go deleted file mode 100644 index 9711b33281..0000000000 --- a/packages/webapi/v1/model/address.go +++ /dev/null @@ -1,42 +0,0 @@ -package model - -import ( - "encoding/json" - "fmt" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/parameters" -) - -// Address is the string representation of iotago.Address -type Address string - -func NewAddress(address iotago.Address) Address { - return Address(address.Bech32(parameters.L1().Protocol.Bech32HRP)) -} - -func (a Address) MarshalJSON() ([]byte, error) { - return json.Marshal(string(a)) -} - -func (a *Address) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - _, _, err := iotago.ParseBech32(s) - if err != nil { - *a = Address("") - return fmt.Errorf("input: %s, %w", s, err) - } - *a = Address(s) - return nil -} - -func (a Address) Address() iotago.Address { - _, addr, err := iotago.ParseBech32(string(a)) - if err != nil { - panic(err) - } - return addr -} diff --git a/packages/webapi/v1/model/blob.go b/packages/webapi/v1/model/blob.go deleted file mode 100644 index a9e9c729ae..0000000000 --- a/packages/webapi/v1/model/blob.go +++ /dev/null @@ -1,20 +0,0 @@ -package model - -import "github.com/iotaledger/wasp/packages/hashing" - -type BlobData struct { - Data Bytes `swagger:"desc(Blob content (base64))"` -} - -func NewBlobData(data []byte) *BlobData { - return &BlobData{Data: NewBytes(data)} -} - -type BlobInfo struct { - Exists bool `json:"exists" swagger:"desc(Whether or not the blob exists in the registry)"` - Hash HashValue `json:"hash" swagger:"desc(Hash of the blob)"` -} - -func NewBlobInfo(exists bool, hash hashing.HashValue) *BlobInfo { - return &BlobInfo{Exists: exists, Hash: NewHashValue(hash)} -} diff --git a/packages/webapi/v1/model/bytes.go b/packages/webapi/v1/model/bytes.go deleted file mode 100644 index 129dad3a37..0000000000 --- a/packages/webapi/v1/model/bytes.go +++ /dev/null @@ -1,45 +0,0 @@ -package model - -import ( - "encoding/base64" - "encoding/json" -) - -// Bytes is the base64 representation of a byte slice. -// It is intended to be a replacement for any []byte attribute in JSON models. -// Normally it shouldn't be necessary since the standard json package already -// handles []byte data, but this makes sure that the swagger documentation -// shows examples correctly (instead of as if a []byte was json-encoded as an -// array of ints). -type Bytes string - -func NewBytes(data []byte) Bytes { - return Bytes(base64.StdEncoding.EncodeToString(data)) -} - -func (b Bytes) MarshalJSON() ([]byte, error) { - return json.Marshal(string(b)) -} - -func (b *Bytes) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - // verify encoding - _, err := base64.StdEncoding.DecodeString(s) - if err != nil { - return err - } - *b = Bytes(s) - return err -} - -func (b Bytes) Bytes() []byte { - data, err := base64.StdEncoding.DecodeString(string(b)) - if err != nil { - // encoding should be already verified - panic(err) - } - return data -} diff --git a/packages/webapi/v1/model/chain_info.go b/packages/webapi/v1/model/chain_info.go deleted file mode 100644 index f62aa284da..0000000000 --- a/packages/webapi/v1/model/chain_info.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package model - -type ChainInfo struct { - ChainID ChainIDBech32 `json:"chainId" swagger:"desc(ChainID bech32)"` - Active bool `json:"active" swagger:"desc(Whether or not the chain is active)"` - StateAddress *Address `json:"stateAddress" swagger:"desc(State address, if we are part of it.)"` - CommitteeNodes []*ChainNodeStatus `json:"committeeNodes" swagger:"desc(Committee nodes and their peering info.)"` - AccessNodes []*ChainNodeStatus `json:"accessNodes" swagger:"desc(Access nodes and their peering info.)"` - CandidateNodes []*ChainNodeStatus `json:"candidateNodes" swagger:"desc(Candidate nodes and their peering info.)"` -} - -type ChainNodeStatus struct { - Node PeeringNodeStatus - ForCommittee bool - ForAccess bool - AccessAPI string -} diff --git a/packages/webapi/v1/model/chain_record.go b/packages/webapi/v1/model/chain_record.go deleted file mode 100644 index 8043b68a62..0000000000 --- a/packages/webapi/v1/model/chain_record.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package model - -import ( - "github.com/samber/lo" - - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/registry" -) - -type ChainRecord struct { - ChainID ChainIDBech32 `json:"chainId" swagger:"desc(ChainID (bech32))"` - Active bool `json:"active" swagger:"desc(Whether or not the chain is active)"` - AccessNodes []string `json:"accessNodes" swagger:"desc(list of access nodes public keys, hex encoded)"` -} - -func NewChainRecord(rec *registry.ChainRecord) *ChainRecord { - chainID := rec.ChainID() - return &ChainRecord{ - ChainID: NewChainIDBech32(chainID), - Active: rec.Active, - AccessNodes: lo.Map(rec.AccessNodes, func(accessNode *cryptolib.PublicKey, _ int) string { - return accessNode.String() - }), - } -} - -func (bd *ChainRecord) Record() (*registry.ChainRecord, error) { - accessNodes := make([]*cryptolib.PublicKey, len(bd.AccessNodes)) - - for i, pubKeyStr := range bd.AccessNodes { - pubKey, err := cryptolib.NewPublicKeyFromString(pubKeyStr) - if err != nil { - return nil, err - } - accessNodes[i] = pubKey - } - rec := registry.NewChainRecord(bd.ChainID.ChainID(), bd.Active, accessNodes) - return rec, nil -} diff --git a/packages/webapi/v1/model/chainid.go b/packages/webapi/v1/model/chainid.go deleted file mode 100644 index dcc75c0b71..0000000000 --- a/packages/webapi/v1/model/chainid.go +++ /dev/null @@ -1,41 +0,0 @@ -package model - -import ( - "encoding/json" - "fmt" - - "github.com/iotaledger/wasp/packages/isc" -) - -// ChainIDBech32 is the string representation of isc.ChainIDBech32 (bech32) -type ChainIDBech32 string - -func NewChainIDBech32(chainID isc.ChainID) ChainIDBech32 { - return ChainIDBech32(chainID.String()) -} - -func (ch ChainIDBech32) MarshalJSON() ([]byte, error) { - return json.Marshal(string(ch)) -} - -func (ch *ChainIDBech32) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - _, err := isc.ChainIDFromString(s) - if err != nil { - *ch = ChainIDBech32("") - return fmt.Errorf("input: %s, %w", s, err) - } - *ch = ChainIDBech32(s) - return nil -} - -func (ch ChainIDBech32) ChainID() isc.ChainID { - chainID, err := isc.ChainIDFromString(string(ch)) - if err != nil { - panic(err) - } - return chainID -} diff --git a/packages/webapi/v1/model/consensus_metrics.go b/packages/webapi/v1/model/consensus_metrics.go deleted file mode 100644 index c21afc4e8c..0000000000 --- a/packages/webapi/v1/model/consensus_metrics.go +++ /dev/null @@ -1,36 +0,0 @@ -package model - -import ( - "time" -) - -type ConsensusWorkflowStatus struct { - FlagStateReceived bool `json:"flagStateReceived" swagger:"desc(Shows if state output is received in current consensus iteration)"` - FlagBatchProposalSent bool `json:"flagBatchProposalSent" swagger:"desc(Shows if batch proposal is sent out in current consensus iteration)"` - FlagConsensusBatchKnown bool `json:"flagConsensusBatchKnown" swagger:"desc(Shows if consensus on batch is reached and known in current consensus iteration)"` - FlagVMStarted bool `json:"flagVMStarted" swagger:"desc(Shows if virtual machine is started in current consensus iteration)"` - FlagVMResultSigned bool `json:"flagVMResultSigned" swagger:"desc(Shows if virtual machine has returned its results in current consensus iteration)"` - FlagTransactionFinalized bool `json:"flagTransactionFinalized" swagger:"desc(Shows if consensus on transaction is reached in current consensus iteration)"` - FlagTransactionPosted bool `json:"flagTransactionPosted" swagger:"desc(Shows if transaction is posted to L1 in current consensus iteration)"` - FlagTransactionSeen bool `json:"flagTransactionSeen" swagger:"desc(Shows if L1 reported that it has seen the transaction of current consensus iteration)"` - FlagInProgress bool `json:"flagInProgress" swagger:"desc(Shows if consensus algorithm is still not completed in current consensus iteration)"` - - TimeBatchProposalSent time.Time `json:"timeBatchProposalSent" swagger:"desc(Shows when batch proposal was last sent out in current consensus iteration)"` - TimeConsensusBatchKnown time.Time `json:"timeConsensusBatchKnown" swagger:"desc(Shows when ACS results of consensus on batch was last received in current consensus iteration)"` - TimeVMStarted time.Time `json:"timeVMStarted" swagger:"desc(Shows when virtual machine was last started in current consensus iteration)"` - TimeVMResultSigned time.Time `json:"timeVMResultSigned" swagger:"desc(Shows when virtual machine results were last received and signed in current consensus iteration)"` - TimeTransactionFinalized time.Time `json:"timeTransactionFinalized" swagger:"desc(Shows when algorithm last noted that all the data for consensus on transaction had been received in current consensus iteration)"` - TimeTransactionPosted time.Time `json:"timeTransactionPosted" swagger:"desc(Shows when transaction was last posted to L1 in current consensus iteration)"` - TimeTransactionSeen time.Time `json:"timeTransactionSeen" swagger:"desc(Shows when algorithm last noted that transaction hadd been seen by L1 in current consensus iteration)"` - TimeCompleted time.Time `json:"timeCompleted" swagger:"desc(Shows when algorithm was last completed in current consensus iteration)"` - - CurrentStateIndex uint32 `json:"currentStateIndex" swagger:"desc(Shows current state index of the consensus)"` -} - -type ConsensusPipeMetrics struct { - EventStateTransitionMsgPipeSize int - EventPeerLogIndexMsgPipeSize int - EventACSMsgPipeSize int - EventVMResultMsgPipeSize int - EventTimerMsgPipeSize int -} diff --git a/packages/webapi/v1/model/dkshares.go b/packages/webapi/v1/model/dkshares.go deleted file mode 100644 index 4e8388360b..0000000000 --- a/packages/webapi/v1/model/dkshares.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package model - -// DKSharesPostRequest is a POST request for creating new DKShare. -type DKSharesPostRequest struct { - PeerPubKeys []string `json:"peerPubKeys" swagger:"desc(Optional, base64 encoded public keys of the peers generating the DKS.)"` - Threshold uint16 `json:"threshold" swagger:"desc(Should be =< len(PeerPubKeys))"` - TimeoutMS uint32 `json:"timeoutMS" swagger:"desc(Timeout in milliseconds.)"` -} - -// DKSharesInfo stands for the DKShare representation, returned by the GET and POST methods. -type DKSharesInfo struct { - Address string `json:"address" swagger:"desc(New generated shared address.)"` - SharedPubKey string `json:"sharedPubKey" swagger:"desc(Shared public key (base64-encoded).)"` - PubKeyShares []string `json:"pubKeyShares" swagger:"desc(Public key shares for all the peers (base64-encoded).)"` - PeerPubKeys []string `json:"peerPubKeys" swagger:"desc(Public keys of the nodes sharing the key (base64-encoded).)"` - Threshold uint16 `json:"threshold"` - PeerIndex *uint16 `json:"peerIndex" swagger:"desc(Index of the node returning the share, if it is a member of the sharing group.)"` -} diff --git a/packages/webapi/v1/model/hash.go b/packages/webapi/v1/model/hash.go deleted file mode 100644 index c90ccca512..0000000000 --- a/packages/webapi/v1/model/hash.go +++ /dev/null @@ -1,41 +0,0 @@ -package model - -import ( - "encoding/json" - - "github.com/iotaledger/wasp/packages/hashing" -) - -// HashValue is the hex representation of a hashing.HashValue -type HashValue string - -func NewHashValue(h hashing.HashValue) HashValue { - return HashValue(h.String()) -} - -func (h HashValue) MarshalJSON() ([]byte, error) { - return json.Marshal(string(h)) -} - -func (h *HashValue) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - // verify encoding - _, err := hashing.HashValueFromHex(s) - if err != nil { - return err - } - *h = HashValue(s) - return nil -} - -func (h HashValue) HashValue() hashing.HashValue { - r, err := hashing.HashValueFromHex(string(h)) - if err != nil { - // encoding should be already verified - panic(err) - } - return r -} diff --git a/packages/webapi/v1/model/httperror.go b/packages/webapi/v1/model/httperror.go deleted file mode 100644 index fea47be998..0000000000 --- a/packages/webapi/v1/model/httperror.go +++ /dev/null @@ -1,34 +0,0 @@ -package model - -import ( - "errors" - "fmt" - "net/http" -) - -// HTTPError is the standard error response for all webapi endpoints, and also implements -// the Go error interface. -type HTTPError struct { - // StatusCode is the associated HTTP status code (default: htttp.StatusInternalServerError) - StatusCode int - - // Message is the error message - Message string -} - -// NewHTTPError creates a new HTTPError -func NewHTTPError(statusCode int, message string) *HTTPError { - return &HTTPError{Message: message, StatusCode: statusCode} -} - -// Error implements the Go error interface -func (e *HTTPError) Error() string { - return fmt.Sprintf("%d: %s", e.StatusCode, e.Message) -} - -// IsHTTPNotFound returns true if the error is an HTTPError with status code http.StatusNotFound -func IsHTTPNotFound(e error) bool { - var he *HTTPError - ok := errors.As(e, &he) - return ok && he.StatusCode == http.StatusNotFound -} diff --git a/packages/webapi/v1/model/info.go b/packages/webapi/v1/model/info.go deleted file mode 100644 index 79e851f386..0000000000 --- a/packages/webapi/v1/model/info.go +++ /dev/null @@ -1,7 +0,0 @@ -package model - -type InfoResponse struct { - Version string `json:"version" swagger:"desc(Wasp version)"` - NetworkID string `json:"networkId" swagger:"desc('hostname:port'; uniquely identifies the node)"` - PublisherPort int `json:"publisherPort" swagger:"desc(Nanomsg port that exposes publisher messages)"` -} diff --git a/packages/webapi/v1/model/node_connection_metrics.go b/packages/webapi/v1/model/node_connection_metrics.go deleted file mode 100644 index 96cde05c1e..0000000000 --- a/packages/webapi/v1/model/node_connection_metrics.go +++ /dev/null @@ -1,71 +0,0 @@ -package model - -import ( - "fmt" - "time" - - "github.com/iotaledger/wasp/packages/metrics/nodeconnmetrics" -) - -type NodeConnectionMessageMetrics struct { - Total uint32 `json:"total" swagger:"desc(Total number of messages sent/received)"` - LastEvent time.Time `json:"lastEvent" swagger:"desc(Last time the message was sent/received)"` - LastMessage string `json:"lastMessage" swagger:"desc(The print out of the last message)"` -} - -type NodeConnectionMessagesMetrics struct { - OutPublishStateTransaction *NodeConnectionMessageMetrics `json:"outPublishStateTransaction" swagger:"desc(Stats of sent out PublishStateTransaction messages)"` - OutPublishGovernanceTransaction *NodeConnectionMessageMetrics `json:"outPublishGovernanceTransaction" swagger:"desc(Stats of sent out PublishGovernanceTransaction messages)"` - OutPullLatestOutput *NodeConnectionMessageMetrics `json:"outPullLatestOutput" swagger:"desc(Stats of sent out PullLatestOutput messages)"` - OutPullTxInclusionState *NodeConnectionMessageMetrics `json:"outPullTxInclusionState" swagger:"desc(Stats of sent out PullTxInclusionState messages)"` - OutPullOutputByID *NodeConnectionMessageMetrics `json:"outPullOutputByID" swagger:"desc(Stats of sent out PullOutputByID messages)"` - InStateOutput *NodeConnectionMessageMetrics `json:"inStateOutput" swagger:"desc(Stats of received State output messages)"` - InAliasOutput *NodeConnectionMessageMetrics `json:"inAliasOutput" swagger:"desc(Stats of received AliasOutput messages)"` - InOutput *NodeConnectionMessageMetrics `json:"inOutput" swagger:"desc(Stats of received Output messages)"` - InOnLedgerRequest *NodeConnectionMessageMetrics `json:"inOnLedgerRequest" swagger:"desc(Stats of received OnLedgerRequest messages)"` - InTxInclusionState *NodeConnectionMessageMetrics `json:"inTxInclusionState" swagger:"desc(Stats of received TxInclusionState messages)"` -} - -type NodeConnectionMetrics struct { - NodeConnectionMessagesMetrics `json:"nodeConnectionMessagesMetrics"` - InMilestone *NodeConnectionMessageMetrics `json:"inMilestone" swagger:"desc(Stats of received Milestone messages)"` - Registered []ChainIDBech32 `json:"registered" swagger:"desc(Chain IDs of the chains registered to receiving L1 events)"` -} - -func NewNodeConnectionMetrics(metrics nodeconnmetrics.NodeConnectionMetrics) *NodeConnectionMetrics { - ncmm := NewNodeConnectionMessagesMetrics(metrics) - registered := metrics.GetRegistered() - r := make([]ChainIDBech32, len(registered)) - for i := range r { - r[i] = NewChainIDBech32(registered[i]) - } - return &NodeConnectionMetrics{ - NodeConnectionMessagesMetrics: *ncmm, - InMilestone: NewNodeConnectionMessageMetrics(metrics.GetInMilestone()), - Registered: r, - } -} - -func NewNodeConnectionMessagesMetrics(metrics nodeconnmetrics.NodeConnectionMessagesMetrics) *NodeConnectionMessagesMetrics { - return &NodeConnectionMessagesMetrics{ - OutPublishStateTransaction: NewNodeConnectionMessageMetrics(metrics.GetOutPublishStateTransaction()), - OutPublishGovernanceTransaction: NewNodeConnectionMessageMetrics(metrics.GetOutPublishGovernanceTransaction()), - OutPullLatestOutput: NewNodeConnectionMessageMetrics(metrics.GetOutPullLatestOutput()), - OutPullTxInclusionState: NewNodeConnectionMessageMetrics(metrics.GetOutPullTxInclusionState()), - OutPullOutputByID: NewNodeConnectionMessageMetrics(metrics.GetOutPullOutputByID()), - - InStateOutput: NewNodeConnectionMessageMetrics(metrics.GetInStateOutput()), - InAliasOutput: NewNodeConnectionMessageMetrics(metrics.GetInAliasOutput()), - InOutput: NewNodeConnectionMessageMetrics(metrics.GetInOutput()), - InOnLedgerRequest: NewNodeConnectionMessageMetrics(metrics.GetInOnLedgerRequest()), - InTxInclusionState: NewNodeConnectionMessageMetrics(metrics.GetInTxInclusionState()), - } -} - -func NewNodeConnectionMessageMetrics[T any](metrics nodeconnmetrics.NodeConnectionMessageMetrics[T]) *NodeConnectionMessageMetrics { - return &NodeConnectionMessageMetrics{ - Total: metrics.GetMessageTotal(), - LastEvent: metrics.GetLastEvent(), - LastMessage: fmt.Sprintf("%v", metrics.GetLastMessage()), - } -} diff --git a/packages/webapi/v1/model/node_owner_certificate.go b/packages/webapi/v1/model/node_owner_certificate.go deleted file mode 100644 index 8ee4416c40..0000000000 --- a/packages/webapi/v1/model/node_owner_certificate.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package model - -type NodeOwnerCertificateRequest struct { - NodePubKey Bytes `json:"nodePubKey" swagger:"desc(Node pub key. (base64))"` - OwnerAddress Address `json:"ownerAddress" swagger:"desc(Node owner address. (bech32))"` -} - -type NodeOwnerCertificateResponse struct { - Certificate Bytes `json:"certificate" swagger:"desc(Certificate stating the ownership. (base64))"` -} diff --git a/packages/webapi/v1/model/offledger_request.go b/packages/webapi/v1/model/offledger_request.go deleted file mode 100644 index f0d342e92a..0000000000 --- a/packages/webapi/v1/model/offledger_request.go +++ /dev/null @@ -1,5 +0,0 @@ -package model - -type OffLedgerRequestBody struct { - Request Bytes `json:"request" swagger:"desc(Offledger Request (base64))"` -} diff --git a/packages/webapi/v1/model/peering.go b/packages/webapi/v1/model/peering.go deleted file mode 100644 index f72e02fb79..0000000000 --- a/packages/webapi/v1/model/peering.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package model - -import ( - "github.com/iotaledger/wasp/packages/peering" -) - -// PeeringTrustedNode describes single node in the list of trusted peering nodes. -type PeeringTrustedNode struct { - PubKey string `json:"pubKey" swagger:"desc(Public key of the NetID.)"` - NetID string `json:"netId" swagger:"desc(NetID of a peer to trust.)"` -} - -func NewPeeringTrustedNode(tp *peering.TrustedPeer) *PeeringTrustedNode { - return &PeeringTrustedNode{ - PubKey: tp.PubKey().String(), - NetID: tp.NetID, - } -} - -type PeeringNodeStatus struct { - PubKey string - NetID string - IsAlive bool - NumUsers int -} diff --git a/packages/webapi/v1/model/reqstatus.go b/packages/webapi/v1/model/reqstatus.go deleted file mode 100644 index f77fc3de59..0000000000 --- a/packages/webapi/v1/model/reqstatus.go +++ /dev/null @@ -1,15 +0,0 @@ -package model - -import ( - "time" -) - -type WaitRequestProcessedParams struct { - Timeout time.Duration `json:"timeout" swagger:"desc(Timeout in nanoseconds),default(30 seconds)"` -} - -type RequestReceiptResponse struct { - Receipt string `json:"receipt" swagger:"desc(Request receipt, empty if request was not processed)"` -} - -const WaitRequestProcessedDefaultTimeout = 30 * time.Second diff --git a/packages/webapi/v1/model/requestid.go b/packages/webapi/v1/model/requestid.go deleted file mode 100644 index b364d2560e..0000000000 --- a/packages/webapi/v1/model/requestid.go +++ /dev/null @@ -1,36 +0,0 @@ -package model - -import ( - "encoding/json" - - "github.com/iotaledger/wasp/packages/isc" -) - -// RequestID is the string representation of isc.RequestID -type RequestID string - -func NewRequestID(reqID isc.RequestID) RequestID { - return RequestID(reqID.String()) -} - -func (r RequestID) MarshalJSON() ([]byte, error) { - return json.Marshal(string(r)) -} - -func (r *RequestID) UnmarshalJSON(b []byte) error { - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - *r = RequestID(s) - _, err := isc.RequestIDFromString(s) - return err -} - -func (r RequestID) RequestID() isc.RequestID { - reqID, err := isc.RequestIDFromString(string(r)) - if err != nil { - panic(err) - } - return reqID -} diff --git a/packages/webapi/v1/reqstatus/reqstatus.go b/packages/webapi/v1/reqstatus/reqstatus.go deleted file mode 100644 index 37ca07a25f..0000000000 --- a/packages/webapi/v1/reqstatus/reqstatus.go +++ /dev/null @@ -1,155 +0,0 @@ -package reqstatus - -import ( - "encoding/json" - "fmt" - "net/http" - "time" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/chainutil" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type reqstatusWebAPI struct { - getChain func(chainID isc.ChainID) chain.Chain - getReceiptFromBlocklog func(ch chain.Chain, reqID isc.RequestID) (*blocklog.RequestReceipt, error) - resolveReceipt func(c echo.Context, ch chain.Chain, rec *blocklog.RequestReceipt) error -} - -// TODO add examples for receipt json -func AddEndpoints(server echoswagger.ApiRouter, getChain chains.ChainProvider) { - r := &reqstatusWebAPI{ - getChain: getChain, - getReceiptFromBlocklog: getReceiptFromBlocklog, - resolveReceipt: resolveReceipt, - } - - server.GET(routes.RequestReceipt(":chainID", ":reqID"), r.handleRequestReceipt). - SetDeprecated(). - SetSummary("Get the processing status of a given request in the node"). - AddParamPath("", "chainID", "ChainID (bech32)"). - AddParamPath("", "reqID", "Request ID"). - AddResponse(http.StatusOK, "Request Receipt", model.RequestReceiptResponse{}, nil) - - server.GET(routes.WaitRequestProcessed(":chainID", ":reqID"), r.handleWaitRequestProcessed). - SetDeprecated(). - SetSummary("Wait until the given request has been processed by the node"). - AddParamPath("", "chainID", "ChainID (bech32)"). - AddParamPath("", "reqID", "Request ID"). - AddParamBody(model.WaitRequestProcessedParams{}, "Params", "Optional parameters", false). - AddResponse(http.StatusOK, "Request Receipt", model.RequestReceiptResponse{}, nil) -} - -func (r *reqstatusWebAPI) handleRequestReceipt(c echo.Context) error { - ch, reqID, err := r.parseParams(c) - if err != nil { - return err - } - rec, err := r.getReceiptFromBlocklog(ch, reqID) - if err != nil { - return err - } - return r.resolveReceipt(c, ch, rec) -} - -const waitRequestProcessedDefaultTimeout = 30 * time.Second - -func (r *reqstatusWebAPI) handleWaitRequestProcessed(c echo.Context) error { - ch, reqID, err := r.parseParams(c) - if err != nil { - return err - } - - req := model.WaitRequestProcessedParams{ - Timeout: waitRequestProcessedDefaultTimeout, - } - if c.Request().Header.Get("Content-Type") == "application/json" { - if err := c.Bind(&req); err != nil { - return httperrors.BadRequest("Invalid request body") - } - } - - delay := time.NewTimer(req.Timeout) - select { - case rec := <-ch.AwaitRequestProcessed(c.Request().Context(), reqID, true): - if !delay.Stop() { - // empty the channel to avoid leak - <-delay.C - } - return r.resolveReceipt(c, ch, rec) - case <-delay.C: - return httperrors.Timeout("Timeout") - } -} - -func (r *reqstatusWebAPI) parseParams(c echo.Context) (chain.Chain, isc.RequestID, error) { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return nil, isc.RequestID{}, httperrors.BadRequest(fmt.Sprintf("Invalid Chain ID %+v: %s", c.Param("chainID"), err.Error())) - } - theChain := r.getChain(chainID) - if theChain == nil { - return nil, isc.RequestID{}, httperrors.NotFound(fmt.Sprintf("Chain not found: %s", chainID.String())) - } - reqID, err := isc.RequestIDFromString(c.Param("reqID")) - if err != nil { - return nil, isc.RequestID{}, httperrors.BadRequest(fmt.Sprintf("Invalid request id %+v: %s", c.Param("reqID"), err.Error())) - } - return theChain, reqID, nil -} - -func getReceiptFromBlocklog(ch chain.Chain, reqID isc.RequestID) (*blocklog.RequestReceipt, error) { - latestState, err := ch.LatestState(chain.ActiveOrCommittedState) - if err != nil { - return nil, httperrors.ServerError("error getting latest chain state") - } - ret, err := chainutil.CallView(latestState, ch, blocklog.Contract.Hname(), blocklog.ViewGetRequestReceipt.Hname(), - dict.Dict{ - blocklog.ParamRequestID: reqID.Bytes(), - }) - if err != nil { - return nil, httperrors.ServerError("error calling get receipt view") - } - if ret == nil { - return nil, nil // not processed yet - } - binRec, err := ret.Get(blocklog.ParamRequestRecord) - if err != nil { - return nil, httperrors.ServerError("error parsing getReceipt view call result") - } - rec, err := blocklog.RequestReceiptFromBytes(binRec) - if err != nil { - return nil, httperrors.ServerError("error decoding receipt from getReceipt view call result") - } - return rec, nil -} - -func resolveReceipt(c echo.Context, ch chain.Chain, rec *blocklog.RequestReceipt) error { - if rec == nil { - return httperrors.NotFound("receipt not found") - } - resolvedReceiptErr, err := chainutil.ResolveError(ch, rec.Error) - if err != nil { - return httperrors.ServerError("error resolving receipt error") - } - iscReceipt := rec.ToISCReceipt(resolvedReceiptErr) - receiptJSON, err := json.Marshal(iscReceipt) - if err != nil { - return httperrors.ServerError("error marshaling receipt into JSON") - } - return c.JSON(http.StatusOK, - &model.RequestReceiptResponse{ - Receipt: string(receiptJSON), - }, - ) -} diff --git a/packages/webapi/v1/reqstatus/reqstatus_test.go b/packages/webapi/v1/reqstatus/reqstatus_test.go deleted file mode 100644 index 7c34b7ce72..0000000000 --- a/packages/webapi/v1/reqstatus/reqstatus_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package reqstatus - -import ( - "encoding/json" - "net/http" - "testing" - - "github.com/labstack/echo/v4" - "github.com/stretchr/testify/require" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" - "github.com/iotaledger/wasp/packages/webapi/v1/testutil" -) - -const foo = "foo" - -func mockedGetReceiptFromBlocklog(_ chain.Chain, id isc.RequestID) (*blocklog.RequestReceipt, error) { - req := isc.NewOffLedgerRequest( - isc.ChainID{123}, - isc.Hn("some contract"), - isc.Hn("some entrypoint"), - dict.Dict{foo: []byte("bar")}, - 42, - ).Sign(cryptolib.NewKeyPair()) - - return &blocklog.RequestReceipt{ - Request: req, - Error: &isc.UnresolvedVMError{ - ErrorCode: isc.VMErrorCode{ - ContractID: isc.Hn("error contract"), - ID: 3, - }, - Params: []interface{}{}, - Hash: 0, - }, - GasBudget: 123, - GasBurned: 10, - GasFeeCharged: 100, - BlockIndex: 111, - RequestIndex: 222, - }, nil -} - -func mockedResolveReceipt(c echo.Context, ch chain.Chain, rec *blocklog.RequestReceipt) error { - iscReceipt := rec.ToISCReceipt(nil) - receiptJSON, _ := json.Marshal(iscReceipt) - return c.JSON(http.StatusOK, - &model.RequestReceiptResponse{ - Receipt: string(receiptJSON), - }, - ) -} - -func TestRequestReceipt(t *testing.T) { - r := &reqstatusWebAPI{ - getChain: func(chainID isc.ChainID) chain.Chain { - return &testutil.MockChain{} - }, - getReceiptFromBlocklog: mockedGetReceiptFromBlocklog, - resolveReceipt: mockedResolveReceipt, - } - - chainID := isc.RandomChainID() - reqID := isc.NewRequestID(iotago.TransactionID{}, 0) - - var res model.RequestReceiptResponse - testutil.CallWebAPIRequestHandler( - t, - r.handleRequestReceipt, - http.MethodGet, - routes.RequestReceipt(":chainID", ":reqID"), - map[string]string{ - "chainID": chainID.String(), - "reqID": reqID.String(), - }, - nil, - &res, - http.StatusOK, - ) - - require.NotEmpty(t, res) -} diff --git a/packages/webapi/v1/request/request.go b/packages/webapi/v1/request/request.go deleted file mode 100644 index 39aaeb9dfc..0000000000 --- a/packages/webapi/v1/request/request.go +++ /dev/null @@ -1,138 +0,0 @@ -package request - -import ( - "fmt" - "io" - "net/http" - "strings" - "time" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/hive.go/core/marshalutil" - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/util/expiringcache" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" - "github.com/iotaledger/wasp/packages/webapi/v2/services" -) - -type ( - shouldBeProcessedFn func(ch chain.ChainCore, req isc.OffLedgerRequest) error -) - -func AddEndpoints( - server echoswagger.ApiRouter, - getChain chains.ChainProvider, - nodePubKey *cryptolib.PublicKey, - cacheTTL time.Duration, -) { - instance := &offLedgerReqAPI{ - getChain: getChain, - shouldBeProcessed: services.ShouldBeProcessed, - requestsCache: expiringcache.New(cacheTTL), - nodePubKey: nodePubKey, - } - server.POST(routes.NewRequest(":chainID"), instance.handleNewRequest). - SetDeprecated(). - SetSummary("Post an off-ledger request"). - AddParamPath("", "chainID", "chainID"). - AddParamBody( - model.OffLedgerRequestBody{Request: "base64 string"}, - "Request", - "Offledger Request encoded in base64. Optionally, the body can be the binary representation of the offledger request, but mime-type must be specified to \"application/octet-stream\"", - false). - AddResponse(http.StatusAccepted, "Request submitted", nil, nil) -} - -type offLedgerReqAPI struct { - getChain chains.ChainProvider - shouldBeProcessed shouldBeProcessedFn - requestsCache *expiringcache.ExpiringCache - nodePubKey *cryptolib.PublicKey -} - -func (o *offLedgerReqAPI) handleNewRequest(c echo.Context) error { - chainID, req, err := parseParams(c) - if err != nil { - return err - } - - reqID := req.ID() - - if o.requestsCache.Get(reqID) != nil { - return httperrors.BadRequest("request already processed") - } - o.requestsCache.Set(reqID, true) - - // check req signature - if err := req.VerifySignature(); err != nil { - o.requestsCache.Set(reqID, true) - return httperrors.BadRequest(fmt.Sprintf("could not verify: %s", err.Error())) - } - - // check req is for the correct chain - if !req.ChainID().Equals(chainID) { - // do not add to cache, it can still be sent to the correct chain - return httperrors.BadRequest("Request is for a different chain") - } - - // check chain exists - ch := o.getChain(chainID) - if ch == nil { - return httperrors.NotFound(fmt.Sprintf("Unknown chain: %s", chainID.String())) - } - - err = o.shouldBeProcessed(ch, req) - if err != nil { - return err - } - - ch.ReceiveOffLedgerRequest(req, o.nodePubKey) - - return c.NoContent(http.StatusAccepted) -} - -func parseParams(c echo.Context) (chainID isc.ChainID, req isc.OffLedgerRequest, err error) { - chainID, err = isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return isc.ChainID{}, nil, httperrors.BadRequest(fmt.Sprintf("Invalid Chain ID %+v: %s", c.Param("chainID"), err.Error())) - } - - contentType := c.Request().Header.Get("Content-Type") - if strings.Contains(strings.ToLower(contentType), "json") { - r := new(model.OffLedgerRequestBody) - if err = c.Bind(r); err != nil { - return isc.ChainID{}, nil, httperrors.BadRequest("error parsing request from payload") - } - rGeneric, err := isc.NewRequestFromMarshalUtil(marshalutil.New(r.Request.Bytes())) - if err != nil { - return isc.ChainID{}, nil, httperrors.BadRequest(fmt.Sprintf("cannot decode off-ledger request: %v", err)) - } - var ok bool - if req, ok = rGeneric.(isc.OffLedgerRequest); !ok { - return isc.ChainID{}, nil, httperrors.BadRequest("error parsing request: off-ledger request is expected") - } - return chainID, req, err - } - - // binary format - reqBytes, err := io.ReadAll(c.Request().Body) - if err != nil { - return isc.ChainID{}, nil, httperrors.BadRequest("error parsing request from payload") - } - rGeneric, err := isc.NewRequestFromMarshalUtil(marshalutil.New(reqBytes)) - if err != nil { - return isc.ChainID{}, nil, httperrors.BadRequest("error parsing request from payload") - } - req, ok := rGeneric.(isc.OffLedgerRequest) - if !ok { - return isc.ChainID{}, nil, httperrors.BadRequest("error parsing request: off-ledger request expected") - } - return chainID, req, err -} diff --git a/packages/webapi/v1/request/request_test.go b/packages/webapi/v1/request/request_test.go deleted file mode 100644 index 9f52e42e0d..0000000000 --- a/packages/webapi/v1/request/request_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package request - -import ( - "net/http" - "testing" - "time" - - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/isc" - util "github.com/iotaledger/wasp/packages/testutil" - "github.com/iotaledger/wasp/packages/util/expiringcache" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" - "github.com/iotaledger/wasp/packages/webapi/v1/testutil" -) - -func shouldBeProcessedMocked(ret error) shouldBeProcessedFn { - return func(_ chain.ChainCore, _ isc.OffLedgerRequest) error { - return ret - } -} - -func newMockedAPI() *offLedgerReqAPI { - return &offLedgerReqAPI{ - getChain: func(chainID isc.ChainID) chain.Chain { - return &testutil.MockChain{} - }, - shouldBeProcessed: shouldBeProcessedMocked(nil), - requestsCache: expiringcache.New(10 * time.Second), - } -} - -func testRequest(t *testing.T, instance *offLedgerReqAPI, chainID isc.ChainID, body interface{}, expectedStatus int) { - testutil.CallWebAPIRequestHandler( - t, - instance.handleNewRequest, - http.MethodPost, - routes.NewRequest(":chainID"), - map[string]string{"chainID": chainID.String()}, - body, - nil, - expectedStatus, - ) -} - -func TestNewRequestBase64(t *testing.T) { - instance := newMockedAPI() - chainID := isc.RandomChainID() - body := model.OffLedgerRequestBody{Request: model.NewBytes(util.DummyOffledgerRequest(chainID).Bytes())} - testRequest(t, instance, chainID, body, http.StatusAccepted) -} - -func TestNewRequestBinary(t *testing.T) { - instance := newMockedAPI() - chainID := isc.RandomChainID() - body := util.DummyOffledgerRequest(chainID).Bytes() - testRequest(t, instance, chainID, body, http.StatusAccepted) -} - -func TestRequestAlreadyProcessed(t *testing.T) { - instance := newMockedAPI() - instance.shouldBeProcessed = shouldBeProcessedMocked(httperrors.BadRequest("")) - - chainID := isc.RandomChainID() - body := util.DummyOffledgerRequest(chainID).Bytes() - testRequest(t, instance, chainID, body, http.StatusBadRequest) -} - -func TestWrongChainID(t *testing.T) { - instance := newMockedAPI() - body := util.DummyOffledgerRequest(isc.RandomChainID()).Bytes() - testRequest(t, instance, isc.RandomChainID(), body, http.StatusBadRequest) -} diff --git a/packages/webapi/v1/routes/routes.go b/packages/webapi/v1/routes/routes.go deleted file mode 100644 index efb0051f8a..0000000000 --- a/packages/webapi/v1/routes/routes.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package routes - -func Info() string { - return "/info" -} - -func NewRequest(chainIDBech32 string) string { - return "/chain/" + chainIDBech32 + "/request" -} - -func CallViewByName(chainIDBech32, contractHname, functionName string) string { - return "/chain/" + chainIDBech32 + "/contract/" + contractHname + "/callview/" + functionName -} - -func CallViewByHname(chainIDBech32, contractHname, functionHname string) string { - return "/chain/" + chainIDBech32 + "/contract/" + contractHname + "/callviewbyhname/" + functionHname -} - -func RequestReceipt(chainIDBech32, reqID string) string { - return "/chain/" + chainIDBech32 + "/request/" + reqID + "/receipt" -} - -func WaitRequestProcessed(chainIDBech32, reqID string) string { - return "/chain/" + chainIDBech32 + "/request/" + reqID + "/wait" -} - -func StateGet(chainIDBech32, key string) string { - return "/chain/" + chainIDBech32 + "/state/" + key -} - -func RequestIDByEVMTransactionHash(chainIDBech32, txHash string) string { - return "/chain/" + chainIDBech32 + "/evm/reqid/" + txHash -} - -func EVMJSONRPC(chainIDBech32 string) string { - return "/chain/" + chainIDBech32 + "/evm/jsonrpc" -} - -func ActivateChain(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/activate" -} - -func DeactivateChain(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/deactivate" -} - -func GetChainInfo(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/info" -} - -func ListChainRecords() string { - return "/adm/chainrecords" -} - -func PutChainRecord() string { - return "/adm/chainrecord" -} - -func GetChainRecord(chainIDBech32 string) string { - return "/adm/chainrecord/" + chainIDBech32 -} - -func GetChainsNodeConnectionMetrics() string { - return "/adm/chain/nodeconn/metrics" -} - -func GetChainNodeConnectionMetrics(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/nodeconn/metrics" -} - -func GetChainConsensusWorkflowStatus(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/consensus/status" -} - -func GetChainConsensusPipeMetrics(chainIDBech32 string) string { - return "/adm/chain/" + chainIDBech32 + "/consensus/metrics/pipe" -} - -func DKSharesPost() string { - return "/adm/dks" -} - -func DKSharesGet(sharedAddress string) string { - return "/adm/dks/" + sharedAddress -} - -func PeeringSelfGet() string { - return "/adm/peering/self" -} - -func PeeringTrustedList() string { - return "/adm/peering/trusted" -} - -func PeeringGetStatus() string { - return "/adm/peering/established" -} - -func PeeringTrustedGet(pubKey string) string { - return "/adm/peering/trusted/" + pubKey -} - -func PeeringTrustedPost() string { - return PeeringTrustedList() -} - -func PeeringTrustedPut(pubKey string) string { - return PeeringTrustedGet(pubKey) -} - -func PeeringTrustedDelete(pubKey string) string { - return PeeringTrustedGet(pubKey) -} - -func AdmNodeOwnerCertificate() string { - return "/adm/node/owner/certificate" -} - -func AdmAccessNode(chainIDBech32 string, pubKey string) string { - return "/adm/chain/" + chainIDBech32 + "/access-node/" + pubKey -} - -func Shutdown() string { - return "/adm/shutdown" -} diff --git a/packages/webapi/v1/state/callview.go b/packages/webapi/v1/state/callview.go deleted file mode 100644 index 0e8e9b1b9b..0000000000 --- a/packages/webapi/v1/state/callview.go +++ /dev/null @@ -1,152 +0,0 @@ -package state - -import ( - "encoding/json" - "fmt" - "net/http" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/packages/chain" - "github.com/iotaledger/wasp/packages/chains" - "github.com/iotaledger/wasp/packages/chainutil" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/webapi/v1/httperrors" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" -) - -type callViewService struct { - chains chains.Provider -} - -func AddEndpoints(server echoswagger.ApiRouter, allChains chains.Provider) { - dictExample := dict.Dict{ - "key1": []byte("value1"), - }.JSONDict() - - s := &callViewService{allChains} - - server.POST(routes.CallViewByName(":chainID", ":contractHname", ":fname"), s.handleCallViewByName). - SetDeprecated(). - SetSummary("Call a view function on a contract by name"). - AddParamPath("", "chainID", "ChainID"). - AddParamPath("", "contractHname", "Contract Hname"). - AddParamPath("getInfo", "fname", "Function name"). - AddParamBody(dictExample, "params", "Parameters", false). - AddResponse(http.StatusOK, "Result", dictExample, nil) - - server.GET(routes.CallViewByName(":chainID", ":contractHname", ":fname"), s.handleCallViewByName). - SetDeprecated(). - SetSummary("Call a view function on a contract by name"). - AddParamPath("", "chainID", "ChainID"). - AddParamPath("", "contractHname", "Contract Hname"). - AddParamPath("getInfo", "fname", "Function name"). - AddParamBody(dictExample, "params", "Parameters", false). - AddResponse(http.StatusOK, "Result", dictExample, nil) - - server.POST(routes.CallViewByHname(":chainID", ":contractHname", ":functionHname"), s.handleCallViewByHname). - SetDeprecated(). - SetSummary("Call a view function on a contract by Hname"). - AddParamPath("", "chainID", "ChainID"). - AddParamPath("", "contractHname", "Contract Hname"). - AddParamPath("getInfo", "functionHname", "Function Hname"). - AddParamBody(dictExample, "params", "Parameters", false). - AddResponse(http.StatusOK, "Result", dictExample, nil) - - server.GET(routes.CallViewByHname(":chainID", ":contractHname", ":functionHname"), s.handleCallViewByHname). - SetDeprecated(). - SetSummary("Call a view function on a contract by Hname"). - AddParamPath("", "chainID", "ChainID"). - AddParamPath("", "contractHname", "Contract Hname"). - AddParamPath("getInfo", "functionHname", "Function Hname"). - AddParamBody(dictExample, "params", "Parameters", false). - AddResponse(http.StatusOK, "Result", dictExample, nil) - - server.GET(routes.StateGet(":chainID", ":key"), s.handleStateGet). - SetDeprecated(). - SetSummary("Fetch the raw value associated with the given key in the chain state"). - AddParamPath("", "chainID", "ChainID"). - AddParamPath("", "key", "Key (hex-encoded)"). - AddResponse(http.StatusOK, "Result", []byte("value"), nil) -} - -func (s *callViewService) handleCallView(c echo.Context, functionHname isc.Hname) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid chain ID: %+v", c.Param("chainID"))) - } - contractHname, err := isc.HnameFromHexString(c.Param("contractHname")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid contract ID: %+v", c.Param("contractHname"))) - } - - var params dict.Dict - if c.Request().Body != http.NoBody { - if err := json.NewDecoder(c.Request().Body).Decode(¶ms); err != nil { - return httperrors.BadRequest("Invalid request body") - } - } - theChain := s.chains().Get(chainID) - if theChain == nil { - return httperrors.NotFound(fmt.Sprintf("Chain not found: %s", chainID)) - } - // TODO should blockIndex be an optional parameter of this endpoint? - latestState, err := theChain.LatestState(chain.ActiveOrCommittedState) - if err != nil { - return httperrors.ServerError(fmt.Sprintf("View call failed: %v", err)) - } - ret, err := chainutil.CallView(latestState, theChain, contractHname, functionHname, params) - if err != nil { - return httperrors.ServerError(fmt.Sprintf("View call failed: %v", err)) - } - - return c.JSON(http.StatusOK, ret) -} - -func (s *callViewService) handleCallViewByName(c echo.Context) error { - fname := c.Param("fname") - return s.handleCallView(c, isc.Hn(fname)) -} - -func (s *callViewService) handleCallViewByHname(c echo.Context) error { - functionHname, err := isc.HnameFromHexString(c.Param("functionHname")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid function ID: %+v", c.Param("functionHname"))) - } - return s.handleCallView(c, functionHname) -} - -func (s *callViewService) handleStateGet(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("Invalid chain ID: %+v", c.Param("chainID"))) - } - - key, err := iotago.DecodeHex(c.Param("key")) - if err != nil { - return httperrors.BadRequest(fmt.Sprintf("cannot parse hex-encoded key: %+v", c.Param("key"))) - } - - theChain := s.chains().Get(chainID) - if theChain == nil { - return httperrors.NotFound(fmt.Sprintf("Chain not found: %s", chainID)) - } - - state, err := theChain.LatestState(chain.ActiveOrCommittedState) - if err != nil { - reason := fmt.Sprintf("View call failed: %v", err) - return httperrors.ServerError(reason) - } - - ret, err := state.Get(kv.Key(key)) - if err != nil { - reason := fmt.Sprintf("View call failed: %v", err) - return httperrors.ServerError(reason) - } - - return c.JSON(http.StatusOK, ret) -} diff --git a/packages/webapi/v1/websocket.go b/packages/webapi/v1/websocket.go deleted file mode 100644 index df34fedea9..0000000000 --- a/packages/webapi/v1/websocket.go +++ /dev/null @@ -1,36 +0,0 @@ -package v1 - -import ( - _ "embed" - - "github.com/labstack/echo/v4" - "github.com/pangpanglabs/echoswagger/v2" - - "github.com/iotaledger/hive.go/core/logger" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/publisher/publisherws" -) - -type webSocketAPI struct { - pws *publisherws.PublisherWebSocket -} - -func addWebSocketEndpoint(e echoswagger.ApiGroup, log *logger.Logger) *webSocketAPI { - api := &webSocketAPI{ - pws: publisherws.New(log, []string{"state", "contract"}), - } - - e.GET("/chain/:chainID/ws", api.handleWebSocket). - SetDeprecated(). - AddParamPath("", "chainID", "ChainID (bech32-encoded)") - - return api -} - -func (w *webSocketAPI) handleWebSocket(c echo.Context) error { - chainID, err := isc.ChainIDFromString(c.Param("chainID")) - if err != nil { - return err - } - return w.pws.ServeHTTP(chainID, c.Response(), c.Request()) -} diff --git a/packages/webapi/v2/controllers/chain/management.go b/packages/webapi/v2/controllers/chain/management.go deleted file mode 100644 index e6dbc784c7..0000000000 --- a/packages/webapi/v2/controllers/chain/management.go +++ /dev/null @@ -1,35 +0,0 @@ -package chain - -import ( - "net/http" - - "github.com/labstack/echo/v4" - - "github.com/iotaledger/wasp/packages/webapi/v2/params" -) - -func (c *Controller) activateChain(e echo.Context) error { - chainID, err := params.DecodeChainID(e) - if err != nil { - return err - } - - if err := c.chainService.ActivateChain(chainID); err != nil { - return err - } - - return e.NoContent(http.StatusOK) -} - -func (c *Controller) deactivateChain(e echo.Context) error { - chainID, err := params.DecodeChainID(e) - if err != nil { - return err - } - - if err := c.chainService.DeactivateChain(chainID); err != nil { - return err - } - - return e.NoContent(http.StatusOK) -} diff --git a/packages/webapi/v2/controllers/requests/waitforrequest.go b/packages/webapi/v2/controllers/requests/waitforrequest.go deleted file mode 100644 index aca1d75465..0000000000 --- a/packages/webapi/v2/controllers/requests/waitforrequest.go +++ /dev/null @@ -1,32 +0,0 @@ -package requests - -import ( - "net/http" - "time" - - "github.com/labstack/echo/v4" - - "github.com/iotaledger/wasp/packages/webapi/v2/models" - "github.com/iotaledger/wasp/packages/webapi/v2/params" -) - -func (c *Controller) waitForRequestToFinish(e echo.Context) error { - chainID, err := params.DecodeChainID(e) - if err != nil { - return err - } - - requestID, err := params.DecodeRequestID(e) - if err != nil { - return err - } - - receipt, vmError, err := c.chainService.WaitForRequestProcessed(e.Request().Context(), chainID, requestID, 30*time.Second) - if err != nil { - return err - } - - mappedReceipt := models.MapReceiptResponse(receipt, vmError) - - return e.JSON(http.StatusOK, mappedReceipt) -} diff --git a/plugins/webapi/component.go b/plugins/webapi/component.go index 874cd92060..a5bee6b06c 100644 --- a/plugins/webapi/component.go +++ b/plugins/webapi/component.go @@ -25,8 +25,6 @@ import ( "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/users" "github.com/iotaledger/wasp/packages/webapi" - v1 "github.com/iotaledger/wasp/packages/webapi/v1" - v2 "github.com/iotaledger/wasp/packages/webapi/v2" ) func init() { @@ -91,7 +89,6 @@ func CreateEchoSwagger(e *echo.Echo, version string) echoswagger.ApiRoot { return echoSwagger } -//nolint:funlen func provide(c *dig.Container) error { type webapiServerDeps struct { dig.In @@ -153,33 +150,7 @@ func provide(c *dig.Container) error { echoSwagger := CreateEchoSwagger(e, deps.AppInfo.Version) - v1.Init( - Plugin.App().NewLogger("WebAPI/v1"), - echoSwagger, - deps.AppInfo.Version, - deps.NetworkProvider, - deps.TrustedNetworkManager, - deps.UserManager, - deps.ChainRecordRegistryProvider, - deps.DKShareRegistryProvider, - deps.NodeIdentityProvider, - func() *chains.Chains { - return deps.Chains - }, - func() *dkg.Node { - return deps.Node - }, - func() { - deps.ShutdownHandler.SelfShutdown("wasp was shutdown via API", false) - }, - deps.NodeConnectionMetrics, - ParamsWebAPI.Auth, - ParamsWebAPI.NodeOwnerAddresses, - deps.APICacheTTL, - deps.PublisherPort, - ) - - v2.Init( + webapi.Init( Plugin.App().NewLogger("WebAPI/v2"), echoSwagger, deps.AppInfo.Version, diff --git a/tools/api-gen/apigen.sh b/tools/api-gen/apigen.sh new file mode 100644 index 0000000000..e8779bdfe7 --- /dev/null +++ b/tools/api-gen/apigen.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +GIT_REF_TAG=$(git describe --tags) +BUILD_LD_FLAGS="-X=github.com/iotaledger/wasp/core/app.Version=$GIT_REF_TAG" + +# To generate with the current commit version: +# go run -ldflags="$BUILD_LD_FLAGS" ./main.go "$@" + +# During development the version is unset, therefore 0 to not commit a new api client each time. +go run ./main.go "$@" \ No newline at end of file diff --git a/tools/api-gen/main.go b/tools/api-gen/main.go index 93696aceec..f17a1c54ac 100644 --- a/tools/api-gen/main.go +++ b/tools/api-gen/main.go @@ -12,7 +12,7 @@ import ( "github.com/iotaledger/wasp/core/app" "github.com/iotaledger/wasp/packages/authentication" "github.com/iotaledger/wasp/packages/cryptolib" - v2 "github.com/iotaledger/wasp/packages/webapi/v2" + v2 "github.com/iotaledger/wasp/packages/webapi" "github.com/iotaledger/wasp/plugins/webapi" ) diff --git a/tools/cluster/chain.go b/tools/cluster/chain.go index 6a7b2ee3fe..c60777c41f 100644 --- a/tools/cluster/chain.go +++ b/tools/cluster/chain.go @@ -2,22 +2,22 @@ package cluster import ( "bytes" + "context" "fmt" "time" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/multiclient" - "github.com/iotaledger/wasp/client/scclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/multiclient" + "github.com/iotaledger/wasp/clients/scclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/collections" - "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/vm/core/blob" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" "github.com/iotaledger/wasp/packages/vm/core/root" "github.com/iotaledger/wasp/packages/vm/vmtypes" ) @@ -89,11 +89,19 @@ func (ch *Chain) SCClient(contractHname isc.Hname, sigScheme *cryptolib.KeyPair, } func (ch *Chain) CommitteeMultiClient() *multiclient.MultiClient { - return multiclient.New(ch.CommitteeAPIHosts()).WithLogFunc(ch.Cluster.Logf) + var resolver multiclient.ClientResolver = func(apiHost string) *apiclient.APIClient { + return ch.Cluster.WaspClientFromHostName(apiHost) + } + + return multiclient.New(resolver, ch.CommitteeAPIHosts()) //.WithLogFunc(ch.Cluster.t.Logf) } func (ch *Chain) AllNodesMultiClient() *multiclient.MultiClient { - return multiclient.New(ch.AllAPIHosts()).WithLogFunc(ch.Cluster.Logf) + var resolver multiclient.ClientResolver = func(apiHost string) *apiclient.APIClient { + return ch.Cluster.WaspClientFromHostName(apiHost) + } + + return multiclient.New(resolver, ch.AllAPIHosts()) //.WithLogFunc(ch.Cluster.t.Logf) } func (ch *Chain) DeployContract(name, progHashStr, description string, initParams map[string]interface{}) (*iotago.Transaction, error) { @@ -134,7 +142,7 @@ func (ch *Chain) DeployWasmContract(name, description string, progBinary []byte, blob.VarFieldProgramDescription: description, }) - programHash, _, _, err := ch.OriginatorClient().UploadBlob(blobFieldValues) + programHash, _, _, err := ch.OriginatorClient().UploadBlob(context.Background(), blobFieldValues) if err != nil { return hashing.NilHash, err } @@ -176,114 +184,109 @@ func (ch *Chain) DeployWasmContract(name, description string, progBinary []byte, } func (ch *Chain) GetBlobFieldValue(blobHash hashing.HashValue, field string) ([]byte, error) { - v, err := ch.Cluster.WaspClient(0).CallView( - ch.ChainID, blob.Contract.Hname(), blob.ViewGetBlobField.Name, - dict.Dict{ - blob.ParamHash: blobHash[:], - blob.ParamField: []byte(field), - }) + v, _, err := ch.Cluster.WaspClient(0).CorecontractsApi. + BlobsGetBlobValue(context.Background(), ch.ChainID.String(), blobHash.Hex(), field). + Execute() //nolint:bodyclose // false positive if err != nil { return nil, err } - if v.IsEmpty() { - return nil, nil - } - ret, err := v.Get(blob.ParamBytes) + + decodedValue, err := iotago.DecodeHex(v.ValueData) if err != nil { return nil, err } - return ret, nil + + return decodedValue, nil } func (ch *Chain) BlockIndex(nodeIndex ...int) (uint32, error) { - cl := ch.SCClient(blocklog.Contract.Hname(), nil, nodeIndex...) - ret, err := cl.CallView(blocklog.ViewGetBlockInfo.Name, nil) + blockInfo, _, err := ch.Cluster. + WaspClient(nodeIndex...).CorecontractsApi.BlocklogGetLatestBlockInfo(context.Background(), ch.ChainID.String()). + Execute() //nolint:bodyclose // false positive if err != nil { return 0, err } - return codec.DecodeUint32(ret.MustGet(blocklog.ParamBlockIndex), 0) + + return blockInfo.BlockIndex, nil } -func (ch *Chain) GetAllBlockInfoRecordsReverse(nodeIndex ...int) ([]*blocklog.BlockInfo, error) { +func (ch *Chain) GetAllBlockInfoRecordsReverse(nodeIndex ...int) ([]*apiclient.BlockInfoResponse, error) { blockIndex, err := ch.BlockIndex(nodeIndex...) if err != nil { return nil, err } - cl := ch.SCClient(blocklog.Contract.Hname(), nil, nodeIndex...) - ret := make([]*blocklog.BlockInfo, 0, blockIndex+1) + ret := make([]*apiclient.BlockInfoResponse, 0, blockIndex+1) for idx := int(blockIndex); idx >= 0; idx-- { - res, err := cl.CallView(blocklog.ViewGetBlockInfo.Name, dict.Dict{ - blocklog.ParamBlockIndex: codec.EncodeUint32(uint32(idx)), - }) + blockInfo, _, err := ch.Cluster. + WaspClient(nodeIndex...).CorecontractsApi.BlocklogGetBlockInfo(context.Background(), ch.ChainID.String(), uint32(idx)). + Execute() //nolint:bodyclose // false positive if err != nil { return nil, err } - bi, err := blocklog.BlockInfoFromBytes(uint32(idx), res.MustGet(blocklog.ParamBlockInfo)) - if err != nil { - return nil, err - } - ret = append(ret, bi) + + ret = append(ret, blockInfo) } return ret, nil } -func (ch *Chain) ContractRegistry(nodeIndex ...int) (map[isc.Hname]*root.ContractRecord, error) { - cl := ch.SCClient(root.Contract.Hname(), nil, nodeIndex...) - ret, err := cl.CallView(root.ViewGetContractRecords.Name, nil) +func (ch *Chain) ContractRegistry(nodeIndex ...int) ([]apiclient.ContractInfoResponse, error) { + contracts, _, err := ch.Cluster. + WaspClient(nodeIndex...).ChainsApi.GetContracts(context.Background(), ch.ChainID.String()). + Execute() //nolint:bodyclose // false positive if err != nil { return nil, err } - return root.DecodeContractRegistry(collections.NewMapReadOnly(ret, root.StateVarContractRegistry)) + + return contracts, nil } func (ch *Chain) GetCounterValue(inccounterSCHname isc.Hname, nodeIndex ...int) (int64, error) { - cl := ch.SCClient(inccounterSCHname, nil, nodeIndex...) - ret, err := cl.CallView(inccounter.ViewGetCounter.Name, nil) + result, _, err := ch.Cluster. + WaspClient(nodeIndex...).RequestsApi.CallView(context.Background()).ContractCallViewRequest(apiclient.ContractCallViewRequest{ + ChainId: ch.ChainID.String(), + ContractHName: inccounterSCHname.String(), + FunctionHName: inccounter.ViewGetCounter.Hname().String(), + }).Execute() //nolint:bodyclose // false positive + if err != nil { + return 0, err + } + + parsedDict, err := apiextensions.APIJsonDictToDict(*result) if err != nil { return 0, err } - return codec.DecodeInt64(ret.MustGet(inccounter.VarCounter), 0) + + return codec.DecodeInt64(parsedDict.MustGet(inccounter.VarCounter), 0) } func (ch *Chain) GetStateVariable(contractHname isc.Hname, key string, nodeIndex ...int) ([]byte, error) { cl := ch.SCClient(contractHname, nil, nodeIndex...) - return cl.StateGet(key) + + return cl.StateGet(context.Background(), key) } -func (ch *Chain) GetRequestReceipt(reqID isc.RequestID, nodeIndex ...int) (*isc.Receipt, error) { - idx := 0 - if len(nodeIndex) > 0 { - idx = nodeIndex[0] - } - rec, err := ch.Cluster.WaspClient(idx).RequestReceipt(ch.ChainID, reqID) - return rec, err +func (ch *Chain) GetRequestReceipt(reqID isc.RequestID, nodeIndex ...int) (*apiclient.ReceiptResponse, error) { + receipt, _, err := ch.Cluster.WaspClient(nodeIndex...).RequestsApi.GetReceipt(context.Background(), ch.ChainID.String(), reqID.String()). + Execute() //nolint:bodyclose // false positive + + return receipt, err } -func (ch *Chain) GetRequestReceiptsForBlock(blockIndex *uint32, nodeIndex ...int) ([]*blocklog.RequestReceipt, error) { - cl := ch.SCClient(blocklog.Contract.Hname(), nil, nodeIndex...) - params := dict.Dict{} +func (ch *Chain) GetRequestReceiptsForBlock(blockIndex *uint32, nodeIndex ...int) ([]apiclient.RequestReceiptResponse, error) { + var err error + var receipts *apiclient.BlockReceiptsResponse + if blockIndex != nil { - params = dict.Dict{ - blocklog.ParamBlockIndex: codec.EncodeUint32(*blockIndex), - } + receipts, _, err = ch.Cluster.WaspClient(nodeIndex...).CorecontractsApi.BlocklogGetRequestReceiptsOfBlock(context.Background(), ch.ChainID.String(), *blockIndex). + Execute() //nolint:bodyclose // false positive + } else { + receipts, _, err = ch.Cluster.WaspClient(nodeIndex...).CorecontractsApi.BlocklogGetRequestReceiptsOfLatestBlock(context.Background(), ch.ChainID.String()). + Execute() //nolint:bodyclose // false positive } - res, err := cl.CallView(blocklog.ViewGetRequestReceiptsForBlock.Name, params) + if err != nil { return nil, err } - returnedBlockIndex := codec.MustDecodeUint32(res.MustGet(blocklog.ParamBlockIndex)) - recs := collections.NewArray16ReadOnly(res, blocklog.ParamRequestRecord) - ret := make([]*blocklog.RequestReceipt, recs.MustLen()) - for i := range ret { - data, err := recs.GetAt(uint16(i)) - if err != nil { - return nil, err - } - ret[i], err = blocklog.RequestReceiptFromBytes(data) - if err != nil { - return nil, err - } - ret[i].WithBlockData(returnedBlockIndex, uint16(i)) - } - return ret, nil + + return receipts.Receipts, nil } diff --git a/tools/cluster/cluster.go b/tools/cluster/cluster.go index e2d3e4a9e6..665e44e6c5 100644 --- a/tools/cluster/cluster.go +++ b/tools/cluster/cluster.go @@ -5,6 +5,7 @@ package cluster import ( "bufio" + "context" "errors" "fmt" "io" @@ -23,9 +24,10 @@ import ( "github.com/iotaledger/hive.go/core/logger" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/multiclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/multiclient" "github.com/iotaledger/wasp/packages/apilib" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" @@ -36,8 +38,6 @@ import ( "github.com/iotaledger/wasp/packages/transaction" "github.com/iotaledger/wasp/packages/util" "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" "github.com/iotaledger/wasp/tools/cluster/templates" ) @@ -107,7 +107,7 @@ func (clu *Cluster) L1Client() l1connection.Client { return clu.l1 } -func (clu *Cluster) AddTrustedNode(peerInfo *model.PeeringTrustedNode, onNodes ...[]int) error { +func (clu *Cluster) AddTrustedNode(peerInfo apiclient.PeeringTrustRequest, onNodes ...[]int) error { nodes := clu.Config.AllNodes() if len(onNodes) > 0 { nodes = onNodes[0] @@ -115,8 +115,10 @@ func (clu *Cluster) AddTrustedNode(peerInfo *model.PeeringTrustedNode, onNodes . for ni := range nodes { var err error + if _, err = clu.WaspClient( - nodes[ni]).PostPeeringTrusted(peerInfo.PubKey, peerInfo.NetID); err != nil { + //nolint:bodyclose // false positive + nodes[ni]).NodeApi.TrustPeer(context.Background()).PeeringTrustRequest(peerInfo).Execute(); err != nil { return err } } @@ -125,17 +127,22 @@ func (clu *Cluster) AddTrustedNode(peerInfo *model.PeeringTrustedNode, onNodes . func (clu *Cluster) TrustAll() error { allNodes := clu.Config.AllNodes() - allPeers := make([]*model.PeeringTrustedNode, len(allNodes)) + allPeers := make([]*apiclient.PeeringNodeIdentityResponse, len(allNodes)) for ni := range allNodes { var err error - if allPeers[ni], err = clu.WaspClient(allNodes[ni]).GetPeeringSelf(); err != nil { + //nolint:bodyclose // false positive + if allPeers[ni], _, err = clu.WaspClient(allNodes[ni]).NodeApi.GetPeeringIdentity(context.Background()).Execute(); err != nil { return err } } for ni := range allNodes { for pi := range allPeers { var err error - if _, err = clu.WaspClient(allNodes[ni]).PostPeeringTrusted(allPeers[pi].PubKey, allPeers[pi].NetID); err != nil { + if _, err = clu.WaspClient( + allNodes[ni]).NodeApi.TrustPeer(context.Background()).PeeringTrustRequest(apiclient.PeeringTrustRequest{ + PublicKey: allPeers[pi].PublicKey, + NetId: allPeers[pi].NetId, + }).Execute(); err != nil { //nolint:bodyclose // false positive return err } } @@ -171,15 +178,18 @@ func (clu *Cluster) RunDKG(committeeNodes []int, threshold uint16, timeout ...ti peerPubKeys := make([]string, 0) for _, i := range committeeNodes { - peeringNodeInfo, err := clu.WaspClient(i).GetPeeringSelf() + //nolint:bodyclose // false positive + peeringNodeInfo, _, err := clu.WaspClient(i).NodeApi.GetPeeringIdentity(context.Background()).Execute() if err != nil { return nil, err } - peerPubKeys = append(peerPubKeys, peeringNodeInfo.PubKey) + + peerPubKeys = append(peerPubKeys, peeringNodeInfo.PublicKey) } dkgInitiatorIndex := uint16(rand.Intn(len(apiHosts))) - return apilib.RunDKG("", apiHosts, peerPubKeys, threshold, dkgInitiatorIndex, timeout...) + + return apilib.RunDKG(clu.WaspClientFromHostName, apiHosts, peerPubKeys, threshold, dkgInitiatorIndex, timeout...) } func (clu *Cluster) DeployChainWithDKG(description string, allPeers, committeeNodes []int, quorum uint16) (*Chain, error) { @@ -213,14 +223,16 @@ func (clu *Cluster) DeployChain(description string, allPeers, committeeNodes []i committeePubKeys := make([]string, len(chain.CommitteeNodes)) for i, nodeIndex := range chain.CommitteeNodes { - peeringNode, err := clu.WaspClient(nodeIndex).GetPeeringSelf() + //nolint:bodyclose // false positive + peeringNode, _, err := clu.WaspClient(nodeIndex).NodeApi.GetPeeringIdentity(context.Background()).Execute() if err != nil { return nil, err } - committeePubKeys[i] = peeringNode.PubKey + + committeePubKeys[i] = peeringNode.PublicKey } - chainID, err := apilib.DeployChain(apilib.CreateChainParams{ + chainID, err := apilib.DeployChain(clu.WaspClientFromHostName, apilib.CreateChainParams{ Layer1Client: clu.L1Client(), CommitteeAPIHosts: chain.CommitteeAPIHosts(), CommitteePubKeys: committeePubKeys, @@ -255,10 +267,11 @@ func (clu *Cluster) addAllAccessNodes(chain *Chain, accessNodes []int) error { addAccessNodesRequests[i] = tx } - peers := multiclient.New(chain.CommitteeAPIHosts()).WithLogFunc(clu.Logf) + peers := multiclient.New(clu.WaspClientFromHostName, chain.CommitteeAPIHosts()) //.WithLogFunc(clu.t.Logf) for _, tx := range addAccessNodesRequests { // ---------- wait until the requests are processed in all committee nodes + if _, err := peers.WaitUntilAllRequestsProcessedSuccessfully(chain.ChainID, tx, 30*time.Second); err != nil { return fmt.Errorf("WaitAddAccessNode: %w", err) } @@ -267,11 +280,14 @@ func (clu *Cluster) addAllAccessNodes(chain *Chain, accessNodes []int) error { scArgs := governance.NewChangeAccessNodesRequest() for _, a := range accessNodes { waspClient := clu.WaspClient(a) - accessNodePeering, err := waspClient.GetPeeringSelf() + + //nolint:bodyclose // false positive + accessNodePeering, _, err := waspClient.NodeApi.GetPeeringIdentity(context.Background()).Execute() if err != nil { return err } - accessNodePubKey, err := cryptolib.NewPublicKeyFromString(accessNodePeering.PubKey) + + accessNodePubKey, err := cryptolib.NewPublicKeyFromString(accessNodePeering.PublicKey) if err != nil { return err } @@ -281,6 +297,7 @@ func (clu *Cluster) addAllAccessNodes(chain *Chain, accessNodes []int) error { NewPostRequestParams(scArgs.AsDict()). WithBaseTokens(1 * isc.Million) govClient := chain.SCClient(governance.Contract.Hname(), chain.OriginatorKeyPair) + tx, err := govClient.PostRequest(governance.FuncChangeAccessNodes.Name, *scParams) if err != nil { return err @@ -298,41 +315,58 @@ func (clu *Cluster) addAllAccessNodes(chain *Chain, accessNodes []int) error { // to consider it as an access node. func (clu *Cluster) AddAccessNode(accessNodeIndex int, chain *Chain) (*iotago.Transaction, error) { waspClient := clu.WaspClient(accessNodeIndex) - if err := apilib.ActivateChainOnNodes("", clu.Config.APIHosts([]int{accessNodeIndex}), chain.ChainID); err != nil { + if err := apilib.ActivateChainOnNodes(clu.WaspClientFromHostName, clu.Config.APIHosts([]int{accessNodeIndex}), chain.ChainID); err != nil { return nil, err } - accessNodePeering, err := waspClient.GetPeeringSelf() + //nolint:bodyclose // false positive + accessNodePeering, _, err := waspClient.NodeApi.GetPeeringIdentity(context.Background()).Execute() if err != nil { return nil, err } - accessNodePubKey, err := cryptolib.NewPublicKeyFromString(accessNodePeering.PubKey) + + accessNodePubKey, err := cryptolib.NewPublicKeyFromString(accessNodePeering.PublicKey) if err != nil { return nil, err } - cert, err := waspClient.NodeOwnershipCertificate(accessNodePubKey, chain.OriginatorAddress()) + + clu.log.Infof("Node owner bech32: %v", chain.OriginatorAddress().Bech32(parameters.L1().Protocol.Bech32HRP)) + cert, _, err := waspClient.NodeApi.SetNodeOwner(context.Background()).NodeOwnerCertificateRequest(apiclient.NodeOwnerCertificateRequest{ + PublicKey: accessNodePubKey.String(), + OwnerAddress: chain.OriginatorAddress().Bech32(parameters.L1().Protocol.Bech32HRP), + }).Execute() //nolint:bodyclose // false positive + if err != nil { + return nil, err + } + + decodedCert, err := iotago.DecodeHex(cert.Certificate) if err != nil { return nil, err } + scArgs := governance.AccessNodeInfo{ NodePubKey: accessNodePubKey.AsBytes(), ValidatorAddr: isc.BytesFromAddress(chain.OriginatorAddress()), - Certificate: cert.Bytes(), + Certificate: decodedCert, ForCommittee: false, AccessAPI: clu.Config.APIHost(accessNodeIndex), } scParams := chainclient. NewPostRequestParams(scArgs.ToAddCandidateNodeParams()). WithBaseTokens(1000) + govClient := chain.SCClient(governance.Contract.Hname(), chain.OriginatorKeyPair) + tx, err := govClient.PostRequest(governance.FuncAddCandidateNode.Name, *scParams) if err != nil { return nil, err } + txID, err := tx.ID() if err != nil { return nil, err } + fmt.Printf("[cluster] Governance::AddCandidateNode, Posted TX, id=%v, args=%+v\n", txID, scArgs) return tx, nil } @@ -342,11 +376,25 @@ func (clu *Cluster) IsNodeUp(i int) bool { } func (clu *Cluster) MultiClient() *multiclient.MultiClient { - return multiclient.New(clu.Config.APIHosts()).WithLogFunc(clu.Logf) + return multiclient.New(clu.WaspClientFromHostName, clu.Config.APIHosts()) //.WithLogFunc(clu.t.Logf) +} + +func (clu *Cluster) WaspClientFromHostName(hostName string) *apiclient.APIClient { + client, err := apiextensions.WaspAPIClientByHostName(hostName) + if err != nil { + panic(err.Error()) + } + + return client } -func (clu *Cluster) WaspClient(nodeIndex int) *client.WaspClient { - return client.NewWaspClient(clu.Config.APIHost(nodeIndex)).WithLogFunc(clu.Logf) +func (clu *Cluster) WaspClient(nodeIndex ...int) *apiclient.APIClient { + idx := 0 + if len(nodeIndex) == 1 { + idx = nodeIndex[0] + } + + return clu.WaspClientFromHostName(clu.Config.APIHost(idx)) } func (clu *Cluster) NodeDataPath(i int) string { @@ -588,12 +636,13 @@ const pollAPIInterval = 500 * time.Millisecond // waits until API for a given WASP node is ready func waitForAPIReady(initOk chan<- bool, apiURL string) { - infoEndpointURL := fmt.Sprintf("%s%s", apiURL, routes.Info()) + infoEndpointURL := fmt.Sprintf("%s%s", apiURL, "/node/version") ticker := time.NewTicker(pollAPIInterval) go func() { for { <-ticker.C + rsp, err := http.Get(infoEndpointURL) //nolint:gosec,noctx if err != nil { fmt.Printf("Error Polling node API %s ready status: %v\n", apiURL, err) @@ -644,7 +693,8 @@ func (clu *Cluster) stopNode(nodeIndex int) { return } fmt.Printf("[cluster] Sending shutdown to wasp node %d\n", nodeIndex) - err := clu.WaspClient(nodeIndex).Shutdown() + + err := clu.KillNodeProcess(nodeIndex) if err != nil { fmt.Println(err) } diff --git a/tools/cluster/config.go b/tools/cluster/config.go index 20174edda5..d10a5838fb 100644 --- a/tools/cluster/config.go +++ b/tools/cluster/config.go @@ -130,7 +130,7 @@ func (c *ClusterConfig) APIHosts(nodeIndexes ...[]int) []string { } func (c *ClusterConfig) APIHost(nodeIndex int) string { - return fmt.Sprintf("127.0.0.1:%d", c.APIPort(nodeIndex)) + return fmt.Sprintf("http://127.0.0.1:%d", c.APIPort(nodeIndex)) } func (c *ClusterConfig) APIPort(nodeIndex int) int { diff --git a/tools/cluster/tests/access_nodes_test.go b/tools/cluster/tests/access_nodes_test.go index 46d3600c1c..48063a0850 100644 --- a/tools/cluster/tests/access_nodes_test.go +++ b/tools/cluster/tests/access_nodes_test.go @@ -1,17 +1,17 @@ package tests import ( + "context" "testing" "time" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/scclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/scclient" "github.com/iotaledger/wasp/contracts/native/inccounter" - "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/registry" "github.com/iotaledger/wasp/packages/utxodb" "github.com/iotaledger/wasp/tools/cluster/templates" ) @@ -51,22 +51,35 @@ func testPermitionlessAccessNode(t *testing.T, env *ChainEnv) { // adds node #0 from cluster2 as access node of node #0 from cluster1 // trust setup between the two nodes - node0peerInfo, err := nodeClient.GetPeeringSelf() + node0peerInfo, _, err := nodeClient.NodeApi.GetPeeringIdentity(context.Background()).Execute() require.NoError(t, err) - err = clu2.AddTrustedNode(node0peerInfo) + + err = clu2.AddTrustedNode(apiclient.PeeringTrustRequest{ + PublicKey: node0peerInfo.PublicKey, + NetId: node0peerInfo.NetId, + }) require.NoError(t, err) - accessNodePeerInfo, err := accessNodeClient.GetPeeringSelf() + accessNodePeerInfo, _, err := accessNodeClient.NodeApi.GetPeeringIdentity(context.Background()).Execute() require.NoError(t, err) - err = env.Clu.AddTrustedNode(accessNodePeerInfo, []int{0}) + + err = env.Clu.AddTrustedNode(apiclient.PeeringTrustRequest{ + PublicKey: accessNodePeerInfo.PublicKey, + NetId: accessNodePeerInfo.NetId, + }, []int{0}) require.NoError(t, err) // activate the chain on the access node - err = accessNodeClient.PutChainRecord(registry.NewChainRecord(env.Chain.ChainID, true, []*cryptolib.PublicKey{})) + _, err = accessNodeClient.ChainsApi. + SetChainRecord(context.Background(), env.Chain.ChainID.String()). + ChainRecord(apiclient.ChainRecord{ + IsActive: true, + AccessNodes: []string{}, + }).Execute() require.NoError(t, err) // add node 0 from cluster 2 as a *permitionless* access node - err = nodeClient.AddAccessNode(env.Chain.ChainID, accessNodePeerInfo.PubKey) + _, err = nodeClient.ChainsApi.AddAccessNode(context.Background(), env.Chain.ChainID.String(), accessNodePeerInfo.PublicKey).Execute() require.NoError(t, err) // give some time for the access node to sync @@ -90,8 +103,9 @@ func testPermitionlessAccessNode(t *testing.T, env *ChainEnv) { require.NoError(t, err) // remove the access node from cluster1 node 0 - err = nodeClient.RemoveAccessNode(env.Chain.ChainID, accessNodePeerInfo.PubKey) + _, err = nodeClient.ChainsApi.RemoveAccessNode(context.Background(), env.Chain.ChainID.String(), accessNodePeerInfo.PublicKey).Execute() require.NoError(t, err) + time.Sleep(1 * time.Second) // Access/Server node info is exchanged asynchronously. // try sending the request again @@ -100,8 +114,9 @@ func testPermitionlessAccessNode(t *testing.T, env *ChainEnv) { // request is not processed after a while time.Sleep(2 * time.Second) - rec, err := nodeClient.RequestReceipt(env.Chain.ChainID, req.ID()) + receipt, _, err := nodeClient.RequestsApi.GetReceipt(context.Background(), env.Chain.ChainID.String(), req.ID().String()).Execute() + require.Error(t, err) - require.Regexp(t, `"Code":404`, err.Error()) - require.Nil(t, rec) + require.Regexp(t, `404`, err.Error()) + require.Nil(t, receipt) } diff --git a/tools/cluster/tests/account_test.go b/tools/cluster/tests/account_test.go index efb57a2762..19f61a4031 100644 --- a/tools/cluster/tests/account_test.go +++ b/tools/cluster/tests/account_test.go @@ -1,13 +1,17 @@ package tests import ( + "context" "fmt" "testing" "time" + "github.com/samber/lo" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/parameters" @@ -66,9 +70,12 @@ func testAccounts(e *ChainEnv) { contractRegistry, err := e.Chain.ContractRegistry(i) require.NoError(e.t, err) - cr := contractRegistry[hname] + cr, ok := lo.Find(contractRegistry, func(item apiclient.ContractInfoResponse) bool { + return item.HName == hname.String() + }) + require.True(e.t, ok) - require.EqualValues(e.t, programHash1, cr.ProgramHash) + require.EqualValues(e.t, programHash1.Hex(), cr.ProgramHash) require.EqualValues(e.t, description, cr.Description) require.EqualValues(e.t, nativeIncCounterSCName, cr.Name) @@ -90,7 +97,9 @@ func testAccounts(e *ChainEnv) { receipts, err := e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(e.Chain.ChainID, reqTx, 10*time.Second) require.NoError(e.t, err) - fees := receipts[0].GasFeeCharged + fees, err := iotago.DecodeUint64(receipts[0].GasFeeCharged) + require.NoError(e.t, err) + e.checkBalanceOnChain(isc.NewAgentID(myAddress), isc.BaseTokenID, transferBaseTokens-fees) for i := range e.Chain.CommitteeNodes { @@ -134,9 +143,13 @@ func testBasic2Accounts(t *testing.T, env *ChainEnv) { require.NoError(t, err) t.Logf("%+v", contractRegistry) - cr := contractRegistry[hname] + cr, ok := lo.Find(contractRegistry, func(item apiclient.ContractInfoResponse) bool { + return item.HName == hname.String() + }) + require.True(t, ok) + require.NotNil(t, cr) - require.EqualValues(t, programHash1, cr.ProgramHash) + require.EqualValues(t, programHash1.Hex(), cr.ProgramHash) require.EqualValues(t, description, cr.Description) require.EqualValues(t, nativeIncCounterSCName, cr.Name) @@ -180,7 +193,7 @@ func testBasic2Accounts(t *testing.T, env *ChainEnv) { origL1Balance := env.Clu.AddressBalances(originatorAddress).BaseTokens originatorClient := chainclient.New(env.Clu.L1Client(), env.Clu.WaspClient(0), chain.ChainID, originatorSigScheme) allowanceBaseTokens := uint64(800_000) - req2, err := originatorClient.PostOffLedgerRequest(accounts.Contract.Hname(), accounts.FuncWithdraw.Hname(), + req2, err := originatorClient.PostOffLedgerRequest(context.Background(), accounts.Contract.Hname(), accounts.FuncWithdraw.Hname(), chainclient.PostRequestParams{ Allowance: isc.NewAssetsBaseTokens(allowanceBaseTokens), }, diff --git a/tools/cluster/tests/advanced_inccounter_test.go b/tools/cluster/tests/advanced_inccounter_test.go index 71fc582d0e..54253463bd 100644 --- a/tools/cluster/tests/advanced_inccounter_test.go +++ b/tools/cluster/tests/advanced_inccounter_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/testutil" diff --git a/tools/cluster/tests/blob_test.go b/tools/cluster/tests/blob_test.go index 180740984d..913f616ece 100644 --- a/tools/cluster/tests/blob_test.go +++ b/tools/cluster/tests/blob_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "fmt" "os" "testing" @@ -8,39 +9,37 @@ import ( "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/vm/core/blob" ) func (e *ChainEnv) getBlobInfo(hash hashing.HashValue) map[string]uint32 { - ret, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, blob.Contract.Hname(), blob.ViewGetBlobInfo.Name, - dict.Dict{ - blob.ParamHash: hash[:], - }) - require.NoError(e.t, err) - decoded, err := blob.DecodeSizesMap(ret) + blobInfo, _, err := e.Chain.Cluster.WaspClient().CorecontractsApi. + BlobsGetBlobInfo(context.Background(), e.Chain.ChainID.String(), hash.Hex()). + Execute() + require.NoError(e.t, err) - return decoded + + return blobInfo.Fields } func (e *ChainEnv) getBlobFieldValue(blobHash hashing.HashValue, field string) []byte { - v, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, blob.Contract.Hname(), blob.ViewGetBlobField.Name, - dict.Dict{ - blob.ParamHash: blobHash[:], - blob.ParamField: []byte(field), - }) + blobField, _, err := e.Chain.Cluster.WaspClient().CorecontractsApi. + BlobsGetBlobValue(context.Background(), e.Chain.ChainID.String(), blobHash.Hex(), field). + Execute() require.NoError(e.t, err) - if v.IsEmpty() { - return nil + + if blobField.ValueData == "" { + return []byte{} } - ret, err := v.Get(blob.ParamBytes) + + value, err := iotago.DecodeHex(blobField.ValueData) + require.NoError(e.t, err) - return ret + return value } // executed in cluster_test.go @@ -108,9 +107,9 @@ func testBlobStoreManyBlobsNoEncoding(t *testing.T, e *ChainEnv) { _, err = e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(e.Chain.ChainID, reqTx, 30*time.Second) require.NoError(t, err) - expectedHash, _, receipt, err := chClient.UploadBlob(fv) + expectedHash, _, receipt, err := chClient.UploadBlob(context.Background(), fv) require.NoError(t, err) - require.Empty(t, receipt.ResolvedError) + require.Empty(t, receipt.Error) t.Logf("expected hash: %s", expectedHash.String()) sizes := e.getBlobInfo(expectedHash) diff --git a/tools/cluster/tests/cluster_test.go b/tools/cluster/tests/cluster_test.go index 01ae3f0a2c..84d1b23c2a 100644 --- a/tools/cluster/tests/cluster_test.go +++ b/tools/cluster/tests/cluster_test.go @@ -32,7 +32,7 @@ func TestClusterMultiNodeCommittee(t *testing.T) { if testing.Short() { t.Skip("Skipping cluster tests in short mode") } - // setup a cluster with a 4 nodes + // setup a cluster with 4 nodes run := createTestWrapper(t, 4, []int{0, 1, 2, 3}) t.Run("deploy basic", func(t *testing.T) { run(t, testDeployChain) }) diff --git a/tools/cluster/tests/cluster_testutils.go b/tools/cluster/tests/cluster_testutils.go index 4744d4af00..7966e92654 100644 --- a/tools/cluster/tests/cluster_testutils.go +++ b/tools/cluster/tests/cluster_testutils.go @@ -3,8 +3,10 @@ package tests import ( "time" + "github.com/samber/lo" "github.com/stretchr/testify/require" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/vm/core/root" @@ -59,10 +61,13 @@ func (e *ChainEnv) deployNativeIncCounterSC(initCounter ...int) { contractRegistry, err := e.Chain.ContractRegistry(i) require.NoError(e.t, err) - cr := contractRegistry[nativeIncCounterSCHname] + cr, ok := lo.Find(contractRegistry, func(item apiclient.ContractInfoResponse) bool { + return item.HName == nativeIncCounterSCHname.String() + }) + require.True(e.t, ok) require.NotNil(e.t, cr) - require.EqualValues(e.t, programHash, cr.ProgramHash) + require.EqualValues(e.t, programHash.Hex(), cr.ProgramHash) require.EqualValues(e.t, description, cr.Description) require.EqualValues(e.t, cr.Name, nativeIncCounterSCName) diff --git a/tools/cluster/tests/deploy_test.go b/tools/cluster/tests/deploy_test.go index 7ac5842b23..f573fe948b 100644 --- a/tools/cluster/tests/deploy_test.go +++ b/tools/cluster/tests/deploy_test.go @@ -1,12 +1,16 @@ package tests import ( + "context" "testing" "time" + "github.com/samber/lo" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" @@ -40,11 +44,15 @@ func testDeployContractOnly(t *testing.T, env *ChainEnv) { env.deployNativeIncCounterSC() // test calling root.FuncFindContractByName view function using client - ret, err := env.Chain.Cluster.WaspClient(0).CallView( - env.Chain.ChainID, root.Contract.Hname(), root.ViewFindContract.Name, - dict.Dict{ + ret, err := apiextensions.CallView(context.Background(), env.Chain.Cluster.WaspClient(), apiclient.ContractCallViewRequest{ + ChainId: env.Chain.ChainID.String(), + ContractHName: root.Contract.Hname().String(), + FunctionHName: root.ViewFindContract.Hname().String(), + Arguments: apiextensions.DictToAPIJsonDict(dict.Dict{ root.ParamHname: isc.Hn(nativeIncCounterSCName).Bytes(), - }) + }), + }) + require.NoError(t, err) recb, err := ret.Get(root.ParamContractRecData) require.NoError(t, err) @@ -84,7 +92,12 @@ func testDeployContractAndSpawn(t *testing.T, env *ChainEnv) { require.NoError(t, err) require.EqualValues(t, len(corecontracts.All)+2, len(contractRegistry)) - cr := contractRegistry[hnameNew] + cr, ok := lo.Find(contractRegistry, func(item apiclient.ContractInfoResponse) bool { + return item.HName == hnameNew.String() + }) + require.True(t, ok) + require.NotNil(t, cr) + require.EqualValues(t, dscrNew, cr.Description) require.EqualValues(t, nameNew, cr.Name) diff --git a/tools/cluster/tests/env.go b/tools/cluster/tests/env.go index 6b98cbc867..3d664d2bb2 100644 --- a/tools/cluster/tests/env.go +++ b/tools/cluster/tests/env.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/scclient" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/scclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" diff --git a/tools/cluster/tests/evm_jsonrpc_test.go b/tools/cluster/tests/evm_jsonrpc_test.go index 55ff6e17a8..4a0c4b6a00 100644 --- a/tools/cluster/tests/evm_jsonrpc_test.go +++ b/tools/cluster/tests/evm_jsonrpc_test.go @@ -4,7 +4,10 @@ package tests import ( + "context" "crypto/ecdsa" + "errors" + "fmt" "math" "testing" "time" @@ -15,17 +18,14 @@ import ( "github.com/ethereum/go-ethereum/rpc" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/evm/evmtest" "github.com/iotaledger/wasp/packages/evm/jsonrpc/jsonrpctest" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/vm/core/accounts" - "github.com/iotaledger/wasp/packages/vm/core/errors" "github.com/iotaledger/wasp/packages/vm/core/evm" - "github.com/iotaledger/wasp/packages/webapi/v1/routes" ) type clusterTestEnv struct { @@ -36,7 +36,8 @@ type clusterTestEnv struct { func newClusterTestEnv(t *testing.T, env *ChainEnv, nodeIndex int) *clusterTestEnv { evmtest.InitGoEthLogger(t) - jsonRPCEndpoint := "http://" + env.Clu.Config.APIHost(nodeIndex) + routes.EVMJSONRPC(env.Chain.ChainID.String()) + evmJSONRPCPath := fmt.Sprintf("/chains/%v/evm", env.Chain.ChainID.String()) + jsonRPCEndpoint := env.Clu.Config.APIHost(nodeIndex) + evmJSONRPCPath rawClient, err := rpc.DialHTTP(jsonRPCEndpoint) require.NoError(t, err) client := ethclient.NewClient(rawClient) @@ -44,23 +45,22 @@ func newClusterTestEnv(t *testing.T, env *ChainEnv, nodeIndex int) *clusterTestE waitTxConfirmed := func(txHash common.Hash) error { c := env.Chain.Client(nil, nodeIndex) - reqID, err := c.RequestIDByEVMTransactionHash(txHash) + reqID, err := c.RequestIDByEVMTransactionHash(context.Background(), txHash) if err != nil { return err } - receipt, err := c.WaspClient.WaitUntilRequestProcessed(env.Chain.ChainID, reqID, 1*time.Minute) + receipt, _, err := c.WaspClient.RequestsApi. + WaitForRequest(context.Background(), env.Chain.ChainID.String(), reqID.String()). + TimeoutSeconds(60). + Execute() if err != nil { return err } + if receipt.Error != nil { - resolved, err := errors.Resolve(receipt.Error, func(contractName string, funcName string, params dict.Dict) (dict.Dict, error) { - return c.CallView(isc.Hn(contractName), funcName, params) - }) - if err != nil { - return err - } - return resolved + return errors.New(receipt.Error.Message) } + return nil } diff --git a/tools/cluster/tests/inccounter_test.go b/tools/cluster/tests/inccounter_test.go index 76f30dee96..f96c17327b 100644 --- a/tools/cluster/tests/inccounter_test.go +++ b/tools/cluster/tests/inccounter_test.go @@ -1,12 +1,15 @@ package tests import ( + "context" "testing" "time" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv" "github.com/iotaledger/wasp/packages/kv/codec" @@ -76,7 +79,7 @@ func (e *contractEnv) checkSC(numRequests int) { require.Greater(e.t, blockIndex, uint32(numRequests+4)) cl := e.Chain.SCClient(governance.Contract.Hname(), nil, i) - info, err := cl.CallView(governance.ViewGetChainInfo.Name, nil) + info, err := cl.CallView(context.Background(), governance.ViewGetChainInfo.Name, nil) require.NoError(e.t, err) chainID, err := codec.DecodeChainID(info.MustGet(governance.VarChainID)) @@ -91,7 +94,7 @@ func (e *contractEnv) checkSC(numRequests int) { require.NoError(e.t, err) require.EqualValues(e.t, e.Chain.Description, desc) - recs, err := e.Chain.SCClient(root.Contract.Hname(), nil, i).CallView(root.ViewGetContractRecords.Name, nil) + recs, err := e.Chain.SCClient(root.Contract.Hname(), nil, i).CallView(context.Background(), root.ViewGetContractRecords.Name, nil) require.NoError(e.t, err) contractRegistry, err := root.DecodeContractRegistry(collections.NewMapReadOnly(recs, root.StateVarContractRegistry)) @@ -125,7 +128,7 @@ func testInvalidEntrypoint(t *testing.T, env *ChainEnv) { receipts, err := e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessed(e.Chain.ChainID, tx, 30*time.Second) require.NoError(t, err) require.Equal(t, 1, len(receipts)) - require.Contains(t, receipts[0].ResolvedError, vm.ErrTargetEntryPointNotFound.MessageFormat()) + require.Contains(t, receipts[0].Error.MessageFormat, vm.ErrTargetEntryPointNotFound.MessageFormat()) } e.checkSC(numRequests) @@ -247,9 +250,12 @@ func testIncViewCounter(t *testing.T, env *ChainEnv) { entryPoint := isc.Hn("increment") e.postRequest(incHname, entryPoint, 0, nil) e.checkWasmContractCounter(1) - ret, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, incHname, "getCounter", nil, - ) + + ret, err := apiextensions.CallView(context.Background(), e.Chain.Cluster.WaspClient(0), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: incHname.String(), + FunctionName: "getCounter", + }) require.NoError(t, err) counter, err := codec.DecodeInt64(ret.MustGet(varCounter), 0) diff --git a/tools/cluster/tests/maintenance_test.go b/tools/cluster/tests/maintenance_test.go index 84242a0bc4..e60607f026 100644 --- a/tools/cluster/tests/maintenance_test.go +++ b/tools/cluster/tests/maintenance_test.go @@ -1,13 +1,14 @@ package tests import ( + "context" "testing" "time" "github.com/stretchr/testify/require" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" @@ -52,7 +53,8 @@ func testMaintenance(t *testing.T, env *ChainEnv) { // call the gov "maintenance status view", check it is OFF { - ret, err := ownerSCClient.CallView(governance.ViewGetMaintenanceStatus.Name, nil) + // TODO: Add maintenance status to wrapped core contracts + ret, err := ownerSCClient.CallView(context.Background(), governance.ViewGetMaintenanceStatus.Name, nil) require.NoError(t, err) maintenanceStatus := codec.MustDecodeBool(ret.MustGet(governance.VarMaintenanceStatus)) require.False(t, maintenanceStatus) @@ -64,7 +66,7 @@ func testMaintenance(t *testing.T, env *ChainEnv) { require.NoError(t, err) rec, err := env.Clu.MultiClient().WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) require.NoError(t, err) - require.Error(t, rec.Error) + require.NotNil(t, rec.Error) } // owner can start maintenance mode @@ -77,7 +79,7 @@ func testMaintenance(t *testing.T, env *ChainEnv) { // call the gov "maintenance status view", check it is ON { - ret, err := ownerSCClient.CallView(governance.ViewGetMaintenanceStatus.Name, nil) + ret, err := ownerSCClient.CallView(context.Background(), governance.ViewGetMaintenanceStatus.Name, nil) require.NoError(t, err) maintenanceStatus := codec.MustDecodeBool(ret.MustGet(governance.VarMaintenanceStatus)) require.True(t, maintenanceStatus) @@ -92,7 +94,8 @@ func testMaintenance(t *testing.T, env *ChainEnv) { require.NoError(t, err) time.Sleep(10 * time.Second) // not ideal, but I don't think there is a good way to wait for something that will NOT be processed rec, err := env.Chain.GetRequestReceipt(notProccessedReq1.ID()) - require.Regexp(t, `.*"Code":404.*`, err.Error()) + + require.EqualValues(t, `404 Not Found`, err.Error()) require.Nil(t, rec) // calls to non-maintenance endpoints are not processed, even when done by the chain owner @@ -100,7 +103,7 @@ func testMaintenance(t *testing.T, env *ChainEnv) { require.NoError(t, err) time.Sleep(10 * time.Second) // not ideal, but I don't think there is a good way to wait for something that will NOT be processed rec, err = env.Chain.GetRequestReceipt(notProccessedReq2.ID()) - require.Regexp(t, `.*"Code":404.*`, err.Error()) + require.EqualValues(t, `404 Not Found`, err.Error()) require.Nil(t, rec) // assert that block number is still the same @@ -135,7 +138,7 @@ func testMaintenance(t *testing.T, env *ChainEnv) { require.NoError(t, err) receipt, err := env.Clu.MultiClient().WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) require.NoError(t, err) - require.Error(t, receipt.Error) + require.NotNil(t, receipt.Error) } // test non-chain owner cannot call stop maintenance @@ -144,7 +147,7 @@ func testMaintenance(t *testing.T, env *ChainEnv) { require.NoError(t, err) rec, err := env.Clu.MultiClient().WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) require.NoError(t, err) - require.Error(t, rec.Error) + require.NotNil(t, rec.Error) } // owner can stop maintenance mode diff --git a/tools/cluster/tests/missing_requests_test.go b/tools/cluster/tests/missing_requests_test.go index 4defd7f86d..0f11099c92 100644 --- a/tools/cluster/tests/missing_requests_test.go +++ b/tools/cluster/tests/missing_requests_test.go @@ -1,12 +1,15 @@ package tests import ( + "context" "testing" "time" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/dict" @@ -44,18 +47,24 @@ func TestMissingRequests(t *testing.T) { _, err = chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(chainID, reqTx, 30*time.Second) require.NoError(t, err) + // TODO: Validate offleder logic // send off-ledger request to all nodes except #3 req := isc.NewOffLedgerRequest(chainID, nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), dict.Dict{}, 0).Sign(userWallet) - err = clu.WaspClient(0).PostOffLedgerRequest(chainID, req) - require.NoError(t, err) - err = clu.WaspClient(1).PostOffLedgerRequest(chainID, req) + _, err = clu.WaspClient(0).RequestsApi.OffLedger(context.Background()).OffLedgerRequest(apiclient.OffLedgerRequest{ + ChainId: chainID.String(), + Request: iotago.EncodeHex(req.Bytes()), + }).Execute() require.NoError(t, err) //------ // send a dummy request to node #3, so that it proposes a batch and the consensus hang is broken req2 := isc.NewOffLedgerRequest(chainID, isc.Hn("foo"), isc.Hn("bar"), nil, 1).Sign(userWallet) - err = clu.WaspClient(3).PostOffLedgerRequest(chainID, req2) + + _, err = clu.WaspClient(0).RequestsApi.OffLedger(context.Background()).OffLedgerRequest(apiclient.OffLedgerRequest{ + ChainId: chainID.String(), + Request: iotago.EncodeHex(req2.Bytes()), + }).Execute() require.NoError(t, err) //------- diff --git a/tools/cluster/tests/offledger_requests_test.go b/tools/cluster/tests/offledger_requests_test.go index 1ec91b4499..49e60d168e 100644 --- a/tools/cluster/tests/offledger_requests_test.go +++ b/tools/cluster/tests/offledger_requests_test.go @@ -1,13 +1,17 @@ package tests import ( + "context" "crypto/rand" "testing" "time" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" @@ -37,7 +41,7 @@ func TestOffledgerRequestAccessNode(t *testing.T) { chClient := newWalletWithFunds(e, 5, 0, 2, 4, 5, 7) // send off-ledger request via Web API (to the access node) - _, err = chClient.PostOffLedgerRequest( + _, err = chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), ) @@ -46,9 +50,12 @@ func TestOffledgerRequestAccessNode(t *testing.T) { waitUntil(t, e.counterEquals(43), clu.Config.AllNodes(), 30*time.Second) // check off-ledger request was successfully processed (check by asking another access node) - ret, err := clu.WaspClient(6).CallView( - e.Chain.ChainID, nativeIncCounterSCHname, inccounter.ViewGetCounter.Name, nil, - ) + ret, err := apiextensions.CallView(context.Background(), clu.WaspClient(6), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: nativeIncCounterSCHname.String(), + FunctionHName: inccounter.ViewGetCounter.Hname().String(), + }) + require.NoError(t, err) resultint64, _ := codec.DecodeInt64(ret.MustGet(inccounter.VarCounter)) require.EqualValues(t, 43, resultint64) @@ -61,7 +68,7 @@ func testOffledgerRequest(t *testing.T, e *ChainEnv) { chClient := newWalletWithFunds(e, 0, 0, 1, 2, 3) // send off-ledger request via Web API - offledgerReq, err := chClient.PostOffLedgerRequest( + offledgerReq, err := chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), ) @@ -69,10 +76,12 @@ func testOffledgerRequest(t *testing.T, e *ChainEnv) { _, err = e.Chain.CommitteeMultiClient().WaitUntilRequestProcessedSuccessfully(e.Chain.ChainID, offledgerReq.ID(), 30*time.Second) require.NoError(t, err) - // check off-ledger request was successfully processed - ret, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, nativeIncCounterSCHname, inccounter.ViewGetCounter.Name, nil, - ) + ret, err := apiextensions.CallView(context.Background(), e.Chain.Cluster.WaspClient(0), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: nativeIncCounterSCHname.String(), + FunctionHName: inccounter.ViewGetCounter.Hname().String(), + }) + require.NoError(t, err) resultint64, err := codec.DecodeInt64(ret.MustGet(inccounter.VarCounter)) require.NoError(t, err) @@ -92,7 +101,7 @@ func testOffledgerRequest900KB(t *testing.T, e *ChainEnv) { paramsDict := dict.Dict{"data": randomData} expectedHash := blob.MustGetBlobHash(paramsDict) - offledgerReq, err := chClient.PostOffLedgerRequest( + offledgerReq, err := chClient.PostOffLedgerRequest(context.Background(), blob.Contract.Hname(), blob.FuncStoreBlob.Hname(), chainclient.PostRequestParams{ @@ -104,14 +113,12 @@ func testOffledgerRequest900KB(t *testing.T, e *ChainEnv) { require.NoError(t, err) // ensure blob was stored by the cluster - res, err := e.Chain.Cluster.WaspClient(2).CallView( - e.Chain.ChainID, blob.Contract.Hname(), blob.ViewGetBlobField.Name, - dict.Dict{ - blob.ParamHash: expectedHash[:], - blob.ParamField: []byte("data"), - }) + res, _, err := e.Chain.Cluster.WaspClient(2).CorecontractsApi. + BlobsGetBlobValue(context.Background(), e.Chain.ChainID.String(), expectedHash.Hex(), "data"). + Execute() require.NoError(t, err) - binaryData, err := res.Get(blob.ParamBytes) + + binaryData, err := iotago.DecodeHex(res.ValueData) require.NoError(t, err) require.EqualValues(t, binaryData, randomData) } @@ -123,7 +130,7 @@ func testOffledgerNonce(t *testing.T, e *ChainEnv) { chClient := newWalletWithFunds(e, 0, 0, 1, 2, 3) // send off-ledger request with a high nonce - offledgerReq, err := chClient.PostOffLedgerRequest( + offledgerReq, err := chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), chainclient.PostRequestParams{ @@ -135,7 +142,7 @@ func testOffledgerNonce(t *testing.T, e *ChainEnv) { require.NoError(t, err) // send off-ledger request with a high nonce -1 - offledgerReq, err = chClient.PostOffLedgerRequest( + offledgerReq, err = chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), chainclient.PostRequestParams{ @@ -147,27 +154,35 @@ func testOffledgerNonce(t *testing.T, e *ChainEnv) { require.NoError(t, err) // send off-ledger request with a much lower nonce - _, err = chClient.PostOffLedgerRequest( + _, err = chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), chainclient.PostRequestParams{ Nonce: 1, }, ) - require.Regexp(t, "invalid nonce", err.Error()) + + apiError, ok := apiextensions.AsAPIError(err) + require.True(t, ok) + require.NotNil(t, apiError.DetailError) + require.Regexp(t, "invalid nonce", apiError.DetailError.Error) // try replaying the initial request - _, err = chClient.PostOffLedgerRequest( + _, err = chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), chainclient.PostRequestParams{ Nonce: 1_000_000, }, ) - require.Regexp(t, "request already processed", err.Error()) + + apiError, ok = apiextensions.AsAPIError(err) + require.True(t, ok) + require.NotNil(t, apiError.DetailError) + require.Regexp(t, "request already processed", apiError.DetailError.Error) // send a request with a higher nonce - offledgerReq, err = chClient.PostOffLedgerRequest( + offledgerReq, err = chClient.PostOffLedgerRequest(context.Background(), nativeIncCounterSCHname, inccounter.FuncIncCounter.Hname(), chainclient.PostRequestParams{ @@ -192,9 +207,14 @@ func newWalletWithFunds(e *ChainEnv, waspnode int, waitOnNodes ...int) *chaincli Transfer: isc.NewAssetsBaseTokens(baseTokes), }) require.NoError(e.t, err) + receipts, err := e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(e.Chain.ChainID, reqTx, 30*time.Second) require.NoError(e.t, err) - expectedBaseTokens := baseTokes - receipts[0].GasFeeCharged + + gasFeeCharged, err := iotago.DecodeUint64(receipts[0].GasFeeCharged) + require.NoError(e.t, err) + + expectedBaseTokens := baseTokes - gasFeeCharged e.checkBalanceOnChain(userAgentID, isc.BaseTokenID, expectedBaseTokens) // wait until access node syncs with account diff --git a/tools/cluster/tests/post_test.go b/tools/cluster/tests/post_test.go index 4dc04908c6..0dcc4571be 100644 --- a/tools/cluster/tests/post_test.go +++ b/tools/cluster/tests/post_test.go @@ -1,13 +1,17 @@ package tests import ( + "context" "testing" "time" + "github.com/samber/lo" "github.com/stretchr/testify/require" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" @@ -37,9 +41,14 @@ func deployInccounter42(e *ChainEnv) *isc.ContractAgentID { contractRegistry, err := e.Chain.ContractRegistry(i) require.NoError(e.t, err) - cr := contractRegistry[hname] - require.EqualValues(e.t, programHash, cr.ProgramHash) + cr, ok := lo.Find(contractRegistry, func(item apiclient.ContractInfoResponse) bool { + return item.HName == hname.String() + }) + require.True(e.t, ok) + require.NotNil(e.t, cr) + + require.EqualValues(e.t, programHash.Hex(), cr.ProgramHash) require.EqualValues(e.t, description, cr.Description) require.EqualValues(e.t, cr.Name, inccounterName) @@ -48,15 +57,19 @@ func deployInccounter42(e *ChainEnv) *isc.ContractAgentID { require.EqualValues(e.t, 42, counterValue) } - // test calling root.FuncFindContractByName view function using client - ret, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, root.Contract.Hname(), root.ViewFindContract.Name, - dict.Dict{ + result, err := apiextensions.CallView(context.Background(), e.Chain.Cluster.WaspClient(), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: root.Contract.Hname().String(), + FunctionHName: root.ViewFindContract.Hname().String(), + Arguments: apiextensions.DictToAPIJsonDict(dict.Dict{ root.ParamHname: hname.Bytes(), - }) + }), + }) require.NoError(e.t, err) - recb, err := ret.Get(root.ParamContractRecData) + + recb, err := result.Get(root.ParamContractRecData) require.NoError(e.t, err) + rec, err := root.ContractRecordFromBytes(recb) require.NoError(e.t, err) require.EqualValues(e.t, description, rec.Description) @@ -75,12 +88,18 @@ func (e *ChainEnv) getNativeContractCounter(hname isc.Hname) int64 { } func (e *ChainEnv) getCounterForNode(hname isc.Hname, nodeIndex int) int64 { - ret, err := e.Chain.Cluster.WaspClient(nodeIndex).CallView( - e.Chain.ChainID, hname, "getCounter", nil, - ) + result, _, err := e.Chain.Cluster.WaspClient(nodeIndex).RequestsApi. + CallView(context.Background()).ContractCallViewRequest(apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: hname.String(), + FunctionName: "getCounter", + }).Execute() + require.NoError(e.t, err) + + decodedDict, err := apiextensions.APIJsonDictToDict(*result) require.NoError(e.t, err) - counter, err := codec.DecodeInt64(ret.MustGet(inccounter.VarCounter), 0) + counter, err := codec.DecodeInt64(decodedDict.MustGet(inccounter.VarCounter), 0) require.NoError(e.t, err) return counter @@ -180,9 +199,14 @@ func testPost5Requests(t *testing.T, e *ChainEnv) { Transfer: isc.NewAssets(baseTokesSent, nil), }) require.NoError(t, err) + receipts, err := e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(e.Chain.ChainID, tx, 30*time.Second) require.NoError(t, err) - onChainBalance += baseTokesSent - receipts[0].GasFeeCharged + + gasFeeCharged, err := iotago.DecodeUint64(receipts[0].GasFeeCharged) + require.NoError(t, err) + + onChainBalance += baseTokesSent - gasFeeCharged } e.expectCounter(contractID.Hname(), 42+5) @@ -215,7 +239,11 @@ func testPost5AsyncRequests(t *testing.T, e *ChainEnv) { for i := 0; i < 5; i++ { receipts, err := e.Chain.CommitteeMultiClient().WaitUntilAllRequestsProcessedSuccessfully(e.Chain.ChainID, tx[i], 30*time.Second) require.NoError(t, err) - onChainBalance += baseTokesSent - receipts[0].GasFeeCharged + + gasFeeCharged, err := iotago.DecodeUint64(receipts[0].GasFeeCharged) + require.NoError(t, err) + + onChainBalance += baseTokesSent - gasFeeCharged } e.expectCounter(contractID.Hname(), 42+5) diff --git a/tools/cluster/tests/publisher_test.go b/tools/cluster/tests/publisher_test.go index e06dafe75d..be022b6951 100644 --- a/tools/cluster/tests/publisher_test.go +++ b/tools/cluster/tests/publisher_test.go @@ -14,7 +14,7 @@ import ( // without this import it won't work, no messages will be received by the client socket... _ "go.nanomsg.org/mangos/v3/transport/all" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/util" diff --git a/tools/cluster/tests/reboot_test.go b/tools/cluster/tests/reboot_test.go index c259114f8e..a745f5f568 100644 --- a/tools/cluster/tests/reboot_test.go +++ b/tools/cluster/tests/reboot_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "fmt" "testing" "time" @@ -8,13 +9,14 @@ import ( "github.com/samber/lo" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/scclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/scclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/testutil" "github.com/iotaledger/wasp/packages/util" "github.com/iotaledger/wasp/packages/utxodb" "github.com/iotaledger/wasp/packages/vm/core/accounts" @@ -27,27 +29,34 @@ func TestReboot(t *testing.T) { client := env.createNewClient() // ------ TODO why does this make the test fail? - er := env.Clu.WaspClient(0).DeactivateChain(env.Chain.ChainID) + _, er := env.Clu.WaspClient(0).ChainsApi.DeactivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(0).ActivateChain(env.Chain.ChainID) + _, er = env.Clu.WaspClient(0).ChainsApi.ActivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(1).DeactivateChain(env.Chain.ChainID) + _, er = env.Clu.WaspClient(1).ChainsApi.DeactivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(1).ActivateChain(env.Chain.ChainID) + _, er = env.Clu.WaspClient(1).ChainsApi.ActivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) //------- tx, err := client.PostRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilAllRequestsProcessed(env.Chain.ChainID, tx, 10*time.Second) + + _, err = apiextensions.APIWaitUntilAllRequestsProcessed(env.Clu.WaspClient(0), env.Chain.ChainID, tx, 10*time.Second) require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 1) req, err := client.PostOffLedgerRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) + + _, _, err = env.Clu.WaspClient(0).RequestsApi. + WaitForRequest(context.Background(), env.Chain.ChainID.String(), req.ID().String()). + TimeoutSeconds(10). + Execute() require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 2) // // ------ TODO why does this make the test fail? @@ -75,13 +84,19 @@ func TestReboot(t *testing.T) { // after rebooting, the chain should resume processing requests without issues tx, err = client.PostRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilAllRequestsProcessed(env.Chain.ChainID, tx, 10*time.Second) + + _, err = apiextensions.APIWaitUntilAllRequestsProcessed(env.Clu.WaspClient(0), env.Chain.ChainID, tx, 10*time.Second) require.NoError(t, err) env.expectCounter(nativeIncCounterSCHname, 3) + // ensure offledger requests are still working req, err = client.PostOffLedgerRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) + + _, _, err = env.Clu.WaspClient(0).RequestsApi. + WaitForRequest(context.Background(), env.Chain.ChainID.String(), req.ID().String()). + TimeoutSeconds(10). + Execute() require.NoError(t, err) env.expectCounter(nativeIncCounterSCHname, 4) } @@ -93,25 +108,33 @@ func TestReboot2(t *testing.T) { tx, err := client.PostRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilAllRequestsProcessed(env.Chain.ChainID, tx, 10*time.Second) + + _, err = apiextensions.APIWaitUntilAllRequestsProcessed(env.Clu.WaspClient(0), env.Chain.ChainID, tx, 10*time.Second) require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 1) req, err := client.PostOffLedgerRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) + + _, _, err = env.Clu.WaspClient(0).RequestsApi. + WaitForRequest(context.Background(), env.Chain.ChainID.String(), req.ID().String()). + TimeoutSeconds(10). + Execute() require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 2) // ------ TODO why does this make the test fail? - er := env.Clu.WaspClient(0).DeactivateChain(env.Chain.ChainID) + _, er := env.Clu.WaspClient(0).ChainsApi.DeactivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(0).ActivateChain(env.Chain.ChainID) + + _, er = env.Clu.WaspClient(0).ChainsApi.ActivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(1).DeactivateChain(env.Chain.ChainID) + _, er = env.Clu.WaspClient(1).ChainsApi.DeactivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) - er = env.Clu.WaspClient(1).ActivateChain(env.Chain.ChainID) + _, er = env.Clu.WaspClient(1).ChainsApi.ActivateChain(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, er) //------- @@ -140,14 +163,21 @@ func TestReboot2(t *testing.T) { // after rebooting, the chain should resume processing requests without issues tx, err = client.PostRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilAllRequestsProcessed(env.Chain.ChainID, tx, 10*time.Second) + + _, err = apiextensions.APIWaitUntilAllRequestsProcessed(env.Clu.WaspClient(0), env.Chain.ChainID, tx, 10*time.Second) require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 3) // ensure off-ledger requests are still working req, err = client.PostOffLedgerRequest(inccounter.FuncIncCounter.Name) require.NoError(t, err) - _, err = env.Clu.WaspClient(0).WaitUntilRequestProcessed(env.Chain.ChainID, req.ID(), 10*time.Second) + + _, _, err = env.Clu.WaspClient(0).RequestsApi. + WaitForRequest(context.Background(), env.Chain.ChainID.String(), req.ID().String()). + TimeoutSeconds(10). + Execute() require.NoError(t, err) + env.expectCounter(nativeIncCounterSCHname, 4) } @@ -165,8 +195,10 @@ func newIncCounterClient(t *testing.T, env *ChainEnv, client *scclient.SCClient) func (icc *incCounterClient) MustIncOnLedger() { tx, err := icc.client.PostRequest(inccounter.FuncIncCounter.Name) require.NoError(icc.t, err) - _, err = icc.env.Clu.WaspClient(0).WaitUntilAllRequestsProcessed(icc.env.Chain.ChainID, tx, 10*time.Second) + + _, err = apiextensions.APIWaitUntilAllRequestsProcessed(icc.env.Clu.WaspClient(0), icc.env.Chain.ChainID, tx, 10*time.Second) require.NoError(icc.t, err) + icc.expected++ icc.env.expectCounter(nativeIncCounterSCHname, icc.expected) } @@ -174,8 +206,13 @@ func (icc *incCounterClient) MustIncOnLedger() { func (icc *incCounterClient) MustIncOffLedger() { req, err := icc.client.PostOffLedgerRequest(inccounter.FuncIncCounter.Name) require.NoError(icc.t, err) - _, err = icc.env.Clu.WaspClient(0).WaitUntilRequestProcessed(icc.env.Chain.ChainID, req.ID(), 10*time.Second) + + _, _, err = icc.env.Clu.WaspClient(0).RequestsApi. + WaitForRequest(context.Background(), icc.env.Chain.ChainID.String(), req.ID().String()). + TimeoutSeconds(10). + Execute() require.NoError(icc.t, err) + icc.expected++ icc.env.expectCounter(nativeIncCounterSCHname, icc.expected) } @@ -246,7 +283,7 @@ func TestRebootN3TwoNodes(t *testing.T) { // Test rebooting nodes during operation. func TestRebootDuringTasks(t *testing.T) { - testutil.RunHeavy(t) + // testutil.RunHeavy(t) env := setupNativeInccounterTest(t, 4, []int{0, 1, 2, 3}) // keep the nodes spammed @@ -285,10 +322,13 @@ func TestRebootDuringTasks(t *testing.T) { time.Sleep(20 * time.Second) // after rebooting, the chain should resume processing requests/views without issues - ret, err := env.Clu.WaspClient(0).CallView( - env.Chain.ChainID, nativeIncCounterSCHname, inccounter.ViewGetCounter.Name, nil, - ) + ret, err := apiextensions.CallView(context.Background(), env.Clu.WaspClient(0), apiclient.ContractCallViewRequest{ + ChainId: env.Chain.ChainID.String(), + ContractHName: nativeIncCounterSCHname.String(), + FunctionHName: inccounter.ViewGetCounter.Hname().String(), + }) require.NoError(t, err) + counter, err := codec.DecodeInt64(ret.MustGet(inccounter.VarCounter), 0) require.NoError(t, err) require.Greater(t, counter, lastCounter) diff --git a/tools/cluster/tests/rotation_test.go b/tools/cluster/tests/rotation_test.go index 85f810426d..e8d3c71208 100644 --- a/tools/cluster/tests/rotation_test.go +++ b/tools/cluster/tests/rotation_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "fmt" "testing" "time" @@ -8,15 +9,13 @@ import ( "github.com/stretchr/testify/require" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/isc/coreutil" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/collections" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/testutil" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" "github.com/iotaledger/wasp/packages/vm/core/governance" "github.com/iotaledger/wasp/tools/cluster" ) @@ -323,18 +322,17 @@ func (e *ChainEnv) waitStateController(nodeIndex int, addr iotago.Address, timeo } func (e *ChainEnv) callGetStateController(nodeIndex int) (iotago.Address, error) { - ret, err := e.Chain.Cluster.WaspClient(nodeIndex).CallView( - e.Chain.ChainID, - blocklog.Contract.Hname(), - blocklog.ViewControlAddresses.Name, - nil, - ) + controlAddresses, _, err := e.Chain.Cluster.WaspClient(nodeIndex).CorecontractsApi. + BlocklogGetControlAddresses(context.Background(), e.Chain.ChainID.String()). + Execute() if err != nil { return nil, err } - addr, err := codec.DecodeAddress(ret.MustGet(blocklog.ParamStateControllerAddress)) + + _, address, err := iotago.ParseBech32(controlAddresses.StateAddress) require.NoError(e.t, err) - return addr, nil + + return address, nil } func (e *ChainEnv) checkAllowedStateControllerAddressInAllNodes(addr iotago.Address) error { @@ -347,24 +345,23 @@ func (e *ChainEnv) checkAllowedStateControllerAddressInAllNodes(addr iotago.Addr } func isAllowedStateControllerAddress(t *testing.T, chain *cluster.Chain, nodeIndex int, addr iotago.Address) bool { - ret, err := chain.Cluster.WaspClient(nodeIndex).CallView( - chain.ChainID, - governance.Contract.Hname(), - governance.ViewGetAllowedStateControllerAddresses.Name, - nil, - ) + addresses, _, err := chain.Cluster.WaspClient(nodeIndex).CorecontractsApi. + GovernanceGetAllowedStateControllerAddresses(context.Background(), chain.ChainID.String()). + Execute() require.NoError(t, err) - arr := collections.NewArray16ReadOnly(ret, governance.ParamAllowedStateControllerAddresses) - arrlen := arr.MustLen() - if arrlen == 0 { + + if len(addresses.Addresses) == 0 { return false } - for i := uint16(0); i < arrlen; i++ { - a, err := codec.DecodeAddress(arr.MustGetAt(i)) + + for _, addressBech32 := range addresses.Addresses { + _, address, err := iotago.ParseBech32(addressBech32) require.NoError(t, err) - if a.Equal(addr) { + + if address.Equal(addr) { return true } } + return false } diff --git a/tools/cluster/tests/spam_test.go b/tools/cluster/tests/spam_test.go index f7af5d9747..d544f6af12 100644 --- a/tools/cluster/tests/spam_test.go +++ b/tools/cluster/tests/spam_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "errors" "fmt" "sync" @@ -10,15 +11,12 @@ import ( "github.com/stretchr/testify/require" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/testutil" "github.com/iotaledger/wasp/packages/utxodb" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/vm/core/testcore" ) // executed in cluster_test.go @@ -85,11 +83,10 @@ func testSpamOnledger(t *testing.T, env *ChainEnv) { waitUntil(t, env.counterEquals(int64(numRequests)), []int{0}, 5*time.Minute) - res, err := env.Chain.Cluster.WaspClient(0).CallView(env.Chain.ChainID, blocklog.Contract.Hname(), blocklog.ViewGetEventsForBlock.Name, dict.Dict{}) + res, _, err := env.Chain.Cluster.WaspClient(0).CorecontractsApi.BlocklogGetEventsOfLatestBlock(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, err) - events, err := testcore.EventsViewResultToStringArray(res) - require.NoError(t, err) - println(events) + + println(res.Events) } // executed in cluster_test.go @@ -165,11 +162,10 @@ func testSpamOffLedger(t *testing.T, env *ChainEnv) { waitUntil(t, env.counterEquals(int64(numRequests)), []int{0}, 5*time.Minute) - res, err := env.Chain.Cluster.WaspClient(0).CallView(env.Chain.ChainID, blocklog.Contract.Hname(), blocklog.ViewGetEventsForBlock.Name, dict.Dict{}) + res, _, err := env.Chain.Cluster.WaspClient(0).CorecontractsApi.BlocklogGetEventsOfLatestBlock(context.Background(), env.Chain.ChainID.String()).Execute() require.NoError(t, err) - events, err := testcore.EventsViewResultToStringArray(res) - require.NoError(t, err) - require.Regexp(t, fmt.Sprintf("counter = %d", numRequests), events[len(events)-1]) + + require.Regexp(t, fmt.Sprintf("counter = %d", numRequests), res.Events[len(res.Events)-1]) avgProcessingDuration := processingDurationsSum / numRequests fmt.Printf("avg processing duration: %ds\n max: %ds\n", avgProcessingDuration, maxProcessingDuration) } @@ -194,7 +190,7 @@ func testSpamCallViewWasm(t *testing.T, env *ChainEnv) { for i := 0; i < n; i++ { go func() { - r, err := client.CallView("getCounter", nil) + r, err := client.CallView(context.Background(), "getCounter", nil) if err != nil { ch <- err return diff --git a/tools/cluster/tests/transfer_test.go b/tools/cluster/tests/transfer_test.go index b9d17cc4a2..31e718c1e0 100644 --- a/tools/cluster/tests/transfer_test.go +++ b/tools/cluster/tests/transfer_test.go @@ -1,12 +1,14 @@ package tests import ( + "context" "testing" "time" "github.com/stretchr/testify/require" - "github.com/iotaledger/wasp/client/chainclient" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/utxodb" "github.com/iotaledger/wasp/packages/vm/core/accounts" @@ -48,7 +50,9 @@ func TestDepositWithdraw(t *testing.T) { chEnv.checkLedger() // chEnv.checkBalanceOnChain(origAgentID, isc.BaseTokenID, 0) - gasFees1 := receipts[0].GasFeeCharged + gasFees1, err := iotago.DecodeUint64(receipts[0].GasFeeCharged) + require.NoError(t, err) + onChainBalance := depositBaseTokens - gasFees1 chEnv.checkBalanceOnChain(myAgentID, isc.BaseTokenID, onChainBalance) @@ -58,7 +62,7 @@ func TestDepositWithdraw(t *testing.T) { // withdraw some base tokens back baseTokensToWithdraw := 1 * isc.Million - req, err := chClient.PostOffLedgerRequest(accounts.Contract.Hname(), accounts.FuncWithdraw.Hname(), + req, err := chClient.PostOffLedgerRequest(context.Background(), accounts.Contract.Hname(), accounts.FuncWithdraw.Hname(), chainclient.PostRequestParams{ Allowance: isc.NewAssetsBaseTokens(baseTokensToWithdraw), }, @@ -68,7 +72,9 @@ func TestDepositWithdraw(t *testing.T) { require.NoError(t, err) chEnv.checkLedger() - gasFees2 := receipt.GasFeeCharged + gasFees2, err := iotago.DecodeUint64(receipt.GasFeeCharged) + require.NoError(t, err) + chEnv.checkBalanceOnChain(myAgentID, isc.BaseTokenID, onChainBalance-baseTokensToWithdraw-gasFees2) require.True(t, e.Clu.AssertAddressBalances(myAddress, isc.NewAssetsBaseTokens(utxodb.FundsFromFaucetAmount-depositBaseTokens+baseTokensToWithdraw)), diff --git a/tools/cluster/tests/util.go b/tools/cluster/tests/util.go index 00c9ac6463..6a6a958d5c 100644 --- a/tools/cluster/tests/util.go +++ b/tools/cluster/tests/util.go @@ -2,19 +2,21 @@ package tests import ( "bytes" + "context" "fmt" "testing" "time" "github.com/stretchr/testify/require" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/contracts/native/inccounter" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/collections" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/packages/vm/core/accounts" "github.com/iotaledger/wasp/packages/vm/core/corecontracts" "github.com/iotaledger/wasp/packages/vm/core/governance" "github.com/iotaledger/wasp/packages/vm/core/root" @@ -27,7 +29,7 @@ func (e *ChainEnv) checkCoreContracts() { require.EqualValues(e.t, []byte{0xFF}, b) cl := e.Chain.SCClient(governance.Contract.Hname(), nil, i) - ret, err := cl.CallView(governance.ViewGetChainInfo.Name, nil) + ret, err := cl.CallView(context.Background(), governance.ViewGetChainInfo.Name, nil) require.NoError(e.t, err) chainID, err := codec.DecodeChainID(ret.MustGet(governance.VarChainID)) @@ -43,7 +45,7 @@ func (e *ChainEnv) checkCoreContracts() { require.EqualValues(e.t, e.Chain.Description, desc) records, err := e.Chain.SCClient(root.Contract.Hname(), nil, i). - CallView(root.ViewGetContractRecords.Name, nil) + CallView(context.Background(), root.ViewGetContractRecords.Name, nil) require.NoError(e.t, err) contractRegistry, err := root.DecodeContractRegistry(collections.NewMapReadOnly(records, root.StateVarContractRegistry)) @@ -75,27 +77,30 @@ func (e *ChainEnv) getBalanceOnChain(agentID isc.AgentID, assetID []byte, nodeIn if len(nodeIndex) > 0 { idx = nodeIndex[0] } - ret, err := e.Chain.Cluster.WaspClient(idx).CallView( - e.Chain.ChainID, accounts.Contract.Hname(), accounts.ViewBalance.Name, - dict.Dict{ - accounts.ParamAgentID: agentID.Bytes(), - }) - if err != nil { - return 0 - } - actual, err := isc.AssetsFromDict(ret) + balance, _, err := e.Chain.Cluster.WaspClient(idx).CorecontractsApi. + AccountsGetAccountBalance(context.Background(), e.Chain.ChainID.String(), agentID.String()). + Execute() + require.NoError(e.t, err) + + assets, err := apiextensions.NewAssetsFromAPIResponse(balance) require.NoError(e.t, err) if bytes.Equal(assetID, isc.BaseTokenID) { - return actual.BaseTokens + return assets.BaseTokens } - nativeTokensSet, err := actual.NativeTokens.Set() - require.NoError(e.t, err) nativeTokenID, err := isc.NativeTokenIDFromBytes(assetID) require.NoError(e.t, err) - return nativeTokensSet[nativeTokenID].Amount.Uint64() + + for _, nativeToken := range assets.NativeTokens { + if nativeToken.ID.Matches(nativeTokenID) { + // TODO: Validate bigint to uint64 behavior + return nativeToken.Amount.Uint64() + } + } + // TODO: Throw error when native token id wasn't found? + return 0 } func (e *ChainEnv) checkBalanceOnChain(agentID isc.AgentID, assetID []byte, expected uint64) { @@ -104,14 +109,15 @@ func (e *ChainEnv) checkBalanceOnChain(agentID isc.AgentID, assetID []byte, expe } func (e *ChainEnv) getAccountsOnChain() []isc.AgentID { - r, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, accounts.Contract.Hname(), accounts.ViewAccounts.Name, nil, - ) + accounts, _, err := e.Chain.Cluster.WaspClient(0).CorecontractsApi. + AccountsGetAccounts(context.Background(), e.Chain.ChainID.String()). + Execute() + require.NoError(e.t, err) ret := make([]isc.AgentID, 0) - for key := range r { - aid, err := isc.AgentIDFromBytes([]byte(key)) + for _, address := range accounts.Accounts { + aid, err := isc.NewAgentIDFromString(address) require.NoError(e.t, err) ret = append(ret, aid) @@ -124,28 +130,31 @@ func (e *ChainEnv) getAccountsOnChain() []isc.AgentID { func (e *ChainEnv) getBalancesOnChain() map[string]*isc.Assets { ret := make(map[string]*isc.Assets) acc := e.getAccountsOnChain() + for _, agentID := range acc { - r, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, accounts.Contract.Hname(), accounts.ViewBalance.Name, - dict.Dict{ - accounts.ParamAgentID: agentID.Bytes(), - }, - ) + balance, _, err := e.Chain.Cluster.WaspClient().CorecontractsApi. + AccountsGetAccountBalance(context.Background(), e.Chain.ChainID.String(), agentID.String()). + Execute() require.NoError(e.t, err) - ret[string(agentID.Bytes())], err = isc.AssetsFromDict(r) + + assets, err := apiextensions.NewAssetsFromAPIResponse(balance) require.NoError(e.t, err) + + ret[string(agentID.Bytes())] = assets } return ret } func (e *ChainEnv) getTotalBalance() *isc.Assets { - r, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, accounts.Contract.Hname(), accounts.ViewTotalAssets.Name, nil, - ) + totalAssets, _, err := e.Chain.Cluster.WaspClient().CorecontractsApi. + AccountsGetTotalAssets(context.Background(), e.Chain.ChainID.String()). + Execute() require.NoError(e.t, err) - ret, err := isc.AssetsFromDict(r) + + assets, err := apiextensions.NewAssetsFromAPIResponse(totalAssets) require.NoError(e.t, err) - return ret + + return assets } func (e *ChainEnv) printAccounts(title string) { @@ -170,16 +179,17 @@ func (e *ChainEnv) checkLedger() { } func (e *ChainEnv) getChainInfo() (isc.ChainID, isc.AgentID) { - ret, err := e.Chain.Cluster.WaspClient(0).CallView( - e.Chain.ChainID, governance.Contract.Hname(), governance.ViewGetChainInfo.Name, nil, - ) + chainInfo, _, err := e.Chain.Cluster.WaspClient(0).ChainsApi. + GetChainInfo(context.Background(), e.Chain.ChainID.String()). + Execute() require.NoError(e.t, err) - chainID, err := codec.DecodeChainID(ret.MustGet(governance.VarChainID)) + chainID, err := isc.ChainIDFromString(chainInfo.ChainID) require.NoError(e.t, err) - ownerID, err := codec.DecodeAgentID(ret.MustGet(governance.VarChainOwnerID)) + ownerID, err := isc.NewAgentIDFromString(chainInfo.ChainOwnerId) require.NoError(e.t, err) + return chainID, ownerID } @@ -190,18 +200,26 @@ func (e *ChainEnv) findContract(name string, nodeIndex ...int) (*root.ContractRe } hname := isc.Hn(name) - ret, err := e.Chain.Cluster.WaspClient(i).CallView( - e.Chain.ChainID, root.Contract.Hname(), root.ViewFindContract.Name, - dict.Dict{ - root.ParamHname: codec.EncodeHname(hname), - }) - if err != nil { - return nil, err + + args := dict.Dict{ + root.ParamHname: codec.EncodeHname(hname), } + + // TODO: Validate with develop + ret, err := apiextensions.CallView(context.Background(), e.Chain.Cluster.WaspClient(i), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: root.Contract.Hname().String(), + FunctionHName: root.ViewFindContract.Hname().String(), + Arguments: apiextensions.JSONDictToAPIJSONDict(args.JSONDict()), + }) + + require.NoError(e.t, err) + recBin, err := ret.Get(root.ParamContractRecData) if err != nil { return nil, err } + return root.ContractRecordFromBytes(recBin) } @@ -224,9 +242,11 @@ func waitTrue(timeout time.Duration, fun func() bool) bool { func (e *ChainEnv) counterEquals(expected int64) conditionFn { return func(t *testing.T, nodeIndex int) bool { - ret, err := e.Chain.Cluster.WaspClient(nodeIndex).CallView( - e.Chain.ChainID, nativeIncCounterSCHname, inccounter.ViewGetCounter.Name, nil, - ) + ret, err := apiextensions.CallView(context.Background(), e.Chain.Cluster.WaspClient(nodeIndex), apiclient.ContractCallViewRequest{ + ChainId: e.Chain.ChainID.String(), + ContractHName: nativeIncCounterSCHname.String(), + FunctionHName: inccounter.ViewGetCounter.Hname().String(), + }) if err != nil { e.t.Logf("chainEnv::counterEquals: failed to call GetCounter: %v", err) return false diff --git a/tools/cluster/tests/wasp-cli_rotation_test.go b/tools/cluster/tests/wasp-cli_rotation_test.go index 979e15b5b8..15a3022e66 100644 --- a/tools/cluster/tests/wasp-cli_rotation_test.go +++ b/tools/cluster/tests/wasp-cli_rotation_test.go @@ -1,6 +1,7 @@ package tests import ( + "context" "fmt" "regexp" "strings" @@ -9,6 +10,7 @@ import ( "github.com/stretchr/testify/require" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/vm/core/governance" @@ -82,23 +84,33 @@ func testWaspCLIExternalRotation(t *testing.T, addAccessNode func(*WaspCLITest, // adds node #0 from cluster2 as access node of the chain { - node0peerInfo, err := w2.Cluster.WaspClient(0).GetPeeringSelf() + node0peerInfo, _, err := w2.Cluster.WaspClient(0).NodeApi. + GetPeeringIdentity(context.Background()). + Execute() require.NoError(t, err) // set trust relations between node0 of cluster 2 and all nodes of cluster 1 - w.Cluster.AddTrustedNode(node0peerInfo) + err = w.Cluster.AddTrustedNode(apiclient.PeeringTrustRequest{ + PublicKey: node0peerInfo.PublicKey, + NetId: node0peerInfo.NetId, + }) + require.NoError(t, err) + cluster1PubKeys := make([]*cryptolib.PublicKey, len(w.Cluster.AllNodes())) for _, nodeIndex := range w.Cluster.Config.AllNodes() { // equivalent of "wasp-cli peer info" - peerInfo, err := w.Cluster.WaspClient(nodeIndex).GetPeeringSelf() + peerInfo, _, err := w.Cluster.WaspClient(nodeIndex).NodeApi. + GetPeeringIdentity(context.Background()). + Execute() require.NoError(t, err) - w2.MustRun("peering", "trust", peerInfo.PubKey, peerInfo.NetID) - cluster1PubKeys[nodeIndex], err = cryptolib.NewPublicKeyFromString(peerInfo.PubKey) + + w2.MustRun("peering", "trust", peerInfo.PublicKey, peerInfo.NetId) + cluster1PubKeys[nodeIndex], err = cryptolib.NewPublicKeyFromString(peerInfo.PublicKey) require.NoError(t, err) } // add node 0 from cluster 2 as an access node in the governance contract - pubKey, err := cryptolib.NewPublicKeyFromString(node0peerInfo.PubKey) + pubKey, err := cryptolib.NewPublicKeyFromString(node0peerInfo.PublicKey) require.NoError(t, err) addAccessNode(w, pubKey.String()) diff --git a/tools/schema/generator/rstemplates/cargotoml.go b/tools/schema/generator/rstemplates/cargotoml.go index e485bc99d8..ae911a09a8 100644 --- a/tools/schema/generator/rstemplates/cargotoml.go +++ b/tools/schema/generator/rstemplates/cargotoml.go @@ -43,14 +43,14 @@ description = "Wasm VM host stub for: $scDesc" // ******************************* "dependenciesLib": ` [dependencies] -wasmlib = { git = "https://github.com/iotaledger/wasp", branch = "wasmclient" } +wasmlib = { git = "https://github.com/iotaledger/wasp", branch = "develop" } `, // ******************************* "dependenciesImpl": ` [dependencies] $package = { path = "../$package" } $#if packagetestwasmlib dependencyErc721 -wasmlib = { git = "https://github.com/iotaledger/wasp", branch = "wasmclient" } +wasmlib = { git = "https://github.com/iotaledger/wasp", branch = "develop" } `, // ******************************* "dependencyErc721": ` @@ -63,7 +63,7 @@ default = ["console_error_panic_hook"] [dependencies] $package$+impl = { path = "../$package$+impl" } -wasmvmhost = { git = "https://github.com/iotaledger/wasp", branch = "wasmclient" } +wasmvmhost = { git = "https://github.com/iotaledger/wasp", branch = "develop" } console_error_panic_hook = { version = "0.1.7", optional = true } wee_alloc = { version = "0.4.5", optional = true } `, diff --git a/tools/wasp-cli/authentication/info.go b/tools/wasp-cli/authentication/info.go index 73fe2d5b3f..7e66a9c22b 100644 --- a/tools/wasp-cli/authentication/info.go +++ b/tools/wasp-cli/authentication/info.go @@ -1,31 +1,43 @@ package authentication import ( - "encoding/json" + "context" "github.com/spf13/cobra" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) +type AuthInfoOutput struct { + AuthenticationMethod string + AuthenticationURL string +} + +var _ log.CLIOutput = &AuthInfoOutput{} + +func (l *AuthInfoOutput) AsText() (string, error) { + template := `Authentication Method: {{ .AuthenticationMethod }} +Authentication URL: {{ .AuthenticationURL }}` + return log.ParseCLIOutputTemplate(l, template) +} + func initInfoCmd() *cobra.Command { return &cobra.Command{ Use: "info", Short: "Receive information about the authentication methods", Run: func(cmd *cobra.Command, args []string) { - client := config.WaspClient(config.MustWaspAPI()) - authInfo, err := client.AuthInfo() - if err != nil { - panic(err) - } - - authInfoJSON, err := json.MarshalIndent(authInfo, "", " ") - if err != nil { - panic(err) - } - - log.Printf(string(authInfoJSON)) + + // Auth is currently not inside Swagger, so this is a temporary change + client := cliclients.WaspClientForIndex() + authInfo, _, err := client.AuthApi.AuthInfo(context.Background()).Execute() + + log.Check(err) + + log.PrintCLIOutput(&AuthInfoOutput{ + AuthenticationMethod: authInfo.Scheme, + AuthenticationURL: authInfo.AuthURL, + }) }, } } diff --git a/tools/wasp-cli/authentication/login.go b/tools/wasp-cli/authentication/login.go index a56f16d2c7..3f44e88356 100644 --- a/tools/wasp-cli/authentication/login.go +++ b/tools/wasp-cli/authentication/login.go @@ -2,13 +2,16 @@ package authentication import ( "bufio" + "context" "os" "syscall" "github.com/spf13/cobra" "golang.org/x/term" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -45,13 +48,16 @@ func initLoginCmd() *cobra.Command { return } - client := config.WaspClient(config.MustWaspAPI()) - token, err := client.Login(username, password) - if err != nil { - panic(err) - } + token, _, err := cliclients.WaspClientForIndex().AuthApi. + Authenticate(context.Background()). + LoginRequest(apiclient.LoginRequest{ + Username: username, + Password: password, + }).Execute() + + log.Check(err) - config.SetToken(token) + config.SetToken(token.Jwt) log.Printf("\nSuccessfully authenticated\n") }, diff --git a/tools/wasp-cli/chain/access-nodes.go b/tools/wasp-cli/chain/access-nodes.go index 6bdf08bbe8..f1ee2182a4 100644 --- a/tools/wasp-cli/chain/access-nodes.go +++ b/tools/wasp-cli/chain/access-nodes.go @@ -4,9 +4,12 @@ package chain import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -21,18 +24,22 @@ func initPermitionlessAccessNodesCmd() *cobra.Command { if nodes == nil { nodes = GetAllWaspNodes() } - chainID := GetCurrentChainID() + chainID := config.GetCurrentChainID() action := args[0] pubKey := args[1] for _, i := range nodes { - client := config.WaspClient(config.MustWaspAPI(i)) + client := cliclients.WaspClientForIndex(i) switch action { case "add": - err := client.AddAccessNode(chainID, pubKey) + _, err := client.ChainsApi. + AddAccessNode(context.Background(), chainID.String(), pubKey). + Execute() log.Check(err) case "remove": - err := client.RemoveAccessNode(chainID, pubKey) + _, err := client.ChainsApi. + RemoveAccessNode(context.Background(), chainID.String(), pubKey). + Execute() log.Check(err) default: log.Fatalf("unknown action: %s", action) diff --git a/tools/wasp-cli/chain/accounts.go b/tools/wasp-cli/chain/accounts.go index 22df1a8593..172cece77f 100644 --- a/tools/wasp-cli/chain/accounts.go +++ b/tools/wasp-cli/chain/accounts.go @@ -1,19 +1,21 @@ package chain import ( + "context" "strings" "github.com/spf13/cobra" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/codec" "github.com/iotaledger/wasp/packages/kv/dict" "github.com/iotaledger/wasp/packages/vm/core/accounts" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" - "github.com/iotaledger/wasp/tools/wasp-cli/wallet" ) func initListAccountsCmd() *cobra.Command { @@ -22,18 +24,18 @@ func initListAccountsCmd() *cobra.Command { Short: "List L2 accounts", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - ret, err := SCClient(accounts.Contract.Hname()).CallView(accounts.ViewAccounts.Name, nil) + client := cliclients.WaspClientForIndex() + chainID := config.GetCurrentChainID() + + accountList, _, err := client.CorecontractsApi.AccountsGetAccounts(context.Background(), chainID.String()).Execute() log.Check(err) - log.Printf("Total %d account(s) in chain %s\n", len(ret), GetCurrentChainID().String()) + log.Printf("Total %d account(s) in chain %s\n", len(accountList.Accounts), config.GetCurrentChainID().String()) header := []string{"agentid"} - rows := make([][]string, len(ret)) - i := 0 - for k := range ret { - agentID, err := codec.DecodeAgentID([]byte(k)) - log.Check(err) - rows[i] = []string{agentID.String()} + rows := make([][]string, len(accountList.Accounts)) + for i, account := range accountList.Accounts { + rows[i] = []string{account} i++ } log.PrintTable(header, rows) @@ -56,25 +58,20 @@ func initBalanceCmd() *cobra.Command { log.Check(err) } - ret, err := SCClient(accounts.Contract.Hname()).CallView(accounts.ViewBalance.Name, dict.Dict{ - accounts.ParamAgentID: agentID.Bytes(), - }) + client := cliclients.WaspClientForIndex() + chainID := config.GetCurrentChainID() + balance, _, err := client.CorecontractsApi.AccountsGetAccountBalance(context.Background(), chainID.String(), agentID.String()).Execute() + log.Check(err) header := []string{"token", "amount"} - rows := make([][]string, len(ret)) - i := 0 - for k, v := range ret { - tokenStr := util.BaseTokenStr - if !isc.IsBaseToken([]byte(k)) { - tokenStr = codec.MustDecodeNativeTokenID([]byte(k)).String() - } - bal, err := codec.DecodeBigIntAbs(v) - log.Check(err) + rows := make([][]string, len(balance.NativeTokens)+1) - rows[i] = []string{tokenStr, bal.String()} - i++ + rows[0] = []string{"base", balance.BaseTokens} + for k, v := range balance.NativeTokens { + rows[k+1] = []string{v.Id, v.Amount} } + log.PrintTable(header, rows) }, } @@ -91,8 +88,10 @@ func initDepositCmd() *cobra.Command { if strings.Contains(args[0], ":") { // deposit to own agentID tokens := util.ParseFungibleTokens(args) - util.WithSCTransaction(GetCurrentChainID(), func() (*iotago.Transaction, error) { - return SCClient(accounts.Contract.Hname()).PostRequest( + util.WithSCTransaction(config.GetCurrentChainID(), func() (*iotago.Transaction, error) { + client := cliclients.WaspClientForIndex() + + return cliclients.SCClient(client, accounts.Contract.Hname()).PostRequest( accounts.FuncDeposit.Name, chainclient.PostRequestParams{ Transfer: tokens, @@ -108,8 +107,10 @@ func initDepositCmd() *cobra.Command { tokens := util.ParseFungibleTokens(tokensStr) allowance := tokens.Clone() - util.WithSCTransaction(GetCurrentChainID(), func() (*iotago.Transaction, error) { - return SCClient(accounts.Contract.Hname()).PostRequest( + util.WithSCTransaction(config.GetCurrentChainID(), func() (*iotago.Transaction, error) { + client := cliclients.WaspClientForIndex() + + return cliclients.SCClient(client, accounts.Contract.Hname()).PostRequest( accounts.FuncTransferAllowanceTo.Name, chainclient.PostRequestParams{ Args: dict.Dict{ diff --git a/tools/wasp-cli/chain/activate.go b/tools/wasp-cli/chain/activate.go index 11e9aec2aa..b5b9549065 100644 --- a/tools/wasp-cli/chain/activate.go +++ b/tools/wasp-cli/chain/activate.go @@ -1,18 +1,17 @@ package chain import ( - "regexp" + "context" + "net/http" "github.com/spf13/cobra" - "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) -var HTTP404ErrRegexp = regexp.MustCompile(`"Code":404`) - func initActivateCmd() *cobra.Command { var nodes []int cmd := &cobra.Command{ @@ -20,26 +19,38 @@ func initActivateCmd() *cobra.Command { Short: "Activates the chain on selected nodes", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - chainID := GetCurrentChainID() + chainID := config.GetCurrentChainID() if nodes == nil { nodes = GetAllWaspNodes() } for _, nodeIdx := range nodes { - client := Client(config.WaspAPI(nodeIdx)) - r, err := client.WaspClient.GetChainInfo(chainID) + client := cliclients.WaspClientForIndex(nodeIdx) + + r, httpStatus, err := client.ChainsApi.GetChainInfo(context.Background(), chainID.String()).Execute() - if err != nil && !HTTP404ErrRegexp.MatchString(err.Error()) { + if err != nil && httpStatus.StatusCode != http.StatusNotFound { log.Check(err) } - if r != nil && r.Active { + + if r != nil && r.IsActive { continue } + if r == nil { - log.Check(client.WaspClient.PutChainRecord(registry.NewChainRecord(chainID, true, []*cryptolib.PublicKey{}))) + _, err := client.ChainsApi.SetChainRecord(context.Background(), chainID.String()).ChainRecord(apiclient.ChainRecord{ + IsActive: true, + AccessNodes: []string{}, + }).Execute() + + log.Check(err) } else { - log.Check(client.WaspClient.ActivateChain(chainID)) + _, err = client.ChainsApi.ActivateChain(context.Background(), chainID.String()).Execute() + + log.Check(err) } } + + log.Printf("Chain activated") }, } @@ -55,12 +66,15 @@ func initDeactivateCmd() *cobra.Command { Short: "Deactivates the chain on selected nodes", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - chainID := GetCurrentChainID() + chainID := config.GetCurrentChainID() if nodes == nil { nodes = GetAllWaspNodes() } for _, nodeIdx := range nodes { - log.Check(Client(config.WaspAPI(nodeIdx)).WaspClient.DeactivateChain(chainID)) + client := cliclients.WaspClientForIndex(nodeIdx) + + _, err := client.ChainsApi.DeactivateChain(context.Background(), chainID.String()).Execute() + log.Check(err) } }, } diff --git a/tools/wasp-cli/chain/add.go b/tools/wasp-cli/chain/add.go index 3611f2f894..528ca02fe3 100644 --- a/tools/wasp-cli/chain/add.go +++ b/tools/wasp-cli/chain/add.go @@ -1,6 +1,10 @@ package chain -import "github.com/spf13/cobra" +import ( + "github.com/spf13/cobra" + + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" +) func initAddChainCmd() *cobra.Command { return &cobra.Command{ @@ -8,7 +12,7 @@ func initAddChainCmd() *cobra.Command { Short: "adds a chain to the list of chains", Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { - AddChainAlias(args[0], args[1]) + config.AddChainAlias(args[0], args[1]) }, } } diff --git a/tools/wasp-cli/chain/alias.go b/tools/wasp-cli/chain/alias.go index 72eaf491d6..5f5138febb 100644 --- a/tools/wasp-cli/chain/alias.go +++ b/tools/wasp-cli/chain/alias.go @@ -1,41 +1,2 @@ package chain -import ( - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/tools/wasp-cli/config" - "github.com/iotaledger/wasp/tools/wasp-cli/log" -) - -var chainAlias string - -func GetChainAlias() string { - if chainAlias == "" { - chainAlias = viper.GetString("chain") - } - if chainAlias == "" { - log.Fatal("No current chain. Call `chain deploy --chain=` or `set chain `") - } - return chainAlias -} - -func SetCurrentChain(chainAlias string) { - config.Set("chain", chainAlias) -} - -func initAliasFlags(chainCmd *cobra.Command) { - chainCmd.PersistentFlags().StringVarP(&chainAlias, "chain", "a", "", "chain alias") -} - -func AddChainAlias(chainAlias, id string) { - config.Set("chains."+chainAlias, id) - SetCurrentChain(chainAlias) -} - -func GetCurrentChainID() isc.ChainID { - chainID, err := isc.ChainIDFromString(viper.GetString("chains." + GetChainAlias())) - log.Check(err) - return chainID -} diff --git a/tools/wasp-cli/chain/blobs.go b/tools/wasp-cli/chain/blobs.go index 2f6aadd36c..a6a26d677c 100644 --- a/tools/wasp-cli/chain/blobs.go +++ b/tools/wasp-cli/chain/blobs.go @@ -1,15 +1,18 @@ package chain import ( + "context" "fmt" "github.com/spf13/cobra" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/hashing" - "github.com/iotaledger/wasp/packages/kv/codec" + "github.com/iotaledger/wasp/packages/kv" "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blob" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) @@ -26,13 +29,15 @@ func initStoreBlobCmd() *cobra.Command { Short: "Store a blob in the chain", Args: cobra.MinimumNArgs(4), Run: func(cmd *cobra.Command, args []string) { - uploadBlob(util.EncodeParams(args), config.MustWaspAPI()) + uploadBlob(cliclients.WaspClientForIndex(), util.EncodeParams(args)) }, } } -func uploadBlob(fieldValues dict.Dict, apiAddress string) (hash hashing.HashValue) { - hash, _, _, err := Client(apiAddress).UploadBlob(fieldValues) +func uploadBlob(client *apiclient.APIClient, fieldValues dict.Dict) (hash hashing.HashValue) { + chainClient := cliclients.ChainClient(client) + + hash, _, _, err := chainClient.UploadBlob(context.Background(), fieldValues) log.Check(err) log.Printf("uploaded blob to chain -- hash: %s", hash) // TODO print receipt? @@ -47,23 +52,28 @@ func initShowBlobCmd() *cobra.Command { Run: func(cmd *cobra.Command, args []string) { hash, err := hashing.HashValueFromHex(args[0]) log.Check(err) - fields, err := SCClient(blob.Contract.Hname()).CallView( - blob.ViewGetBlobInfo.Name, - dict.Dict{blob.ParamHash: hash.Bytes()}, - ) + + client := cliclients.WaspClientForIndex() + + blobInfo, _, err := client. + CorecontractsApi. + BlobsGetBlobInfo(context.Background(), config.GetCurrentChainID().String(), hash.Hex()). + Execute() log.Check(err) values := dict.New() - for field := range fields { - value, err := SCClient(blob.Contract.Hname()).CallView( - blob.ViewGetBlobField.Name, - dict.Dict{ - blob.ParamHash: hash.Bytes(), - blob.ParamField: []byte(field), - }, - ) + for field := range blobInfo.Fields { + value, _, err := client. + CorecontractsApi. + BlobsGetBlobValue(context.Background(), config.GetCurrentChainID().String(), hash.Hex(), field). + Execute() + + log.Check(err) + + decodedValue, err := iotago.DecodeHex(value.ValueData) log.Check(err) - values.Set(field, value[blob.ParamBytes]) + + values.Set(kv.Key(field), []byte(decodedValue)) } util.PrintDictAsJSON(values) }, @@ -76,23 +86,24 @@ func initListBlobsCmd() *cobra.Command { Short: "List blobs in chain", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - ret, err := SCClient(blob.Contract.Hname()).CallView(blob.ViewListBlobs.Name, nil) - log.Check(err) + client := cliclients.WaspClientForIndex() + + blobsResponse, _, err := client. + CorecontractsApi. + BlobsGetAllBlobs(context.Background(), config.GetCurrentChainID().String()). + Execute() - blobs, err := blob.DecodeSizesMap(ret) log.Check(err) - log.Printf("Total %d blob(s) in chain %s\n", len(ret), GetCurrentChainID()) + log.Printf("Total %d blob(s) in chain %s\n", len(blobsResponse.Blobs), config.GetCurrentChainID()) header := []string{"hash", "size"} - rows := make([][]string, len(ret)) - i := 0 - for k, size := range blobs { - hash, err := codec.DecodeHashValue([]byte(k)) - log.Check(err) - rows[i] = []string{hash.String(), fmt.Sprintf("%d", size)} - i++ + rows := make([][]string, len(blobsResponse.Blobs)) + + for i, blob := range blobsResponse.Blobs { + rows[i] = []string{blob.Hash, fmt.Sprintf("%d", blob.Size)} } + log.PrintTable(header, rows) }, } diff --git a/tools/wasp-cli/chain/blocklog.go b/tools/wasp-cli/chain/blocklog.go index 3028f711fc..ca3d1cbde9 100644 --- a/tools/wasp-cli/chain/blocklog.go +++ b/tools/wasp-cli/chain/blocklog.go @@ -1,17 +1,17 @@ package chain import ( + "context" "strconv" "time" "github.com/spf13/cobra" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/codec" - "github.com/iotaledger/wasp/packages/kv/collections" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" - "github.com/iotaledger/wasp/packages/vm/core/errors" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -35,49 +35,56 @@ func initBlockCmd() *cobra.Command { } } -func fetchBlockInfo(args []string) *blocklog.BlockInfo { +func fetchBlockInfo(args []string) *apiclient.BlockInfoResponse { + client := cliclients.WaspClientForIndex() + if len(args) == 0 { - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetBlockInfo.Name, nil) - log.Check(err) - index, err := codec.DecodeUint32(ret.MustGet(blocklog.ParamBlockIndex)) - log.Check(err) - b, err := blocklog.BlockInfoFromBytes(index, ret.MustGet(blocklog.ParamBlockInfo)) + blockInfo, _, err := client. + CorecontractsApi. + BlocklogGetLatestBlockInfo(context.Background(), config.GetCurrentChainID().String()). + Execute() + log.Check(err) - return b + return blockInfo } + index, err := strconv.Atoi(args[0]) log.Check(err) - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetBlockInfo.Name, dict.Dict{ - blocklog.ParamBlockIndex: codec.EncodeUint32(uint32(index)), - }) - log.Check(err) - b, err := blocklog.BlockInfoFromBytes(uint32(index), ret.MustGet(blocklog.ParamBlockInfo)) + + blockInfo, _, err := client. + CorecontractsApi. + BlocklogGetBlockInfo(context.Background(), config.GetCurrentChainID().String(), uint32(index)). + Execute() + log.Check(err) - return b + + return blockInfo } func logRequestsInBlock(index uint32) { - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetRequestReceiptsForBlock.Name, dict.Dict{ - blocklog.ParamBlockIndex: codec.EncodeUint32(index), - }) + client := cliclients.WaspClientForIndex() + receipts, _, err := client.CorecontractsApi. + BlocklogGetRequestReceiptsOfBlock(context.Background(), config.GetCurrentChainID().String(), index). + Execute() + log.Check(err) - arr := collections.NewArray16ReadOnly(ret, blocklog.ParamRequestRecord) - for i := uint16(0); i < arr.MustLen(); i++ { - receipt, err := blocklog.RequestReceiptFromBytes(arr.MustGetAt(i)) - log.Check(err) - logReceipt(receipt, i) + + for i, receipt := range receipts.Receipts { + logReceipt(&receipt, i) } } -func logReceipt(receipt *blocklog.RequestReceipt, index ...uint16) { +func logReceipt(receipt *apiclient.RequestReceiptResponse, index ...int) { req := receipt.Request kind := "on-ledger" - if req.IsOffLedger() { + if req.IsOffLedger { kind = "off-ledger" } - args := req.Params() + args, err := apiextensions.APIJsonDictToDict(req.Params) + log.Check(err) + var argsTree interface{} = "(empty)" if len(args) > 0 { argsTree = args @@ -85,35 +92,33 @@ func logReceipt(receipt *blocklog.RequestReceipt, index ...uint16) { errMsg := "(empty)" if receipt.Error != nil { - resolved, err := errors.Resolve(receipt.Error, func(contractName string, funcName string, params dict.Dict) (dict.Dict, error) { - return SCClient(isc.Hn(contractName)).CallView(funcName, params) - }) - log.Check(err) - errMsg = resolved.Error() + errMsg = receipt.Error.ErrorMessage } tree := []log.TreeItem{ {K: "Kind", V: kind}, - {K: "Sender", V: req.SenderAccount().String()}, - {K: "Contract Hname", V: req.CallTarget().Contract.String()}, - {K: "Entry point", V: req.CallTarget().EntryPoint.String()}, + {K: "Sender", V: req.SenderAccount}, + {K: "Contract Hname", V: req.CallTarget.ContractHName}, + {K: "Function Hname", V: req.CallTarget.FunctionHName}, {K: "Arguments", V: argsTree}, {K: "Error", V: errMsg}, } if len(index) > 0 { - log.Printf("Request #%d (%s):\n", index[0], req.ID().String()) + log.Printf("Request #%d (%s):\n", index[0], req.RequestId) } else { - log.Printf("Request %s:\n", req.ID().String()) + log.Printf("Request %s:\n", req.RequestId) } log.PrintTree(tree, 2, 2) } func logEventsInBlock(index uint32) { - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetEventsForBlock.Name, dict.Dict{ - blocklog.ParamBlockIndex: codec.EncodeUint32(index), - }) + client := cliclients.WaspClientForIndex() + events, _, err := client.CorecontractsApi. + BlocklogGetEventsOfBlock(context.Background(), config.GetCurrentChainID().String(), index). + Execute() + log.Check(err) - logEvents(ret) + logEvents(events) } func initRequestCmd() *cobra.Command { @@ -124,18 +129,17 @@ func initRequestCmd() *cobra.Command { Run: func(cmd *cobra.Command, args []string) { reqID, err := isc.RequestIDFromString(args[0]) log.Check(err) - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetRequestReceipt.Name, dict.Dict{ - blocklog.ParamRequestID: codec.EncodeRequestID(reqID), - }) - log.Check(err) - blockIndex, err := codec.DecodeUint32(ret.MustGet(blocklog.ParamBlockIndex)) - log.Check(err) - receipt, err := blocklog.RequestReceiptFromBytes(ret.MustGet(blocklog.ParamRequestRecord)) + client := cliclients.WaspClientForIndex() + receipt, _, err := client.CorecontractsApi. + BlocklogGetRequestReceipt(context.Background(), config.GetCurrentChainID().String(), reqID.String()). + Execute() + log.Check(err) - log.Printf("Request found in block %d\n\n", blockIndex) + log.Printf("Request found in block %d\n\n", receipt.BlockIndex) logReceipt(receipt) + log.Printf("\n") logEventsInRequest(reqID) log.Printf("\n") @@ -144,20 +148,23 @@ func initRequestCmd() *cobra.Command { } func logEventsInRequest(reqID isc.RequestID) { - ret, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetEventsForRequest.Name, dict.Dict{ - blocklog.ParamRequestID: codec.EncodeRequestID(reqID), - }) + client := cliclients.WaspClientForIndex() + events, _, err := client.CorecontractsApi. + BlocklogGetEventsOfRequest(context.Background(), config.GetCurrentChainID().String(), reqID.String()). + Execute() + log.Check(err) - logEvents(ret) + logEvents(events) } -func logEvents(ret dict.Dict) { - arr := collections.NewArray16ReadOnly(ret, blocklog.ParamEvent) +func logEvents(ret *apiclient.EventsResponse) { header := []string{"event"} - rows := make([][]string, arr.MustLen()) - for i := uint16(0); i < arr.MustLen(); i++ { - rows[i] = []string{string(arr.MustGetAt(i))} + rows := make([][]string, len(ret.Events)) + + for i, event := range ret.Events { + rows[i] = []string{event} } - log.Printf("Total %d events\n", arr.MustLen()) + + log.Printf("Total %d events\n", len(ret.Events)) log.PrintTable(header, rows) } diff --git a/tools/wasp-cli/chain/callview.go b/tools/wasp-cli/chain/callview.go index 82c8530c55..530033c2ee 100644 --- a/tools/wasp-cli/chain/callview.go +++ b/tools/wasp-cli/chain/callview.go @@ -1,9 +1,14 @@ package chain import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) @@ -15,9 +20,24 @@ func initCallViewCmd() *cobra.Command { Long: "Call contract , view function with given params.", Args: cobra.MinimumNArgs(2), Run: func(cmd *cobra.Command, args []string) { - r, err := SCClient(isc.Hn(args[0])).CallView(args[1], util.EncodeParams(args[2:])) + client := cliclients.WaspClientForIndex() + + contractName := args[0] + funcName := args[1] + params := util.EncodeParams(args[2:]) + + result, _, err := client.RequestsApi.CallView(context.Background()).ContractCallViewRequest(apiclient.ContractCallViewRequest{ + ChainId: config.GetCurrentChainID().String(), + ContractName: contractName, + FunctionName: funcName, + Arguments: apiextensions.JSONDictToAPIJSONDict(params.JSONDict()), + }).Execute() log.Check(err) - util.PrintDictAsJSON(r) + + decodedResult, err := apiextensions.APIJsonDictToDict(*result) + log.Check(err) + + util.PrintDictAsJSON(decodedResult) }, } } diff --git a/tools/wasp-cli/chain/client.go b/tools/wasp-cli/chain/client.go deleted file mode 100644 index bb74abf058..0000000000 --- a/tools/wasp-cli/chain/client.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2020 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -package chain - -import ( - "github.com/iotaledger/wasp/client/chainclient" - "github.com/iotaledger/wasp/client/scclient" - "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/tools/wasp-cli/config" - "github.com/iotaledger/wasp/tools/wasp-cli/wallet" -) - -func Client(apiAddress string) *chainclient.Client { - return chainclient.New( - config.L1Client(), - config.WaspClient(apiAddress), - GetCurrentChainID(), - wallet.Load().KeyPair, - ) -} - -func SCClient(contractHname isc.Hname, i ...int) *scclient.SCClient { - return scclient.New(Client(config.WaspAPI(i...)), contractHname) -} diff --git a/tools/wasp-cli/chain/cmd.go b/tools/wasp-cli/chain/cmd.go index d1a217b23a..6f428a2994 100644 --- a/tools/wasp-cli/chain/cmd.go +++ b/tools/wasp-cli/chain/cmd.go @@ -3,6 +3,7 @@ package chain import ( "github.com/spf13/cobra" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -21,7 +22,7 @@ func Init(rootCmd *cobra.Command) { chainCmd := initChainCmd() rootCmd.AddCommand(chainCmd) - initAliasFlags(chainCmd) + config.InitAliasFlags(chainCmd) initUploadFlags(chainCmd) chainCmd.AddCommand(initListCmd()) diff --git a/tools/wasp-cli/chain/deploy.go b/tools/wasp-cli/chain/deploy.go index 8f309eed62..deadbd6075 100644 --- a/tools/wasp-cli/chain/deploy.go +++ b/tools/wasp-cli/chain/deploy.go @@ -4,6 +4,7 @@ package chain import ( + "context" "math" "os" "strconv" @@ -12,6 +13,8 @@ import ( "github.com/spf13/viper" iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/multiclient" "github.com/iotaledger/wasp/packages/apilib" "github.com/iotaledger/wasp/packages/evm/evmtypes" "github.com/iotaledger/wasp/packages/kv/codec" @@ -19,9 +22,10 @@ import ( "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/vm/core/evm" "github.com/iotaledger/wasp/packages/vm/core/root" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" - "github.com/iotaledger/wasp/tools/wasp-cli/wallet" ) func GetAllWaspNodes() []int { @@ -73,7 +77,7 @@ func initDeployCmd() *cobra.Command { Short: "Deploy a new chain", Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - l1Client := config.L1Client() + l1Client := cliclients.L1Client() if committee == nil { committee = GetAllWaspNodes() @@ -88,16 +92,19 @@ func initDeployCmd() *cobra.Command { } committeePubKeys := make([]string, 0) - for _, api := range config.CommitteeAPI(committee) { - peerInfo, err := config.WaspClient(api).GetPeeringSelf() + for _, apiIndex := range committee { + peerInfo, _, err := cliclients.WaspClientForIndex(apiIndex).NodeApi.GetPeeringIdentity(context.Background()).Execute() log.Check(err) - committeePubKeys = append(committeePubKeys, peerInfo.PubKey) + committeePubKeys = append(committeePubKeys, peerInfo.PublicKey) } - chainid, _, err := apilib.DeployChainWithDKG(apilib.CreateChainParams{ - AuthenticationToken: config.GetToken(), + var clientResolver multiclient.ClientResolver = func(apiHost string) *apiclient.APIClient { + return cliclients.WaspClientForHostName(apiHost) + } + + chainid, _, err := apilib.DeployChainWithDKG(clientResolver, apilib.CreateChainParams{ Layer1Client: l1Client, - CommitteeAPIHosts: config.CommitteeAPI(committee), + CommitteeAPIHosts: config.CommitteeAPIURL(committee), CommitteePubKeys: committeePubKeys, N: uint16(len(committee)), T: uint16(quorum), @@ -116,11 +123,11 @@ func initDeployCmd() *cobra.Command { var alias string if len(args) == 0 { - alias = GetChainAlias() + alias = config.GetChainAlias() } else { alias = args[0] } - AddChainAlias(alias, chainid.String()) + config.AddChainAlias(alias, chainid.String()) }, } diff --git a/tools/wasp-cli/chain/deploycontract.go b/tools/wasp-cli/chain/deploycontract.go index 594be43c51..074b413292 100644 --- a/tools/wasp-cli/chain/deploycontract.go +++ b/tools/wasp-cli/chain/deploycontract.go @@ -1,9 +1,12 @@ package chain import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/hashing" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/kv/codec" @@ -11,7 +14,8 @@ import ( "github.com/iotaledger/wasp/packages/vm/core/blob" "github.com/iotaledger/wasp/packages/vm/core/root" "github.com/iotaledger/wasp/packages/vm/vmtypes" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) @@ -22,7 +26,7 @@ func initDeployContractCmd() *cobra.Command { Short: "Deploy a contract in the chain", Args: cobra.MinimumNArgs(4), Run: func(cmd *cobra.Command, args []string) { - apiAddress := config.MustWaspAPI() + client := cliclients.WaspClientForIndex() vmtype := args[0] name := args[1] description := args[2] @@ -46,22 +50,22 @@ func initDeployContractCmd() *cobra.Command { blob.VarFieldProgramDescription: description, blob.VarFieldProgramBinary: util.ReadFile(filename), }) - progHash = uploadBlob(blobFieldValues, apiAddress) + progHash = uploadBlob(client, blobFieldValues) } - deployContract(name, description, progHash, initParams, apiAddress) + deployContract(client, name, description, progHash, initParams) }, } } -func deployContract(name, description string, progHash hashing.HashValue, initParams dict.Dict, apiAddress string) { - util.WithOffLedgerRequest(GetCurrentChainID(), func() (isc.OffLedgerRequest, error) { +func deployContract(client *apiclient.APIClient, name, description string, progHash hashing.HashValue, initParams dict.Dict) { + util.WithOffLedgerRequest(config.GetCurrentChainID(), func() (isc.OffLedgerRequest, error) { args := codec.MakeDict(map[string]interface{}{ root.ParamName: name, root.ParamDescription: description, root.ParamProgramHash: progHash, }) args.Extend(initParams) - return Client(apiAddress).PostOffLedgerRequest( + return cliclients.ChainClient(client).PostOffLedgerRequest(context.Background(), root.Contract.Hname(), root.FuncDeployContract.Hname(), chainclient.PostRequestParams{ diff --git a/tools/wasp-cli/chain/events.go b/tools/wasp-cli/chain/events.go index ac8a4fe254..646141aeb6 100644 --- a/tools/wasp-cli/chain/events.go +++ b/tools/wasp-cli/chain/events.go @@ -1,11 +1,13 @@ package chain import ( + "context" + "github.com/spf13/cobra" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/dict" - "github.com/iotaledger/wasp/packages/vm/core/blocklog" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -15,11 +17,15 @@ func initEventsCmd() *cobra.Command { Short: "Show events of contract ", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - r, err := SCClient(blocklog.Contract.Hname()).CallView(blocklog.ViewGetEventsForContract.Name, dict.Dict{ - blocklog.ParamContractHname: isc.Hn(args[0]).Bytes(), - }) + client := cliclients.WaspClientForIndex() + contractHName := isc.Hn(args[0]).String() + + events, _, err := client.CorecontractsApi. + BlocklogGetEventsOfContract(context.Background(), config.GetCurrentChainID().String(), contractHName). + Execute() + log.Check(err) - logEvents(r) + logEvents(events) }, } } diff --git a/tools/wasp-cli/chain/governance.go b/tools/wasp-cli/chain/governance.go index e64dd2aad9..bb0c35bb43 100644 --- a/tools/wasp-cli/chain/governance.go +++ b/tools/wasp-cli/chain/governance.go @@ -6,7 +6,7 @@ package chain import ( "github.com/spf13/cobra" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/cryptolib" "github.com/iotaledger/wasp/packages/vm/core/governance" "github.com/iotaledger/wasp/tools/wasp-cli/log" diff --git a/tools/wasp-cli/chain/info.go b/tools/wasp-cli/chain/info.go index 9a6b60a4cc..80d502a8b7 100644 --- a/tools/wasp-cli/chain/info.go +++ b/tools/wasp-cli/chain/info.go @@ -4,16 +4,16 @@ package chain import ( + "context" "strconv" "github.com/spf13/cobra" + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/kv/collections" - "github.com/iotaledger/wasp/packages/vm/core/governance" - "github.com/iotaledger/wasp/packages/vm/core/root" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) @@ -24,68 +24,81 @@ func initInfoCmd() *cobra.Command { Short: "Show information about the chain", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - chainInfo, err := config.WaspClient(config.MustWaspAPI()).GetChainInfo(GetCurrentChainID()) + client := cliclients.WaspClientForIndex() + + chainInfo, _, err := client.ChainsApi. + GetChainInfo(context.Background(), config.GetCurrentChainID().String()). + Execute() + log.Check(err) + + committeeInfo, _, err := client.ChainsApi. + GetCommitteeInfo(context.Background(), config.GetCurrentChainID().String()). + Execute() log.Check(err) printNodesRowHdr := []string{"PubKey", "NetID", "Alive", "Committee", "Access", "AccessAPI"} - printNodesRowFmt := func(n *model.ChainNodeStatus) []string { + printNodesRowFmt := func(n apiclient.CommitteeNode, isCommitteeNode, isAccessNode bool) []string { return []string{ - n.Node.PubKey, - n.Node.NetID, + n.Node.PublicKey, + n.Node.NetId, strconv.FormatBool(n.Node.IsAlive), - strconv.FormatBool(n.ForCommittee), - strconv.FormatBool(n.ForAccess), + strconv.FormatBool(isCommitteeNode), + strconv.FormatBool(isAccessNode), n.AccessAPI, } } - printNodes := func(label string, nodes []*model.ChainNodeStatus) { + printNodes := func(label string, nodes []apiclient.CommitteeNode, isCommitteeNode, isAccessNode bool) { if nodes == nil { log.Printf("%s: N/A\n", label) } log.Printf("%s: %v\n", label, len(nodes)) rows := make([][]string, 0) for _, n := range nodes { - rows = append(rows, printNodesRowFmt(n)) + rows = append(rows, printNodesRowFmt(n, isCommitteeNode, isAccessNode)) } log.PrintTable(printNodesRowHdr, rows) } log.Printf("Chain ID: %s\n", chainInfo.ChainID) - log.Printf("Active: %v\n", chainInfo.Active) + log.Printf("Active: %v\n", chainInfo.IsActive) - if chainInfo.Active { - log.Printf("State address: %v\n", chainInfo.StateAddress) - printNodes("Committee nodes", chainInfo.CommitteeNodes) - printNodes("Access nodes", chainInfo.AccessNodes) - printNodes("Candidate nodes", chainInfo.CandidateNodes) - - ret, err := SCClient(governance.Contract.Hname()).CallView(governance.ViewGetChainInfo.Name, nil) - log.Check(err) - govInfo, err := governance.GetChainInfo(ret) - log.Check(err) + if chainInfo.IsActive { + log.Printf("State address: %v\n", committeeInfo.StateAddress) + printNodes("Committee nodes", committeeInfo.CommitteeNodes, true, false) + printNodes("Access nodes", committeeInfo.AccessNodes, false, true) + printNodes("Candidate nodes", committeeInfo.CandidateNodes, false, false) - log.Printf("Description: %s\n", govInfo.Description) + log.Printf("Description: %s\n", chainInfo.Description) - recs, err := SCClient(root.Contract.Hname()).CallView(root.ViewGetContractRecords.Name, nil) - log.Check(err) - contracts, err := root.DecodeContractRegistry(collections.NewMapReadOnly(recs, root.StateVarContractRegistry)) + contracts, _, err := client.ChainsApi.GetContracts(context.Background(), config.GetCurrentChainID().String()).Execute() log.Check(err) log.Printf("#Contracts: %d\n", len(contracts)) - log.Printf("Owner: %s\n", govInfo.ChainOwnerID.String()) + log.Printf("Owner: %s\n", chainInfo.ChainOwnerId) - if govInfo.GasFeePolicy != nil { + // TODO: Validate the gas fee token id logic + if chainInfo.GasFeePolicy != nil { gasFeeToken := util.BaseTokenStr - if !isc.IsEmptyNativeTokenID(govInfo.GasFeePolicy.GasFeeTokenID) { - gasFeeToken = govInfo.GasFeePolicy.GasFeeTokenID.String() + + if chainInfo.GasFeePolicy.GasFeeTokenId != "" { + decodedToken, err := iotago.DecodeHex(chainInfo.GasFeePolicy.GasFeeTokenId) + log.Check(err) + + tokenID, err := isc.NativeTokenIDFromBytes(decodedToken) + log.Check(err) + + if !isc.IsEmptyNativeTokenID(tokenID) { + gasFeeToken = tokenID.String() + } } - log.Printf("Gas fee: 1 %s = %d gas units\n", gasFeeToken, govInfo.GasFeePolicy.GasPerToken) - log.Printf("Validator fee share: %d%%\n", govInfo.GasFeePolicy.ValidatorFeeShare) + + log.Printf("Gas fee: 1 %s = %d gas units\n", gasFeeToken, chainInfo.GasFeePolicy.GasPerToken) + log.Printf("Validator fee share: %d%%\n", chainInfo.GasFeePolicy.ValidatorFeeShare) } - log.Printf("Maximum blob size: %d bytes\n", govInfo.MaxBlobSize) - log.Printf("Maximum event size: %d bytes\n", govInfo.MaxEventSize) - log.Printf("Maximum events per request: %d\n", govInfo.MaxEventsPerReq) + log.Printf("Maximum blob size: %d bytes\n", chainInfo.MaxBlobSize) + log.Printf("Maximum event size: %d bytes\n", chainInfo.MaxEventSize) + log.Printf("Maximum events per request: %d\n", chainInfo.MaxEventsPerReq) } }, } diff --git a/tools/wasp-cli/chain/list.go b/tools/wasp-cli/chain/list.go index cb8e286b3f..bf98d594e8 100644 --- a/tools/wasp-cli/chain/list.go +++ b/tools/wasp-cli/chain/list.go @@ -1,12 +1,13 @@ package chain import ( + "context" "fmt" "github.com/spf13/cobra" - "github.com/iotaledger/wasp/packages/registry" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -16,31 +17,34 @@ func initListCmd() *cobra.Command { Short: "List deployed chains", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - client := config.WaspClient(config.MustWaspAPI()) - chains, err := client.GetChainRecordList() + client := cliclients.WaspClientForIndex() + chains, _, err := client.ChainsApi.GetChains(context.Background()).Execute() log.Check(err) + model := &ListChainModel{ Length: len(chains), - BaseURL: client.BaseURL(), + BaseURL: client.GetConfig().Host, } + model.Chains = make(map[string]bool) for _, chain := range chains { - model.Chains[chain.ChainID().String()] = chain.Active + model.Chains[chain.ChainID] = chain.IsActive } + log.PrintCLIOutput(model) showChainList(chains) }, } } -func showChainList(chains []*registry.ChainRecord) { +func showChainList(chains []apiclient.ChainInfoResponse) { header := []string{"chainid", "active"} rows := make([][]string, len(chains)) for i, chain := range chains { rows[i] = []string{ - chain.ChainID().String(), - fmt.Sprintf("%v", chain.Active), + chain.ChainID, + fmt.Sprintf("%v", chain.IsActive), } } log.PrintTable(header, rows) diff --git a/tools/wasp-cli/chain/listcontracts.go b/tools/wasp-cli/chain/listcontracts.go index 29dd5c4d2f..6b0dc78221 100644 --- a/tools/wasp-cli/chain/listcontracts.go +++ b/tools/wasp-cli/chain/listcontracts.go @@ -1,10 +1,12 @@ package chain import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/packages/kv/collections" - "github.com/iotaledger/wasp/packages/vm/core/root" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -14,12 +16,14 @@ func initListContractsCmd() *cobra.Command { Short: "List deployed contracts in chain", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - records, err := SCClient(root.Contract.Hname()).CallView(root.ViewGetContractRecords.Name, nil) - log.Check(err) - contracts, err := root.DecodeContractRegistry(collections.NewMapReadOnly(records, root.StateVarContractRegistry)) + client := cliclients.WaspClientForIndex() + contracts, _, err := client.ChainsApi. + GetContracts(context.Background(), config.GetCurrentChainID().String()). + Execute() + log.Check(err) - log.Printf("Total %d contracts in chain %s\n", len(contracts), GetCurrentChainID()) + log.Printf("Total %d contracts in chain %s\n", len(contracts), config.GetCurrentChainID()) header := []string{ "hname", @@ -31,12 +35,12 @@ func initListContractsCmd() *cobra.Command { } rows := make([][]string, len(contracts)) i := 0 - for hname, c := range contracts { + for _, contract := range contracts { rows[i] = []string{ - hname.String(), - c.Name, - c.Description, - c.ProgramHash.String(), + contract.HName, + contract.Name, + contract.Description, + contract.ProgramHash, } i++ } diff --git a/tools/wasp-cli/chain/postrequest.go b/tools/wasp-cli/chain/postrequest.go index a9f0e62b30..d107e8c538 100644 --- a/tools/wasp-cli/chain/postrequest.go +++ b/tools/wasp-cli/chain/postrequest.go @@ -6,19 +6,22 @@ import ( "github.com/spf13/cobra" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client/chainclient" + "github.com/iotaledger/wasp/clients/chainclient" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/transaction" "github.com/iotaledger/wasp/packages/vm/gas" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) func postRequest(hname, fname string, params chainclient.PostRequestParams, offLedger, adjustStorageDeposit bool) { - scClient := SCClient(isc.Hn(hname)) + apiClient := cliclients.WaspClientForIndex() + scClient := cliclients.SCClient(apiClient, isc.Hn(hname)) if offLedger { params.Nonce = uint64(time.Now().UnixNano()) - util.WithOffLedgerRequest(GetCurrentChainID(), func() (isc.OffLedgerRequest, error) { + util.WithOffLedgerRequest(config.GetCurrentChainID(), func() (isc.OffLedgerRequest, error) { return scClient.PostOffLedgerRequest(fname, params) }) return @@ -27,7 +30,7 @@ func postRequest(hname, fname string, params chainclient.PostRequestParams, offL if !adjustStorageDeposit { // check if there are enough funds for SD output := transaction.MakeBasicOutput( - GetCurrentChainID().AsAddress(), + config.GetCurrentChainID().AsAddress(), scClient.ChainClient.KeyPair.Address(), params.Transfer, &isc.RequestMetadata{ @@ -44,7 +47,7 @@ func postRequest(hname, fname string, params chainclient.PostRequestParams, offL util.SDAdjustmentPrompt(output) } - util.WithSCTransaction(GetCurrentChainID(), func() (*iotago.Transaction, error) { + util.WithSCTransaction(config.GetCurrentChainID(), func() (*iotago.Transaction, error) { return scClient.PostRequest(fname, params) }) } diff --git a/tools/wasp-cli/chain/rotate.go b/tools/wasp-cli/chain/rotate.go index 84903d21c9..9b53e76090 100644 --- a/tools/wasp-cli/chain/rotate.go +++ b/tools/wasp-cli/chain/rotate.go @@ -12,9 +12,10 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/parameters" "github.com/iotaledger/wasp/packages/transaction" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" + cliwallet "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" - "github.com/iotaledger/wasp/tools/wasp-cli/wallet" ) func initRotateCmd() *cobra.Command { @@ -23,16 +24,15 @@ func initRotateCmd() *cobra.Command { Short: "Issues a tx that changes the chain state controller", Args: cobra.MinimumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - l1Client := config.L1Client() + l1Client := cliclients.L1Client() prefix, newStateControllerAddr, err := iotago.ParseBech32(args[0]) log.Check(err) if parameters.L1().Protocol.Bech32HRP != prefix { log.Fatalf("unexpected prefix. expected: %s, actual: %s", parameters.L1().Protocol.Bech32HRP, prefix) } - wallet := wallet.Load() - - aliasID := GetCurrentChainID().AsAliasID() + wallet := cliwallet.Load() + aliasID := config.GetCurrentChainID().AsAliasID() chainOutputID, chainOutput, err := l1Client.GetAliasOutput(aliasID) log.Check(err) diff --git a/tools/wasp-cli/chain/rundkg.go b/tools/wasp-cli/chain/rundkg.go index 7894fb151c..5097b89b94 100644 --- a/tools/wasp-cli/chain/rundkg.go +++ b/tools/wasp-cli/chain/rundkg.go @@ -4,16 +4,19 @@ package chain import ( + "context" "fmt" "math/rand" "os" "github.com/spf13/cobra" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/multiclient" "github.com/iotaledger/wasp/packages/apilib" "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -36,14 +39,20 @@ func initRunDKGCmd() *cobra.Command { } committeePubKeys := make([]string, 0) - for _, api := range config.CommitteeAPI(committee) { - peerInfo, err := client.NewWaspClient(api).GetPeeringSelf() + for _, apiIndex := range committee { + peerInfo, _, err := cliclients.WaspClientForIndex(apiIndex).NodeApi.GetPeeringIdentity(context.Background()).Execute() log.Check(err) - committeePubKeys = append(committeePubKeys, peerInfo.PubKey) + + committeePubKeys = append(committeePubKeys, peerInfo.PublicKey) } dkgInitiatorIndex := uint16(rand.Intn(len(committee))) - stateControllerAddr, err := apilib.RunDKG(config.GetToken(), config.CommitteeAPI(committee), committeePubKeys, uint16(quorum), dkgInitiatorIndex) + + var clientResolver multiclient.ClientResolver = func(apiHost string) *apiclient.APIClient { + return cliclients.WaspClientForHostName(apiHost) + } + + stateControllerAddr, err := apilib.RunDKG(clientResolver, config.CommitteeAPIURL(committee), committeePubKeys, uint16(quorum), dkgInitiatorIndex) log.Check(err) fmt.Fprintf(os.Stdout, "DKG successful, address: %s", stateControllerAddr.Bech32(parameters.L1().Protocol.Bech32HRP)) diff --git a/tools/wasp-cli/cli/cliclients/clients.go b/tools/wasp-cli/cli/cliclients/clients.go new file mode 100644 index 0000000000..58d2a97b4c --- /dev/null +++ b/tools/wasp-cli/cli/cliclients/clients.go @@ -0,0 +1,54 @@ +package cliclients + +import ( + "github.com/iotaledger/wasp/clients/apiclient" + "github.com/iotaledger/wasp/clients/apiextensions" + "github.com/iotaledger/wasp/clients/chainclient" + "github.com/iotaledger/wasp/clients/scclient" + "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/packages/l1connection" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" + "github.com/iotaledger/wasp/tools/wasp-cli/log" +) + +func WaspClientForHostName(apiAddress string) *apiclient.APIClient { + L1Client() // this will fill parameters.L1() with data from the L1 node + log.Verbosef("using Wasp host %s\n", apiAddress) + + client, err := apiextensions.WaspAPIClientByHostName(apiAddress) + log.Check(err) + + client.GetConfig().AddDefaultHeader("Authorization", "Bearer "+config.GetToken()) + + return client +} + +func WaspClientForIndex(i ...int) *apiclient.APIClient { + return WaspClientForHostName(config.MustWaspAPIURL(i...)) +} + +func L1Client() l1connection.Client { + log.Verbosef("using L1 API %s\n", config.L1APIAddress()) + + return l1connection.NewClient( + l1connection.Config{ + APIAddress: config.L1APIAddress(), + FaucetAddress: config.L1FaucetAddress(), + }, + log.HiveLogger(), + ) +} + +func ChainClient(waspClient *apiclient.APIClient) *chainclient.Client { + return chainclient.New( + L1Client(), + waspClient, + config.GetCurrentChainID(), + wallet.Load().KeyPair, + ) +} + +func SCClient(apiClient *apiclient.APIClient, contractHname isc.Hname) *scclient.SCClient { + return scclient.New(ChainClient(apiClient), contractHname) +} diff --git a/tools/wasp-cli/cli/config/chain.go b/tools/wasp-cli/cli/config/chain.go new file mode 100644 index 0000000000..d416dd4f79 --- /dev/null +++ b/tools/wasp-cli/cli/config/chain.go @@ -0,0 +1,40 @@ +package config + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "github.com/iotaledger/wasp/packages/isc" + "github.com/iotaledger/wasp/tools/wasp-cli/log" +) + +var chainAlias string + +func GetChainAlias() string { + if chainAlias == "" { + chainAlias = viper.GetString("chain") + } + if chainAlias == "" { + log.Fatal("No current chain. Call `chain deploy --chain=` or `set chain `") + } + return chainAlias +} + +func SetCurrentChain(chainAlias string) { + Set("chain", chainAlias) +} + +func InitAliasFlags(chainCmd *cobra.Command) { + chainCmd.PersistentFlags().StringVarP(&chainAlias, "chain", "a", "", "chain alias") +} + +func AddChainAlias(chainAlias, id string) { + Set("chains."+chainAlias, id) + SetCurrentChain(chainAlias) +} + +func GetCurrentChainID() isc.ChainID { + chainID, err := isc.ChainIDFromString(viper.GetString("chains." + GetChainAlias())) + log.Check(err) + return chainID +} diff --git a/tools/wasp-cli/cli/config/config.go b/tools/wasp-cli/cli/config/config.go new file mode 100644 index 0000000000..c69f766a34 --- /dev/null +++ b/tools/wasp-cli/cli/config/config.go @@ -0,0 +1,150 @@ +package config + +import ( + "fmt" + "time" + + "github.com/spf13/viper" + + "github.com/iotaledger/wasp/packages/parameters" + "github.com/iotaledger/wasp/packages/testutil/privtangle/privtangledefaults" + "github.com/iotaledger/wasp/tools/wasp-cli/log" +) + +var ( + ConfigPath string + WaitForCompletion bool +) + +const ( + HostKindAPI = "api" + HostKindPeering = "peering" + HostKindNanomsg = "nanomsg" + + l1ParamsKey = "l1.params" + l1ParamsTimestampKey = "l1.timestamp" + l1ParamsExpiration = 24 * time.Hour +) + +func L1ParamsExpired() bool { + if viper.Get(l1ParamsKey) == nil { + return true + } + return viper.GetTime(l1ParamsTimestampKey).Add(l1ParamsExpiration).Before(time.Now()) +} + +func RefreshL1ParamsFromNode() { + if log.VerboseFlag { + log.Printf("Getting L1 params from node at %s...\n", L1APIAddress()) + } + + Set(l1ParamsKey, parameters.L1NoLock()) + Set(l1ParamsTimestampKey, time.Now()) +} + +func LoadL1ParamsFromConfig() { + // read L1 params from config file + var params *parameters.L1Params + err := viper.UnmarshalKey("l1.params", ¶ms) + log.Check(err) + parameters.InitL1(params) +} + +func Read() { + viper.SetConfigFile(ConfigPath) + _ = viper.ReadInConfig() +} + +func L1APIAddress() string { + host := viper.GetString("l1.apiAddress") + if host != "" { + return host + } + return fmt.Sprintf( + "%s:%d", + privtangledefaults.Host, + privtangledefaults.BasePort+privtangledefaults.NodePortOffsetRestAPI, + ) +} + +func L1FaucetAddress() string { + address := viper.GetString("l1.faucetAddress") + if address != "" { + return address + } + return fmt.Sprintf( + "%s:%d", + privtangledefaults.Host, + privtangledefaults.BasePort+privtangledefaults.NodePortOffsetFaucet, + ) +} + +func GetToken() string { + return viper.GetString("authentication.token") +} + +func SetToken(token string) { + Set("authentication.token", token) +} + +func MustWaspAPIURL(i ...int) string { + apiAddress := WaspAPIURL(i...) + if apiAddress == "" { + panic("wasp webapi not defined") + } + return apiAddress +} + +func WaspAPIURL(i ...int) string { + index := 0 + if len(i) > 0 { + index = i[0] + } + return viper.GetString(fmt.Sprintf("wasp.%d.%s", index, HostKindAPI)) +} + +func CommitteeAPIURL(indices []int) []string { + return committeeHosts(HostKindAPI, indices) +} + +func committeeHosts(kind string, indices []int) []string { + hosts := make([]string, 0) + for _, i := range indices { + hosts = append(hosts, committeeHost(kind, i)) + } + return hosts +} + +func committeeConfigVar(kind string, i int) string { + return fmt.Sprintf("wasp.%d.%s", i, kind) +} + +func committeeHost(kind string, i int) string { + r := viper.GetString(committeeConfigVar(kind, i)) + if r != "" { + return r + } + defaultPort := defaultWaspPort(kind, i) + return fmt.Sprintf("127.0.0.1:%d", defaultPort) +} + +func TotalNumberOfWaspNodes() int { + return len(viper.Sub("wasp").AllSettings()) +} + +func defaultWaspPort(kind string, i int) int { + switch kind { + case HostKindNanomsg: + return 5550 + i + case HostKindPeering: + return 4000 + i + case HostKindAPI: + return 9090 + i + } + panic(fmt.Sprintf("no handler for kind %s", kind)) +} + +func Set(key string, value interface{}) { + viper.Set(key, value) + log.Check(viper.WriteConfig()) +} diff --git a/tools/wasp-cli/config/checkversions.go b/tools/wasp-cli/cli/init/checkversions.go similarity index 58% rename from tools/wasp-cli/config/checkversions.go rename to tools/wasp-cli/cli/init/checkversions.go index fae5dd1200..9bb3a6253f 100644 --- a/tools/wasp-cli/config/checkversions.go +++ b/tools/wasp-cli/cli/init/checkversions.go @@ -1,9 +1,12 @@ -package config +package init import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -14,14 +17,16 @@ func initCheckVersionsCmd(waspVersion string) *cobra.Command { Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { // query every wasp node info endpoint and ensure the `Version` matches - for i := 0; i < totalNumberOfWaspNodes(); i++ { - client := client.NewWaspClient(committeeHost(HostKindAPI, i)) - waspServerInfo, err := client.Info() + for i := 0; i < config.TotalNumberOfWaspNodes(); i++ { + version, _, err := cliclients.WaspClientForIndex(i).NodeApi. + GetVersion(context.Background()). + Execute() log.Check(err) - if waspVersion == waspServerInfo.Version { + + if waspVersion == version.Version { log.Printf("Wasp-cli version matches Wasp #%d\n", i) } else { - log.Printf("! -> Version mismatch with Wasp #%d. cli version: %s, wasp version: %s\n", i, waspVersion, waspServerInfo.Version) + log.Printf("! -> Version mismatch with Wasp #%d. cli version: %s, wasp version: %s\n", i, waspVersion, version.Version) } } }, diff --git a/tools/wasp-cli/cli/init/init.go b/tools/wasp-cli/cli/init/init.go new file mode 100644 index 0000000000..272a76ad8a --- /dev/null +++ b/tools/wasp-cli/cli/init/init.go @@ -0,0 +1,59 @@ +package init + +import ( + "github.com/spf13/cobra" + + "github.com/iotaledger/wasp/packages/parameters" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" +) + +func initConfigSetCmd() *cobra.Command { + return &cobra.Command{ + Use: "set ", + Short: "Set a configuration value", + Args: cobra.ExactArgs(2), + Run: func(cmd *cobra.Command, args []string) { + v := args[1] + switch v { + case "true": + config.Set(args[0], true) + case "false": + config.Set(args[0], false) + default: + config.Set(args[0], v) + } + }, + } +} + +func initRefreshL1ParamsCmd() *cobra.Command { + return &cobra.Command{ + Use: "refresh-l1-params", + Short: "Refresh L1 params from node", + Args: cobra.NoArgs, + Run: func(cmd *cobra.Command, args []string) { + config.RefreshL1ParamsFromNode() + }, + } +} + +func Init(rootCmd *cobra.Command, waspVersion string) { + rootCmd.PersistentFlags().StringVarP(&config.ConfigPath, "config", "c", "wasp-cli.json", "path to wasp-cli.json") + rootCmd.PersistentFlags().BoolVarP(&config.WaitForCompletion, "wait", "w", true, "wait for request completion") + + cliclients.L1Client() + + rootCmd.AddCommand(initCheckVersionsCmd(waspVersion)) + rootCmd.AddCommand(initConfigSetCmd()) + rootCmd.AddCommand(initRefreshL1ParamsCmd()) + + // The first time parameters.L1() is called, it will be initialized with this function + parameters.InitL1Lazy(func() { + if config.L1ParamsExpired() { + config.RefreshL1ParamsFromNode() + } else { + config.LoadL1ParamsFromConfig() + } + }) +} diff --git a/tools/wasp-cli/cli/wallet/wallet.go b/tools/wasp-cli/cli/wallet/wallet.go new file mode 100644 index 0000000000..5795ff3a85 --- /dev/null +++ b/tools/wasp-cli/cli/wallet/wallet.go @@ -0,0 +1,40 @@ +package wallet + +import ( + "github.com/spf13/viper" + + iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/packages/cryptolib" + "github.com/iotaledger/wasp/tools/wasp-cli/log" +) + +var AddressIndex int + +type Wallet struct { + KeyPair *cryptolib.KeyPair + AddressIndex int +} + +func Load() *Wallet { + seedHex := viper.GetString("wallet.seed") + + if seedHex == "" { + log.Fatal("call `init` first") + } + + seedBytes, err := iotago.DecodeHex(seedHex) + log.Check(err) + + seed := cryptolib.NewSeedFromBytes(seedBytes) + kp := cryptolib.NewKeyPairFromSeed(seed.SubSeed(uint64(AddressIndex))) + + return &Wallet{KeyPair: kp, AddressIndex: AddressIndex} +} + +func (w *Wallet) PrivateKey() *cryptolib.PrivateKey { + return w.KeyPair.GetPrivateKey() +} + +func (w *Wallet) Address() iotago.Address { + return w.KeyPair.GetPublicKey().AsEd25519Address() +} diff --git a/tools/wasp-cli/config/config.go b/tools/wasp-cli/config/config.go deleted file mode 100644 index 9a329101ed..0000000000 --- a/tools/wasp-cli/config/config.go +++ /dev/null @@ -1,279 +0,0 @@ -package config - -import ( - "fmt" - "time" - - "github.com/spf13/cobra" - "github.com/spf13/viper" - - "github.com/iotaledger/wasp/client" - "github.com/iotaledger/wasp/packages/l1connection" - "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/packages/testutil/privtangle/privtangledefaults" - "github.com/iotaledger/wasp/tools/wasp-cli/log" -) - -var ( - ConfigPath string - WaitForCompletion bool -) - -const ( - HostKindAPI = "api" - HostKindPeering = "peering" - HostKindNanomsg = "nanomsg" - - l1ParamsKey = "l1.params" - l1ParamsTimestampKey = "l1.timestamp" - l1ParamsExpiration = 24 * time.Hour -) - -func initConfigSetCmd() *cobra.Command { - return &cobra.Command{ - Use: "set ", - Short: "Set a configuration value", - Args: cobra.ExactArgs(2), - Run: func(cmd *cobra.Command, args []string) { - v := args[1] - switch v { - case "true": - Set(args[0], true) - case "false": - Set(args[0], false) - default: - Set(args[0], v) - } - }, - } -} - -func initRefreshL1ParamsCmd() *cobra.Command { - return &cobra.Command{ - Use: "refresh-l1-params", - Short: "Refresh L1 params from node", - Args: cobra.NoArgs, - Run: func(cmd *cobra.Command, args []string) { - refreshL1ParamsFromNode() - }, - } -} - -func Init(rootCmd *cobra.Command, waspVersion string) { - rootCmd.PersistentFlags().StringVarP(&ConfigPath, "config", "c", "wasp-cli.json", "path to wasp-cli.json") - rootCmd.PersistentFlags().BoolVarP(&WaitForCompletion, "wait", "w", true, "wait for request completion") - - rootCmd.AddCommand(initConfigSetCmd()) - rootCmd.AddCommand(initCheckVersionsCmd(waspVersion)) - rootCmd.AddCommand(initRefreshL1ParamsCmd()) - - // The first time parameters.L1() is called, it will be initialized with this function - parameters.InitL1Lazy(func() { - if l1ParamsExpired() { - refreshL1ParamsFromNode() - } else { - loadL1ParamsFromConfig() - } - }) -} - -func l1ParamsExpired() bool { - if viper.Get(l1ParamsKey) == nil { - return true - } - return viper.GetTime(l1ParamsTimestampKey).Add(l1ParamsExpiration).Before(time.Now()) -} - -func refreshL1ParamsFromNode() { - if log.VerboseFlag { - log.Printf("Getting L1 params from node at %s...\n", L1APIAddress()) - } - L1Client() // this will call parameters.InitL1() - Set(l1ParamsKey, parameters.L1NoLock()) - Set(l1ParamsTimestampKey, time.Now()) -} - -func loadL1ParamsFromConfig() { - // read L1 params from config file - var params *parameters.L1Params - err := viper.UnmarshalKey("l1.params", ¶ms) - log.Check(err) - parameters.InitL1(params) -} - -func Read() { - viper.SetConfigFile(ConfigPath) - _ = viper.ReadInConfig() -} - -func L1APIAddress() string { - host := viper.GetString("l1.apiAddress") - if host != "" { - return host - } - return fmt.Sprintf( - "%s:%d", - privtangledefaults.Host, - privtangledefaults.BasePort+privtangledefaults.NodePortOffsetRestAPI, - ) -} - -func L1INXAddress() string { - host := viper.GetString("l1.inxAddress") - if host != "" { - return host - } - return fmt.Sprintf( - "%s:%d", - privtangledefaults.INXHost, - privtangledefaults.BasePort+privtangledefaults.NodePortOffsetINX, - ) -} - -func L1FaucetAddress() string { - address := viper.GetString("l1.faucetAddress") - if address != "" { - return address - } - return fmt.Sprintf( - "%s:%d", - privtangledefaults.Host, - privtangledefaults.BasePort+privtangledefaults.NodePortOffsetFaucet, - ) -} - -func L1Client() l1connection.Client { - log.Verbosef("using L1 API %s\n", L1APIAddress()) - - return l1connection.NewClient( - l1connection.Config{ - APIAddress: L1APIAddress(), - FaucetAddress: L1FaucetAddress(), - }, - log.HiveLogger(), - ) -} - -func GetToken() string { - return viper.GetString("authentication.token") -} - -func SetToken(token string) { - Set("authentication.token", token) -} - -func WaspClient(apiAddress string) *client.WaspClient { - // TODO: add authentication for /adm - L1Client() // this will fill parameters.L1() with data from the L1 node - log.Verbosef("using Wasp host %s\n", apiAddress) - return client.NewWaspClient(apiAddress).WithToken(GetToken()) -} - -func MustWaspAPI(i ...int) string { - apiAddress := WaspAPI(i...) - if apiAddress == "" { - panic("wasp webapi not defined") - } - return apiAddress -} - -func WaspAPI(i ...int) string { - index := 0 - if len(i) > 0 { - index = i[0] - } - return viper.GetString(fmt.Sprintf("wasp.%d.%s", index, HostKindAPI)) -} - -func WaspNanomsg(i ...int) string { - index := 0 - if len(i) > 0 { - index = i[0] - } - r := viper.GetString("wasp." + HostKindNanomsg) - if r != "" { - return r - } - return committeeHost(HostKindNanomsg, index) -} - -func FindNodeBy(kind, v string) int { - for i := 0; i < 100; i++ { - if committeeHost(kind, i) == v { - return i - } - } - log.Fatalf("Cannot find node with %q = %q in configuration", kind, v) - return 0 -} - -func CommitteeAPI(indices []int) []string { - return committee(HostKindAPI, indices) -} - -func CommitteePeering(indices []int) []string { - return committee(HostKindPeering, indices) -} - -func CommitteeNanomsg(indices []int) []string { - return committee(HostKindNanomsg, indices) -} - -func committee(kind string, indices []int) []string { - hosts := make([]string, 0) - for _, i := range indices { - hosts = append(hosts, committeeHost(kind, i)) - } - return hosts -} - -func committeeConfigVar(kind string, i int) string { - return fmt.Sprintf("wasp.%d.%s", i, kind) -} - -func CommitteeAPIConfigVar(i int) string { - return committeeConfigVar(HostKindAPI, i) -} - -func CommitteePeeringConfigVar(i int) string { - return committeeConfigVar(HostKindPeering, i) -} - -func CommitteeNanomsgConfigVar(i int) string { - return committeeConfigVar(HostKindNanomsg, i) -} - -func committeeHost(kind string, i int) string { - r := viper.GetString(committeeConfigVar(kind, i)) - if r != "" { - return r - } - defaultPort := defaultWaspPort(kind, i) - return fmt.Sprintf("127.0.0.1:%d", defaultPort) -} - -func totalNumberOfWaspNodes() int { - waspSubKey := viper.Sub("wasp") - if waspSubKey == nil { - return 0 - } - - return len(waspSubKey.AllSettings()) -} - -func defaultWaspPort(kind string, i int) int { - switch kind { - case HostKindNanomsg: - return 5550 + i - case HostKindPeering: - return 4000 + i - case HostKindAPI: - return 9090 + i - } - panic(fmt.Sprintf("no handler for kind %s", kind)) -} - -func Set(key string, value interface{}) { - viper.Set(key, value) - log.Check(viper.WriteConfig()) -} diff --git a/tools/wasp-cli/log/log.go b/tools/wasp-cli/log/log.go index 45fc4dddb5..559cc56e30 100644 --- a/tools/wasp-cli/log/log.go +++ b/tools/wasp-cli/log/log.go @@ -14,7 +14,7 @@ import ( "github.com/iotaledger/hive.go/core/logger" iotago "github.com/iotaledger/iota.go/v3" - "github.com/iotaledger/wasp/client" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/packages/kv/dict" ) @@ -143,11 +143,21 @@ func PrintCLIOutput(output CLIOutput) { func Check(err error) { if err != nil { - if errors.Is(err, client.ErrNotAuthorized) { - err = errors.New("unauthorized request: are you logged in? (wasp-cli login)") + errorModel := &ErrorModel{err.Error()} + apiError, ok := apiextensions.AsAPIError(err) + + if ok { + if strings.Contains(apiError.Error, "404") { + err = errors.New("unauthorized request: are you logged in? (wasp-cli login)") + } else { + errorModel.Error = apiError.Error + + if apiError.DetailError != nil { + errorModel.Error += "\n" + apiError.DetailError.Error + "\n" + apiError.DetailError.Message + } + } } - errorModel := &ErrorModel{err.Error()} message, _ := GetCLIOutputText(errorModel) Fatalf("%v", message) } diff --git a/tools/wasp-cli/main.go b/tools/wasp-cli/main.go index 3c0654feeb..6c6149dbc4 100644 --- a/tools/wasp-cli/main.go +++ b/tools/wasp-cli/main.go @@ -12,8 +12,9 @@ import ( "github.com/iotaledger/wasp/core/app" "github.com/iotaledger/wasp/tools/wasp-cli/authentication" "github.com/iotaledger/wasp/tools/wasp-cli/chain" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" + cliinit "github.com/iotaledger/wasp/tools/wasp-cli/cli/init" "github.com/iotaledger/wasp/tools/wasp-cli/completion" - "github.com/iotaledger/wasp/tools/wasp-cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/decode" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/metrics" @@ -54,12 +55,11 @@ func init() { } rootCmd = initRootCmd(waspVersion) - rootCmd.AddCommand(completion.InitCompletionCommand(rootCmd.Root().Name())) authentication.Init(rootCmd) log.Init(rootCmd) - config.Init(rootCmd, waspVersion) + cliinit.Init(rootCmd, waspVersion) wallet.Init(rootCmd) chain.Init(rootCmd) decode.Init(rootCmd) diff --git a/tools/wasp-cli/metrics/consensus.go b/tools/wasp-cli/metrics/consensus.go index 5938b75d9e..ad120c3d51 100644 --- a/tools/wasp-cli/metrics/consensus.go +++ b/tools/wasp-cli/metrics/consensus.go @@ -1,6 +1,7 @@ package metrics import ( + "context" "fmt" "time" @@ -8,7 +9,7 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -20,14 +21,21 @@ func initConsensusMetricsCmd() *cobra.Command { Short: "Show current value of collected metrics of consensus", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - client := config.WaspClient(config.MustWaspAPI()) + client := cliclients.WaspClientForIndex() _, chainAddress, err := iotago.ParseBech32(chainAlias) log.Check(err) + chainID := isc.ChainIDFromAddress(chainAddress.(*iotago.AliasAddress)) - workflowStatus, err := client.GetChainConsensusWorkflowStatus(chainID) + workflowStatus, _, err := client.MetricsApi. + GetChainWorkflowMetrics(context.Background(), chainID.String()). + Execute() log.Check(err) - pipeMetrics, err := client.GetChainConsensusPipeMetrics(chainID) + + pipeMetrics, _, err := client.MetricsApi. + GetChainPipeMetrics(context.Background(), chainID.String()). + Execute() log.Check(err) + header := []string{"Flag name", "Value", "Last time set"} table := make([][]string, 15) table[0] = makeWorkflowTableRow("State received", workflowStatus.FlagStateReceived, time.Time{}) diff --git a/tools/wasp-cli/metrics/nodeconn.go b/tools/wasp-cli/metrics/nodeconn.go index a9b56989f8..59334c5868 100644 --- a/tools/wasp-cli/metrics/nodeconn.go +++ b/tools/wasp-cli/metrics/nodeconn.go @@ -1,14 +1,16 @@ package metrics import ( + "context" "fmt" "strings" + "time" "github.com/spf13/cobra" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/packages/webapi/v1/model" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -20,22 +22,31 @@ func initNodeconnMetricsCmd() *cobra.Command { Short: "Show current value of collected metrics of connection to L1", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - client := config.WaspClient(config.MustWaspAPI()) + client := cliclients.WaspClientForIndex() + if chainAlias == "" { - nodeconnMetrics, err := client.GetNodeConnectionMetrics() + + nodeconnMetrics, _, err := client.MetricsApi.GetL1Metrics(context.Background()).Execute() log.Check(err) log.Printf("Following chains are registered for L1 events:\n") - for _, s := range nodeconnMetrics.Registered { + for _, s := range nodeconnMetrics.RegisteredChainIDs { log.Printf("\t%s\n", s) } + + milestoneMsg := "" + if nodeconnMetrics.InMilestone.LastMessage.MilestoneId != nil { + milestoneMsg = *nodeconnMetrics.InMilestone.LastMessage.MilestoneId + } + + inMilestone := mapMetricItem(nodeconnMetrics.InMilestone.Messages, nodeconnMetrics.InMilestone.Timestamp, milestoneMsg) printMessagesMetrics( - &nodeconnMetrics.NodeConnectionMessagesMetrics, - [][]string{makeMessagesMetricsTableRow("Milestone", true, nodeconnMetrics.InMilestone)}, + nodeconnMetrics, + [][]string{makeMessagesMetricsTableRow("Milestone", true, inMilestone)}, ) } else { chainID, err := isc.ChainIDFromString(chainAlias) log.Check(err) - msgsMetrics, err := client.GetChainNodeConnectionMetrics(chainID) + msgsMetrics, _, err := client.MetricsApi.GetChainMetrics(context.Background(), chainID.String()).Execute() log.Check(err) printMessagesMetrics(msgsMetrics, [][]string{}) } @@ -43,25 +54,45 @@ func initNodeconnMetricsCmd() *cobra.Command { } } -func printMessagesMetrics(msgsMetrics *model.NodeConnectionMessagesMetrics, additionalRows [][]string) { +func mapMetricItem(messages uint32, timestamp time.Time, message string) *apiclient.InterfaceMetricItem { + return &apiclient.InterfaceMetricItem{ + Timestamp: timestamp, + LastMessage: message, + Messages: messages, + } +} + +func printMessagesMetrics(msgsMetrics *apiclient.ChainMetrics, additionalRows [][]string) { header := []string{"Message name", "", "Total", "Last time", "Last message"} + + publisherStateTransaction := mapMetricItem(msgsMetrics.OutPublisherStateTransaction.Messages, msgsMetrics.OutPublisherStateTransaction.Timestamp, msgsMetrics.OutPublisherStateTransaction.LastMessage.TxId) + govTransaction := mapMetricItem(msgsMetrics.OutPublishGovernanceTransaction.Messages, msgsMetrics.OutPublishGovernanceTransaction.Timestamp, msgsMetrics.OutPublishGovernanceTransaction.LastMessage.TxId) + pullLatestOutput := mapMetricItem(msgsMetrics.OutPullLatestOutput.Messages, msgsMetrics.OutPullLatestOutput.Timestamp, msgsMetrics.OutPullLatestOutput.LastMessage) + outPullTxInclusionState := mapMetricItem(msgsMetrics.OutPullTxInclusionState.Messages, msgsMetrics.OutPullTxInclusionState.Timestamp, msgsMetrics.OutPullTxInclusionState.LastMessage.TxId) + outPullOutputByID := mapMetricItem(msgsMetrics.OutPullOutputByID.Messages, msgsMetrics.OutPullOutputByID.Timestamp, msgsMetrics.OutPullOutputByID.LastMessage.OutputId) + inStateOutput := mapMetricItem(msgsMetrics.InStateOutput.Messages, msgsMetrics.InStateOutput.Timestamp, msgsMetrics.InStateOutput.LastMessage.OutputId) + inAliasOutput := mapMetricItem(msgsMetrics.InAliasOutput.Messages, msgsMetrics.InAliasOutput.Timestamp, msgsMetrics.InAliasOutput.LastMessage.Raw) + inOutput := mapMetricItem(msgsMetrics.InOutput.Messages, msgsMetrics.InOutput.Timestamp, msgsMetrics.InOutput.LastMessage.OutputId) + inOnLedgerRequest := mapMetricItem(msgsMetrics.InOnLedgerRequest.Messages, msgsMetrics.InOnLedgerRequest.Timestamp, msgsMetrics.InOnLedgerRequest.LastMessage.OutputId) + inTxInclusionState := mapMetricItem(msgsMetrics.InTxInclusionState.Messages, msgsMetrics.InTxInclusionState.Timestamp, msgsMetrics.InTxInclusionState.LastMessage.TxId) + table := [][]string{ - makeMessagesMetricsTableRow("Publish state transaction", false, msgsMetrics.OutPublishStateTransaction), - makeMessagesMetricsTableRow("Publish governance transaction", false, msgsMetrics.OutPublishGovernanceTransaction), - makeMessagesMetricsTableRow("Pull latest output", false, msgsMetrics.OutPullLatestOutput), - makeMessagesMetricsTableRow("Pull tx inclusion state", false, msgsMetrics.OutPullTxInclusionState), - makeMessagesMetricsTableRow("Pull output by ID", false, msgsMetrics.OutPullOutputByID), - makeMessagesMetricsTableRow("State output", true, msgsMetrics.InStateOutput), - makeMessagesMetricsTableRow("Alias output", true, msgsMetrics.InAliasOutput), - makeMessagesMetricsTableRow("Output", true, msgsMetrics.InOutput), - makeMessagesMetricsTableRow("On ledger request", true, msgsMetrics.InOnLedgerRequest), - makeMessagesMetricsTableRow("Tx inclusion state", true, msgsMetrics.InTxInclusionState), + makeMessagesMetricsTableRow("Publish state transaction", false, publisherStateTransaction), + makeMessagesMetricsTableRow("Publish governance transaction", false, govTransaction), + makeMessagesMetricsTableRow("Pull latest output", false, pullLatestOutput), + makeMessagesMetricsTableRow("Pull tx inclusion state", false, outPullTxInclusionState), + makeMessagesMetricsTableRow("Pull output by ID", false, outPullOutputByID), + makeMessagesMetricsTableRow("State output", true, inStateOutput), + makeMessagesMetricsTableRow("Alias output", true, inAliasOutput), + makeMessagesMetricsTableRow("Output", true, inOutput), + makeMessagesMetricsTableRow("On ledger request", true, inOnLedgerRequest), + makeMessagesMetricsTableRow("Tx inclusion state", true, inTxInclusionState), } table = append(table, additionalRows...) log.PrintTable(header, table) } -func makeMessagesMetricsTableRow(name string, isIn bool, ncmm *model.NodeConnectionMessageMetrics) []string { +func makeMessagesMetricsTableRow(name string, isIn bool, ncmm *apiclient.InterfaceMetricItem) []string { res := make([]string, 5) res[0] = name if isIn { @@ -69,8 +100,8 @@ func makeMessagesMetricsTableRow(name string, isIn bool, ncmm *model.NodeConnect } else { res[1] = "OUT" } - res[2] = fmt.Sprintf("%v", ncmm.Total) - res[3] = ncmm.LastEvent.String() + res[2] = fmt.Sprintf("%v", ncmm.Messages) + res[3] = ncmm.Timestamp.String() res[4] = ncmm.LastMessage if len(res[4]) > maxMessageLen { res[4] = res[4][:maxMessageLen] diff --git a/tools/wasp-cli/peering/distrust.go b/tools/wasp-cli/peering/distrust.go index d42fab8b47..5ab8f3d6e6 100644 --- a/tools/wasp-cli/peering/distrust.go +++ b/tools/wasp-cli/peering/distrust.go @@ -4,10 +4,13 @@ package peering import ( + "context" + "github.com/spf13/cobra" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/peering" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -18,21 +21,31 @@ func initDistrustCmd() *cobra.Command { Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { pubKeyOrNetID := args[0] - waspClient := config.WaspClient(config.MustWaspAPI()) + client := cliclients.WaspClientForIndex() + if peering.CheckNetID(pubKeyOrNetID) != nil { - log.Check(waspClient.DeletePeeringTrusted(pubKeyOrNetID)) + _, err := client.NodeApi.DistrustPeer(context.Background()).PeeringTrustRequest(apiclient.PeeringTrustRequest{ + NetId: pubKeyOrNetID, + PublicKey: pubKeyOrNetID, + }).Execute() + log.Check(err) log.Printf("# Distrusted PubKey: %v\n", pubKeyOrNetID) return } - trustedList, err := waspClient.GetPeeringTrustedList() + + trustedList, _, err := client.NodeApi.GetTrustedPeers(context.Background()).Execute() log.Check(err) + for _, t := range trustedList { - if t.NetID == pubKeyOrNetID { - err := waspClient.DeletePeeringTrusted(t.PubKey) + if t.PublicKey == pubKeyOrNetID { + _, err := client.NodeApi.DistrustPeer(context.Background()).PeeringTrustRequest(apiclient.PeeringTrustRequest{ + PublicKey: t.PublicKey, + }).Execute() + if err != nil { - log.Printf("error: failed to distrust %v/%v, reason=%v\n", t.PubKey, t.NetID, err) + log.Printf("error: failed to distrust %v/%v, reason=%v\n", t.PublicKey, t.NetId, err) } else { - log.Printf("# Distrusted PubKey: %v\n", t.PubKey) + log.Printf("# Distrusted PubKey: %v\n", t.PublicKey) } } } diff --git a/tools/wasp-cli/peering/info.go b/tools/wasp-cli/peering/info.go index 9ce3026c23..216179e47a 100644 --- a/tools/wasp-cli/peering/info.go +++ b/tools/wasp-cli/peering/info.go @@ -4,9 +4,11 @@ package peering import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -16,10 +18,11 @@ func initInfoCmd() *cobra.Command { Short: "Node info.", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - info, err := config.WaspClient(config.MustWaspAPI()).GetPeeringSelf() + client := cliclients.WaspClientForIndex() + info, _, err := client.NodeApi.GetPeeringIdentity(context.Background()).Execute() log.Check(err) - model := &InfoModel{PubKey: info.PubKey, NetID: info.NetID} + model := &InfoModel{PubKey: info.PublicKey, NetID: info.NetId} log.PrintCLIOutput(model) }, } diff --git a/tools/wasp-cli/peering/listtrusted.go b/tools/wasp-cli/peering/listtrusted.go index 1789bf2f55..8c1160e637 100644 --- a/tools/wasp-cli/peering/listtrusted.go +++ b/tools/wasp-cli/peering/listtrusted.go @@ -4,9 +4,11 @@ package peering import ( + "context" + "github.com/spf13/cobra" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -16,14 +18,16 @@ func initListTrustedCmd() *cobra.Command { Short: "List trusted wasp nodes.", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - trustedList, err := config.WaspClient(config.MustWaspAPI()).GetPeeringTrustedList() + client := cliclients.WaspClientForIndex() + trustedList, _, err := client.NodeApi.GetTrustedPeers(context.Background()).Execute() log.Check(err) + header := []string{"PubKey", "NetID"} rows := make([][]string, len(trustedList)) for i := range rows { rows[i] = []string{ - trustedList[i].PubKey, - trustedList[i].NetID, + trustedList[i].PublicKey, + trustedList[i].NetId, } } log.PrintTable(header, rows) diff --git a/tools/wasp-cli/peering/trust.go b/tools/wasp-cli/peering/trust.go index f06d940719..62c80a35ac 100644 --- a/tools/wasp-cli/peering/trust.go +++ b/tools/wasp-cli/peering/trust.go @@ -4,12 +4,15 @@ package peering import ( + "context" + "github.com/spf13/cobra" iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiclient" "github.com/iotaledger/wasp/packages/peering" "github.com/iotaledger/wasp/tools/wasp-cli/chain" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -21,18 +24,27 @@ func initTrustCmd() *cobra.Command { Short: "Trust the specified wasp node as a peer.", Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { + if nodes == nil { nodes = chain.GetAllWaspNodes() } + pubKey := args[0] netID := args[1] _, err := iotago.DecodeHex(pubKey) // Assert it can be decoded. log.Check(err) log.Check(peering.CheckNetID(netID)) + for _, i := range nodes { - _, err = config.WaspClient(config.MustWaspAPI(i)).PostPeeringTrusted(pubKey, netID) - log.Check(err) + client := cliclients.WaspClientForIndex(i) + + _, err = client.NodeApi.TrustPeer(context.Background()).PeeringTrustRequest(apiclient.PeeringTrustRequest{ + NetId: netID, + PublicKey: pubKey, + }).Execute() } + + log.Check(err) }, } diff --git a/tools/wasp-cli/util/tx.go b/tools/wasp-cli/util/tx.go index 9e27cf9648..3b3056eb14 100644 --- a/tools/wasp-cli/util/tx.go +++ b/tools/wasp-cli/util/tx.go @@ -1,26 +1,29 @@ package util import ( + "context" "os" "time" iotago "github.com/iotaledger/iota.go/v3" + "github.com/iotaledger/wasp/clients/apiextensions" "github.com/iotaledger/wasp/packages/isc" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) -func PostTransaction(tx *iotago.Transaction) { - _, err := config.L1Client().PostTxAndWaitUntilConfirmation(tx) - log.Check(err) -} - func WithOffLedgerRequest(chainID isc.ChainID, f func() (isc.OffLedgerRequest, error)) { req, err := f() log.Check(err) log.Printf("Posted off-ledger request (check result with: %s chain request %s)\n", os.Args[0], req.ID().String()) if config.WaitForCompletion { - _, err = config.WaspClient(config.MustWaspAPI()).WaitUntilRequestProcessed(chainID, req.ID(), 1*time.Minute) + + _, _, err = cliclients.WaspClientForIndex().RequestsApi. + WaitForRequest(context.Background(), chainID.String(), req.ID().String()). + TimeoutSeconds(60). + Execute() + log.Check(err) } // TODO print receipt? @@ -33,7 +36,8 @@ func WithSCTransaction(chainID isc.ChainID, f func() (*iotago.Transaction, error if config.WaitForCompletion || len(forceWait) > 0 { log.Printf("Waiting for tx requests to be processed...\n") - _, err := config.WaspClient(config.MustWaspAPI()).WaitUntilAllRequestsProcessed(chainID, tx, 1*time.Minute) + client := cliclients.WaspClientForIndex() + _, err := apiextensions.APIWaitUntilAllRequestsProcessed(client, chainID, tx, 1*time.Minute) log.Check(err) } diff --git a/tools/wasp-cli/wallet/cmd.go b/tools/wasp-cli/wallet/cmd.go index c452dafc0b..a9189a2e8a 100644 --- a/tools/wasp-cli/wallet/cmd.go +++ b/tools/wasp-cli/wallet/cmd.go @@ -2,6 +2,8 @@ package wallet import ( "github.com/spf13/cobra" + + "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" ) func Init(rootCmd *cobra.Command) { @@ -11,5 +13,5 @@ func Init(rootCmd *cobra.Command) { rootCmd.AddCommand(initSendFundsCmd()) rootCmd.AddCommand(initRequestFundsCmd()) - rootCmd.PersistentFlags().IntVarP(&addressIndex, "address-index", "i", 0, "address index") + rootCmd.PersistentFlags().IntVarP(&wallet.AddressIndex, "address-index", "i", 0, "address index") } diff --git a/tools/wasp-cli/wallet/info.go b/tools/wasp-cli/wallet/info.go index f3fb9ed499..335363ffca 100644 --- a/tools/wasp-cli/wallet/info.go +++ b/tools/wasp-cli/wallet/info.go @@ -6,7 +6,8 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + cliwallet "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -16,8 +17,7 @@ func initAddressCmd() *cobra.Command { Short: "Show the wallet address", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - wallet := Load() - + wallet := cliwallet.Load() address := wallet.Address() model := &AddressModel{Address: address.Bech32(parameters.L1().Protocol.Bech32HRP)} @@ -58,17 +58,17 @@ func initBalanceCmd() *cobra.Command { Short: "Show the wallet balance", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - wallet := Load() + wallet := cliwallet.Load() address := wallet.Address() - outs, err := config.L1Client().OutputMap(address) + outs, err := cliclients.L1Client().OutputMap(address) log.Check(err) balance := isc.AssetsFromOutputMap(outs) model := &BalanceModel{ Address: address.Bech32(parameters.L1().Protocol.Bech32HRP), - AddressIndex: addressIndex, + AddressIndex: wallet.AddressIndex, NativeTokens: balance.NativeTokens, BaseTokens: balance.BaseTokens, OutputMap: outs, diff --git a/tools/wasp-cli/wallet/request-funds.go b/tools/wasp-cli/wallet/request-funds.go index b7ef7b7a6b..c93a827c8a 100644 --- a/tools/wasp-cli/wallet/request-funds.go +++ b/tools/wasp-cli/wallet/request-funds.go @@ -4,7 +4,8 @@ import ( "github.com/spf13/cobra" "github.com/iotaledger/wasp/packages/parameters" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -14,8 +15,8 @@ func initRequestFundsCmd() *cobra.Command { Short: "Request funds from the faucet", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - address := Load().Address() - log.Check(config.L1Client().RequestFunds(address)) + address := wallet.Load().Address() + log.Check(cliclients.L1Client().RequestFunds(address)) model := &RequestFundsModel{ Address: address.Bech32(parameters.L1().Protocol.Bech32HRP), diff --git a/tools/wasp-cli/wallet/send.go b/tools/wasp-cli/wallet/send.go index cbbc547048..3d1f578223 100644 --- a/tools/wasp-cli/wallet/send.go +++ b/tools/wasp-cli/wallet/send.go @@ -6,7 +6,8 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/isc" "github.com/iotaledger/wasp/packages/transaction" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/cliclients" + cliwallet "github.com/iotaledger/wasp/tools/wasp-cli/cli/wallet" "github.com/iotaledger/wasp/tools/wasp-cli/log" "github.com/iotaledger/wasp/tools/wasp-cli/util" ) @@ -27,9 +28,9 @@ func initSendFundsCmd() *cobra.Command { log.Printf("\nSending \n\t%v \n\tto: %v\n\n", tokens, args[0]) - wallet := Load() + wallet := cliwallet.Load() senderAddress := wallet.Address() - client := config.L1Client() + client := cliclients.L1Client() outputSet, err := client.OutputMap(senderAddress) log.Check(err) diff --git a/tools/wasp-cli/wallet/wallet.go b/tools/wasp-cli/wallet/wallet.go index 697cafe404..ab17c2d083 100644 --- a/tools/wasp-cli/wallet/wallet.go +++ b/tools/wasp-cli/wallet/wallet.go @@ -6,7 +6,7 @@ import ( iotago "github.com/iotaledger/iota.go/v3" "github.com/iotaledger/wasp/packages/cryptolib" - "github.com/iotaledger/wasp/tools/wasp-cli/config" + "github.com/iotaledger/wasp/tools/wasp-cli/cli/config" "github.com/iotaledger/wasp/tools/wasp-cli/log" ) @@ -14,10 +14,6 @@ type WalletConfig struct { Seed []byte } -type Wallet struct { - KeyPair *cryptolib.KeyPair -} - func initInitCmd() *cobra.Command { return &cobra.Command{ Use: "init", @@ -44,28 +40,6 @@ func initInitCmd() *cobra.Command { } } -func Load() *Wallet { - seedHex := viper.GetString("wallet.seed") - if seedHex == "" { - log.Fatal("call `init` first") - } - seedBytes, err := iotago.DecodeHex(seedHex) - log.Check(err) - seed := cryptolib.NewSeedFromBytes(seedBytes) - kp := cryptolib.NewKeyPairFromSeed(seed.SubSeed(uint64(addressIndex))) - return &Wallet{KeyPair: kp} -} - -var addressIndex int - -func (w *Wallet) PrivateKey() *cryptolib.PrivateKey { - return w.KeyPair.GetPrivateKey() -} - -func (w *Wallet) Address() iotago.Address { - return w.KeyPair.GetPublicKey().AsEd25519Address() -} - type InitModel struct { ConfigPath string Message string