From dafe33a8dbcb7604cc1e7bf34b3f41bc9de4c9e1 Mon Sep 17 00:00:00 2001 From: Enrique Lacal Date: Fri, 3 May 2024 10:59:41 +0100 Subject: [PATCH] fix: TLS and extend FileServer OpenAPI - Enable TLS on the HTTP Server correctly - Nest FileServer OpenAPI under /api/*filepath - Add JSON OpenAPI version - Update the mocks to fix Signed-off-by: Enrique Lacal --- Dockerfile | 1 + Makefile | 8 +- README.md | 13 +- go.mod | 3 + go.sum | 15 + internal/rest/restgateway.go | 7 +- internal/rest/router.go | 11 +- internal/utils/swagger-ui.go | 2 +- mocks/events/subscription_manager.go | 63 +- mocks/fabric/client/identity_client.go | 19 +- mocks/fabric/client/rpc_client.go | 43 +- mocks/fabric/dep/ca_client.go | 43 +- mocks/kvstore/kv_iterator.go | 35 +- mocks/kvstore/kv_store.go | 39 +- mocks/rest/async/async_dispatcher.go | 27 +- mocks/rest/async/dispatcher.go | 27 +- mocks/rest/identity/client.go | 39 +- mocks/rest/identity/identity_client.go | 20 + .../receipt/api/receipt_store_persistence.go | 31 +- mocks/rest/receipt/receipt_store.go | 8 + mocks/rest/receipt/store.go | 19 +- mocks/rest/sync/dispatcher.go | 11 +- mocks/tx/processor.go | 15 +- mocks/tx/tx_processor.go | 4 + mocks/ws/web_socket_channels.go | 15 +- mocks/ws/web_socket_server.go | 15 +- openapi/spec.json | 1549 +++++++++++++++++ 27 files changed, 1971 insertions(+), 111 deletions(-) create mode 100644 openapi/spec.json diff --git a/Dockerfile b/Dockerfile index 4890064..c7be572 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN mkdir /.cache \ RUN make FROM alpine:3.19 +RUN apk add curl WORKDIR /fabconnect COPY --from=fabconnect-builder /fabconnect/fabconnect ./ ADD ./openapi ./openapi/ diff --git a/Makefile b/Makefile index 6f2738f..731591c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ TESTED_INTERNALS := $(shell go list ./internal/... | grep -v test | grep -v kafk TESTED_CMD := $(shell go list ./cmd/...) COVERPKG_INTERNALS = $(shell go list ./internal/... | grep -v test | grep -v kafka | tr "\n" ",") COVERPKG_CMD = $(shell go list ./cmd/... | tr "\n" ",") -# Expect that FireFly compiles with CGO disabled +# Expect that FireFly-FabConnect compiles with CGO disabled CGO_ENABLED=0 GOGC=30 .DELETE_ON_ERROR: @@ -20,13 +20,13 @@ lint: ${LINT} GOGC=20 $(LINT) run -v --timeout 5m ${LINT}: $(VGO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 -firefly-nocgo: ${GOFILES} +firefly-fabconnect-nocgo: ${GOFILES} CGO_ENABLED=0 $(VGO) build -o ${BINARY_NAME}-nocgo -ldflags "-X main.buildDate=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` -X main.buildVersion=$(BUILD_VERSION)" -tags=prod -tags=prod -v -firefly: ${GOFILES} +firefly-fabconnect: ${GOFILES} $(VGO) build -o ${BINARY_NAME} -ldflags "-X main.buildDate=`date -u +\"%Y-%m-%dT%H:%M:%SZ\"` -X main.buildVersion=$(BUILD_VERSION)" -tags=prod -tags=prod -v go-mod-tidy: .ALWAYS go mod tidy -build: firefly-nocgo firefly +build: firefly-fabconnect-nocgo firefly-fabconnect .ALWAYS: ; clean: $(VGO) clean diff --git a/README.md b/README.md index 223e54e..8bcf866 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ A reliable REST and websocket API to interact with a Fabric network and stream events. +This component provides 3 high level sets of API endpoints: + +- Client MSPs (aka the wallet): registering and enrolling identities to be used for signing transactions +- Transactions: submit transactions and query for transaction result/receipts +- Events: subscribe to events with regex based filter and stream to the client app via websocket + ## Architecture ### High Level Components @@ -13,12 +19,6 @@ A reliable REST and websocket API to interact with a Fabric network and stream e ![objects and flows architecture](/images/arch-2.png) ![kafkal handler architecture](/images/arch-3.png) -The component provides 3 high level sets of API endpoints: - -- Client MSPs (aka the wallet): registering and enrolling identities to be used for signing transactions -- Transactions: submit transactions and query for transaction result/receipts -- Events: subscribe to events with regex based filter and stream to the client app via websocket - ## Getting Started After checking out the repo, simply run `make` to build and test. @@ -57,6 +57,7 @@ To launch, first prepare the 2 configurations files: } ``` +// TODO clean this up - the standard Fabric common connection profile (CCP) file that describes the target Fabric network, at the location specified in the main config file above under `rpc.configPath`. For details on the CCP file, see [Fabric SDK documentation](https://hyperledger.github.io/fabric-sdk-node/release-1.4/tutorial-network-config.html). Note that the CCP file must contain the `client` section, which is required for the fabconnect to act as a client to Fabric networks. Use the following command to launch the connector: diff --git a/go.mod b/go.mod index 8207722..d2abbe9 100644 --- a/go.mod +++ b/go.mod @@ -82,6 +82,7 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.5.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect + github.com/vektra/mockery v1.1.2 // indirect github.com/weppos/publicsuffix-go v0.30.2-0.20230730094716-a20f9abcc222 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect @@ -90,11 +91,13 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.18.0 // indirect golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e // indirect + golang.org/x/mod v0.14.0 // indirect golang.org/x/net v0.20.0 // indirect golang.org/x/sync v0.5.0 // indirect golang.org/x/sys v0.16.0 // indirect golang.org/x/term v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.16.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1 // indirect google.golang.org/grpc v1.60.1 // indirect google.golang.org/protobuf v1.32.0 // indirect diff --git a/go.sum b/go.sum index 440737c..18113c7 100644 --- a/go.sum +++ b/go.sum @@ -7,6 +7,11 @@ github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtix github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A= @@ -477,6 +482,8 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= +github.com/vektra/mockery v1.1.2 h1:uc0Yn67rJpjt8U/mAZimdCKn9AeA97BOkjpmtBSlfP4= +github.com/vektra/mockery v1.1.2/go.mod h1:VcfZjKaFOPO+MpN4ZvwPjs4c48lkq1o3Ym8yHZJu0jU= github.com/weppos/publicsuffix-go v0.4.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= github.com/weppos/publicsuffix-go v0.5.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= github.com/weppos/publicsuffix-go v0.13.0/go.mod h1:z3LCPQ38eedDQSwmsSRW4Y7t2L8Ln16JPQ02lHAdn5k= @@ -492,6 +499,7 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -549,10 +557,13 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -569,6 +580,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -675,10 +687,13 @@ golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/rest/restgateway.go b/internal/rest/restgateway.go index 8f6c908..c1699ac 100644 --- a/internal/rest/restgateway.go +++ b/internal/rest/restgateway.go @@ -154,7 +154,12 @@ func (g *Gateway) Start() error { go func() { <-readyToListen log.Printf("HTTP server listening on %s", g.srv.Addr) - err := g.srv.ListenAndServe() + var err error + if tlsConfig != nil { + err = g.srv.ListenAndServeTLS(g.config.HTTP.TLS.ClientCertsFile, g.config.HTTP.TLS.ClientKeyFile) + } else { + err = g.srv.ListenAndServe() + } if err != nil { log.Errorf("Listening ended with: %s", err) } diff --git a/internal/rest/router.go b/internal/rest/router.go index 26725a8..13743d8 100644 --- a/internal/rest/router.go +++ b/internal/rest/router.go @@ -67,8 +67,7 @@ func newRouter(syncDispatcher restsync.Dispatcher, asyncDispatcher restasync.Dis func (r *router) addRoutes() { r.httpRouter.GET("/api", r.serveSwaggerUI) - r.httpRouter.GET("/spec.yaml", r.serveSwagger) - + r.httpRouter.ServeFiles("/api/*filepath", http.Dir("./openapi")) r.httpRouter.POST("/identities", r.registerUser) r.httpRouter.PUT("/identities/:username", r.modifyUser) r.httpRouter.POST("/identities/:username/enroll", r.enrollUser) @@ -136,13 +135,7 @@ func (r *router) statusHandler(res http.ResponseWriter, _ *http.Request, _ httpr _, _ = res.Write(reply) } -func (r *router) serveSwagger(res http.ResponseWriter, req *http.Request, _ httprouter.Params) { - log.Infof("--> %s %s", req.Method, req.URL) - fs := http.FileServer(http.Dir("./openapi")) - fs.ServeHTTP(res, req) -} - -func (r *router) serveSwaggerUI(res http.ResponseWriter, req *http.Request, _ httprouter.Params) { +func (r *router) serveSwaggerUI(res http.ResponseWriter, req *http.Request, params httprouter.Params) { log.Infof("--> %s %s", req.Method, req.URL) res.Header().Add("Content-Type", "text/html") _, _ = res.Write(utils.SwaggerUIHTML(req.Context())) diff --git a/internal/utils/swagger-ui.go b/internal/utils/swagger-ui.go index 6930247..999dfb2 100644 --- a/internal/utils/swagger-ui.go +++ b/internal/utils/swagger-ui.go @@ -40,7 +40,7 @@ var swaggerUIHTML = ` window.onload = function() { // Begin Swagger UI call region const ui = SwaggerUIBundle({ - url: "/spec.yaml", + url: "/api/spec.yaml", dom_id: '#swagger-ui', deepLinking: true, presets: [ diff --git a/mocks/events/subscription_manager.go b/mocks/events/subscription_manager.go index 7a5ddd1..0611907 100644 --- a/mocks/events/subscription_manager.go +++ b/mocks/events/subscription_manager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockevents @@ -26,6 +26,10 @@ type SubscriptionManager struct { func (_m *SubscriptionManager) AddStream(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*events.StreamInfo, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for AddStream") + } + var r0 *events.StreamInfo var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*events.StreamInfo, *util.RestError)); ok { @@ -54,6 +58,10 @@ func (_m *SubscriptionManager) AddStream(res http.ResponseWriter, req *http.Requ func (_m *SubscriptionManager) AddSubscription(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*api.SubscriptionInfo, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for AddSubscription") + } + var r0 *api.SubscriptionInfo var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*api.SubscriptionInfo, *util.RestError)); ok { @@ -87,6 +95,10 @@ func (_m *SubscriptionManager) Close() { func (_m *SubscriptionManager) DeleteStream(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*map[string]string, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for DeleteStream") + } + var r0 *map[string]string var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*map[string]string, *util.RestError)); ok { @@ -115,6 +127,10 @@ func (_m *SubscriptionManager) DeleteStream(res http.ResponseWriter, req *http.R func (_m *SubscriptionManager) DeleteSubscription(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*map[string]string, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for DeleteSubscription") + } + var r0 *map[string]string var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*map[string]string, *util.RestError)); ok { @@ -149,6 +165,10 @@ func (_m *SubscriptionManager) Init(mocked ...kvstore.KVStore) error { _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func(...kvstore.KVStore) error); ok { r0 = rf(mocked...) @@ -163,6 +183,10 @@ func (_m *SubscriptionManager) Init(mocked ...kvstore.KVStore) error { func (_m *SubscriptionManager) ResetSubscription(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*map[string]string, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for ResetSubscription") + } + var r0 *map[string]string var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*map[string]string, *util.RestError)); ok { @@ -191,6 +215,10 @@ func (_m *SubscriptionManager) ResetSubscription(res http.ResponseWriter, req *h func (_m *SubscriptionManager) ResumeStream(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*map[string]string, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for ResumeStream") + } + var r0 *map[string]string var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*map[string]string, *util.RestError)); ok { @@ -219,6 +247,10 @@ func (_m *SubscriptionManager) ResumeStream(res http.ResponseWriter, req *http.R func (_m *SubscriptionManager) StreamByID(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*events.StreamInfo, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for StreamByID") + } + var r0 *events.StreamInfo var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*events.StreamInfo, *util.RestError)); ok { @@ -247,6 +279,10 @@ func (_m *SubscriptionManager) StreamByID(res http.ResponseWriter, req *http.Req func (_m *SubscriptionManager) Streams(res http.ResponseWriter, req *http.Request, params httprouter.Params) []*events.StreamInfo { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Streams") + } + var r0 []*events.StreamInfo if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) []*events.StreamInfo); ok { r0 = rf(res, req, params) @@ -263,6 +299,10 @@ func (_m *SubscriptionManager) Streams(res http.ResponseWriter, req *http.Reques func (_m *SubscriptionManager) SubscriptionByID(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*api.SubscriptionInfo, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for SubscriptionByID") + } + var r0 *api.SubscriptionInfo var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*api.SubscriptionInfo, *util.RestError)); ok { @@ -291,6 +331,10 @@ func (_m *SubscriptionManager) SubscriptionByID(res http.ResponseWriter, req *ht func (_m *SubscriptionManager) Subscriptions(res http.ResponseWriter, req *http.Request, params httprouter.Params) []*api.SubscriptionInfo { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Subscriptions") + } + var r0 []*api.SubscriptionInfo if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) []*api.SubscriptionInfo); ok { r0 = rf(res, req, params) @@ -307,6 +351,10 @@ func (_m *SubscriptionManager) Subscriptions(res http.ResponseWriter, req *http. func (_m *SubscriptionManager) SuspendStream(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*map[string]string, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for SuspendStream") + } + var r0 *map[string]string var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*map[string]string, *util.RestError)); ok { @@ -335,6 +383,10 @@ func (_m *SubscriptionManager) SuspendStream(res http.ResponseWriter, req *http. func (_m *SubscriptionManager) UpdateStream(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*events.StreamInfo, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for UpdateStream") + } + var r0 *events.StreamInfo var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*events.StreamInfo, *util.RestError)); ok { @@ -359,13 +411,12 @@ func (_m *SubscriptionManager) UpdateStream(res http.ResponseWriter, req *http.R return r0, r1 } -type mockConstructorTestingTNewSubscriptionManager interface { +// NewSubscriptionManager creates a new instance of SubscriptionManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSubscriptionManager(t interface { mock.TestingT Cleanup(func()) -} - -// NewSubscriptionManager creates a new instance of SubscriptionManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSubscriptionManager(t mockConstructorTestingTNewSubscriptionManager) *SubscriptionManager { +}) *SubscriptionManager { mock := &SubscriptionManager{} mock.Mock.Test(t) diff --git a/mocks/fabric/client/identity_client.go b/mocks/fabric/client/identity_client.go index 324e0b5..3a6a348 100644 --- a/mocks/fabric/client/identity_client.go +++ b/mocks/fabric/client/identity_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockfabric @@ -23,6 +23,10 @@ func (_m *IdentityClient) AddSignerUpdateListener(_a0 client.SignerUpdateListene func (_m *IdentityClient) GetClientOrg() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetClientOrg") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -37,6 +41,10 @@ func (_m *IdentityClient) GetClientOrg() string { func (_m *IdentityClient) GetSigningIdentity(name string) (msp.SigningIdentity, error) { ret := _m.Called(name) + if len(ret) == 0 { + panic("no return value specified for GetSigningIdentity") + } + var r0 msp.SigningIdentity var r1 error if rf, ok := ret.Get(0).(func(string) (msp.SigningIdentity, error)); ok { @@ -59,13 +67,12 @@ func (_m *IdentityClient) GetSigningIdentity(name string) (msp.SigningIdentity, return r0, r1 } -type mockConstructorTestingTNewIdentityClient interface { +// NewIdentityClient creates a new instance of IdentityClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewIdentityClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewIdentityClient creates a new instance of IdentityClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewIdentityClient(t mockConstructorTestingTNewIdentityClient) *IdentityClient { +}) *IdentityClient { mock := &IdentityClient{} mock.Mock.Test(t) diff --git a/mocks/fabric/client/rpc_client.go b/mocks/fabric/client/rpc_client.go index 88f6fe3..e89e3d6 100644 --- a/mocks/fabric/client/rpc_client.go +++ b/mocks/fabric/client/rpc_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockfabric @@ -22,6 +22,10 @@ type RPCClient struct { func (_m *RPCClient) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -36,6 +40,10 @@ func (_m *RPCClient) Close() error { func (_m *RPCClient) Invoke(channelID string, signer string, chaincodeName string, method string, args []string, transientMap map[string]string, isInit bool) (*client.TxReceipt, error) { ret := _m.Called(channelID, signer, chaincodeName, method, args, transientMap, isInit) + if len(ret) == 0 { + panic("no return value specified for Invoke") + } + var r0 *client.TxReceipt var r1 error if rf, ok := ret.Get(0).(func(string, string, string, string, []string, map[string]string, bool) (*client.TxReceipt, error)); ok { @@ -62,6 +70,10 @@ func (_m *RPCClient) Invoke(channelID string, signer string, chaincodeName strin func (_m *RPCClient) Query(channelID string, signer string, chaincodeName string, method string, args []string, strongread bool) ([]byte, error) { ret := _m.Called(channelID, signer, chaincodeName, method, args, strongread) + if len(ret) == 0 { + panic("no return value specified for Query") + } + var r0 []byte var r1 error if rf, ok := ret.Get(0).(func(string, string, string, string, []string, bool) ([]byte, error)); ok { @@ -88,6 +100,10 @@ func (_m *RPCClient) Query(channelID string, signer string, chaincodeName string func (_m *RPCClient) QueryBlock(channelID string, signer string, blocknumber uint64, blockhash []byte) (*utils.RawBlock, *utils.Block, error) { ret := _m.Called(channelID, signer, blocknumber, blockhash) + if len(ret) == 0 { + panic("no return value specified for QueryBlock") + } + var r0 *utils.RawBlock var r1 *utils.Block var r2 error @@ -123,6 +139,10 @@ func (_m *RPCClient) QueryBlock(channelID string, signer string, blocknumber uin func (_m *RPCClient) QueryBlockByTxID(channelID string, signer string, txID string) (*utils.RawBlock, *utils.Block, error) { ret := _m.Called(channelID, signer, txID) + if len(ret) == 0 { + panic("no return value specified for QueryBlockByTxID") + } + var r0 *utils.RawBlock var r1 *utils.Block var r2 error @@ -158,6 +178,10 @@ func (_m *RPCClient) QueryBlockByTxID(channelID string, signer string, txID stri func (_m *RPCClient) QueryChainInfo(channelID string, signer string) (*fab.BlockchainInfoResponse, error) { ret := _m.Called(channelID, signer) + if len(ret) == 0 { + panic("no return value specified for QueryChainInfo") + } + var r0 *fab.BlockchainInfoResponse var r1 error if rf, ok := ret.Get(0).(func(string, string) (*fab.BlockchainInfoResponse, error)); ok { @@ -184,6 +208,10 @@ func (_m *RPCClient) QueryChainInfo(channelID string, signer string) (*fab.Block func (_m *RPCClient) QueryTransaction(channelID string, signer string, txID string) (map[string]interface{}, error) { ret := _m.Called(channelID, signer, txID) + if len(ret) == 0 { + panic("no return value specified for QueryTransaction") + } + var r0 map[string]interface{} var r1 error if rf, ok := ret.Get(0).(func(string, string, string) (map[string]interface{}, error)); ok { @@ -210,6 +238,10 @@ func (_m *RPCClient) QueryTransaction(channelID string, signer string, txID stri func (_m *RPCClient) SubscribeEvent(subInfo *api.SubscriptionInfo, since uint64) (*client.RegistrationWrapper, <-chan *fab.BlockEvent, <-chan *fab.CCEvent, error) { ret := _m.Called(subInfo, since) + if len(ret) == 0 { + panic("no return value specified for SubscribeEvent") + } + var r0 *client.RegistrationWrapper var r1 <-chan *fab.BlockEvent var r2 <-chan *fab.CCEvent @@ -255,13 +287,12 @@ func (_m *RPCClient) Unregister(_a0 *client.RegistrationWrapper) { _m.Called(_a0) } -type mockConstructorTestingTNewRPCClient interface { +// NewRPCClient creates a new instance of RPCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewRPCClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewRPCClient creates a new instance of RPCClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRPCClient(t mockConstructorTestingTNewRPCClient) *RPCClient { +}) *RPCClient { mock := &RPCClient{} mock.Mock.Test(t) diff --git a/mocks/fabric/dep/ca_client.go b/mocks/fabric/dep/ca_client.go index 02467fa..53a7fa1 100644 --- a/mocks/fabric/dep/ca_client.go +++ b/mocks/fabric/dep/ca_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockfabricdep @@ -17,6 +17,10 @@ type CAClient struct { func (_m *CAClient) Enroll(_a0 *api.EnrollmentRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Enroll") + } + var r0 error if rf, ok := ret.Get(0).(func(*api.EnrollmentRequest) error); ok { r0 = rf(_a0) @@ -31,6 +35,10 @@ func (_m *CAClient) Enroll(_a0 *api.EnrollmentRequest) error { func (_m *CAClient) GetAllIdentities(_a0 string) ([]*api.IdentityResponse, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for GetAllIdentities") + } + var r0 []*api.IdentityResponse var r1 error if rf, ok := ret.Get(0).(func(string) ([]*api.IdentityResponse, error)); ok { @@ -57,6 +65,10 @@ func (_m *CAClient) GetAllIdentities(_a0 string) ([]*api.IdentityResponse, error func (_m *CAClient) GetCAInfo() (*api.GetCAInfoResponse, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetCAInfo") + } + var r0 *api.GetCAInfoResponse var r1 error if rf, ok := ret.Get(0).(func() (*api.GetCAInfoResponse, error)); ok { @@ -83,6 +95,10 @@ func (_m *CAClient) GetCAInfo() (*api.GetCAInfoResponse, error) { func (_m *CAClient) GetIdentity(_a0 string, _a1 string) (*api.IdentityResponse, error) { ret := _m.Called(_a0, _a1) + if len(ret) == 0 { + panic("no return value specified for GetIdentity") + } + var r0 *api.IdentityResponse var r1 error if rf, ok := ret.Get(0).(func(string, string) (*api.IdentityResponse, error)); ok { @@ -109,6 +125,10 @@ func (_m *CAClient) GetIdentity(_a0 string, _a1 string) (*api.IdentityResponse, func (_m *CAClient) ModifyIdentity(_a0 *api.IdentityRequest) (*api.IdentityResponse, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for ModifyIdentity") + } + var r0 *api.IdentityResponse var r1 error if rf, ok := ret.Get(0).(func(*api.IdentityRequest) (*api.IdentityResponse, error)); ok { @@ -135,6 +155,10 @@ func (_m *CAClient) ModifyIdentity(_a0 *api.IdentityRequest) (*api.IdentityRespo func (_m *CAClient) Reenroll(_a0 *api.ReenrollmentRequest) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Reenroll") + } + var r0 error if rf, ok := ret.Get(0).(func(*api.ReenrollmentRequest) error); ok { r0 = rf(_a0) @@ -149,6 +173,10 @@ func (_m *CAClient) Reenroll(_a0 *api.ReenrollmentRequest) error { func (_m *CAClient) Register(_a0 *api.RegistrationRequest) (string, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Register") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(*api.RegistrationRequest) (string, error)); ok { @@ -173,6 +201,10 @@ func (_m *CAClient) Register(_a0 *api.RegistrationRequest) (string, error) { func (_m *CAClient) Revoke(_a0 *api.RevocationRequest) (*api.RevocationResponse, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + var r0 *api.RevocationResponse var r1 error if rf, ok := ret.Get(0).(func(*api.RevocationRequest) (*api.RevocationResponse, error)); ok { @@ -195,13 +227,12 @@ func (_m *CAClient) Revoke(_a0 *api.RevocationRequest) (*api.RevocationResponse, return r0, r1 } -type mockConstructorTestingTNewCAClient interface { +// NewCAClient creates a new instance of CAClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewCAClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewCAClient creates a new instance of CAClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewCAClient(t mockConstructorTestingTNewCAClient) *CAClient { +}) *CAClient { mock := &CAClient{} mock.Mock.Test(t) diff --git a/mocks/kvstore/kv_iterator.go b/mocks/kvstore/kv_iterator.go index 84a1f77..705f227 100644 --- a/mocks/kvstore/kv_iterator.go +++ b/mocks/kvstore/kv_iterator.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockkvstore @@ -13,6 +13,10 @@ type KVIterator struct { func (_m *KVIterator) Key() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Key") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -27,6 +31,10 @@ func (_m *KVIterator) Key() string { func (_m *KVIterator) Last() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Last") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -41,6 +49,10 @@ func (_m *KVIterator) Last() bool { func (_m *KVIterator) Next() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Next") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -55,6 +67,10 @@ func (_m *KVIterator) Next() bool { func (_m *KVIterator) Prev() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Prev") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -74,6 +90,10 @@ func (_m *KVIterator) Release() { func (_m *KVIterator) Seek(_a0 string) bool { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Seek") + } + var r0 bool if rf, ok := ret.Get(0).(func(string) bool); ok { r0 = rf(_a0) @@ -88,6 +108,10 @@ func (_m *KVIterator) Seek(_a0 string) bool { func (_m *KVIterator) Value() []byte { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Value") + } + var r0 []byte if rf, ok := ret.Get(0).(func() []byte); ok { r0 = rf() @@ -100,13 +124,12 @@ func (_m *KVIterator) Value() []byte { return r0 } -type mockConstructorTestingTNewKVIterator interface { +// NewKVIterator creates a new instance of KVIterator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewKVIterator(t interface { mock.TestingT Cleanup(func()) -} - -// NewKVIterator creates a new instance of KVIterator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewKVIterator(t mockConstructorTestingTNewKVIterator) *KVIterator { +}) *KVIterator { mock := &KVIterator{} mock.Mock.Test(t) diff --git a/mocks/kvstore/kv_store.go b/mocks/kvstore/kv_store.go index 565ef24..5d908a2 100644 --- a/mocks/kvstore/kv_store.go +++ b/mocks/kvstore/kv_store.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockkvstore @@ -16,6 +16,10 @@ type KVStore struct { func (_m *KVStore) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -30,6 +34,10 @@ func (_m *KVStore) Close() error { func (_m *KVStore) Delete(key string) error { ret := _m.Called(key) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(key) @@ -44,6 +52,10 @@ func (_m *KVStore) Delete(key string) error { func (_m *KVStore) Get(key string) ([]byte, error) { ret := _m.Called(key) + if len(ret) == 0 { + panic("no return value specified for Get") + } + var r0 []byte var r1 error if rf, ok := ret.Get(0).(func(string) ([]byte, error)); ok { @@ -70,6 +82,10 @@ func (_m *KVStore) Get(key string) ([]byte, error) { func (_m *KVStore) Init() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -84,6 +100,10 @@ func (_m *KVStore) Init() error { func (_m *KVStore) NewIterator() kvstore.KVIterator { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for NewIterator") + } + var r0 kvstore.KVIterator if rf, ok := ret.Get(0).(func() kvstore.KVIterator); ok { r0 = rf() @@ -100,6 +120,10 @@ func (_m *KVStore) NewIterator() kvstore.KVIterator { func (_m *KVStore) NewIteratorWithRange(keyRange interface{}) kvstore.KVIterator { ret := _m.Called(keyRange) + if len(ret) == 0 { + panic("no return value specified for NewIteratorWithRange") + } + var r0 kvstore.KVIterator if rf, ok := ret.Get(0).(func(interface{}) kvstore.KVIterator); ok { r0 = rf(keyRange) @@ -116,6 +140,10 @@ func (_m *KVStore) NewIteratorWithRange(keyRange interface{}) kvstore.KVIterator func (_m *KVStore) Put(key string, val []byte) error { ret := _m.Called(key, val) + if len(ret) == 0 { + panic("no return value specified for Put") + } + var r0 error if rf, ok := ret.Get(0).(func(string, []byte) error); ok { r0 = rf(key, val) @@ -126,13 +154,12 @@ func (_m *KVStore) Put(key string, val []byte) error { return r0 } -type mockConstructorTestingTNewKVStore interface { +// NewKVStore creates a new instance of KVStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewKVStore(t interface { mock.TestingT Cleanup(func()) -} - -// NewKVStore creates a new instance of KVStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewKVStore(t mockConstructorTestingTNewKVStore) *KVStore { +}) *KVStore { mock := &KVStore{} mock.Mock.Test(t) diff --git a/mocks/rest/async/async_dispatcher.go b/mocks/rest/async/async_dispatcher.go index f8a75bd..a0f47e9 100644 --- a/mocks/rest/async/async_dispatcher.go +++ b/mocks/rest/async/async_dispatcher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockasync @@ -27,6 +27,10 @@ func (_m *AsyncDispatcher) Close() { func (_m *AsyncDispatcher) DispatchMsgAsync(ctx context.Context, msg *messages.SendTransaction, ack bool) (*messages.AsyncSentMsg, error) { ret := _m.Called(ctx, msg, ack) + if len(ret) == 0 { + panic("no return value specified for DispatchMsgAsync") + } + var r0 *messages.AsyncSentMsg var r1 error if rf, ok := ret.Get(0).(func(context.Context, *messages.SendTransaction, bool) (*messages.AsyncSentMsg, error)); ok { @@ -58,6 +62,10 @@ func (_m *AsyncDispatcher) HandleReceipts(res http.ResponseWriter, req *http.Req func (_m *AsyncDispatcher) IsInitialized() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsInitialized") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -72,6 +80,10 @@ func (_m *AsyncDispatcher) IsInitialized() bool { func (_m *AsyncDispatcher) Run() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Run") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -86,6 +98,10 @@ func (_m *AsyncDispatcher) Run() error { func (_m *AsyncDispatcher) ValidateConf() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ValidateConf") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -96,13 +112,12 @@ func (_m *AsyncDispatcher) ValidateConf() error { return r0 } -type mockConstructorTestingTNewAsyncDispatcher interface { +// NewAsyncDispatcher creates a new instance of AsyncDispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewAsyncDispatcher(t interface { mock.TestingT Cleanup(func()) -} - -// NewAsyncDispatcher creates a new instance of AsyncDispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewAsyncDispatcher(t mockConstructorTestingTNewAsyncDispatcher) *AsyncDispatcher { +}) *AsyncDispatcher { mock := &AsyncDispatcher{} mock.Mock.Test(t) diff --git a/mocks/rest/async/dispatcher.go b/mocks/rest/async/dispatcher.go index ad08074..b789b49 100644 --- a/mocks/rest/async/dispatcher.go +++ b/mocks/rest/async/dispatcher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockasync @@ -27,6 +27,10 @@ func (_m *Dispatcher) Close() { func (_m *Dispatcher) DispatchMsgAsync(ctx context.Context, msg *messages.SendTransaction, ack bool) (*messages.AsyncSentMsg, error) { ret := _m.Called(ctx, msg, ack) + if len(ret) == 0 { + panic("no return value specified for DispatchMsgAsync") + } + var r0 *messages.AsyncSentMsg var r1 error if rf, ok := ret.Get(0).(func(context.Context, *messages.SendTransaction, bool) (*messages.AsyncSentMsg, error)); ok { @@ -58,6 +62,10 @@ func (_m *Dispatcher) HandleReceipts(res http.ResponseWriter, req *http.Request, func (_m *Dispatcher) IsInitialized() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsInitialized") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -72,6 +80,10 @@ func (_m *Dispatcher) IsInitialized() bool { func (_m *Dispatcher) Run() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Run") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -86,6 +98,10 @@ func (_m *Dispatcher) Run() error { func (_m *Dispatcher) ValidateConf() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ValidateConf") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -96,13 +112,12 @@ func (_m *Dispatcher) ValidateConf() error { return r0 } -type mockConstructorTestingTNewDispatcher interface { +// NewDispatcher creates a new instance of Dispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDispatcher(t interface { mock.TestingT Cleanup(func()) -} - -// NewDispatcher creates a new instance of Dispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDispatcher(t mockConstructorTestingTNewDispatcher) *Dispatcher { +}) *Dispatcher { mock := &Dispatcher{} mock.Mock.Test(t) diff --git a/mocks/rest/identity/client.go b/mocks/rest/identity/client.go index e3f9898..bbaed87 100644 --- a/mocks/rest/identity/client.go +++ b/mocks/rest/identity/client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockidentity @@ -22,6 +22,10 @@ type Client struct { func (_m *Client) Enroll(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.Response, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Enroll") + } + var r0 *identity.Response var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.Response, *util.RestError)); ok { @@ -50,6 +54,10 @@ func (_m *Client) Enroll(res http.ResponseWriter, req *http.Request, params http func (_m *Client) Get(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.Identity, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Get") + } + var r0 *identity.Identity var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.Identity, *util.RestError)); ok { @@ -78,6 +86,10 @@ func (_m *Client) Get(res http.ResponseWriter, req *http.Request, params httprou func (_m *Client) List(res http.ResponseWriter, req *http.Request, params httprouter.Params) ([]*identity.Identity, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 []*identity.Identity var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) ([]*identity.Identity, *util.RestError)); ok { @@ -106,6 +118,10 @@ func (_m *Client) List(res http.ResponseWriter, req *http.Request, params httpro func (_m *Client) Modify(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RegisterResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Modify") + } + var r0 *identity.RegisterResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RegisterResponse, *util.RestError)); ok { @@ -134,6 +150,10 @@ func (_m *Client) Modify(res http.ResponseWriter, req *http.Request, params http func (_m *Client) Reenroll(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.Response, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Reenroll") + } + var r0 *identity.Response var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.Response, *util.RestError)); ok { @@ -162,6 +182,10 @@ func (_m *Client) Reenroll(res http.ResponseWriter, req *http.Request, params ht func (_m *Client) Register(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RegisterResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Register") + } + var r0 *identity.RegisterResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RegisterResponse, *util.RestError)); ok { @@ -190,6 +214,10 @@ func (_m *Client) Register(res http.ResponseWriter, req *http.Request, params ht func (_m *Client) Revoke(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RevokeResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + var r0 *identity.RevokeResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RevokeResponse, *util.RestError)); ok { @@ -214,13 +242,12 @@ func (_m *Client) Revoke(res http.ResponseWriter, req *http.Request, params http return r0, r1 } -type mockConstructorTestingTNewClient interface { +// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewClient(t mockConstructorTestingTNewClient) *Client { +}) *Client { mock := &Client{} mock.Mock.Test(t) diff --git a/mocks/rest/identity/identity_client.go b/mocks/rest/identity/identity_client.go index 6371baa..44dee88 100644 --- a/mocks/rest/identity/identity_client.go +++ b/mocks/rest/identity/identity_client.go @@ -50,6 +50,10 @@ func (_m *IdentityClient) Enroll(res http.ResponseWriter, req *http.Request, par func (_m *IdentityClient) Get(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.Identity, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Get") + } + var r0 *identity.Identity var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.Identity, *util.RestError)); ok { @@ -78,6 +82,10 @@ func (_m *IdentityClient) Get(res http.ResponseWriter, req *http.Request, params func (_m *IdentityClient) List(res http.ResponseWriter, req *http.Request, params httprouter.Params) ([]*identity.Identity, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 []*identity.Identity var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) ([]*identity.Identity, *util.RestError)); ok { @@ -106,6 +114,10 @@ func (_m *IdentityClient) List(res http.ResponseWriter, req *http.Request, param func (_m *IdentityClient) Modify(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RegisterResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Modify") + } + var r0 *identity.RegisterResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RegisterResponse, *util.RestError)); ok { @@ -162,6 +174,10 @@ func (_m *IdentityClient) Reenroll(res http.ResponseWriter, req *http.Request, p func (_m *IdentityClient) Register(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RegisterResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Register") + } + var r0 *identity.RegisterResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RegisterResponse, *util.RestError)); ok { @@ -190,6 +206,10 @@ func (_m *IdentityClient) Register(res http.ResponseWriter, req *http.Request, p func (_m *IdentityClient) Revoke(res http.ResponseWriter, req *http.Request, params httprouter.Params) (*identity.RevokeResponse, *util.RestError) { ret := _m.Called(res, req, params) + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + var r0 *identity.RevokeResponse var r1 *util.RestError if rf, ok := ret.Get(0).(func(http.ResponseWriter, *http.Request, httprouter.Params) (*identity.RevokeResponse, *util.RestError)); ok { diff --git a/mocks/rest/receipt/api/receipt_store_persistence.go b/mocks/rest/receipt/api/receipt_store_persistence.go index 8c9a585..eeaf138 100644 --- a/mocks/rest/receipt/api/receipt_store_persistence.go +++ b/mocks/rest/receipt/api/receipt_store_persistence.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockreceiptapi @@ -13,6 +13,10 @@ type ReceiptStorePersistence struct { func (_m *ReceiptStorePersistence) AddReceipt(requestID string, receipt *map[string]interface{}) error { ret := _m.Called(requestID, receipt) + if len(ret) == 0 { + panic("no return value specified for AddReceipt") + } + var r0 error if rf, ok := ret.Get(0).(func(string, *map[string]interface{}) error); ok { r0 = rf(requestID, receipt) @@ -32,6 +36,10 @@ func (_m *ReceiptStorePersistence) Close() { func (_m *ReceiptStorePersistence) GetReceipt(requestID string) (*map[string]interface{}, error) { ret := _m.Called(requestID) + if len(ret) == 0 { + panic("no return value specified for GetReceipt") + } + var r0 *map[string]interface{} var r1 error if rf, ok := ret.Get(0).(func(string) (*map[string]interface{}, error)); ok { @@ -58,6 +66,10 @@ func (_m *ReceiptStorePersistence) GetReceipt(requestID string) (*map[string]int func (_m *ReceiptStorePersistence) GetReceipts(skip int, limit int, ids []string, sinceEpochMS int64, from string, to string, start string) (*[]map[string]interface{}, error) { ret := _m.Called(skip, limit, ids, sinceEpochMS, from, to, start) + if len(ret) == 0 { + panic("no return value specified for GetReceipts") + } + var r0 *[]map[string]interface{} var r1 error if rf, ok := ret.Get(0).(func(int, int, []string, int64, string, string, string) (*[]map[string]interface{}, error)); ok { @@ -84,6 +96,10 @@ func (_m *ReceiptStorePersistence) GetReceipts(skip int, limit int, ids []string func (_m *ReceiptStorePersistence) Init() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -98,6 +114,10 @@ func (_m *ReceiptStorePersistence) Init() error { func (_m *ReceiptStorePersistence) ValidateConf() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ValidateConf") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -108,13 +128,12 @@ func (_m *ReceiptStorePersistence) ValidateConf() error { return r0 } -type mockConstructorTestingTNewReceiptStorePersistence interface { +// NewReceiptStorePersistence creates a new instance of ReceiptStorePersistence. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewReceiptStorePersistence(t interface { mock.TestingT Cleanup(func()) -} - -// NewReceiptStorePersistence creates a new instance of ReceiptStorePersistence. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewReceiptStorePersistence(t mockConstructorTestingTNewReceiptStorePersistence) *ReceiptStorePersistence { +}) *ReceiptStorePersistence { mock := &ReceiptStorePersistence{} mock.Mock.Test(t) diff --git a/mocks/rest/receipt/receipt_store.go b/mocks/rest/receipt/receipt_store.go index 685e907..fd266d2 100644 --- a/mocks/rest/receipt/receipt_store.go +++ b/mocks/rest/receipt/receipt_store.go @@ -45,6 +45,10 @@ func (_m *ReceiptStore) Init(_a0 ws.WebSocketChannels, _a1 ...api.ReceiptStorePe _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func(ws.WebSocketChannels, ...api.ReceiptStorePersistence) error); ok { r0 = rf(_a0, _a1...) @@ -64,6 +68,10 @@ func (_m *ReceiptStore) ProcessReceipt(msgBytes []byte) { func (_m *ReceiptStore) ValidateConf() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ValidateConf") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() diff --git a/mocks/rest/receipt/store.go b/mocks/rest/receipt/store.go index d154010..3299264 100644 --- a/mocks/rest/receipt/store.go +++ b/mocks/rest/receipt/store.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockreceipt @@ -45,6 +45,10 @@ func (_m *Store) Init(_a0 ws.WebSocketChannels, _a1 ...api.ReceiptStorePersisten _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Init") + } + var r0 error if rf, ok := ret.Get(0).(func(ws.WebSocketChannels, ...api.ReceiptStorePersistence) error); ok { r0 = rf(_a0, _a1...) @@ -64,6 +68,10 @@ func (_m *Store) ProcessReceipt(msgBytes []byte) { func (_m *Store) ValidateConf() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ValidateConf") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -74,13 +82,12 @@ func (_m *Store) ValidateConf() error { return r0 } -type mockConstructorTestingTNewStore interface { +// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStore(t interface { mock.TestingT Cleanup(func()) -} - -// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewStore(t mockConstructorTestingTNewStore) *Store { +}) *Store { mock := &Store{} mock.Mock.Test(t) diff --git a/mocks/rest/sync/dispatcher.go b/mocks/rest/sync/dispatcher.go index 1bb858d..ce6cfe6 100644 --- a/mocks/rest/sync/dispatcher.go +++ b/mocks/rest/sync/dispatcher.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mocksync @@ -46,13 +46,12 @@ func (_m *Dispatcher) QueryChaincode(res http.ResponseWriter, req *http.Request, _m.Called(res, req, params) } -type mockConstructorTestingTNewDispatcher interface { +// NewDispatcher creates a new instance of Dispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewDispatcher(t interface { mock.TestingT Cleanup(func()) -} - -// NewDispatcher creates a new instance of Dispatcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewDispatcher(t mockConstructorTestingTNewDispatcher) *Dispatcher { +}) *Dispatcher { mock := &Dispatcher{} mock.Mock.Test(t) diff --git a/mocks/tx/processor.go b/mocks/tx/processor.go index 85ff6dc..22d0445 100644 --- a/mocks/tx/processor.go +++ b/mocks/tx/processor.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mocktx @@ -18,6 +18,10 @@ type Processor struct { func (_m *Processor) GetRPCClient() client.RPCClient { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRPCClient") + } + var r0 client.RPCClient if rf, ok := ret.Get(0).(func() client.RPCClient); ok { r0 = rf() @@ -40,13 +44,12 @@ func (_m *Processor) OnMessage(_a0 tx.Context) { _m.Called(_a0) } -type mockConstructorTestingTNewProcessor interface { +// NewProcessor creates a new instance of Processor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewProcessor(t interface { mock.TestingT Cleanup(func()) -} - -// NewProcessor creates a new instance of Processor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewProcessor(t mockConstructorTestingTNewProcessor) *Processor { +}) *Processor { mock := &Processor{} mock.Mock.Test(t) diff --git a/mocks/tx/tx_processor.go b/mocks/tx/tx_processor.go index a921ea9..8af5526 100644 --- a/mocks/tx/tx_processor.go +++ b/mocks/tx/tx_processor.go @@ -18,6 +18,10 @@ type TxProcessor struct { func (_m *TxProcessor) GetRPCClient() client.RPCClient { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRPCClient") + } + var r0 client.RPCClient if rf, ok := ret.Get(0).(func() client.RPCClient); ok { r0 = rf() diff --git a/mocks/ws/web_socket_channels.go b/mocks/ws/web_socket_channels.go index 4efeccd..df396c5 100644 --- a/mocks/ws/web_socket_channels.go +++ b/mocks/ws/web_socket_channels.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockws @@ -13,6 +13,10 @@ type WebSocketChannels struct { func (_m *WebSocketChannels) GetChannels(topic string) (chan<- interface{}, chan<- interface{}, <-chan error, <-chan struct{}) { ret := _m.Called(topic) + if len(ret) == 0 { + panic("no return value specified for GetChannels") + } + var r0 chan<- interface{} var r1 chan<- interface{} var r2 <-chan error @@ -60,13 +64,12 @@ func (_m *WebSocketChannels) SendReply(message interface{}) { _m.Called(message) } -type mockConstructorTestingTNewWebSocketChannels interface { +// NewWebSocketChannels creates a new instance of WebSocketChannels. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewWebSocketChannels(t interface { mock.TestingT Cleanup(func()) -} - -// NewWebSocketChannels creates a new instance of WebSocketChannels. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewWebSocketChannels(t mockConstructorTestingTNewWebSocketChannels) *WebSocketChannels { +}) *WebSocketChannels { mock := &WebSocketChannels{} mock.Mock.Test(t) diff --git a/mocks/ws/web_socket_server.go b/mocks/ws/web_socket_server.go index 2470b4c..c8c6794 100644 --- a/mocks/ws/web_socket_server.go +++ b/mocks/ws/web_socket_server.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.29.0. DO NOT EDIT. +// Code generated by mockery v2.40.2. DO NOT EDIT. package mockws @@ -23,6 +23,10 @@ func (_m *WebSocketServer) Close() { func (_m *WebSocketServer) GetChannels(topic string) (chan<- interface{}, chan<- interface{}, <-chan error, <-chan struct{}) { ret := _m.Called(topic) + if len(ret) == 0 { + panic("no return value specified for GetChannels") + } + var r0 chan<- interface{} var r1 chan<- interface{} var r2 <-chan error @@ -75,13 +79,12 @@ func (_m *WebSocketServer) SendReply(message interface{}) { _m.Called(message) } -type mockConstructorTestingTNewWebSocketServer interface { +// NewWebSocketServer creates a new instance of WebSocketServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewWebSocketServer(t interface { mock.TestingT Cleanup(func()) -} - -// NewWebSocketServer creates a new instance of WebSocketServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewWebSocketServer(t mockConstructorTestingTNewWebSocketServer) *WebSocketServer { +}) *WebSocketServer { mock := &WebSocketServer{} mock.Mock.Test(t) diff --git a/openapi/spec.json b/openapi/spec.json new file mode 100644 index 0000000..e9647a4 --- /dev/null +++ b/openapi/spec.json @@ -0,0 +1,1549 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0", + "title": "API Reference for Hyperledger FireFly FabConnect", + "description": "Hyperledger FireFly FabConnect is a connector that provides a RESTful API to submit requests to Fabric networks and an event stream to listen for Fabric events over websocket or webhook based channels.\n" + }, + "servers": [ + { + "url": "/" + } + ], + "security": [ + { + "basic_auth": [] + } + ], + "paths": { + "/identities": { + "get": { + "summary": "List all signing identities registered with the Fabric CA", + "parameters": [], + "responses": { + "200": { + "description": "Signing identities returned", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/identity_summary" + } + } + } + } + } + } + }, + "post": { + "summary": "Registers a new signing account with the Fabric CA", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_register_input" + } + } + } + }, + "responses": { + "201": { + "description": "Signing identity registered", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_register_output" + } + } + } + } + } + } + }, + "/identities/{username}": { + "get": { + "summary": "Get the signing identity registered with the Fabric CA", + "parameters": [ + { + "$ref": "#/components/parameters/username" + } + ], + "responses": { + "200": { + "description": "Signing identity returned", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity" + } + } + } + } + } + }, + "put": { + "summary": "Modify the existing signing identity", + "parameters": [ + { + "$ref": "#/components/parameters/username" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_register_input" + } + } + } + }, + "responses": { + "201": { + "description": "Signing identity modified", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_modify_output" + } + } + } + } + } + } + }, + "/identities/{username}/enroll": { + "post": { + "summary": "Enroll the registered signing identity with the Fabric CA", + "parameters": [ + { + "$ref": "#/components/parameters/username" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_enroll_input" + } + } + } + }, + "responses": { + "200": { + "description": "Signing identity enrolled", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_enroll_output" + } + } + } + } + } + } + }, + "/identities/{username}/reenroll": { + "post": { + "summary": "Re-enroll the registered signing identity with the Fabric CA", + "parameters": [ + { + "$ref": "#/components/parameters/username" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_reenroll_input" + } + } + } + }, + "responses": { + "200": { + "description": "Signing identity re-enrolled", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_enroll_output" + } + } + } + } + } + } + }, + "/identities/{username}/revoke": { + "post": { + "summary": "Revoke the existing enrollment certificates for the registered signing identity with the Fabric CA", + "parameters": [ + { + "$ref": "#/components/parameters/username" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_revoke_input" + } + } + } + }, + "responses": { + "200": { + "description": "Signing identity certificates revoked", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/identity_revoke_output" + } + } + } + } + } + } + }, + "/chaininfo": { + "get": { + "summary": "Return information of the ledger for a specified channel", + "parameters": [ + { + "$ref": "#/components/parameters/channel" + }, + { + "$ref": "#/components/parameters/signer" + } + ], + "responses": { + "200": { + "description": "Chain info retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/chaininfo" + } + } + } + } + } + } + }, + "/blocks/{blockNumberOrHash}": { + "get": { + "summary": "Query the block by number", + "parameters": [ + { + "$ref": "#/components/parameters/blockNumberOrHash" + }, + { + "$ref": "#/components/parameters/channel" + }, + { + "$ref": "#/components/parameters/signer" + } + ], + "responses": { + "200": { + "description": "Block retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/get_block_output" + } + } + } + } + } + } + }, + "/blockByTxId/{txId}": { + "get": { + "summary": "Query the block by a transaction Id included in the block", + "parameters": [ + { + "$ref": "#/components/parameters/txId" + }, + { + "$ref": "#/components/parameters/channel" + }, + { + "$ref": "#/components/parameters/signer" + } + ], + "responses": { + "200": { + "description": "Block retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/get_block_output" + } + } + } + } + } + } + }, + "/transactions": { + "post": { + "summary": "Send proposal to peers then send the transaction with the endorsements to the orderer", + "parameters": [ + { + "$ref": "#/components/parameters/sync" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/tx_input_unstructured" + }, + { + "$ref": "#/components/schemas/tx_input_structured" + } + ] + } + } + } + }, + "responses": { + "200": { + "description": "Transaction submitted (fly-sync=false) or committed (fly-sync-true)" + } + } + } + }, + "/transactions/{txId}": { + "get": { + "summary": "Query the channel for a transaction by ID (hash)", + "parameters": [ + { + "$ref": "#/components/parameters/txId" + }, + { + "$ref": "#/components/parameters/channel" + }, + { + "$ref": "#/components/parameters/signer" + } + ], + "responses": { + "200": { + "description": "Transaction retrieved", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/get_transaction_output" + } + } + } + } + } + } + }, + "/query": { + "post": { + "summary": "Send query request to the target chaincode", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/query_input_unstructured" + }, + { + "$ref": "#/components/schemas/query_input_structured" + } + ] + } + } + } + }, + "responses": { + "200": { + "description": "Transaction submitted (fly-sync=false) or committed (fly-sync-true)" + } + } + } + }, + "/receipts": { + "get": { + "summary": "Retrieve transaction receipts from the receipts store. Only applicable to transactions submitted with 'fly-sync=false'", + "responses": { + "200": { + "description": "Receipts returned" + } + } + } + }, + "/receipts/{receiptId}": { + "get": { + "summary": "Retrieve transaction receipt by the receipt Id. Only applicable to transactions submitted with 'fly-sync=false'", + "parameters": [ + { + "$ref": "#/components/parameters/receiptId" + } + ], + "responses": { + "200": { + "description": "Receipt returned" + } + } + } + }, + "/eventstreams": { + "get": { + "summary": "List all event streams", + "responses": { + "200": { + "description": "Event streams returned" + } + } + }, + "post": { + "summary": "Create a new event stream", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/eventstream_input" + } + } + } + }, + "responses": { + "200": { + "description": "Event stream created" + } + } + } + }, + "/eventstreams/{eventstreamId}": { + "get": { + "summary": "Get event stream by id", + "parameters": [ + { + "$ref": "#/components/parameters/eventstreamId" + } + ], + "responses": { + "200": { + "description": "Event stream retrieved" + } + } + }, + "delete": { + "summary": "Delete the event stream by id", + "parameters": [ + { + "$ref": "#/components/parameters/eventstreamId" + } + ], + "responses": { + "200": { + "description": "Event stream deleted" + } + } + } + }, + "/subscriptions": { + "get": { + "summary": "List all subscriptions under the specified event stream", + "responses": { + "200": { + "description": "Subscriptions returned" + } + } + }, + "post": { + "summary": "Create a new subscription under the specified event stream", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/subscription_input" + } + } + } + }, + "responses": { + "200": { + "description": "Subscription created" + } + } + } + }, + "/subscriptions/{subscriptionId}": { + "get": { + "summary": "Get subscription by id", + "parameters": [ + { + "$ref": "#/components/parameters/subscriptionId" + } + ], + "responses": { + "200": { + "description": "Subscription retrieved" + } + } + }, + "delete": { + "summary": "Delete the subscription by id", + "parameters": [ + { + "$ref": "#/components/parameters/subscriptionId" + } + ], + "responses": { + "200": { + "description": "Subscription deleted" + } + } + } + } + }, + "components": { + "securitySchemes": { + "basic_auth": { + "type": "http", + "scheme": "basic" + } + }, + "schemas": { + "identity_prop_name": { + "type": "string", + "description": "unique name/id of the signing identity" + }, + "identity_type": { + "type": "string", + "description": "Type of identity. Default is 'client' if not specified in the request", + "default": "client", + "enum": [ + "client", + "peer", + "orderer", + "user" + ] + }, + "identity_maxEnrollments": { + "type": "integer", + "description": "Maximum number of times this identity can be enrolled" + }, + "identity_attributes": { + "type": "object" + }, + "identity_attribute_reqs": { + "type": "object", + "description": "The attributes to include in the certificate. They must have been defined for the identity during registration. If omitted, \"hf.Affiliation\", \"hf.EnrollmentID\", \"hf.Type\" will be added" + }, + "identity_register_input": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/identity_prop_name" + }, + "type": { + "$ref": "#/components/schemas/identity_type" + }, + "maxEnrollments": { + "$ref": "#/components/schemas/identity_maxEnrollments" + }, + "attributes": { + "$ref": "#/components/schemas/identity_attributes" + } + } + }, + "identity_register_output": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/identity_prop_name" + }, + "secret": { + "type": "string" + } + } + }, + "identity_modify_input": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/identity_type" + }, + "maxEnrollments": { + "$ref": "#/components/schemas/identity_maxEnrollments" + }, + "attributes": { + "$ref": "#/components/schemas/identity_attributes" + } + } + }, + "identity_modify_output": { + "type": "object", + "properties": { + "name": { + "$ref": "#/components/schemas/identity_prop_name" + } + } + }, + "identity_enroll_input": { + "type": "object", + "properties": { + "secret": { + "type": "string", + "description": "Must be the enrollment secret returned in the response of the identity registration call" + }, + "attributes": { + "$ref": "#/components/schemas/identity_attribute_reqs" + } + } + }, + "identity_reenroll_input": { + "type": "object", + "properties": { + "attributes": { + "$ref": "#/components/schemas/identity_attribute_reqs" + } + } + }, + "identity_enroll_output": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + } + }, + "identity_revoke_input": { + "type": "object", + "properties": { + "reason": { + "type": "string", + "description": "See https://godoc.org/golang.org/x/crypto/ocsp for valid values. The default value is 0 (ocsp.Unspecified)" + }, + "generateCRL": { + "type": "boolean", + "description": "Whether to generate a CRL and return it in the response" + } + } + }, + "identity_revoke_output": { + "type": "object", + "properties": { + "revokedCerts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "aki": { + "type": "string" + }, + "serial": { + "type": "string" + } + } + } + }, + "CRL": { + "type": "string" + } + } + }, + "identity_summary": { + "allOf": [ + { + "$ref": "#/components/schemas/identity_register_input" + }, + { + "properties": { + "maxEnrollments": { + "type": "integer", + "description": "Maximum number of enrollments allowed for this identity. -1 means no limits" + }, + "affiliation": { + "type": "string" + }, + "caname": { + "type": "string", + "description": "Name of the Certificate Authority used to register the identity. Fabric CA suppors multiple Certificate Authorities. An empty string means the default authority" + } + } + } + ] + }, + "identity": { + "allOf": [ + { + "$ref": "#/components/schemas/identity_summary" + }, + { + "properties": { + "organization": { + "type": "string" + }, + "mspId": { + "type": "string" + }, + "enrollmentCert": { + "type": "string", + "description": "Enrollment certificate for the signing identity. If missing, then the identity was only registered but not enrolled" + }, + "caCert": { + "type": "string", + "description": "Certificate of the issuing CA" + } + } + } + ] + }, + "input_headers": { + "type": "object", + "properties": { + "signer": { + "type": "string", + "description": "Name of the signing identity" + }, + "channel": { + "type": "string", + "description": "Target channel to send the transaction to" + }, + "chaincode": { + "type": "string", + "description": "Name of the chaincode to invoke" + } + } + }, + "tx_input_headers": { + "allOf": [ + { + "properties": { + "type": { + "type": "string", + "enum": [ + "SendTransaction" + ] + } + } + }, + { + "$ref": "#/components/schemas/input_headers" + } + ] + }, + "schema_header": { + "type": "object", + "properties": { + "payloadSchema": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "array" + ] + }, + "prefixItems": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object" + } + ] + } + } + } + } + } + }, + "tx_input_headers_with_schema": { + "allOf": [ + { + "$ref": "#/components/schemas/tx_input_headers" + }, + { + "$ref": "#/components/schemas/schema_header" + } + ] + }, + "tx_input_unstructured": { + "description": "Use a flat list of string arguments for the 'args' property", + "type": "object", + "properties": { + "headers": { + "$ref": "#/components/schemas/tx_input_headers" + }, + "func": { + "type": "string", + "description": "Target function name to invoke" + }, + "args": { + "type": "array", + "items": { + "type": "string", + "description": "Parameters to pass to the chaincode function" + } + }, + "transientMap": { + "type": "object", + "items": { + "type": "string" + } + }, + "init": { + "type": "boolean", + "default": false + } + } + }, + "tx_input_structured": { + "description": "Specify a JSON schema in the headers, so that the 'args' property can be specified as a JSON object", + "type": "object", + "properties": { + "headers": { + "$ref": "#/components/schemas/tx_input_headers_with_schema" + }, + "func": { + "type": "string", + "description": "Target function name to invoke" + }, + "args": { + "type": "object", + "description": "JSON structure for the parameters to pass to the chaincode function" + }, + "init": { + "type": "boolean", + "default": false + } + } + }, + "input_headers_with_schema": { + "allOf": [ + { + "$ref": "#/components/schemas/input_headers" + }, + { + "$ref": "#/components/schemas/schema_header" + } + ] + }, + "query_input_unstructured": { + "description": "Use a flat list of string arguments for the 'args' property", + "type": "object", + "properties": { + "headers": { + "$ref": "#/components/schemas/input_headers" + }, + "func": { + "type": "string", + "description": "Target function name to invoke" + }, + "args": { + "type": "array", + "items": { + "type": "string", + "description": "Parameters to pass to the chaincode function" + } + }, + "strongread": { + "type": "boolean", + "description": "By default only the client organization's first peer is contacted for the query request; set to true to contact multiple peers in the channel" + } + } + }, + "query_input_structured": { + "description": "Specify a JSON schema in the headers, so that the 'args' property can be specified as a JSON object", + "type": "object", + "properties": { + "headers": { + "$ref": "#/components/schemas/input_headers_with_schema" + }, + "func": { + "type": "string", + "description": "Target function name to invoke" + }, + "args": { + "type": "object", + "description": "JSON structure for the parameters to pass to the chaincode function" + }, + "strongread": { + "type": "boolean", + "description": "By default only the client organization's first peer is contacted for the query request; set to true to contact multiple peers in the channel" + } + } + }, + "webhook_info": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "headers": { + "type": "object", + "description": "Use this to specify security headers for authentication with the webhook endpoint" + }, + "tlsSkipHostVerify": { + "type": "boolean", + "description": "Whether to disable server TLS certificate verification" + }, + "requestTimeoutSec": { + "type": "integer", + "description": "Request timeout (seconds)" + } + } + }, + "websocket_info": { + "type": "object", + "properties": { + "topic": { + "type": "string", + "description": "Specify the topic for websocket clients to use in order to listen for events" + }, + "distributionMode": { + "type": "string", + "description": "Specify 'broadcast' to send events to all clients listening on the topic; otherwise only one of the listening clients gets the event", + "default": "", + "enum": [ + "", + "broadcast", + "workloadDistribution" + ] + } + } + }, + "eventstream_input": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "websocket", + "webhook" + ], + "default": "websocket" + }, + "websocket": { + "oneOf": [ + { + "$ref": "#/components/schemas/websocket_info" + }, + { + "$ref": "#/components/schemas/webhook_info" + } + ] + }, + "suspended": { + "type": "boolean", + "default": false, + "description": "if set to 'true', the stream will be suspended" + }, + "batchSize": { + "type": "integer", + "default": 1, + "description": "how many events should be packed in each event batch to deliver to the client. Range is 1-1000" + }, + "batchTimeoutMS": { + "type": "integer", + "default": 5000, + "description": "if there are pending events to deliver, but the batch size has not been reached, this is the maximum amount of milliseconds to wait before delivering the current batch" + }, + "errorHandling": { + "type": "string", + "description": "when the delivery should be blocked when the event listener client failed to take delivery, or skip and continue", + "enum": [ + "block", + "skip" + ], + "default": "skip" + }, + "retryTimeoutSec": { + "type": "integer", + "description": "total amount of time (in seconds) to retry a failed event delivery" + }, + "blockedRetryDelaySec": { + "type": "integer", + "description": "amount of time (in seconds) to wait before retrying a failed delivery" + }, + "timestamps": { + "type": "boolean", + "default": false, + "description": "Chaincode events from Fabric do not contain timestamps. If set to 'true', FabConnect to make a call to Fabric to download the block to obtain the timestamp, and set on the event. Note doing this incurs time overhead in events processing" + }, + "timestampCacheSize": { + "type": "integer", + "default": 1000, + "description": "The size of the internal cache for the blocknumber <-> timestamp map" + } + } + }, + "subscription_input": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "stream": { + "type": "string", + "description": "The id of the event stream the subscription belongs to" + }, + "channel": { + "type": "string" + }, + "signer": { + "type": "string" + }, + "fromBlock": { + "type": "string", + "description": "The block number to subscribe from, ignoring any blocks earlier. If left empty, the subscription will be on the newest block" + }, + "payloadType": { + "type": "string", + "default": "string", + "enum": [ + "json", + "string" + ] + }, + "filter": { + "type": "object", + "properties": { + "blockType": { + "type": "string", + "description": "Specify 'tx' for endorser blocks; specify 'config' for config or config update blocks", + "default": "tx", + "enum": [ + "tx", + "config" + ] + }, + "chaincodeId": { + "type": "string", + "default": "", + "description": "Optionally specify a particular chaincode name to subscribe to" + }, + "eventFilter": { + "type": "string", + "default": "", + "description": "Optionally specify a regular expression for the event names" + } + } + } + } + }, + "chaininfo": { + "type": "object", + "properties": { + "height": { + "type": "integer" + }, + "current_block_hash": { + "type": "string", + "description": "hexidecimal string for the hash of the current block" + }, + "previous_block_hash": { + "type": "string", + "description": "hexidecimal string for the hash of the previous block" + } + } + }, + "get_transaction_output": { + "type": "object", + "properties": { + "raw": { + "$ref": "#/components/schemas/raw_transaction" + }, + "transaction": { + "$ref": "#/components/schemas/transaction" + } + } + }, + "raw_transaction": { + "type": "object", + "description": "The transaction object defined by Fabric protobuf type `common.Envelope`", + "properties": { + "payload": { + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/payload_action" + } + } + } + }, + "header": { + "type": "object", + "properties": { + "channel_header": { + "type": "object", + "properties": { + "channel_id": { + "type": "string" + }, + "epoch": { + "type": "string" + }, + "timestamp": { + "type": "integer", + "description": "unix nano time for when the transaction was submitted" + }, + "tx_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "version": { + "type": "integer" + } + } + }, + "signature_header": { + "$ref": "#/components/schemas/signature_header" + } + } + } + } + }, + "siganture": { + "type": "string", + "description": "base64 encoded signature bytes" + } + } + }, + "payload_action": { + "type": "object", + "properties": { + "header": { + "$ref": "#/components/schemas/signature_header" + }, + "payload": { + "type": "object", + "properties": { + "action": { + "type": "object", + "properties": { + "proposal_response_payload": { + "type": "object", + "properties": { + "extension": { + "type": "object", + "properties": { + "chaincode_id": { + "$ref": "#/components/schemas/chaincode_id" + }, + "events": { + "type": "object", + "properties": { + "chaincodeId": { + "type": "string" + }, + "transactionId": { + "type": "string" + }, + "timestamp": { + "type": "string", + "description": "unix nano of the time when the transaction was submitted" + }, + "eventName": { + "type": "string" + }, + "payload": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object" + }, + { + "type": "array" + } + ] + } + } + } + } + }, + "proposal_hash": { + "type": "string", + "description": "base64 encoded bytes for the proposal's hash" + } + } + } + } + }, + "chaincode_proposal_payload": { + "type": "object", + "properties": { + "TransientMap": { + "type": "object" + }, + "input": { + "type": "object", + "properties": { + "chaincode_spec": { + "type": "object", + "properties": { + "chaincode_id": { + "$ref": "#/components/schemas/chaincode_id" + }, + "input": { + "$ref": "#/components/schemas/chaincode_input" + } + } + } + } + } + } + } + } + } + } + }, + "chaincode_input": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_init": { + "type": "boolean" + } + } + }, + "signature_header": { + "type": "object", + "properties": { + "creator": { + "type": "object", + "properties": { + "mspid": { + "type": "string" + }, + "id_bytes": { + "type": "string", + "description": "base64 encoded bytes for the signer's enrollment certificate" + } + } + }, + "nonce": { + "type": "string", + "description": "base64 encoded bytes for the transaction nonce" + } + } + }, + "creator": { + "type": "object", + "properties": { + "msp_id": { + "type": "string" + }, + "cert": { + "type": "string" + } + } + }, + "chaincode_id": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "transaction": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "tx_id": { + "type": "string" + }, + "nonce": { + "type": "string", + "description": "hexidecimal encoded bytes for the transaction nonce" + }, + "creator": { + "$ref": "#/components/schemas/creator" + }, + "status": { + "type": "string" + }, + "signature": { + "type": "string", + "description": "base64 encoded bytes for the transaction signature" + }, + "timestamp": { + "type": "integer", + "description": "unix nano time for when the transaction was submitted" + }, + "actions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/transaction_action" + } + } + } + }, + "transaction_action": { + "type": "object", + "properties": { + "nonce": { + "type": "string", + "description": "hexidecimal encoded bytes for the transaction action's nonce" + }, + "creator": { + "$ref": "#/components/schemas/creator" + }, + "transient_map": { + "type": "object" + }, + "chaincode_id": { + "$ref": "#/components/schemas/chaincode_id" + }, + "input": { + "$ref": "#/components/schemas/chaincode_input" + }, + "proposal_hash": { + "type": "string", + "description": "hexidecimal encoded bytes of the proposal's hash" + }, + "event": { + "type": "object", + "properties": { + "chaincodeId": { + "type": "string" + }, + "transactionId": { + "type": "string" + }, + "timestamp": { + "type": "string" + }, + "eventName": { + "type": "string" + }, + "payload": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object" + }, + { + "type": "array" + } + ] + } + } + } + } + }, + "config": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "timestamp": { + "type": "integer" + }, + "nonce": { + "type": "string" + }, + "creator": { + "$ref": "#/components/schemas/creator" + }, + "config": { + "type": "object", + "description": "the object defined by the Fabric protobuf type `common.Config`" + } + } + }, + "get_block_output": { + "type": "object", + "properties": { + "block": { + "type": "object", + "description": "the optimized data structure for the retrieved block", + "properties": { + "block_numer": { + "type": "integer" + }, + "data_hash": { + "type": "string", + "description": "base64 encoded bytes of the hash of the block content" + }, + "previous_hash": { + "type": "string", + "description": "base64 encoded bytes of the hash of the previous block" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/transaction" + } + }, + "config": { + "$ref": "#/components/schemas/config" + } + } + }, + "raw": { + "type": "object", + "description": "the raw data structure defined by Fabric protobuf type `common.Block`", + "properties": { + "data": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/raw_transaction" + } + } + } + }, + "header": { + "type": "object", + "properties": { + "number": { + "type": "integer" + }, + "data_hash": { + "type": "string", + "description": "base64 encoded bytes of the hash of the block content" + }, + "previous_hash": { + "type": "string", + "description": "base64 encoded bytes of the hash of the previous block" + } + } + }, + "metadata": { + "type": "object", + "properties": { + "metadata": { + "description": "metadata about the block content, details see Fabric protobuf type `common.BlockMetadataIndex`", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "parameters": { + "username": { + "required": true, + "name": "username", + "in": "path", + "schema": { + "type": "string" + } + }, + "txId": { + "required": true, + "name": "txId", + "in": "path", + "schema": { + "type": "string" + } + }, + "receiptId": { + "required": true, + "name": "receiptId", + "in": "path", + "schema": { + "type": "string" + } + }, + "eventstreamId": { + "required": true, + "name": "eventstreamId", + "in": "path", + "schema": { + "type": "string" + } + }, + "subscriptionId": { + "required": true, + "name": "subscriptionId", + "in": "path", + "schema": { + "type": "string" + } + }, + "sync": { + "name": "fly-sync", + "in": "query", + "schema": { + "type": "boolean" + } + }, + "channel": { + "name": "fly-channel", + "in": "query", + "schema": { + "type": "string" + } + }, + "signer": { + "name": "fly-signer", + "in": "query", + "schema": { + "type": "string" + } + }, + "blockNumberOrHash": { + "description": "block number or block hash", + "required": true, + "name": "blockNumberOrHash", + "in": "path", + "schema": { + "type": "string" + } + } + } + } +}