From f6479ae22d3ce409a9a4a07cf2c2f71e71fb9290 Mon Sep 17 00:00:00 2001 From: a <a@a.a> Date: Sat, 17 Sep 2022 21:47:04 -0500 Subject: [PATCH] wip --- go.mod | 23 + go.sum | 661 +++++- openrpc/generate/generate.go | 261 +++ openrpc/generate/generate_test.go | 83 + openrpc/generate/test.gotmpl | 14 + openrpc/generate/test.json | 77 + openrpc/main.go | 86 + openrpc/main_test.go | 53 + openrpc/parse/parse.go | 121 ++ openrpc/parse/parse_test.go | 73 + openrpc/parse/testdata/eth_openrpc.json | 1864 +++++++++++++++++ .../testdata/execution-api/debug/getters.yaml | 57 + .../testdata/execution-api/engine/README.md | 7 + .../execution-api/engine/authentication.md | 54 + .../execution-api/engine/specification.md | 398 ++++ .../testdata/execution-api/eth/block.yaml | 72 + .../testdata/execution-api/eth/client.yaml | 38 + .../testdata/execution-api/eth/execute.yaml | 56 + .../execution-api/eth/fee_market.yaml | 74 + .../testdata/execution-api/eth/filter.yaml | 64 + .../testdata/execution-api/eth/mining.yaml | 64 + .../testdata/execution-api/eth/sign.yaml | 26 + .../testdata/execution-api/eth/state.yaml | 86 + .../testdata/execution-api/eth/submit.yaml | 22 + .../execution-api/eth/transaction.yaml | 51 + .../execution-api/schemas/base-types.yaml | 49 + .../testdata/execution-api/schemas/block.yaml | 125 ++ .../execution-api/schemas/client.yaml | 18 + .../execution-api/schemas/filter.yaml | 51 + .../execution-api/schemas/receipt.yaml | 104 + .../testdata/execution-api/schemas/state.yaml | 56 + .../execution-api/schemas/transaction.yaml | 289 +++ openrpc/templates/cli.gotmpl | 10 + openrpc/templates/cli_cmd.gotmpl | 300 +++ openrpc/templates/example-proxy-server.gotmpl | 163 ++ openrpc/templates/server.gotmpl | 293 +++ openrpc/templates/types.gotmpl | 37 + openrpc/types/objects.go | 78 + openrpc/types/types.go | 265 +++ openrpc/util/common.go | 54 + 40 files changed, 6272 insertions(+), 5 deletions(-) create mode 100644 openrpc/generate/generate.go create mode 100644 openrpc/generate/generate_test.go create mode 100644 openrpc/generate/test.gotmpl create mode 100644 openrpc/generate/test.json create mode 100644 openrpc/main.go create mode 100644 openrpc/main_test.go create mode 100644 openrpc/parse/parse.go create mode 100644 openrpc/parse/parse_test.go create mode 100644 openrpc/parse/testdata/eth_openrpc.json create mode 100644 openrpc/parse/testdata/execution-api/debug/getters.yaml create mode 100644 openrpc/parse/testdata/execution-api/engine/README.md create mode 100644 openrpc/parse/testdata/execution-api/engine/authentication.md create mode 100644 openrpc/parse/testdata/execution-api/engine/specification.md create mode 100644 openrpc/parse/testdata/execution-api/eth/block.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/client.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/execute.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/fee_market.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/filter.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/mining.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/sign.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/state.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/submit.yaml create mode 100644 openrpc/parse/testdata/execution-api/eth/transaction.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/base-types.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/block.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/client.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/filter.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/receipt.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/state.yaml create mode 100644 openrpc/parse/testdata/execution-api/schemas/transaction.yaml create mode 100644 openrpc/templates/cli.gotmpl create mode 100644 openrpc/templates/cli_cmd.gotmpl create mode 100644 openrpc/templates/example-proxy-server.gotmpl create mode 100644 openrpc/templates/server.gotmpl create mode 100644 openrpc/templates/types.gotmpl create mode 100644 openrpc/types/objects.go create mode 100644 openrpc/types/types.go create mode 100644 openrpc/util/common.go diff --git a/go.mod b/go.mod index 8c3f221..fc2519f 100644 --- a/go.mod +++ b/go.mod @@ -8,24 +8,47 @@ require ( github.com/davecgh/go-spew v1.1.1 github.com/deckarep/golang-set v1.8.0 github.com/ethereum/go-ethereum v1.10.22 + github.com/go-openapi/spec v0.20.7 + github.com/gobuffalo/packr/v2 v2.8.3 + github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487 + github.com/imdario/mergo v0.3.13 github.com/json-iterator/go v1.1.12 + github.com/test-go/testify v1.1.4 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce nhooyr.io/websocket v1.8.7 + sigs.k8s.io/yaml v1.3.0 ) require ( github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/swag v0.19.15 // indirect github.com/go-stack/stack v1.8.0 // indirect + github.com/gobuffalo/logger v1.0.6 // indirect + github.com/gobuffalo/packd v1.0.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/karrick/godirwalk v1.16.1 // indirect github.com/klauspost/compress v1.10.3 // indirect + github.com/mailru/easyjson v0.7.6 // indirect + github.com/markbates/errx v1.1.0 // indirect + github.com/markbates/oncer v1.0.0 // indirect + github.com/markbates/safe v1.0.1 // indirect github.com/mattn/go-colorable v0.1.12 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect + github.com/sirupsen/logrus v1.8.1 // indirect + github.com/stretchr/testify v1.7.2 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0fea36f..0e23b8c 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,117 @@ -gfx.cafe/util/go/bufpool v0.0.0-20220917112702-95618babdf53 h1:j45c1YN77NyWrO0dN+e7lKJctXpC5TlVZWmww/PpFA0= -gfx.cafe/util/go/bufpool v0.0.0-20220917112702-95618babdf53/go.mod h1:+DiyiCOBGS9O9Ce4ewHQO3Y59h66WSWAbgZZ2O2AYYw= -gfx.cafe/util/go/bufpool v0.0.0-20220917125029-50ae27cc8dc2 h1:QbQ1cIU+XqtD5Fo0avKioxelXXGLHI+ucHysfc0XHks= -gfx.cafe/util/go/bufpool v0.0.0-20220917125029-50ae27cc8dc2/go.mod h1:+DiyiCOBGS9O9Ce4ewHQO3Y59h66WSWAbgZZ2O2AYYw= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= +cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= +cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= +cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= +cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gfx.cafe/util/go/bufpool v0.0.0-20220917152604-80373e5a2c51 h1:YrqWNVHgEyeSckO+5MxYBKcqGZYI2Imx40QhCrIDZCw= gfx.cafe/util/go/bufpool v0.0.0-20220917152604-80373e5a2c51/go.mod h1:+DiyiCOBGS9O9Ce4ewHQO3Y59h66WSWAbgZZ2O2AYYw= git.tuxpa.in/a/zlog v1.32.0 h1:KKXbRF1x8kJDSzUoGz/pivo+4TVY6xT5sVtdFZ6traY= git.tuxpa.in/a/zlog v1.32.0/go.mod h1:vUa2Qhu6DLPLqmfRy99FiPqaY2eb6/KQjtMekW3UNnA= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.10.22 h1:HbEgsDo1YTGIf4KB/NNpn+XH+PiNJXUZ9ksRxiqWyMc= github.com/ethereum/go-ethereum v1.10.22/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= +github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI= +github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -31,6 +121,16 @@ github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1 github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/logger v1.0.6 h1:nnZNpxYo0zx+Aj9RfMPBm+x9zAU2OayFh/xrAWi34HU= +github.com/gobuffalo/logger v1.0.6/go.mod h1:J31TBEHR1QLV2683OXTAItYIg8pv2JMHnF/quuAbMjs= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packd v1.0.1 h1:U2wXfRr4E9DH8IdsDLlRFwTZTK7hLfq9qT/QHXGVe/0= +github.com/gobuffalo/packd v1.0.1/go.mod h1:PP2POP3p3RXGz7Jh6eYEf93S7vA2za6xM7QT85L4+VY= +github.com/gobuffalo/packr/v2 v2.6.0/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08= +github.com/gobuffalo/packr/v2 v2.8.3 h1:xE1yzvnO56cUC0sTpKR3DIbxZgB54AftTFMhB2XEWlY= +github.com/gobuffalo/packr/v2 v2.8.3/go.mod h1:0SahksCVcx4IMnigTjiFuyldmTrdTctXsOdiU5KwbKc= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -38,70 +138,621 @@ github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487 h1:NyaWOSkqFK1d9o+HLfnMIGzrHuUUPeBNIZyi5Zoe/lY= +github.com/gregdhill/go-openrpc v0.0.0-20220114144539-ae6f44720487/go.mod h1:a1eRkbhd3DYpRH2lnuUsVG+QMTI+v0hGnsis8C9hMrA= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw= +github.com/karrick/godirwalk v1.16.1/go.mod h1:j4mkqPuvaLI8mp1DroR3P6ad7cyYd4c1qeJ3RV7ULlk= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/errx v1.1.0 h1:QDFeR+UP95dO12JgW+tgi2UVfo0V8YBHiUIOaeBPiEI= +github.com/markbates/errx v1.1.0/go.mod h1:PLa46Oex9KNbVDZhKel8v1OT7hD5JZ2eI7AHhA0wswc= +github.com/markbates/oncer v1.0.0 h1:E83IaVAHygyndzPimgUYJjbshhDTALZyXxvk9FOlQRY= +github.com/markbates/oncer v1.0.0/go.mod h1:Z59JA581E9GP6w96jai+TGqafHPW+cPfRxz2aSZ0mcI= +github.com/markbates/safe v1.0.1 h1:yjZkbvRM6IzKj9tlu/zMJLS0n/V351OZWRnF3QfaUxI= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE= +github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/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.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= +go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= +go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/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.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/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-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/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-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/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-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +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= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= +google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= +google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= +google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= +google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= +google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/openrpc/generate/generate.go b/openrpc/generate/generate.go new file mode 100644 index 0000000..58f3284 --- /dev/null +++ b/openrpc/generate/generate.go @@ -0,0 +1,261 @@ +package generate + +import ( + "bytes" + "encoding/json" + "fmt" + "go/ast" + "go/parser" + "go/printer" + "go/token" + "os" + "path" + "path/filepath" + "regexp" + "strings" + "text/template" + + "gfx.cafe/open/jrpc/openrpc/types" + "gfx.cafe/open/jrpc/openrpc/util" + "github.com/go-openapi/spec" + "github.com/gobuffalo/packr/v2" + "github.com/imdario/mergo" +) + +const ( + params = "Params" + result = "Result" + goExt = "go" + goTmplExt = goExt + "tmpl" +) + +var ProgramName = "CHANGME" + +func schemaAsJSONPretty(s spec.Schema) string { + b, err := json.MarshalIndent(s, "", " ") + if err != nil { + return "" + } + b = bytes.ReplaceAll(b, []byte("{"), []byte("")) + b = bytes.ReplaceAll(b, []byte("}"), []byte("")) + b = bytes.ReplaceAll(b, []byte(`"`), []byte("")) + b = bytes.ReplaceAll(b, []byte(`$ref: #`), []byte("")) + + // Remove empty JSON $refs + reg := regexp.MustCompile(`^\s*\$ref.*$/mg`) + ss := reg.ReplaceAllString(string(b), "") + + return ss +} + +func maybeLookupComponentsContentDescriptor(cmpnts *types.Components, cd *types.ContentDescriptor) (rootCD *types.ContentDescriptor, err error) { + rootCD = cd + if cd == nil || cmpnts == nil { + return + } + if strings.Contains(cd.Schema.Ref.String(), "contentDescriptors") { + r := filepath.Base(cd.Schema.Ref.String()) + rootCD = cmpnts.ContentDescriptors[r] + return + } + return +} + +func schemaHazRef(sch spec.Schema) bool { + return sch.Ref.String() != "" +} + +func derefSchemaRecurse(cts *types.Components, sch spec.Schema) spec.Schema { + if schemaHazRef(sch) { + sch = getSchemaFromRef(cts, sch.Ref) + sch = derefSchemaRecurse(cts, sch) + } + for i := range sch.OneOf { + got := derefSchemaRecurse(cts, sch.OneOf[i]) + if err := mergo.Merge(&got, sch.OneOf[i]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.OneOf[i] = got + } + for i := range sch.AnyOf { + got := derefSchemaRecurse(cts, sch.AnyOf[i]) + if err := mergo.Merge(&got, sch.AnyOf[i]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.AnyOf[i] = got + } + for i := range sch.AllOf { + got := derefSchemaRecurse(cts, sch.AllOf[i]) + if err := mergo.Merge(&got, sch.AllOf[i]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.AllOf[i] = got + } + for k, _ := range sch.Properties { + got := derefSchemaRecurse(cts, sch.Properties[k]) + if err := mergo.Merge(&got, sch.Properties[k]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.Properties[k] = got + } + for k, _ := range sch.PatternProperties { + got := derefSchemaRecurse(cts, sch.PatternProperties[k]) + if err := mergo.Merge(&got, sch.PatternProperties[k]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.PatternProperties[k] = got + } + if sch.Items == nil { + return sch + } + if sch.Items.Len() > 1 { + for i := range sch.Items.Schemas { + got := derefSchemaRecurse(cts, sch.Items.Schemas[i]) + if err := mergo.Merge(&got, sch.Items.Schemas[i]); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.Items.Schemas[i] = got + } + } else { + // Is schema + got := derefSchemaRecurse(cts, *sch.Items.Schema) + if err := mergo.Merge(&got, sch.Items.Schema); err != nil { + panic(err.Error()) + } + got.Schema = "" + sch.Items.Schema = &got + } + + return sch +} + +func getSchemaFromRef(cmpnts *types.Components, ref spec.Ref) (sch spec.Schema) { + if cmpnts == nil || ref.String() == "" { + return + } + r := filepath.Base(ref.String()) + sch = cmpnts.Schemas[r] // Trust parser + return +} + +func maybeMethodParams(method types.Method) string { + if len(method.Params) > 0 { + return fmt.Sprintf("%s%s", util.CamelCase(method.Name), params) + } + return "" +} + +func maybeMethodResult(method types.Method) string { + if method.Result != nil { + return fmt.Sprintf("%s%s", util.CamelCase(method.Name), result) + } + return "" +} + +func maybeMethodComment(method types.Method) string { + if comment := util.FirstOf(method.Description, method.Summary); comment != "" { + return fmt.Sprintf("// %s", comment) + } + return "" +} + +func maybeFieldComment(desc string) string { + if desc != "" { + return fmt.Sprintf("// %s", desc) + } + return "" +} + +func getProgramName() string { + return ProgramName +} + +type object struct { + Name string + Fields *types.FieldMap +} + +func funcMap(openrpc *types.OpenRPCSpec1) template.FuncMap { + return template.FuncMap{ + "programName": getProgramName, + "derefSchema": derefSchemaRecurse, + "schemaHasRef": schemaHazRef, + "schemaAsJSONPretty": schemaAsJSONPretty, + "lookupContentDescriptor": maybeLookupComponentsContentDescriptor, + "sanitizeBackticks": util.SanitizeBackticks, + "inspect": util.Inpect, + "slice": util.Slice, + "camelCase": util.CamelCase, + "lowerFirst": util.LowerFirst, + "maybeMethodComment": maybeMethodComment, + "maybeMethodParams": maybeMethodParams, + "maybeMethodResult": maybeMethodResult, + "maybeFieldComment": maybeFieldComment, + "getObjects": func(om *types.ObjectMap) []object { + keys := om.GetKeys() + objects := make([]object, 0, len(keys)) + for _, k := range keys { + objects = append(objects, object{k, om.Get(k)}) + } + return objects + }, + "getFields": func(fm *types.FieldMap) []types.BasicType { + keys := fm.GetKeys() + fields := make([]types.BasicType, 0, len(keys)) + for _, k := range keys { + fields = append(fields, fm.Get(k)) + } + return fields + }, + "indent": func(spaces int, v string) string { + pad := strings.Repeat(" ", spaces) + return pad + strings.Replace(v, "\n", "\n"+pad, -1) + }, + } +} + +func WriteFile(box *packr.Box, name, pkg string, openrpc *types.OpenRPCSpec1) error { + data, err := box.Find(fmt.Sprintf("%s.%s", name, goTmplExt)) + if err != nil { + return err + } + + tmp, err := template.New(name).Funcs(funcMap(openrpc)).Parse(string(data)) + if err != nil { + return err + } + + tmpl := new(bytes.Buffer) + err = tmp.Execute(tmpl, openrpc) + if err != nil { + return err + } + + fset := new(token.FileSet) + root, err := parser.ParseFile(fset, "", tmpl.Bytes(), parser.ParseComments) + if err != nil { + return err + } + ast.SortImports(fset, root) + cfg := printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8} + + root.Name.Name = path.Base(pkg) + + err = os.MkdirAll(pkg, os.ModePerm) + if err != nil { + return err + } + file, err := os.OpenFile(path.Join(pkg, fmt.Sprintf("%s.%s", name, goExt)), os.O_RDWR|os.O_CREATE, 0644) + if err != nil { + return err + } + defer file.Close() + + return cfg.Fprint(file, fset, root) +} diff --git a/openrpc/generate/generate_test.go b/openrpc/generate/generate_test.go new file mode 100644 index 0000000..1e4fa2f --- /dev/null +++ b/openrpc/generate/generate_test.go @@ -0,0 +1,83 @@ +package generate + +import ( + "bytes" + "encoding/json" + "io/ioutil" + "testing" + "text/template" + + "github.com/gregdhill/go-openrpc/parse" + "github.com/gregdhill/go-openrpc/types" + "github.com/test-go/testify/require" +) + +var exp = `package generate +type ServiceMethodParams struct { +// this is a desc +Param1 string +// this is a desc +Param2 string + +Param3 string +// this is an object +Param4 +} +type Param4 struct { +// this is a foo +Foo string +// this is a bar +Bar string +} +type ServiceMethodResult struct { +// the requested data +Data string +} +` + +func tmpl(t *testing.T) string { + data, err := ioutil.ReadFile("test.json") + require.NoError(t, err) + + spec := types.NewOpenRPCSpec1() + err = json.Unmarshal(data, spec) + require.NoError(t, err) + + parse.GetTypes(spec, spec.Objects) + + data, err = ioutil.ReadFile("test.gotmpl") + require.NoError(t, err) + tmp, err := template.New("server").Funcs(funcMap(spec)).Parse(string(data)) + require.NoError(t, err) + + buf := new(bytes.Buffer) + err = tmp.Execute(buf, spec) + require.NoError(t, err) + + return buf.String() +} + +func TestGenerate(t *testing.T) { + + t.Run("Should be same at least once, in a while", func(t *testing.T) { + require.Equal(t, exp, tmpl(t)) + }) + + t.Skip("isaac gets fail here") + t.Run("Should be deterministic", func(t *testing.T) { + for i := 0; i < 20; i++ { + got := tmpl(t) + if exp == got { + t.Log("same same") + continue + } + t.Log("but different") + require.Equal(t, exp, got) + } + }) +} + +func TestMaybeComment(t *testing.T) { + require.Equal(t, "", maybeFieldComment("")) + require.Equal(t, "// hello, world", maybeFieldComment("hello, world")) +} diff --git a/openrpc/generate/test.gotmpl b/openrpc/generate/test.gotmpl new file mode 100644 index 0000000..c33ffeb --- /dev/null +++ b/openrpc/generate/test.gotmpl @@ -0,0 +1,14 @@ +package generate + +{{- range (getObjects .Objects) }} +{{ printf "type %s struct {" .Name }} +{{- range (getFields .Fields) }} +{{ maybeFieldComment .Desc }} +{{- if (eq .Name .Type) }} +{{ printf "%s" .Name }} +{{- else }} +{{ printf "%s %s" .Name .Type }} +{{- end }} +{{- end }} +{{ printf "}" }} +{{- end }} diff --git a/openrpc/generate/test.json b/openrpc/generate/test.json new file mode 100644 index 0000000..bcc79ac --- /dev/null +++ b/openrpc/generate/test.json @@ -0,0 +1,77 @@ +{ + "openrpc": "1.0.0", + "info": { + "version": "1.0.0", + "title": "JSON-RPC", + "description": "This is a test OpenRPC spec" + }, + "methods": [ + { + "name": "service_method", + "description": "returns the method of this service", + "summary": "current service", + "params": [ + { + "name": "param1", + "description": "this is a desc", + "schema": { + "title": "param1", + "type": "string", + "pattern": "^0x[a-fA-F\\d]+$" + } + }, + { + "name": "param2", + "description": "this is a desc", + "schema": { + "$ref": "#/components/schemas/Param2" + } + }, + { + "$ref": "#/components/schemas/Param3" + }, + { + "name": "param4", + "description": "this is a desc", + "schema": { + "type": "object", + "title": "param4", + "description": "this is an object", + "properties": { + "foo": { + "description": "this is a foo", + "title": "foo", + "type": "string" + }, + "bar": { + "description": "this is a bar", + "title": "bar", + "type": "string" + } + } + } + } + ], + "result": { + "name": "data", + "description": "the requested data", + "schema": { + "title": "data", + "type": "string" + } + } + } + ], + "components": { + "schemas": { + "Param2": { + "title": "param2", + "type": "string" + }, + "Param3": { + "title": "param3", + "type": "string" + } + } + } + } diff --git a/openrpc/main.go b/openrpc/main.go new file mode 100644 index 0000000..c796afd --- /dev/null +++ b/openrpc/main.go @@ -0,0 +1,86 @@ +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io/ioutil" + "os" + + "gfx.cafe/open/jrpc/openrpc/generate" + "gfx.cafe/open/jrpc/openrpc/parse" + "gfx.cafe/open/jrpc/openrpc/types" + "github.com/gobuffalo/packr/v2" +) + +var ( + pkgDir string + specFile string + cliGen bool + cliCommandName string +) + +func init() { + flag.StringVar(&pkgDir, "dir", "rpc", "set the target directory") + flag.StringVar(&specFile, "spec", "", "the openrpc compliant spec") + flag.StringVar(&cliCommandName, "cli.name", "CHANGEME", "With -cli, names binary program. Default is FIXME.") + flag.BoolVar(&cliGen, "cli", false, "Toggle CLI program generation") +} + +func readSpec(file string) (*types.OpenRPCSpec1, error) { + data, err := ioutil.ReadFile(file) + if err != nil { + return nil, err + } + + spec := types.NewOpenRPCSpec1() + err = json.Unmarshal(data, spec) + if err != nil { + return nil, err + } + + return spec, nil +} + +func run() error { + flag.Parse() + if specFile == "" { + return fmt.Errorf("spec file is required") + } + + openrpc, err := readSpec(specFile) + if err != nil { + return err + } + + parse.GetTypes(openrpc, openrpc.Objects) + box := packr.New("template", "./templates") + + if err = generate.WriteFile(box, "server", pkgDir, openrpc); err != nil { + return err + } + + if err = generate.WriteFile(box, "types", pkgDir, openrpc); err != nil { + return err + } + + if cliGen { + generate.ProgramName = cliCommandName + if err = generate.WriteFile(box, "cli", "main", openrpc); err != nil { + return err + } + + if err = generate.WriteFile(box, "cli_cmd", "cmd", openrpc); err != nil { + return err + } + } + + return nil +} + +func main() { + if err := run(); err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } +} diff --git a/openrpc/main_test.go b/openrpc/main_test.go new file mode 100644 index 0000000..691a316 --- /dev/null +++ b/openrpc/main_test.go @@ -0,0 +1,53 @@ +package main + +import ( + "os" + "testing" + + packr "github.com/gobuffalo/packr/v2" + "github.com/gregdhill/go-openrpc/generate" + "github.com/gregdhill/go-openrpc/parse" +) + +func generateExampleProxyServer() error { + specFile := "parse/testdata/eth_openrpc.json" + pkgDir := "rpc" + + openrpc, err := readSpec(specFile) + if err != nil { + return err + } + + parse.GetTypes(openrpc, openrpc.Objects) + box := packr.New("template", "./templates") + + if err = generate.WriteFile(box, "server", pkgDir, openrpc); err != nil { + return err + } + + if err = generate.WriteFile(box, "types", pkgDir, openrpc); err != nil { + return err + } + if err = generate.WriteFile(box, "example-proxy-server", "main", openrpc); err != nil { + return err + } else { + // HACK + if err := os.MkdirAll("example/", os.ModePerm); err != nil { + return err + } + if err := os.Rename("main/example-proxy-server.go", "example/example-proxy-server.go"); err != nil { + return err + } + if err := os.RemoveAll("main/"); err != nil { + return err + } + } + return nil +} + +func TestExampleProxyServer(t *testing.T) { + err := generateExampleProxyServer() + if err != nil { + t.Fatal(err) + } +} diff --git a/openrpc/parse/parse.go b/openrpc/parse/parse.go new file mode 100644 index 0000000..2152aa2 --- /dev/null +++ b/openrpc/parse/parse.go @@ -0,0 +1,121 @@ +package parse + +import ( + "fmt" + "path" + "reflect" + + "gfx.cafe/open/jrpc/openrpc/types" + "gfx.cafe/open/jrpc/openrpc/util" + "github.com/go-openapi/spec" +) + +const ( + params = "Params" + result = "Result" +) + +func persistTitleAndDesc(prev, next spec.Schema) spec.Schema { + next.Title = util.FirstOf(next.Title, prev.Title) + next.Description = util.FirstOf(next.Description, prev.Description) + return next +} + +func persistFields(prev, next spec.Schema) spec.Schema { + next.Title = util.FirstOf(next.Title, prev.Title, path.Base(prev.Ref.String())) + next.Description = util.FirstOf(next.Description, prev.Description) + if next.Items == nil { + next.Items = prev.Items + } + return next +} + +func resolveSchema(openrpc *types.OpenRPCSpec1, sch spec.Schema) spec.Schema { + doc, _, _ := sch.Ref.GetPointer().Get(openrpc) + + if s, ok := doc.(spec.Schema); ok { + sch = persistFields(sch, s) + } else if cd, ok := doc.(*types.ContentDescriptor); ok { + sch = persistFields(sch, cd.Schema) + } + + if sch.Ref.GetURL() != nil { + return resolveSchema(openrpc, sch) + } + return sch +} + +func getConcreteType(in string) string { + switch in { + case reflect.Bool.String(), "boolean": + return reflect.Bool.String() + default: + return in + } +} + +func getObjectType(openrpc *types.OpenRPCSpec1, sch spec.Schema) string { + sch = resolveSchema(openrpc, sch) + + if len(sch.Properties) > 0 || len(sch.Type) < 1 { + return util.CamelCase(sch.Title) + } + + return getConcreteType(sch.Type[0]) +} + +func dereference(openrpc *types.OpenRPCSpec1, name string, sch spec.Schema, om *types.ObjectMap) { + // resolve all pointers + sch = resolveSchema(openrpc, sch) + + if len(sch.Properties) > 0 { + for key, value := range sch.Properties { + value.Title = key + dereference(openrpc, sch.Title, value, om) + } + om.Set(name, types.BasicType{sch.Description, sch.Title, util.CamelCase(sch.Title)}) + return + } else if len(sch.OneOf) > 0 { + next := sch.OneOf[0] + dereference(openrpc, sch.Title, next, om) + om.Set(name, types.BasicType{sch.Description, sch.Title, getObjectType(openrpc, resolveSchema(openrpc, next))}) + return + } else if sch.Items != nil { + if sch.Items.Schema != nil { + dereference(openrpc, sch.Title, *sch.Items.Schema, om) + dereference(openrpc, name, persistTitleAndDesc(sch, *sch.Items.Schema), om) + om.Set(name, types.BasicType{sch.Description, sch.Title, fmt.Sprintf("[]%s", getObjectType(openrpc, persistTitleAndDesc(sch, *sch.Items.Schema)))}) + } else if len(sch.Items.Schemas) > 0 { + om.Set(name, types.BasicType{sch.Description, sch.Title, "[]string"}) + } + return + } + + if len(sch.Type) == 0 { + return + } + + om.Set(name, types.BasicType{sch.Description, sch.Title, getConcreteType(sch.Type[0])}) + return +} + +// GetTypes constructs all possible type definitions from the spec +func GetTypes(openrpc *types.OpenRPCSpec1, om *types.ObjectMap) { + for _, m := range openrpc.Methods { + name := fmt.Sprintf("%s%s", util.CamelCase(m.Name), params) + for _, param := range m.Params { + sch := param.Schema + sch.Title = util.FirstOf(sch.Title, param.Name) + sch.Description = util.FirstOf(sch.Description, param.Description) + dereference(openrpc, name, sch, om) + } + if m.Result != nil { + name = fmt.Sprintf("%s%s", util.CamelCase(m.Name), result) + res := m.Result + sch := res.Schema + sch.Title = util.FirstOf(sch.Title, res.Name) + sch.Description = util.FirstOf(sch.Description, res.Description) + dereference(openrpc, name, sch, om) + } + } +} diff --git a/openrpc/parse/parse_test.go b/openrpc/parse/parse_test.go new file mode 100644 index 0000000..6326ec1 --- /dev/null +++ b/openrpc/parse/parse_test.go @@ -0,0 +1,73 @@ +package parse + +import ( + "encoding/json" + "io/ioutil" + "testing" + + "gfx.cafe/open/jrpc/openrpc/types" + "github.com/test-go/testify/require" +) + +func TestParse(t *testing.T) { + data, err := ioutil.ReadFile("testdata/eth_openrpc.json") + require.NoError(t, err) + spec := types.NewOpenRPCSpec1() + err = json.Unmarshal(data, spec) + require.NoError(t, err) + GetTypes(spec, spec.Objects) + + result := spec.Objects.Get("GetBlockByHashResult") + require.NotNil(t, result) + require.Len(t, result.GetKeys(), 1) + + result = spec.Objects.Get("EthBlockNumberResult") + require.NotNil(t, result) + require.Len(t, result.GetKeys(), 1) + + result = spec.Objects.Get("BlockNumber") + require.NotNil(t, result) + require.Len(t, result.GetKeys(), 1) + + result = spec.Objects.Get("EthAccountsResult") + require.NotNil(t, result) + bt := result.Get("Addresses") + require.Equal(t, "Addresses", bt.Name) + require.Equal(t, "[]string", bt.Type) + + result = spec.Objects.Get("EthGetTransactionReceiptResult") + require.NotNil(t, result) + bt = result.Get("Receipt") + require.Equal(t, "Receipt", bt.Name) + require.Equal(t, "Receipt", bt.Type) + + result = spec.Objects.Get("EthSyncingResult") + require.NotNil(t, result) + bt = result.Get("Syncing") + require.Equal(t, "Syncing", bt.Name) + require.Equal(t, "SyncStatus", bt.Type) + + result = spec.Objects.Get("EthGetTransactionByHashResult") + require.NotNil(t, result) + bt = result.Get("Transaction") + require.Equal(t, "Transaction", bt.Name) + + result = spec.Objects.Get("Transaction") + require.NotNil(t, result) + bt = result.Get("BlockHash") + require.Equal(t, "BlockHash", bt.Name) +} + +func TestParseMulti(t *testing.T) { + sp := types.NewOpenRPCSpec1() + var err error + err = sp.AddSchemas("./testdata/execution-api/schemas") + require.NoError(t, err) + err = sp.AddMethods("./testdata/execution-api/eth") + require.NoError(t, err) + err = sp.AddMethods("./testdata/execution-api/engine") + require.NoError(t, err) + err = sp.AddMethods("./testdata/execution-api/debug") + require.NoError(t, err) + // TODO: finish this test +} diff --git a/openrpc/parse/testdata/eth_openrpc.json b/openrpc/parse/testdata/eth_openrpc.json new file mode 100644 index 0000000..7f9b44b --- /dev/null +++ b/openrpc/parse/testdata/eth_openrpc.json @@ -0,0 +1,1864 @@ +{ + "openrpc": "1.0.0", + "info": { + "version": "1.0.10", + "title": "Ethereum JSON-RPC", + "description": "This API lets you interact with an EVM-based client via JSON-RPC", + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "methods": [ + { + "name": "web3_clientVersion", + "description": "Returns the version of the current client", + "summary": "current client version", + "params": [], + "result": { + "name": "clientVersion", + "description": "client version", + "schema": { + "title": "clientVersion", + "type": "string" + } + } + }, + { + "name": "web3_sha3", + "summary": "Hashes data", + "description": "Hashes data using the Keccak-256 algorithm", + "params": [ + { + "name": "data", + "description": "data to hash using the Keccak-256 algorithm", + "summary": "data to hash", + "schema": { + "title": "data", + "type": "string", + "pattern": "^0x[a-fA-F\\d]+$" + } + } + ], + "result": { + "name": "hashedData", + "description": "Keccak-256 hash of the given data", + "schema": { + "$ref": "#/components/schemas/Keccak" + } + }, + "examples": [ + { + "name": "sha3Example", + "params": [ + { + "name": "sha3ParamExample", + "value": "0x68656c6c6f20776f726c64" + } + ], + "result": { + "name": "sha3ResultExample", + "value": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad" + } + } + ] + }, + { + "name": "net_listening", + "summary": "returns listening status", + "description": "Determines if this client is listening for new network connections.", + "params": [], + "result": { + "name": "netListeningResult", + "description": "`true` if listening is active or `false` if listening is not active", + "schema": { + "title": "isNetListening", + "type": "boolean" + } + }, + "examples": [ + { + "name": "netListeningTrueExample", + "description": "example of true result for net_listening", + "params": [], + "result": { + "name": "netListeningExampleFalseResult", + "value": true + } + } + ] + }, + { + "name": "net_peerCount", + "summary": "number of peers", + "description": "Returns the number of peers currently connected to this client.", + "params": [], + "result": { + "name": "quantity", + "description": "number of connected peers.", + "schema": { + "title": "numConnectedPeers", + "description": "Hex representation of number of connected peers", + "type": "string" + } + } + }, + { + "name": "net_version", + "summary": "chain ID associated with network", + "description": "Returns the chain ID associated with the current network.", + "params": [], + "result": { + "name": "chainID", + "description": "chain ID associated with the current network", + "schema": { + "title": "chainID", + "type": "string", + "pattern": "^0x[a-fA-F\\d]+$" + } + } + }, + { + "name": "eth_blockNumber", + "summary": "Returns the number of most recent block.", + "params": [], + "result": { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + }, + { + "name": "eth_call", + "summary": "Executes a new message call (locally) immediately without creating a transaction on the block chain.", + "params": [ + { + "$ref": "#/components/contentDescriptors/Transaction" + }, + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "returnValue", + "description": "The return value of the executed contract", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + { + "name": "eth_chainId", + "summary": "Returns the currently configured chain id", + "description": "Returns the currently configured chain id, a value used in replay-protected transaction signing as introduced by [EIP-155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md).", + "params": [], + "result": { + "name": "chainId", + "description": "hex format integer of the current chain id. Defaults are mainnet=61, morden=62.", + "schema": { + "title": "chainId", + "type": "string", + "pattern": "^0x[a-fA-F\\d]+$" + } + } + }, + { + "name": "eth_coinbase", + "summary": "Returns the client coinbase address.", + "params": [], + "result": { + "name": "address", + "description": "The address owned by the client that is used as default for things like the mining reward", + "schema": { + "$ref": "#/components/schemas/Address" + } + } + }, + { + "name": "eth_estimateGas", + "summary": "Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.", + "params": [ + { + "$ref": "#/components/contentDescriptors/Transaction" + } + ], + "result": { + "name": "gasUsed", + "description": "The amount of gas used", + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "name": "eth_gasPrice", + "summary": "Returns the current price per gas in wei", + "params": [], + "result": { + "$ref": "#/components/contentDescriptors/GasPrice" + } + }, + { + "name": "eth_getBalance", + "summary": "Returns Ether balance of a given or account or contract", + "params": [ + { + "name": "address", + "required": true, + "description": "The address of the account or contract", + "schema": { + "$ref": "#/components/schemas/Address" + } + }, + { + "name": "blockNumber", + "description": "A BlockNumber at which to request the balance", + "schema": { + "$ref": "#/components/schemas/BlockNumber" + } + } + ], + "result": { + "name": "getBalanceResult", + "schema": { + "title": "getBalanceResult", + "oneOf": [ + { + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getBlockByHash", + "summary": "Gets a block for a given hash", + "params": [ + { + "name": "blockHash", + "required": true, + "schema": { + "$ref": "#/components/schemas/BlockHash" + } + }, + { + "name": "includeTransactions", + "description": "If `true` it returns the full transaction objects, if `false` only the hashes of the transactions.", + "required": true, + "schema": { + "title": "isTransactionsIncluded", + "type": "boolean" + } + } + ], + "result": { + "name": "getBlockByHashResult", + "schema": { + "title": "getBlockByHashResult", + "oneOf": [ + { + "$ref": "#/components/schemas/Block" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getBlockByNumber", + "summary": "Gets a block for a given number salad", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockNumber" + }, + { + "name": "includeTransactions", + "description": "If `true` it returns the full transaction objects, if `false` only the hashes of the transactions.", + "required": true, + "schema": { + "title": "isTransactionsIncluded", + "type": "boolean" + } + } + ], + "result": { + "name": "getBlockByNumberResult", + "schema": { + "title": "getBlockByNumberResult", + "oneOf": [ + { + "$ref": "#/components/schemas/Block" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getBlockTransactionCountByHash", + "summary": "Returns the number of transactions in a block from a block matching the given block hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockHash" + } + ], + "result": { + "name": "blockTransactionCountByHash", + "description": "The Number of total transactions in the given block", + "schema": { + "title": "blockTransactionCountByHash", + "oneOf": [ + { + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getBlockTransactionCountByNumber", + "summary": "Returns the number of transactions in a block from a block matching the given block number.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "blockTransactionCountByHash", + "description": "The Number of total transactions in the given block", + "schema": { + "title": "blockTransactionCountByHash", + "oneOf": [ + { + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getCode", + "summary": "Returns code at a given contract address", + "params": [ + { + "name": "address", + "required": true, + "description": "The address of the contract", + "schema": { + "$ref": "#/components/schemas/Address" + } + }, + { + "name": "blockNumber", + "description": "A BlockNumber of which the code existed", + "schema": { + "$ref": "#/components/schemas/BlockNumber" + } + } + ], + "result": { + "name": "bytes", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + { + "name": "eth_getFilterChanges", + "summary": "Polling method for a filter, which returns an array of logs which occurred since last poll.", + "params": [ + { + "name": "filterId", + "required": true, + "schema": { + "$ref": "#/components/schemas/FilterId" + } + } + ], + "result": { + "name": "logResult", + "schema": { + "title": "logResult", + "type": "array", + "items": { + "$ref": "#/components/schemas/Log" + } + } + } + }, + { + "name": "eth_getFilterLogs", + "summary": "Returns an array of all logs matching filter with given id.", + "params": [ + { + "name": "filterId", + "required": true, + "schema": { + "$ref": "#/components/schemas/FilterId" + } + } + ], + "result": { + "$ref": "#/components/contentDescriptors/Logs" + } + }, + { + "name": "eth_getRawTransactionByHash", + "summary": "Returns raw transaction data of a transaction with the given hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/TransactionHash" + } + ], + "result": { + "name": "rawTransactionByHash", + "description": "The raw transaction data", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + { + "name": "eth_getRawTransactionByBlockHashAndIndex", + "summary": "Returns raw transaction data of a transaction with the given hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockHash" + }, + { + "name": "index", + "description": "The ordering in which a transaction is mined within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "name": "rawTransaction", + "description": "The raw transaction data", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + { + "name": "eth_getRawTransactionByBlockNumberAndIndex", + "summary": "Returns raw transaction data of a transaction with the given hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockNumber" + }, + { + "name": "index", + "description": "The ordering in which a transaction is mined within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "name": "rawTransaction", + "description": "The raw transaction data", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + }, + { + "name": "eth_getLogs", + "summary": "Returns an array of all logs matching a given filter object.", + "params": [ + { + "$ref": "#/components/contentDescriptors/Filter" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/Logs" + } + }, + { + "name": "eth_getStorageAt", + "summary": "Gets a storage value from a contract address, a position, and an optional blockNumber", + "params": [ + { + "$ref": "#/components/contentDescriptors/Address" + }, + { + "$ref": "#/components/contentDescriptors/Position" + }, + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "dataWord", + "schema": { + "$ref": "#/components/schemas/DataWord" + } + } + }, + { + "name": "eth_getTransactionByBlockHashAndIndex", + "summary": "Returns the information about a transaction requested by the block hash and index of which it was mined.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockHash" + }, + { + "name": "index", + "description": "The ordering in which a transaction is mined within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "$ref": "#/components/contentDescriptors/TransactionResult" + }, + "examples": [ + { + "name": "nullExample", + "params": [ + { + "name": "blockHashExample", + "value": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" + }, + { + "name": "indexExample", + "value": "0x0" + } + ], + "result": { + "name": "nullResultExample", + "value": null + } + } + ] + }, + { + "name": "eth_getTransactionByBlockNumberAndIndex", + "summary": "Returns the information about a transaction requested by the block hash and index of which it was mined.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockNumber" + }, + { + "name": "index", + "description": "The ordering in which a transaction is mined within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "$ref": "#/components/contentDescriptors/TransactionResult" + } + }, + { + "name": "eth_getTransactionByHash", + "summary": "Returns the information about a transaction requested by transaction hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/TransactionHash" + } + ], + "result": { + "title": "Transaction", + "$ref": "#/components/contentDescriptors/TransactionResult" + } + }, + { + "name": "eth_getTransactionCount", + "summary": "Returns the number of transactions sent from an address", + "params": [ + { + "$ref": "#/components/contentDescriptors/Address" + }, + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "transactionCount", + "schema": { + "title": "nonceOrNull", + "oneOf": [ + { + "$ref": "#/components/schemas/Nonce" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getTransactionReceipt", + "summary": "Returns the receipt information of a transaction by its hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/TransactionHash" + } + ], + "result": { + "name": "transactionReceiptResult", + "description": "returns either a receipt or null", + "schema": { + "title": "receipt", + "oneOf": [ + { + "$ref": "#/components/schemas/Receipt" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getUncleByBlockHashAndIndex", + "summary": "Returns information about a uncle of a block by hash and uncle index position.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockHash" + }, + { + "name": "index", + "description": "The ordering in which a uncle is included within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "name": "uncle", + "schema": { + "title": "uncleOrNull", + "oneOf": [ + { + "$ref": "#/components/schemas/Uncle" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getUncleByBlockNumberAndIndex", + "summary": "Returns information about a uncle of a block by hash and uncle index position.", + "params": [ + { + "name": "uncleBlockNumber", + "description": "The block in which the uncle was included", + "required": true, + "schema": { + "$ref": "#/components/schemas/BlockNumber" + } + }, + { + "name": "index", + "description": "The ordering in which a uncle is included within its block.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Integer" + } + } + ], + "result": { + "name": "uncleResult", + "description": "returns an uncle or null", + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Uncle" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + }, + "examples": [ + { + "name": "nullResultExample", + "params": [ + { + "name": "uncleBlockNumberExample", + "value": "0x0" + }, + { + "name": "uncleBlockNumberIndexExample", + "value": "0x0" + } + ], + "result": { + "name": "nullResultExample", + "value": null + } + } + ] + }, + { + "name": "eth_getUncleCountByBlockHash", + "summary": "Returns the number of uncles in a block from a block matching the given block hash.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockHash" + } + ], + "result": { + "name": "uncleCountResult", + "schema": { + "title": "uncleCountOrNull", + "oneOf": [ + { + "description": "The Number of total uncles in the given block", + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getUncleCountByBlockNumber", + "summary": "Returns the number of uncles in a block from a block matching the given block number.", + "params": [ + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "uncleCountResult", + "schema": { + "title": "uncleCountOrNull", + "oneOf": [ + { + "description": "The Number of total uncles in the given block", + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getProof", + "summary": "Returns the account- and storage-values of the specified account including the Merkle-proof.", + "params": [ + { + "name": "address", + "description": "The address of the account or contract", + "required": true, + "schema": { + "$ref": "#/components/schemas/Address" + } + }, + { + "name": "storageKeys", + "required": true, + "schema": { + "title": "storageKeys", + "description": "The storage keys of all the storage slots being requested", + "items": { + "description": "A storage key is indexed from the solidity compiler by the order it is declared. For mappings it uses the keccak of the mapping key with its position (and recursively for X-dimensional mappings)", + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "$ref": "#/components/contentDescriptors/BlockNumber" + } + ], + "result": { + "name": "account", + "schema": { + "title": "proofAccountOrNull", + "oneOf": [ + { + "title": "proofAccount", + "type": "object", + "description": "The merkle proofs of the specified account connecting them to the blockhash of the block specified", + "properties": { + "address": { + "description": "The address of the account or contract of the request", + "$ref": "#/components/schemas/Address" + }, + "accountProof": { + "$ref": "#/components/schemas/AccountProof" + }, + "balance": { + "description": "The Ether balance of the account or contract of the request", + "$ref": "#/components/schemas/Integer" + }, + "codeHash": { + "description": "The code hash of the contract of the request (keccak(NULL) if external account)", + "$ref": "#/components/schemas/Keccak" + }, + "nonce": { + "description": "The transaction count of the account or contract of the request", + "$ref": "#/components/schemas/Nonce" + }, + "storageHash": { + "description": "The storage hash of the contract of the request (keccak(rlp(NULL)) if external account)", + "$ref": "#/components/schemas/Keccak" + }, + "storageProof": { + "$ref": "#/components/schemas/StorageProof" + } + } + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + } + }, + { + "name": "eth_getWork", + "summary": "Returns the hash of the current block, the seedHash, and the boundary condition to be met ('target').", + "params": [], + "result": { + "name": "work", + "schema": { + "type": "array", + "items": [ + { + "$ref": "#/components/schemas/PowHash" + }, + { + "$ref": "#/components/schemas/SeedHash" + }, + { + "$ref": "#/components/schemas/Difficulty" + } + ] + } + } + }, + { + "name": "eth_hashrate", + "summary": "Returns the number of hashes per second that the node is mining with.", + "params": [], + "result": { + "name": "hashesPerSecond", + "schema": { + "description": "Integer of the number of hashes per second", + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "name": "eth_mining", + "summary": "Returns true if client is actively mining new blocks.", + "params": [], + "result": { + "name": "mining", + "schema": { + "description": "Whether of not the client is mining", + "type": "boolean" + } + } + }, + { + "name": "eth_newBlockFilter", + "summary": "Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.", + "params": [], + "result": { + "$ref": "#/components/contentDescriptors/FilterId" + } + }, + { + "name": "eth_newFilter", + "summary": "Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.", + "params": [ + { + "$ref": "#/components/contentDescriptors/Filter" + } + ], + "result": { + "name": "filterId", + "schema": { + "description": "The filter ID for use in `eth_getFilterChanges`", + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "name": "eth_newPendingTransactionFilter", + "summary": "Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.", + "params": [], + "result": { + "$ref": "#/components/contentDescriptors/FilterId" + } + }, + { + "name": "eth_pendingTransactions", + "summary": "Returns the pending transactions list", + "params": [], + "result": { + "name": "pendingTransactions", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Transaction" + } + } + } + }, + { + "name": "eth_protocolVersion", + "summary": "Returns the current ethereum protocol version.", + "params": [], + "result": { + "name": "protocolVersion", + "schema": { + "description": "The current ethereum protocol version", + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "name": "eth_sign", + "summary": "The sign method calculates an Ethereum specific signature.", + "deprecated": true, + "params": [ + { + "$ref": "#/components/schemas/Address" + }, + { + "$ref": "#/components/schemas/Bytes" + } + ], + "result": { + "$ref": "#/components/contentDescriptors/Signature" + } + }, + { + "name": "eth_accounts", + "summary": "Returns a list of addresses owned by client.", + "deprecated": true, + "params": [], + "result": { + "name": "addresses", + "description": "addresses owned by the client", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Address" + } + } + } + }, + { + "name": "eth_sendTransaction", + "summary": "Creates new message call transaction or a contract creation, if the data field contains code.", + "deprecated": true, + "params": [ + { + "$ref": "#/components/contentDescriptors/Transaction" + } + ], + "result": { + "name": "transactionHash", + "schema": { + "description": "The transaction hash, or the zero hash if the transaction is not yet available.", + "$ref": "#/components/schemas/Keccak" + } + } + }, + { + "name": "eth_sendRawTransaction", + "summary": "Creates new message call transaction or a contract creation for signed transactions.", + "params": [ + { + "name": "signedTransactionData", + "required": true, + "description": "The signed transaction data", + "schema": { + "$ref": "#/components/schemas/Bytes" + } + } + ], + "result": { + "name": "transactionHash", + "schema": { + "description": "The transaction hash, or the zero hash if the transaction is not yet available.", + "$ref": "#/components/schemas/Keccak" + } + } + }, + { + "name": "eth_submitHashrate", + "summary": "Returns an array of all logs matching a given filter object.", + "params": [ + { + "name": "hashRate", + "required": true, + "schema": { + "$ref": "#/components/schemas/DataWord" + } + }, + { + "name": "id", + "required": true, + "description": "String identifying the client", + "schema": { + "$ref": "#/components/schemas/DataWord" + } + } + ], + "result": { + "name": "submitHashRateSuccess", + "schema": { + "type": "boolean", + "description": "whether of not submitting went through successfully" + } + } + }, + { + "name": "eth_submitWork", + "summary": "Used for submitting a proof-of-work solution.", + "params": [ + { + "$ref": "#/components/contentDescriptors/Nonce" + }, + { + "name": "powHash", + "required": true, + "schema": { + "$ref": "#/components/schemas/PowHash" + } + }, + { + "name": "mixHash", + "required": true, + "schema": { + "$ref": "#/components/schemas/MixHash" + } + } + ], + "result": { + "name": "solutionValid", + "description": "returns true if the provided solution is valid, otherwise false.", + "schema": { + "type": "boolean", + "description": "Whether or not the provided solution is valid" + } + }, + "examples": [ + { + "name": "submitWorkExample", + "params": [ + { + "name": "nonceExample", + "description": "example of a number only used once", + "value": "0x0000000000000001" + }, + { + "name": "powHashExample", + "description": "proof of work to submit", + "value": "0x6bf2cAE0dE3ec3ecA5E194a6C6e02cf42aADfe1C2c4Fff12E5D36C3Cf7297F22" + }, + { + "name": "mixHashExample", + "description": "the mix digest example", + "value": "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000" + } + ], + "result": { + "name": "solutionInvalidExample", + "description": "this example should return `false` as it is not a valid pow to submit", + "value": false + } + } + ] + }, + { + "name": "eth_syncing", + "summary": "Returns an object with data about the sync status or false.", + "params": [], + "result": { + "name": "syncing", + "schema": { + "oneOf": [ + { + "description": "An object with sync status data", + "title": "syncStatus", + "type": "object", + "properties": { + "startingBlock": { + "description": "Block at which the import started (will only be reset, after the sync reached his head)", + "$ref": "#/components/schemas/Integer" + }, + "currentBlock": { + "description": "The current block, same as eth_blockNumber", + "$ref": "#/components/schemas/Integer" + }, + "highestBlock": { + "description": "The estimated highest block", + "$ref": "#/components/schemas/Integer" + }, + "knownStates": { + "description": "The known states", + "$ref": "#/components/schemas/Integer" + }, + "pulledStates": { + "description": "The pulled states", + "$ref": "#/components/schemas/Integer" + } + } + }, + { + "type": "boolean", + "description": "The value `false` indicating that syncing is complete" + } + ] + } + } + }, + { + "name": "eth_uninstallFilter", + "summary": "Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additionally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time.", + "params": [ + { + "name": "filterId", + "required": true, + "schema": { + "$ref": "#/components/schemas/FilterId" + } + } + ], + "result": { + "name": "filterUninstalledSuccess", + "schema": { + "type": "boolean", + "description": "Whether of not the filter was successfully uninstalled" + } + } + } + ], + "components": { + "schemas": { + "ProofNode": { + "type": "string", + "description": "An individual node used to prove a path down a merkle-patricia-tree", + "$ref": "#/components/schemas/Bytes" + }, + "AccountProof": { + "$ref": "#/components/schemas/ProofNodes" + }, + "StorageProof": { + "type": "array", + "description": "Current block header PoW hash.", + "items": { + "type": "object", + "description": "Object proving a relationship of a storage value to an account's storageHash.", + "properties": { + "key": { + "description": "The key used to get the storage slot in its account tree", + "$ref": "#/components/schemas/Integer" + }, + "value": { + "description": "The value of the storage slot in its account tree", + "$ref": "#/components/schemas/Integer" + }, + "proof": { + "$ref": "#/components/schemas/ProofNodes" + } + } + } + }, + "ProofNodes": { + "type": "array", + "description": "The set of node values needed to traverse a patricia merkle tree (from root to leaf) to retrieve a value", + "items": { + "$ref": "#/components/schemas/ProofNode" + } + }, + "PowHash": { + "description": "Current block header PoW hash.", + "$ref": "#/components/schemas/DataWord" + }, + "SeedHash": { + "description": "The seed hash used for the DAG.", + "$ref": "#/components/schemas/DataWord" + }, + "MixHash": { + "description": "The mix digest.", + "$ref": "#/components/schemas/DataWord" + }, + "Difficulty": { + "description": "The boundary condition ('target'), 2^256 / difficulty.", + "$ref": "#/components/schemas/DataWord" + }, + "FilterId": { + "type": "string", + "description": "An identifier used to reference the filter." + }, + "BlockHash": { + "type": "string", + "pattern": "^0x[a-fA-F\\d]{64}$", + "description": "The hex representation of the Keccak 256 of the RLP encoded block" + }, + "BlockNumber": { + "type": "string", + "pattern": "^0x[a-fA-F\\d]+$", + "description": "The hex representation of the block's height" + }, + "BlockNumberTag": { + "type": "string", + "description": "The optional block height description", + "enum": [ + "earliest", + "latest", + "pending" + ] + }, + "Receipt": { + "type": "object", + "description": "The receipt of a transaction", + "required": [ + "blockHash", + "blockNumber", + "contractAddress", + "cumulativeGasUsed", + "from", + "gasUsed", + "logs", + "logsBloom", + "to", + "transactionHash", + "transactionIndex" + ], + "properties": { + "blockHash": { + "description": "BlockHash of the block in which the transaction was mined", + "$ref": "#/components/schemas/BlockHash" + }, + "blockNumber": { + "description": "BlockNumber of the block in which the transaction was mined", + "$ref": "#/components/schemas/BlockNumber" + }, + "contractAddress": { + "description": "The contract address created, if the transaction was a contract creation, otherwise null", + "$ref": "#/components/schemas/Address" + }, + "cumulativeGasUsed": { + "description": "The gas units used by the transaction", + "$ref": "#/components/schemas/Integer" + }, + "from": { + "description": "The sender of the transaction", + "$ref": "#/components/schemas/Address" + }, + "gasUsed": { + "description": "The total gas used by the transaction", + "$ref": "#/components/schemas/Integer" + }, + "logs": { + "type": "array", + "description": "An array of all the logs triggered during the transaction", + "items": { + "$ref": "#/components/schemas/Log" + } + }, + "logsBloom": { + "$ref": "#/components/schemas/BloomFilter" + }, + "to": { + "description": "Destination address of the transaction", + "$ref": "#/components/schemas/Address" + }, + "transactionHash": { + "description": "Keccak 256 of the transaction", + "$ref": "#/components/schemas/Keccak" + }, + "transactionIndex": { + "description": "An array of all the logs triggered during the transaction", + "$ref": "#/components/schemas/BloomFilter" + }, + "postTransactionState": { + "description": "The intermediate stateRoot directly after transaction execution.", + "$ref": "#/components/schemas/Keccak" + }, + "status": { + "description": "Whether or not the transaction threw an error.", + "type": "string" + } + } + }, + "BloomFilter": { + "type": "string", + "description": "A 2048 bit bloom filter from the logs of the transaction. Each log sets 3 bits though taking the low-order 11 bits of each of the first three pairs of bytes in a Keccak 256 hash of the log's byte series" + }, + "Log": { + "type": "object", + "description": "An indexed event generated during a transaction", + "properties": { + "address": { + "description": "Sender of the transaction", + "$ref": "#/components/schemas/Address" + }, + "blockHash": { + "description": "BlockHash of the block in which the transaction was mined", + "$ref": "#/components/schemas/BlockHash" + }, + "blockNumber": { + "description": "BlockNumber of the block in which the transaction was mined", + "$ref": "#/components/schemas/BlockNumber" + }, + "data": { + "description": "The data/input string sent along with the transaction", + "$ref": "#/components/schemas/Bytes" + }, + "logIndex": { + "description": "The index of the event within its transaction, null when its pending", + "$ref": "#/components/schemas/Integer" + }, + "removed": { + "schema": { + "description": "Whether or not the log was orphaned off the main chain", + "type": "boolean" + } + }, + "topics": { + "type": "array", + "items": { + "topic": { + "description": "32 Bytes DATA of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256))", + "$ref": "#/components/schemas/DataWord" + } + } + }, + "transactionHash": { + "description": "The hash of the transaction in which the log occurred", + "$ref": "#/components/schemas/Keccak" + }, + "transactionIndex": { + "description": "The index of the transaction in which the log occurred", + "$ref": "#/components/schemas/Integer" + } + } + }, + "Uncle": { + "type": "object", + "description": "Orphaned blocks that can be included in the chain but at a lower block reward. NOTE: An uncle doesn’t contain individual transactions.", + "properties": { + "number": { + "description": "The block number or null when its the pending block", + "$ref": "#/components/schemas/IntOrPending" + }, + "hash": { + "description": "The block hash or null when its the pending block", + "$ref": "#/components/schemas/KeccakOrPending" + }, + "parentHash": { + "description": "Hash of the parent block", + "$ref": "#/components/schemas/Keccak" + }, + "nonce": { + "description": "Randomly selected number to satisfy the proof-of-work or null when its the pending block", + "$ref": "#/components/schemas/IntOrPending" + }, + "sha3Uncles": { + "description": "Keccak hash of the uncles data in the block", + "$ref": "#/components/schemas/Keccak" + }, + "logsBloom": { + "type": "string", + "description": "The bloom filter for the logs of the block or null when its the pending block", + "pattern": "^0x[a-fA-F\\d]+$" + }, + "transactionsRoot": { + "description": "The root of the transactions trie of the block.", + "$ref": "#/components/schemas/Keccak" + }, + "stateRoot": { + "description": "The root of the final state trie of the block", + "$ref": "#/components/schemas/Keccak" + }, + "receiptsRoot": { + "description": "The root of the receipts trie of the block", + "$ref": "#/components/schemas/Keccak" + }, + "miner": { + "description": "The address of the beneficiary to whom the mining rewards were given or null when its the pending block", + "oneOf": [ + { + "$ref": "#/components/schemas/Address" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + }, + "difficulty": { + "type": "string", + "description": "Integer of the difficulty for this block" + }, + "totalDifficulty": { + "description": "Integer of the total difficulty of the chain until this block", + "$ref": "#/components/schemas/IntOrPending" + }, + "extraData": { + "type": "string", + "description": "The 'extra data' field of this block" + }, + "size": { + "type": "string", + "description": "Integer the size of this block in bytes" + }, + "gasLimit": { + "type": "string", + "description": "The maximum gas allowed in this block" + }, + "gasUsed": { + "type": "string", + "description": "The total used gas by all transactions in this block" + }, + "timestamp": { + "type": "string", + "description": "The unix timestamp for when the block was collated" + }, + "uncles": { + "description": "Array of uncle hashes", + "type": "array", + "items": { + "description": "Block hash of the RLP encoding of an uncle block", + "$ref": "#/components/schemas/Keccak" + } + } + } + }, + "Block": { + "type": "object", + "properties": { + "number": { + "description": "The block number or null when its the pending block", + "$ref": "#/components/schemas/IntOrPending" + }, + "hash": { + "description": "The block hash or null when its the pending block", + "$ref": "#/components/schemas/KeccakOrPending" + }, + "parentHash": { + "description": "Hash of the parent block", + "$ref": "#/components/schemas/Keccak" + }, + "nonce": { + "description": "Randomly selected number to satisfy the proof-of-work or null when its the pending block", + "$ref": "#/components/schemas/IntOrPending" + }, + "sha3Uncles": { + "description": "Keccak hash of the uncles data in the block", + "$ref": "#/components/schemas/Keccak" + }, + "logsBloom": { + "type": "string", + "description": "The bloom filter for the logs of the block or null when its the pending block", + "pattern": "^0x[a-fA-F\\d]+$" + }, + "transactionsRoot": { + "description": "The root of the transactions trie of the block.", + "$ref": "#/components/schemas/Keccak" + }, + "stateRoot": { + "description": "The root of the final state trie of the block", + "$ref": "#/components/schemas/Keccak" + }, + "receiptsRoot": { + "description": "The root of the receipts trie of the block", + "$ref": "#/components/schemas/Keccak" + }, + "miner": { + "description": "The address of the beneficiary to whom the mining rewards were given or null when its the pending block", + "oneOf": [ + { + "$ref": "#/components/schemas/Address" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + }, + "difficulty": { + "type": "string", + "description": "Integer of the difficulty for this block" + }, + "totalDifficulty": { + "description": "Integer of the total difficulty of the chain until this block", + "$ref": "#/components/schemas/IntOrPending" + }, + "extraData": { + "type": "string", + "description": "The 'extra data' field of this block" + }, + "size": { + "type": "string", + "description": "Integer the size of this block in bytes" + }, + "gasLimit": { + "type": "string", + "description": "The maximum gas allowed in this block" + }, + "gasUsed": { + "type": "string", + "description": "The total used gas by all transactions in this block" + }, + "timestamp": { + "type": "string", + "description": "The unix timestamp for when the block was collated" + }, + "transactions": { + "description": "Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter", + "type": "array", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/Transaction" + }, + { + "$ref": "#/components/schemas/TransactionHash" + } + ] + } + }, + "uncles": { + "description": "Array of uncle hashes", + "type": "array", + "items": { + "description": "Block hash of the RLP encoding of an uncle block", + "$ref": "#/components/schemas/Keccak" + } + } + } + }, + "Transaction": { + "type": "object", + "required": [ + "gas", + "gasPrice", + "nonce" + ], + "properties": { + "blockHash": { + "description": "Hash of the block where this transaction was in. null when its pending", + "$ref": "#/components/schemas/KeccakOrPending" + }, + "blockNumber": { + "description": "Block number where this transaction was in. null when its pending", + "$ref": "#/components/contentDescriptors/BlockNumber" + }, + "from": { + "description": "Address of the sender", + "$ref": "#/components/schemas/Address" + }, + "gas": { + "type": "string", + "description": "The gas limit provided by the sender in Wei" + }, + "gasPrice": { + "type": "string", + "description": "The gas price willing to be paid by the sender in Wei" + }, + "hash": { + "$ref": "#/components/schemas/TransactionHash" + }, + "data": { + "type": "string", + "description": "The data field sent with the transaction" + }, + "nonce": { + "description": "The total number of prior transactions made by the sender", + "$ref": "#/components/schemas/Nonce" + }, + "to": { + "description": "address of the receiver. null when its a contract creation transaction", + "$ref": "#/components/schemas/Address" + }, + "transactionIndex": { + "description": "Integer of the transaction's index position in the block. null when its pending", + "$ref": "#/components/schemas/IntOrPending" + }, + "value": { + "description": "Value of Ether being transferred in Wei", + "$ref": "#/components/schemas/Keccak" + }, + "v": { + "type": "string", + "description": "ECDSA recovery id" + }, + "r": { + "type": "string", + "description": "ECDSA signature r" + }, + "s": { + "type": "string", + "description": "ECDSA signature s" + } + } + }, + "TransactionHash": { + "type": "string", + "description": "Keccak 256 Hash of the RLP encoding of a transaction", + "$ref": "#/components/schemas/Keccak" + }, + "KeccakOrPending": { + "oneOf": [ + { + "$ref": "#/components/schemas/Keccak" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + }, + "IntOrPending": { + "oneOf": [ + { + "$ref": "#/components/schemas/Integer" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + }, + "Keccak": { + "type": "string", + "description": "Hex representation of a Keccak 256 hash", + "pattern": "^0x[a-fA-F\\d]{64}$" + }, + "Nonce": { + "description": "A number only to be used once", + "pattern": "^0x[a-fA-F0-9]+$", + "type": "string" + }, + "Null": { + "type": "null", + "description": "Null" + }, + "Integer": { + "type": "string", + "pattern": "^0x[a-fA-F0-9]+$", + "description": "Hex representation of the integer" + }, + "Address": { + "type": "string", + "pattern": "^0x[a-fA-F\\d]{40}$" + }, + "Position": { + "type": "string", + "description": "Hex representation of the storage slot where the variable exists", + "pattern": "^0x([a-fA-F0-9]?)+$" + }, + "DataWord": { + "type": "string", + "description": "Hex representation of a 256 bit unit of data", + "pattern": "^0x([a-fA-F\\d]{64})?$" + }, + "Bytes": { + "type": "string", + "description": "Hex representation of a variable length byte array", + "pattern": "^0x([a-fA-F0-9]?)+$" + } + }, + "contentDescriptors": { + "Block": { + "name": "block", + "summary": "A block", + "description": "A block object", + "schema": { + "$ref": "#/components/schemas/Block" + } + }, + "Null": { + "name": "Null", + "description": "JSON Null value", + "summary": "Null value", + "schema": { + "type": "null", + "description": "Null value" + } + }, + "Signature": { + "name": "signature", + "summary": "The signature.", + "required": true, + "schema": { + "$ref": "#/components/schemas/Bytes", + "pattern": "0x^([A-Fa-f0-9]{2}){65}$" + } + }, + "GasPrice": { + "name": "gasPrice", + "required": true, + "schema": { + "description": "Integer of the current gas price", + "$ref": "#/components/schemas/Integer" + } + }, + "Transaction": { + "required": true, + "name": "transaction", + "schema": { + "$ref": "#/components/schemas/Transaction" + } + }, + "TransactionResult": { + "name": "transactionResult", + "description": "Returns a transaction or null", + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/Transaction" + }, + { + "$ref": "#/components/schemas/Null" + } + ] + } + }, + "Message": { + "name": "message", + "required": true, + "schema": { + "$ref": "#/components/schemas/Bytes" + } + }, + "Filter": { + "name": "filter", + "required": true, + "schema": { + "type": "object", + "description": "A filter used to monitor the blockchain for log/events", + "properties": { + "fromBlock": { + "description": "Block from which to begin filtering events", + "$ref": "#/components/schemas/BlockNumber" + }, + "toBlock": { + "description": "Block from which to end filtering events", + "$ref": "#/components/schemas/BlockNumber" + }, + "address": { + "oneOf": [ + { + "type": "string", + "description": "Address of the contract from which to monitor events", + "$ref": "#/components/schemas/Address" + }, + { + "type": "array", + "description": "List of contract addresses from which to monitor events", + "items": { + "$ref": "#/components/schemas/Address" + } + } + ] + }, + "topics": { + "type": "array", + "description": "Array of 32 Bytes DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with 'or' options", + "items": { + "description": "Indexable 32 bytes piece of data (made from the event's function signature in solidity)", + "$ref": "#/components/schemas/DataWord" + } + } + } + } + }, + "Address": { + "name": "address", + "required": true, + "schema": { + "$ref": "#/components/schemas/Address" + } + }, + "BlockHash": { + "name": "blockHash", + "required": true, + "schema": { + "$ref": "#/components/schemas/BlockHash" + } + }, + "Nonce": { + "name": "nonce", + "required": true, + "schema": { + "$ref": "#/components/schemas/Nonce" + } + }, + "Position": { + "name": "key", + "required": true, + "schema": { + "$ref": "#/components/schemas/Position" + } + }, + "Logs": { + "name": "logs", + "description": "An array of all logs matching filter with given id.", + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Log" + } + } + }, + "FilterId": { + "name": "filterId", + "schema": { + "description": "The filter ID for use in `eth_getFilterChanges`", + "$ref": "#/components/schemas/Integer" + } + }, + "BlockNumber": { + "name": "blockNumber", + "required": true, + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/BlockNumber" + }, + { + "$ref": "#/components/schemas/BlockNumberTag" + } + ] + } + }, + "TransactionHash": { + "name": "transactionHash", + "required": true, + "schema": { + "$ref": "#/components/schemas/TransactionHash" + } + } + } + } + } diff --git a/openrpc/parse/testdata/execution-api/debug/getters.yaml b/openrpc/parse/testdata/execution-api/debug/getters.yaml new file mode 100644 index 0000000..6d28d9f --- /dev/null +++ b/openrpc/parse/testdata/execution-api/debug/getters.yaml @@ -0,0 +1,57 @@ +- name: debug_getRawHeader + summary: Returns an RLP-encoded header. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Header RLP + schema: + $ref: '#/components/schemas/bytes' +- name: debug_getRawBlock + summary: Returns an RLP-encoded block. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Block RLP + schema: + $ref: '#/components/schemas/bytes' +- name: debug_getRawTransaction + summary: Returns an array of EIP-2718 binary-encoded transactions. + params: + - name: Transaction hash + required: true + schema: + $ref: '#/components/schemas/hash32' + result: + name: EIP-2718 binary-encoded transaction + schema: + $ref: '#/components/schemas/bytes' +- name: debug_getRawReceipts + summary: Returns an array of EIP-2718 binary-encoded receipts. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Receipts + schema: + title: Receipt array + type: array + items: + $ref: '#/components/schemas/bytes' +- name: debug_getBadBlocks + summary: Returns an array of recent bad blocks that the client has seen on the network. + params: [] + result: + name: Blocks + schema: + title: Bad block array + type: array + items: + $ref: '#/components/schemas/BadBlock' diff --git a/openrpc/parse/testdata/execution-api/engine/README.md b/openrpc/parse/testdata/execution-api/engine/README.md new file mode 100644 index 0000000..1bce2a5 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/engine/README.md @@ -0,0 +1,7 @@ +# Engine JSON-RPC API + +The Engine JSON-RPC API is a collection of methods that all execution clients implement. +This interface allows the communication between consensus and execution layers of the two-component post-Merge Ethereum Client. + +This API is in *active development* and currently [specified as a markdown document](./specification.md). +A schema will follow once the specification stabilizes. diff --git a/openrpc/parse/testdata/execution-api/engine/authentication.md b/openrpc/parse/testdata/execution-api/engine/authentication.md new file mode 100644 index 0000000..4847c9e --- /dev/null +++ b/openrpc/parse/testdata/execution-api/engine/authentication.md @@ -0,0 +1,54 @@ +# Authentication + +The `engine` JSON-RPC interface, exposed by execution layer clients and consumed by consensus layer clients, needs to be authenticated. The authentication scheme chosen for this purpose is [JWT](https://jwt.io/). + +The type of attacks that this authentication scheme attempts to protect against are the following: + +- RPC port exposed towards the internet, allowing attackers to exchange messages with execution layer engine API. +- RPC port exposed towards the browser, allowing malicious webpages to submit messages to the execution layer engine API. + +The authentication scheme is _not_ designed to + +- Prevent attackers with capability to read ('sniff') network traffic from reading the traffic, +- Prevent attackers with capability to read ('sniff') network traffic from performing replay-attacks of earlier messages. + +Authentication is performed as follows: + +- For `HTTP` dialogue, each `jsonrpc` request is individually authenticated by supplying `JWT` token in the HTTP header. +- For a WebSocket dialogue, only the initial handshake is authenticated, after which the message dialogue proceeds without further use of JWT. + - Clarification: The websocket handshake starts with the consensus layer client performing a websocket upgrade request. This is a regular http GET request, and the actual +parameters for the WS-handshake are carried in the http headers. +- For `inproc`, a.k.a raw ipc communication, no authentication is required, under the assumption that a process able to access `ipc` channels for the process, which usually means local file access, is already sufficiently permissioned that further authentication requirements do not add security. + + +## JWT specifications + +- The execution layer client **MUST** expose the authenticated Engine API at a port independent from existing JSON-RPC API. + - The default port for the authenticated Engine API is `8551`. The Engine API is exposed under the `engine` namespace. +- The execution layer client **MUST** support at least the following `alg` `HMAC + SHA256` (`HS256`) +- The execution layer client **MUST** reject the `alg` `none`. + + +The HMAC algorithm implies that several consensus layer clients will be able to use the same key, and from an authentication perspective, be able to impersonate each other. From a deployment perspective, it means that an EL does not need to be provisioned with individual keys for each consensus layer client. + +## Key distribution + +The execution layer and consensus layer clients **SHOULD** accept a configuration parameter: `jwt-secret`, which designates a file containing the hex-encoded 256 bit secret key to be used for verifying/generating JWT tokens. + +If such a parameter is not given, the client **SHOULD** generate such a token, valid for the duration of the execution, and **SHOULD** store the hex-encoded secret as a `jwt.hex` file on the filesystem. This file can then be used to provision the counterpart client. + +If such a parameter _is_ given, but the file cannot be read, or does not contain a hex-encoded key of `256` bits, the client **SHOULD** treat this as an error: either abort the startup, or show error and continue without exposing the authenticated port. + +## JWT Claims + +This specification utilizes the following list of JWT claims: + +- Required: `iat` (issued-at) claim. The execution layer client **SHOULD** only accept `iat` timestamps which are within +-60 seconds from the current time. +- Optional: `id` claim. The consensus layer client **MAY** use this to communicate a unique identifier for the individual consensus layer client. +- Optional: `clv` claim. The consensus layer client **MAY** use this to communicate the consensus layer client type/version. + +Other claims **MAY** be included in the JWT payload. If the execution layer client sees claims it does not recognize, these **MUST** be ignored. + +## Examples + +Todo, add some examples of JWT authentication here. diff --git a/openrpc/parse/testdata/execution-api/engine/specification.md b/openrpc/parse/testdata/execution-api/engine/specification.md new file mode 100644 index 0000000..2ef315b --- /dev/null +++ b/openrpc/parse/testdata/execution-api/engine/specification.md @@ -0,0 +1,398 @@ +# Engine API + +This document specifies the Engine API methods that the Consensus Layer uses to interact with the Execution Layer. + +## Table of contents + +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> + +- [Underlying protocol](#underlying-protocol) + - [Authentication](#authentication) +- [Versioning](#versioning) +- [Message ordering](#message-ordering) +- [Load-balancing and advanced configurations](#load-balancing-and-advanced-configurations) +- [Errors](#errors) +- [Timeouts](#timeouts) +- [Structures](#structures) + - [ExecutionPayloadV1](#executionpayloadv1) + - [ForkchoiceStateV1](#forkchoicestatev1) + - [PayloadAttributesV1](#payloadattributesv1) + - [PayloadStatusV1](#payloadstatusv1) + - [TransitionConfigurationV1](#transitionconfigurationv1) +- [Routines](#routines) + - [Payload validation](#payload-validation) + - [Sync](#sync) + - [Payload building](#payload-building) +- [Core](#core) + - [engine_newPayloadV1](#engine_newpayloadv1) + - [Request](#request) + - [Response](#response) + - [Specification](#specification) + - [engine_forkchoiceUpdatedV1](#engine_forkchoiceupdatedv1) + - [Request](#request-1) + - [Response](#response-1) + - [Specification](#specification-1) + - [engine_getPayloadV1](#engine_getpayloadv1) + - [Request](#request-2) + - [Response](#response-2) + - [Specification](#specification-2) + - [engine_exchangeTransitionConfigurationV1](#engine_exchangetransitionconfigurationv1) + - [Request](#request-3) + - [Response](#response-3) + - [Specification](#specification-3) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + +## Underlying protocol + +Message format and encoding notation used by this specification are inherited +from [Ethereum JSON-RPC Specification][json-rpc-spec]. + +Client software **MUST** expose Engine API at a port independent from JSON-RPC API. +The default port for the Engine API is 8551. +The Engine API is exposed under the `engine` namespace. + +To facilitate an Engine API consumer to access state and logs (e.g. proof-of-stake deposits) through the same connection, +the client **MUST** also expose the following subset of `eth` methods: +* `eth_blockNumber` +* `eth_call` +* `eth_chainId` +* `eth_getCode` +* `eth_getBlockByHash` +* `eth_getBlockByNumber` +* `eth_getLogs` +* `eth_sendRawTransaction` +* `eth_syncing` + +These methods are described in [Ethereum JSON-RPC Specification][json-rpc-spec]. + +### Authentication + +Engine API uses JWT authentication enabled by default. +JWT authentication is specified in [Authentication](./authentication.md) document. + +## Versioning + +The versioning of the Engine API is defined as follows: + +* The version of each method and structure is independent from versions of other methods and structures. +* The `VX`, where the `X` is the number of the version, is suffixed to the name of each method and structure. +* The version of a method or a structure **MUST** be incremented by one if any of the following is changed: + * a set of method parameters + * a method response value + * a method behavior + * a set of structure fields +* The specification **MAY** reference a method or a structure without the version suffix e.g. `engine_newPayload`. These statements should be read as related to all versions of the referenced method or structure. + +## Message ordering + +Consensus Layer client software **MUST** respect the order of the corresponding fork choice update events +when making calls to the `engine_forkchoiceUpdated` method. + +Execution Layer client software **MUST** process `engine_forkchoiceUpdated` method calls +in the same order as they have been received. + +## Load-balancing and advanced configurations + +The Engine API supports a one-to-many Consensus Layer to Execution Layer configuration. +Intuitively this is because the Consensus Layer drives the Execution Layer and thus can drive many of them independently. + +On the other hand, generic many-to-one Consensus Layer to Execution Layer configurations are not supported out-of-the-box. +The Execution Layer, by default, only supports one chain head at a time and thus has undefined behavior when multiple Consensus Layers simultaneously control the head. +The Engine API does work properly, if in such a many-to-one configuration, only one Consensus Layer instantiation is able to *write* to the Execution Layer's chain head and initiate the payload build process (i.e. call `engine_forkchoiceUpdated` ), +while other Consensus Layers can only safely insert payloads (i.e. `engine_newPayload`) and read from the Execution Layer. + +## Errors + +The list of error codes introduced by this specification can be found below. + +| Code | Message | Meaning | +| - | - | - | +| -32700 | Parse error | Invalid JSON was received by the server. | +| -32600 | Invalid Request | The JSON sent is not a valid Request object. | +| -32601 | Method not found | The method does not exist / is not available. | +| -32602 | Invalid params | Invalid method parameter(s). | +| -32603 | Internal error | Internal JSON-RPC error. | +| -32000 | Server error | Generic client error while processing request. | +| -38001 | Unknown payload | Payload does not exist / is not available. | +| -38002 | Invalid forkchoice state | Forkchoice state is invalid / inconsistent. | +| -38003 | Invalid payload attributes | Payload attributes are invalid / inconsistent. | + +Each error returns a `null` `data` value, except `-32000` which returns the `data` object with a `err` member that explains the error encountered. + +For example: + +```console +$ curl https://localhost:8551 \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","method":"engine_getPayloadV1","params": ["0x1"],"id":1}' +{ + "jsonrpc": "2.0", + "id": 1, + "error": { + "code": -32000, + "message": "Server error", + "data": { + "err": "Database corrupted" + } + } +} +``` + +## Timeouts + +Consensus Layer client software **MUST** wait for a specified `timeout` before aborting the call. In such an event, the Consensus Layer client software **SHOULD** retry the call when it is needed to keep progressing. + +Consensus Layer client software **MAY** wait for response longer than it is specified by the `timeout` parameter. + +## Structures + +Values of a field of `DATA` type **MUST** be encoded as a hexadecimal string with a `0x` prefix matching the regular expression `^0x(?:[a-fA-F0-9]{2})*$`. + +Values of a field of `QUANTITY` type **MUST** be encoded as a hexadecimal string with a `0x` prefix and the leading 0s stripped (except for the case of encoding the value `0`) matching the regular expression `^0x(?:0|(?:[a-fA-F1-9][a-fA-F0-9]*))$`. + +*Note:* Byte order of encoded value having `QUANTITY` type is big-endian. + +### ExecutionPayloadV1 + +This structure maps on the [`ExecutionPayload`](https://github.com/ethereum/consensus-specs/blob/dev/specs/bellatrix/beacon-chain.md#ExecutionPayload) structure of the beacon chain spec. The fields are encoded as follows: + +- `parentHash`: `DATA`, 32 Bytes +- `feeRecipient`: `DATA`, 20 Bytes +- `stateRoot`: `DATA`, 32 Bytes +- `receiptsRoot`: `DATA`, 32 Bytes +- `logsBloom`: `DATA`, 256 Bytes +- `prevRandao`: `DATA`, 32 Bytes +- `blockNumber`: `QUANTITY`, 64 Bits +- `gasLimit`: `QUANTITY`, 64 Bits +- `gasUsed`: `QUANTITY`, 64 Bits +- `timestamp`: `QUANTITY`, 64 Bits +- `extraData`: `DATA`, 0 to 32 Bytes +- `baseFeePerGas`: `QUANTITY`, 256 Bits +- `blockHash`: `DATA`, 32 Bytes +- `transactions`: `Array of DATA` - Array of transaction objects, each object is a byte list (`DATA`) representing `TransactionType || TransactionPayload` or `LegacyTransaction` as defined in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) + +### ForkchoiceStateV1 + +This structure encapsulates the fork choice state. The fields are encoded as follows: + +- `headBlockHash`: `DATA`, 32 Bytes - block hash of the head of the canonical chain +- `safeBlockHash`: `DATA`, 32 Bytes - the "safe" block hash of the canonical chain under certain synchrony and honesty assumptions. This value **MUST** be either equal to or an ancestor of `headBlockHash` +- `finalizedBlockHash`: `DATA`, 32 Bytes - block hash of the most recent finalized block + +*Note:* `safeBlockHash` and `finalizedBlockHash` fields are allowed to have `0x0000000000000000000000000000000000000000000000000000000000000000` value unless transition block is finalized. + +### PayloadAttributesV1 + +This structure contains the attributes required to initiate a payload build process in the context of an `engine_forkchoiceUpdated` call. The fields are encoded as follows: + +- `timestamp`: `QUANTITY`, 64 Bits - value for the `timestamp` field of the new payload +- `prevRandao`: `DATA`, 32 Bytes - value for the `prevRandao` field of the new payload +- `suggestedFeeRecipient`: `DATA`, 20 Bytes - suggested value for the `feeRecipient` field of the new payload + +### PayloadStatusV1 + +This structure contains the result of processing a payload. The fields are encoded as follows: + +- `status`: `enum` - `"VALID" | "INVALID" | "SYNCING" | "ACCEPTED" | "INVALID_BLOCK_HASH"` +- `latestValidHash`: `DATA|null`, 32 Bytes - the hash of the most recent *valid* block in the branch defined by payload and its ancestors +- `validationError`: `String|null` - a message providing additional details on the validation error if the payload is classified as `INVALID` or `INVALID_BLOCK_HASH`. + +### TransitionConfigurationV1 + +This structure contains configurable settings of the transition process. The fields are encoded as follows: +- `terminalTotalDifficulty`: `QUANTITY`, 256 Bits - maps on the `TERMINAL_TOTAL_DIFFICULTY` parameter of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#client-software-configuration) +- `terminalBlockHash`: `DATA`, 32 Bytes - maps on `TERMINAL_BLOCK_HASH` parameter of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#client-software-configuration) +- `terminalBlockNumber`: `QUANTITY`, 64 Bits - maps on `TERMINAL_BLOCK_NUMBER` parameter of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#client-software-configuration) + +## Routines + +### Payload validation + +Payload validation process consists of validating a payload with respect to the block header and execution environment rule sets. The process is specified as follows: + +1. Client software **MAY** obtain a parent state by executing ancestors of a payload as a part of the validation process. In this case each ancestor **MUST** also pass payload validation process. + +2. Client software **MUST** validate that the most recent PoW block in the chain of a payload ancestors satisfies terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#transition-block-validity). This check maps to the transition block validity section of the EIP. If this validation fails, the response **MUST** contain `{status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000}`. Additionally, each block in a tree of descendants of an invalid terminal block **MUST** be deemed `INVALID`. + +3. Client software **MUST** validate a payload according to the block header and execution environment rule set with modifications to these rule sets defined in the [Block Validity](https://eips.ethereum.org/EIPS/eip-3675#block-validity) section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#specification): + * If validation succeeds, the response **MUST** contain `{status: VALID, latestValidHash: payload.blockHash}` + * If validation fails, the response **MUST** contain `{status: INVALID, latestValidHash: validHash}` where `validHash` **MUST** be: + - The block hash of the ancestor of the invalid payload satisfying the following two conditions: + - It is fully validated and deemed `VALID` + - Any other ancestor of the invalid payload with a higher `blockNumber` is `INVALID` + - `0x0000000000000000000000000000000000000000000000000000000000000000` if the above conditions are satisfied by a PoW block. + - `null` if client software cannot determine the ancestor of the invalid + payload satisfying the above conditions. + * Client software **MUST NOT** surface an `INVALID` payload over any API endpoint and p2p interface. + +4. Client software **MAY** provide additional details on the validation error if a payload is deemed `INVALID` by assigning the corresponding message to the `validationError` field. + +5. The process of validating a payload on the canonical chain **MUST NOT** be affected by an active sync process on a side branch of the block tree. For example, if side branch `B` is `SYNCING` but the requisite data for validating a payload from canonical branch `A` is available, client software **MUST** run full validation of the payload and respond accordingly. + +### Sync + +In the context of this specification, the sync is understood as the process of obtaining data required to validate a payload. The sync process may consist of the following stages: + +1. Pulling data from remote peers in the network. +2. Passing ancestors of a payload through the [Payload validation](#payload-validation) and obtaining a parent state. + +*Note:* Each of these stages is optional. Exact behavior of client software during the sync process is implementation dependent. + +### Payload building + +The payload build process is specified as follows: + +1. Client software **MUST** set the payload field values according to the set of parameters passed into this method with exception of the `suggestedFeeRecipient`. The built `ExecutionPayload` **MAY** deviate the `feeRecipient` field value from what is specified by the `suggestedFeeRecipient` parameter. + +2. Client software **SHOULD** build the initial version of the payload which has an empty transaction set. + +3. Client software **SHOULD** start the process of updating the payload. The strategy of this process is implementation dependent. The default strategy is to keep the transaction set up-to-date with the state of local mempool. + +4. Client software **SHOULD** stop the updating process when either a call to `engine_getPayload` with the build process's `payloadId` is made or [`SECONDS_PER_SLOT`](https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#time-parameters-1) (12s in the Mainnet configuration) have passed since the point in time identified by the `timestamp` parameter. + +## Core + +### engine_newPayloadV1 + +#### Request + +* method: `engine_newPayloadV1` +* params: + 1. [`ExecutionPayloadV1`](#ExecutionPayloadV1) +* timeout: 8s + +#### Response + +* result: [`PayloadStatusV1`](#PayloadStatusV1) +* error: code and message set in case an exception happens while processing the payload. + +#### Specification + +1. Client software **MUST** validate `blockHash` value as being equivalent to `Keccak256(RLP(ExecutionBlockHeader))`, where `ExecutionBlockHeader` is the execution layer block header (the former PoW block header structure). Fields of this object are set to the corresponding payload values and constant values according to the Block structure section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#block-structure), extended with the corresponding section of [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399#block-structure). Client software **MUST** run this validation in all cases even if this branch or any other branches of the block tree are in an active sync process. + +2. Client software **MAY** initiate a sync process if requisite data for payload validation is missing. Sync process is specified in the [Sync](#sync) section. + +3. Client software **MUST** validate the payload if it extends the canonical chain and requisite data for the validation is locally available. The validation process is specified in the [Payload validation](#payload-validation) section. + +4. Client software **MAY NOT** validate the payload if the payload doesn't belong to the canonical chain. + +5. Client software **MUST** respond to this method call in the following way: + * `{status: INVALID_BLOCK_HASH, latestValidHash: null, validationError: errorMessage | null}` if the `blockHash` validation has failed + * `{status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000, validationError: errorMessage | null}` if terminal block conditions are not satisfied + * `{status: SYNCING, latestValidHash: null, validationError: null}` if requisite data for the payload's acceptance or validation is missing + * with the payload status obtained from the [Payload validation](#payload-validation) process if the payload has been fully validated while processing the call + * `{status: ACCEPTED, latestValidHash: null, validationError: null}` if the following conditions are met: + - the `blockHash` of the payload is valid + - the payload doesn't extend the canonical chain + - the payload hasn't been fully validated + - ancestors of a payload are known and comprise a well-formed chain. + +6. If any of the above fails due to errors unrelated to the normal processing flow of the method, client software **MUST** respond with an error object. + +### engine_forkchoiceUpdatedV1 + +#### Request + +* method: "engine_forkchoiceUpdatedV1" +* params: + 1. `forkchoiceState`: `Object` - instance of [`ForkchoiceStateV1`](#ForkchoiceStateV1) + 2. `payloadAttributes`: `Object|null` - instance of [`PayloadAttributesV1`](#PayloadAttributesV1) or `null` +* timeout: 8s + +#### Response + +* result: `object` + - `payloadStatus`: [`PayloadStatusV1`](#PayloadStatusV1); values of the `status` field in the context of this method are restricted to the following subset: + * `"VALID"` + * `"INVALID"` + * `"SYNCING"` + - `payloadId`: `DATA|null`, 8 Bytes - identifier of the payload build process or `null` +* error: code and message set in case an exception happens while the validating payload, updating the forkchoice or initiating the payload build process. + +#### Specification + +1. Client software **MAY** initiate a sync process if `forkchoiceState.headBlockHash` references an unknown payload or a payload that can't be validated because data that are requisite for the validation is missing. The sync process is specified in the [Sync](#sync) section. + +2. Client software **MAY** skip an update of the forkchoice state and **MUST NOT** begin a payload build process if `forkchoiceState.headBlockHash` references an ancestor of the head of canonical chain. In the case of such an event, client software **MUST** return `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}`. + +3. If `forkchoiceState.headBlockHash` references a PoW block, client software **MUST** validate this block with respect to terminal block conditions according to [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#transition-block-validity). This check maps to the transition block validity section of the EIP. Additionally, if this validation fails, client software **MUST NOT** update the forkchoice state and **MUST NOT** begin a payload build process. + +4. Before updating the forkchoice state, client software **MUST** ensure the validity of the payload referenced by `forkchoiceState.headBlockHash`, and **MAY** validate the payload while processing the call. The validation process is specified in the [Payload validation](#payload-validation) section. If the validation process fails, client software **MUST NOT** update the forkchoice state and **MUST NOT** begin a payload build process. + +5. Client software **MUST** update its forkchoice state if payloads referenced by `forkchoiceState.headBlockHash` and `forkchoiceState.finalizedBlockHash` are `VALID`. The update is specified as follows: + * The values `(forkchoiceState.headBlockHash, forkchoiceState.finalizedBlockHash)` of this method call map on the `POS_FORKCHOICE_UPDATED` event of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#block-validity) and **MUST** be processed according to the specification defined in the EIP + * All updates to the forkchoice state resulting from this call **MUST** be made atomically. + +6. Client software **MUST** return `-38002: Invalid forkchoice state` error if the payload referenced by `forkchoiceState.headBlockHash` is `VALID` and a payload referenced by either `forkchoiceState.finalizedBlockHash` or `forkchoiceState.safeBlockHash` does not belong to the chain defined by `forkchoiceState.headBlockHash`. + +7. Client software **MUST** ensure that `payloadAttributes.timestamp` is greater than `timestamp` of a block referenced by `forkchoiceState.headBlockHash`. If this condition isn't held client software **MUST** respond with `-38003: Invalid payload attributes` and **MUST NOT** begin a payload build process. In such an event, the `forkchoiceState` update **MUST NOT** be rolled back. + +8. Client software **MUST** begin a payload build process building on top of `forkchoiceState.headBlockHash` and identified via `buildProcessId` value if `payloadAttributes` is not `null` and the forkchoice state has been updated successfully. The build process is specified in the [Payload building](#payload-building) section. + +9. Client software **MUST** respond to this method call in the following way: + * `{payloadStatus: {status: SYNCING, latestValidHash: null, validationError: null}, payloadId: null}` if `forkchoiceState.headBlockHash` references an unknown payload or a payload that can't be validated because requisite data for the validation is missing + * `{payloadStatus: {status: INVALID, latestValidHash: validHash, validationError: errorMessage | null}, payloadId: null}` obtained from the [Payload validation](#payload-validation) process if the payload is deemed `INVALID` + * `{payloadStatus: {status: INVALID, latestValidHash: 0x0000000000000000000000000000000000000000000000000000000000000000, validationError: errorMessage | null}, payloadId: null}` obtained either from the [Payload validation](#payload-validation) process or as a result of validating a terminal PoW block referenced by `forkchoiceState.headBlockHash` + * `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: null}` if the payload is deemed `VALID` and a build process hasn't been started + * `{payloadStatus: {status: VALID, latestValidHash: forkchoiceState.headBlockHash, validationError: null}, payloadId: buildProcessId}` if the payload is deemed `VALID` and the build process has begun + * `{error: {code: -38002, message: "Invalid forkchoice state"}}` if `forkchoiceState` is either invalid or inconsistent + * `{error: {code: -38003, message: "Invalid payload attributes"}}` if the payload is deemed `VALID` and `forkchoiceState` has been applied successfully, but no build process has been started due to invalid `payloadAttributes`. + +10. If any of the above fails due to errors unrelated to the normal processing flow of the method, client software **MUST** respond with an error object. + +### engine_getPayloadV1 + +#### Request + +* method: `engine_getPayloadV1` +* params: + 1. `payloadId`: `DATA`, 8 Bytes - Identifier of the payload build process +* timeout: 1s + +#### Response + +* result: [`ExecutionPayloadV1`](#ExecutionPayloadV1) +* error: code and message set in case an exception happens while getting the payload. + +#### Specification + +1. Given the `payloadId` client software **MUST** return the most recent version of the payload that is available in the corresponding build process at the time of receiving the call. + +2. The call **MUST** return `-38001: Unknown payload` error if the build process identified by the `payloadId` does not exist. + +3. Client software **MAY** stop the corresponding build process after serving this call. + +### engine_exchangeTransitionConfigurationV1 + +#### Request + +* method: `engine_exchangeTransitionConfigurationV1` +* params: + 1. `transitionConfiguration`: `Object` - instance of [`TransitionConfigurationV1`](#TransitionConfigurationV1) +* timeout: 1s + +#### Response + +* result: [`TransitionConfigurationV1`](#TransitionConfigurationV1) +* error: code and message set in case an exception happens while getting a transition configuration. + +#### Specification + +1. Execution Layer client software **MUST** respond with configurable setting values that are set according to the Client software configuration section of [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#client-software-configuration). + +2. Execution Layer client software **SHOULD** surface an error to the user if local configuration settings mismatch corresponding values received in the call of this method, with exception for `terminalBlockNumber` value. + +3. Consensus Layer client software **SHOULD** surface an error to the user if local configuration settings mismatch corresponding values obtained from the response to the call of this method. + +4. Consensus Layer client software **SHOULD** poll this endpoint every 60 seconds. + +5. Execution Layer client software **SHOULD** surface an error to the user if it does not recieve a request on this endpoint at least once every 120 seconds. + +6. Considering the absence of the `TERMINAL_BLOCK_NUMBER` setting, Consensus Layer client software **MAY** use `0` value for the `terminalBlockNumber` field in the input parameters of this call. + +7. Considering the absence of the `TERMINAL_TOTAL_DIFFICULTY` value (i.e. when a value has not been decided), Consensus Layer and Execution Layer client software **MUST** use `115792089237316195423570985008687907853269984665640564039457584007913129638912` value (equal to`2**256-2**10`) for the `terminalTotalDifficulty` input parameter of this call. + +[json-rpc-spec]: https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/execution-apis/assembled-spec/openrpc.json&uiSchema[appBar][ui:splitView]=false&uiSchema[appBar][ui:input]=false&uiSchema[appBar][ui:examplesDropdown]=false diff --git a/openrpc/parse/testdata/execution-api/eth/block.yaml b/openrpc/parse/testdata/execution-api/eth/block.yaml new file mode 100644 index 0000000..c1c954c --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/block.yaml @@ -0,0 +1,72 @@ +- name: eth_getBlockByHash + summary: Returns information about a block by hash. + params: + - name: Block hash + required: true + schema: + $ref: '#/components/schemas/hash32' + - name: Hydrated transactions + required: true + schema: + title: hydrated + type: boolean + result: + name: Block information + schema: + $ref: '#/components/schemas/Block' +- name: eth_getBlockByNumber + summary: Returns information about a block by number. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + - name: Hydrated transactions + required: true + schema: + title: hydrated + type: boolean + result: + name: Block information + schema: + $ref: '#/components/schemas/Block' +- name: eth_getBlockTransactionCountByHash + summary: Returns the number of transactions in a block from a block matching the given block hash. + params: + - name: Block hash + schema: + $ref: '#/components/schemas/hash32' + result: + name: Transaction count + schema: + $ref: '#/components/schemas/uint' +- name: eth_getBlockTransactionCountByNumber + summary: Returns the number of transactions in a block matching the given block number. + params: + - name: Block + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Transaction count + schema: + $ref: '#/components/schemas/uint' +- name: eth_getUncleCountByBlockHash + summary: Returns the number of uncles in a block from a block matching the given block hash. + params: + - name: Block hash + schema: + $ref: '#/components/schemas/hash32' + result: + name: Uncle count + schema: + $ref: '#/components/schemas/uint' +- name: eth_getUncleCountByBlockNumber + summary: Returns the number of transactions in a block matching the given block number. + params: + - name: Block + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Uncle count + schema: + $ref: '#/components/schemas/uint' diff --git a/openrpc/parse/testdata/execution-api/eth/client.yaml b/openrpc/parse/testdata/execution-api/eth/client.yaml new file mode 100644 index 0000000..0af6f83 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/client.yaml @@ -0,0 +1,38 @@ +- name: eth_chainId + summary: Returns the chain ID of the current network. + params: [] + result: + name: Chain ID + schema: + $ref: '#/components/schemas/uint' +- name: eth_syncing + summary: Returns an object with data about the sync status or false. + params: [] + result: + name: Syncing status + schema: + $ref: '#/components/schemas/SyncingStatus' +- name: eth_coinbase + summary: Returns the client coinbase address. + params: [] + result: + name: Coinbase address + schema: + $ref: '#/components/schemas/address' +- name: eth_accounts + summary: Returns a list of addresses owned by client. + params: [] + result: + name: Accounts + schema: + title: Accounts + type: array + items: + $ref: '#/components/schemas/address' +- name: eth_blockNumber + summary: Returns the number of most recent block. + params: [] + result: + name: Block number + schema: + $ref: '#/components/schemas/uint' diff --git a/openrpc/parse/testdata/execution-api/eth/execute.yaml b/openrpc/parse/testdata/execution-api/eth/execute.yaml new file mode 100644 index 0000000..c5e5270 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/execute.yaml @@ -0,0 +1,56 @@ +- name: eth_call + summary: Executes a new message call immediately without creating a transaction on the block chain. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/GenericTransaction' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Return data + schema: + $ref: '#/components/schemas/bytes' +- name: eth_estimateGas + summary: Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/GenericTransaction' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Gas used + schema: + $ref: '#/components/schemas/uint' +- name: eth_createAccessList + summary: Generates an access list for a transaction. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/GenericTransaction' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Gas used + schema: + title: Access list result + type: object + properties: + accessList: + title: "accessList" + $ref: '#/components/schemas/AccessList' + error: + title: "error" + type: string + gasUsed: + title: Gas used + $ref: '#/components/schemas/uint' diff --git a/openrpc/parse/testdata/execution-api/eth/fee_market.yaml b/openrpc/parse/testdata/execution-api/eth/fee_market.yaml new file mode 100644 index 0000000..019fc43 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/fee_market.yaml @@ -0,0 +1,74 @@ +- name: eth_gasPrice + summary: Returns the current price per gas in wei. + params: [] + result: + name: Gas price + schema: + title: Gas price + $ref: '#/components/schemas/uint' +- name: eth_maxPriorityFeePerGas + summary: Returns the current maxPriorityFeePerGas per gas in wei. + params: [] + result: + name: Max priority fee per gas + schema: + title: Max priority fee per gas + $ref: '#/components/schemas/uint' +- name: eth_feeHistory + summary: Transaction fee history + description: Returns transaction base fee per gas and effective priority fee per gas for the requested/supported block range. + params: + - name: blockCount + description: Requested range of blocks. Clients will return less than the requested range if not all blocks are available. + required: true + schema: + $ref: '#/components/schemas/uint' + - name: newestBlock + description: Highest block of the requested range. + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + - name: rewardPercentiles + description: A monotonically increasing list of percentile values. For each block in the requested range, the transactions will be sorted in ascending order by effective tip per gas and the coresponding effective tip for the percentile will be determined, accounting for gas consumed. + required: true + schema: + title: rewardPercentiles + type: array + items: + title: rewardPercentile + description: Floating point value between 0 and 100. + type: number + result: + name: feeHistoryResult + description: Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available. + schema: + title: feeHistoryResults + description: Fee history results. + type: object + required: + - oldestBlock + - baseFeePerGas + - gasUsedRatio + properties: + oldestBlock: + title: oldestBlock + description: Lowest number block of returned range. + $ref: '#/components/schemas/uint' + baseFeePerGas: + title: baseFeePerGasArray + description: An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks. + type: array + items: + $ref: '#/components/schemas/uint' + reward: + title: rewardArray + description: A two-dimensional array of effective priority fees per gas at the requested block percentiles. + type: array + items: + title: rewardPercentile + description: An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty. + type: array + items: + title: rewardPercentile + description: A given percentile sample of effective priority fees per gas from a single block in ascending order, weighted by gas used. Zeroes are returned if the block is empty. + $ref: '#/components/schemas/uint' diff --git a/openrpc/parse/testdata/execution-api/eth/filter.yaml b/openrpc/parse/testdata/execution-api/eth/filter.yaml new file mode 100644 index 0000000..0138a4e --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/filter.yaml @@ -0,0 +1,64 @@ +- name: eth_newFilter + summary: Creates a filter object, based on filter options, to notify when the state changes (logs). + params: + - name: Filter + schema: + $ref: '#/components/schemas/Filter' + result: + name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' +- name: eth_newBlockFilter + summary: Creates a filter in the node, to notify when a new block arrives. + params: [] + result: + name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' +- name: eth_newPendingTransactionFilter + summary: Creates a filter in the node, to notify when new pending transactions arrive. + params: [] + result: + name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' +- name: eth_uninstallFilter + summary: Uninstalls a filter with given id. + params: + - name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' + result: + name: Success + schema: + type: boolean +- name: eth_getFilterChanges + summary: Polling method for a filter, which returns an array of logs which occurred since last poll. + params: + - name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' + result: + name: Log objects + schema: + $ref: '#/components/schemas/FilterResults' +- name: eth_getFilterLogs + summary: Returns an array of all logs matching filter with given id. + params: + - name: Filter Identifier + schema: + $ref: '#/components/schemas/uint' + result: + name: Log objects + schema: + $ref: '#/components/schemas/FilterResults' +- name: eth_getLogs + summary: Returns an array of all logs matching filter with given id. + params: + - name: Filter + schema: + $ref: '#/components/schemas/Filter' + result: + name: Log objects + schema: + $ref: '#/components/schemas/FilterResults' diff --git a/openrpc/parse/testdata/execution-api/eth/mining.yaml b/openrpc/parse/testdata/execution-api/eth/mining.yaml new file mode 100644 index 0000000..5512d84 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/mining.yaml @@ -0,0 +1,64 @@ +- name: eth_mining + summary: Returns whether the client is actively mining new blocks. + params: [] + result: + name: Mining status + schema: + title: miningStatus + type: boolean +- name: eth_hashrate + summary: Returns the number of hashes per second that the node is mining with. + params: [] + result: + name: Mining status + schema: + title: Hashrate + $ref: '#/components/schemas/uint' +- name: eth_getWork + summary: Returns the hash of the current block, the seedHash, and the boundary condition to be met (“targetâ€). + params: [] + result: + name: Current work + schema: + type: array + items: + - title: Proof-of-work hash + $ref: '#/components/schemas/bytes32' + - title: seed hash + $ref: '#/components/schemas/bytes32' + - title: difficulty + $ref: '#/components/schemas/bytes32' +- name: eth_submitWork + summary: Used for submitting a proof-of-work solution. + params: + - name: nonce + required: true + schema: + $ref: '#/components/schemas/bytes8' + - name: hash + required: true + schema: + $ref: '#/components/schemas/bytes32' + - name: digest + required: true + schema: + $ref: '#/components/schemas/bytes32' + result: + name: Success + schema: + type: boolean +- name: eth_submitHashrate + summary: Used for submitting mining hashrate. + params: + - name: Hashrate + required: true + schema: + $ref: '#/components/schemas/bytes32' + - name: ID + required: true + schema: + $ref: '#/components/schemas/bytes32' + result: + name: Success + schema: + type: boolean diff --git a/openrpc/parse/testdata/execution-api/eth/sign.yaml b/openrpc/parse/testdata/execution-api/eth/sign.yaml new file mode 100644 index 0000000..0d6f50d --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/sign.yaml @@ -0,0 +1,26 @@ +- name: eth_sign + summary: Returns an EIP-191 signature over the provided data. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Message + required: true + schema: + $ref: '#/components/schemas/bytes' + result: + name: Signature + schema: + $ref: '#/components/schemas/bytes65' +- name: eth_signTransaction + summary: Returns an RLP encoded transaction signed by the specified account. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/GenericTransaction' + result: + name: Encoded transaction + schema: + $ref: '#/components/schemas/bytes' diff --git a/openrpc/parse/testdata/execution-api/eth/state.yaml b/openrpc/parse/testdata/execution-api/eth/state.yaml new file mode 100644 index 0000000..08929db --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/state.yaml @@ -0,0 +1,86 @@ +- name: eth_getBalance + summary: Returns the balance of the account of given address. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Balance + schema: + $ref: '#/components/schemas/uint' +- name: eth_getStorageAt + summary: Returns the value from a storage position at a given address. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Storage slot + required: true + schema: + $ref: '#/components/schemas/uint256' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Value + schema: + $ref: '#/components/schemas/bytes' +- name: eth_getTransactionCount + summary: Returns the number of transactions sent from an address. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Transaction count + schema: + $ref: '#/components/schemas/uint' +- name: eth_getCode + summary: Returns code at a given address. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: Block + required: false + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Bytecode + schema: + $ref: '#/components/schemas/bytes' +- name: eth_getProof + summary: Returns the merkle proof for a given account and optionally some storage keys. + params: + - name: Address + required: true + schema: + $ref: '#/components/schemas/address' + - name: StorageKeys + required: true + schema: + title: Storage keys + type: array + items: + $ref: '#/components/schemas/hash32' + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + result: + name: Account + schema: + $ref: '#/components/schemas/AccountProof' diff --git a/openrpc/parse/testdata/execution-api/eth/submit.yaml b/openrpc/parse/testdata/execution-api/eth/submit.yaml new file mode 100644 index 0000000..000e2bf --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/submit.yaml @@ -0,0 +1,22 @@ +- name: eth_sendTransaction + summary: Signs and submits a transaction. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/GenericTransaction' + result: + name: Transaction hash + schema: + $ref: '#/components/schemas/hash32' +- name: eth_sendRawTransaction + summary: Submits a raw transaction. + params: + - name: Transaction + required: true + schema: + $ref: '#/components/schemas/bytes' + result: + name: Transaction hash + schema: + $ref: '#/components/schemas/hash32' diff --git a/openrpc/parse/testdata/execution-api/eth/transaction.yaml b/openrpc/parse/testdata/execution-api/eth/transaction.yaml new file mode 100644 index 0000000..f90a6e8 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/eth/transaction.yaml @@ -0,0 +1,51 @@ +- name: eth_getTransactionByHash + summary: Returns the information about a transaction requested by transaction hash. + params: + - name: Transaction hash + required: true + schema: + $ref: '#/components/schemas/hash32' + result: + name: Transaction information + schema: + $ref: '#/components/schemas/TransactionInfo' +- name: eth_getTransactionByBlockHashAndIndex + summary: Returns information about a transaction by block hash and transaction index position. + params: + - name: Block hash + required: true + schema: + $ref: '#/components/schemas/hash32' + - name: Transaction index + required: true + schema: + $ref: '#/components/schemas/uint' + result: + name: Transaction information + schema: + $ref: '#/components/schemas/TransactionInfo' +- name: eth_getTransactionByBlockNumberAndIndex + summary: Returns information about a transaction by block number and transaction index position. + params: + - name: Block + required: true + schema: + $ref: '#/components/schemas/BlockNumberOrTag' + - name: Transaction index + required: true + schema: + $ref: '#/components/schemas/uint' + result: + name: Transaction information + schema: + $ref: '#/components/schemas/TransactionInfo' +- name: eth_getTransactionReceipt + summary: Returns the receipt of a transaction by transaction hash. + params: + - name: Transaction hash + schema: + $ref: '#/components/schemas/hash32' + result: + name: Receipt Information + schema: + $ref: '#/components/schemas/ReceiptInfo' diff --git a/openrpc/parse/testdata/execution-api/schemas/base-types.yaml b/openrpc/parse/testdata/execution-api/schemas/base-types.yaml new file mode 100644 index 0000000..a657f63 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/base-types.yaml @@ -0,0 +1,49 @@ +address: + title: hex encoded address + type: string + pattern: ^0x[0-9,a-f,A-F]{40}$ +addresses: + title: hex encoded address + type: array + items: + $ref: '#/components/schemas/address' +byte: + title: hex encoded byte + type: string + pattern: ^0x([0-9,a-f,A-F]?){1,2}$ +bytes: + title: hex encoded bytes + type: string + pattern: ^0x[0-9a-f]*$ +bytes8: + title: 8 hex encoded bytes + type: string + pattern: ^0x[0-9a-f]{16}$ +bytes32: + title: 32 hex encoded bytes + type: string + pattern: ^0x([0-9a-f][0-9a-f]){0,32}$ +bytes256: + title: 256 hex encoded bytes + type: string + pattern: ^0x[0-9a-f]{512}$ +bytes65: + title: 65 hex encoded bytes + type: string + pattern: ^0x[0-9a-f]{512}$ +uint: + title: hex encoded unsigned integer + type: string + pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$ +uint64: + title: hex encoded unsigned integer + type: string + pattern: ^0x([1-9a-f][0-9a-f]{0,15})|0$ +uint256: + title: hex encoded unsigned integer + type: string + pattern: ^0x[0-9a-f]{0,64}$ +hash32: + title: 32 byte hex value + type: string + pattern: ^0x([0-9a-f][0-9a-f]){0,32}$ diff --git a/openrpc/parse/testdata/execution-api/schemas/block.yaml b/openrpc/parse/testdata/execution-api/schemas/block.yaml new file mode 100644 index 0000000..00f5761 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/block.yaml @@ -0,0 +1,125 @@ +Block: + title: Block object + type: object + required: + - parentHash + - sha3Uncles + - miner + - stateRoot + - transactionsRoot + - receiptsRoot + - logsBloom + - number + - gasLimit + - gasUsed + - timestamp + - extraData + - mixHash + - nonce + - size + - transactions + - uncles + properties: + parentHash: + title: Parent block hash + $ref: '#/components/schemas/hash32' + sha3Uncles: + title: Ommers hash + $ref: '#/components/schemas/hash32' + miner: + title: Coinbase + $ref: '#/components/schemas/address' + stateRoot: + title: State root + $ref: '#/components/schemas/hash32' + transactionsRoot: + title: Transactions root + $ref: '#/components/schemas/hash32' + receiptsRoot: + title: Receipts root + $ref: '#/components/schemas/hash32' + logsBloom: + title: Bloom filter + $ref: '#/components/schemas/bytes256' + difficulty: + title: Difficulty + $ref: '#/components/schemas/bytes' + number: + title: Number + $ref: '#/components/schemas/uint' + gasLimit: + title: Gas limit + $ref: '#/components/schemas/uint' + gasUsed: + title: Gas used + $ref: '#/components/schemas/uint' + timestamp: + title: Timestamp + $ref: '#/components/schemas/uint' + extraData: + title: Extra data + $ref: '#/components/schemas/bytes' + mixHash: + title: Mix hash + $ref: '#/components/schemas/hash32' + nonce: + title: Nonce + $ref: '#/components/schemas/bytes8' + totalDifficulty: + title: Total difficult + $ref: '#/components/schemas/uint' + baseFeePerGas: + title: Base fee per gas + $ref: '#/components/schemas/uint' + size: + title: Block size + $ref: '#/components/schemas/uint' + transactions: + anyOf: + - title: Transaction hashes + type: array + items: + $ref: '#/components/schemas/hash32' + - title: Full transactions + type: array + items: + $ref: '#/components/schemas/TransactionSigned' + uncles: + title: Uncles + type: array + items: + $ref: '#/components/schemas/hash32' +BlockTag: + title: Block tag + type: string + enum: + - earliest + - finalized + - safe + - latest + - pending + description: '`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions; `pending`: A sample next block built by the client on top of `latest` and containing the set of transactions usually taken from local mempool. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error' +BlockNumberOrTag: + title: Block number or tag + oneOf: + - title: Block number + $ref: '#/components/schemas/uint' + - title: Block tag + $ref: '#/components/schemas/BlockTag' +BadBlock: + title: Bad block + type: object + required: + - block + - hash + - rlp + properties: + block: + title: Block + $ref: '#/components/schemas/bytes' + hash: + title: Hash + $ref: '#/components/schemas/hash32' + rlp: + title: RLP + $ref: '#/components/schemas/bytes' diff --git a/openrpc/parse/testdata/execution-api/schemas/client.yaml b/openrpc/parse/testdata/execution-api/schemas/client.yaml new file mode 100644 index 0000000..faafb48 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/client.yaml @@ -0,0 +1,18 @@ +SyncingStatus: + title: Syncing status + oneOf: + - title: Syncing progress + type: object + properties: + startingBlock: + title: Starting block + $ref: '#/components/schemas/uint' + currentBlock: + title: Current block + $ref: '#/components/schemas/uint' + highestBlock: + title: Highest block + $ref: '#/components/schemas/uint' + - title: Not syncing + description: Should always return false if not syncing. + type: boolean diff --git a/openrpc/parse/testdata/execution-api/schemas/filter.yaml b/openrpc/parse/testdata/execution-api/schemas/filter.yaml new file mode 100644 index 0000000..51ebf0d --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/filter.yaml @@ -0,0 +1,51 @@ +FilterResults: + title: Filter results + oneOf: + - title: new block hashes + type: array + items: + $ref: '#/components/schemas/hash32' + - title: new transaction hashes + type: array + items: + $ref: '#/components/schemas/hash32' + - title: new logs + type: array + items: + $ref: '#/components/schemas/Log' +Filter: + title: filter + type: object + properties: + fromBlock: + title: from block + $ref: '#/components/schemas/uint' + toBlock: + title: to block + $ref: '#/components/schemas/uint' + address: + title: Address(es) + oneOf: + - title: Address + $ref: '#/components/schemas/address' + - title: Addresses + $ref: '#/components/schemas/addresses' + topics: + title: Topics + $ref: '#/components/schemas/FilterTopics' +FilterTopics: + title: Filter Topics + type: array + items: + $ref: '#/components/schemas/FilterTopic' +FilterTopic: + title: Filter Topic List Entry + oneOf: + - title: Any Topic Match + type: "null" + - title: Single Topic Match + $ref: '#/components/schemas/bytes32' + - title: Multiple Topic Match + type: array + items: + $ref: '#/components/schemas/bytes32' diff --git a/openrpc/parse/testdata/execution-api/schemas/receipt.yaml b/openrpc/parse/testdata/execution-api/schemas/receipt.yaml new file mode 100644 index 0000000..9da2350 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/receipt.yaml @@ -0,0 +1,104 @@ +Log: + title: log + type: object + required: + - transactionHash + properties: + removed: + title: removed + type: boolean + logIndex: + title: log index + $ref: '#/components/schemas/uint' + transactionIndex: + title: transaction index + $ref: '#/components/schemas/uint' + transactionHash: + title: transaction hash + $ref: '#/components/schemas/hash32' + blockHash: + title: block hash + $ref: '#/components/schemas/hash32' + blockNumber: + title: block number + $ref: '#/components/schemas/uint' + address: + title: address + $ref: '#/components/schemas/address' + data: + title: data + $ref: '#/components/schemas/bytes' + topics: + title: topics + type: array + items: + $ref: '#/components/schemas/bytes32' +ReceiptInfo: + type: object + title: Receipt info + required: + - blockHash + - blockNumber + - from + - cumulativeGasUsed + - gasUsed + - logs + - logsBloom + - transactionHash + - transactionIndex + - effectiveGasPrice + properties: + transactionHash: + title: transaction hash + $ref: '#/components/schemas/hash32' + transactionIndex: + title: transaction index + $ref: '#/components/schemas/uint' + blockHash: + title: block hash + $ref: '#/components/schemas/hash32' + blockNumber: + title: block number + $ref: '#/components/schemas/uint' + from: + title: from + $ref: '#/components/schemas/address' + to: + title: to + description: Address of the receiver or null in a contract creation transaction. + $ref: '#/components/schemas/address' + cumulativeGasUsed: + title: cumulative gas used + description: The sum of gas used by this transaction and all preceding transactions in the same block. + $ref: '#/components/schemas/uint' + gasUsed: + title: gas used + description: The amount of gas used for this specific transaction alone. + $ref: '#/components/schemas/uint' + contractAddress: + title: contract address + description: The contract address created, if the transaction was a contract creation, otherwise null. + oneOf: + - $ref: '#/components/schemas/address' + - name: Null + type: "null" + logs: + title: logs + type: array + items: + $ref: '#/components/schemas/Log' + logsBloom: + title: logs bloom + $ref: '#/components/schemas/bytes256' + root: + title: state root + description: The post-transaction state root. Only specified for transactions included before the Byzantium upgrade. + $ref: '#/components/schemas/bytes32' + status: + title: status + description: Either 1 (success) or 0 (failure). Only specified for transactions included after the Byzantium upgrade. + $ref: '#/components/schemas/uint' + effectiveGasPrice: + title: effective gas price + description: The actual value per gas deducted from the senders account. Before EIP-1559, this is equal to the transaction's gas price. After, it is equal to baseFeePerGas + min(maxFeePerGas - baseFeePerGas, maxPriorityFeePerGas). + $ref: '#/components/schemas/uint' diff --git a/openrpc/parse/testdata/execution-api/schemas/state.yaml b/openrpc/parse/testdata/execution-api/schemas/state.yaml new file mode 100644 index 0000000..e50a968 --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/state.yaml @@ -0,0 +1,56 @@ +AccountProof: + title: Account proof + type: object + required: + - address + - accountProof + - balance + - codeHash + - nonce + - storageHash + - storageProof + properties: + address: + title: address + $ref: '#/components/schemas/address' + accountProof: + title: accountProof + type: array + items: + $ref: '#/components/schemas/bytes' + balance: + title: balance + $ref: '#/components/schemas/uint256' + codeHash: + title: codeHash + $ref: '#/components/schemas/hash32' + nonce: + title: nonce + $ref: '#/components/schemas/uint64' + storageHash: + title: storageHash + $ref: '#/components/schemas/hash32' + storageProof: + title: storageProof + type: array + items: + $ref: '#/components/schemas/StorageProof' +StorageProof: + title: Storage proof + type: object + required: + - key + - value + - proof + properties: + key: + title: key + $ref: '#/components/schemas/hash32' + value: + title: value + $ref: '#/components/schemas/uint256' + proof: + title: proof + type: array + items: + $ref: '#/components/schemas/bytes' diff --git a/openrpc/parse/testdata/execution-api/schemas/transaction.yaml b/openrpc/parse/testdata/execution-api/schemas/transaction.yaml new file mode 100644 index 0000000..bf8166a --- /dev/null +++ b/openrpc/parse/testdata/execution-api/schemas/transaction.yaml @@ -0,0 +1,289 @@ +AccessListEntry: + title: Access list entry + type: object + properties: + address: + $ref: '#/components/schemas/address' + storageKeys: + type: array + items: + $ref: '#/components/schemas/hash32' +AccessList: + title: Access list + type: array + items: + $ref: '#/components/schemas/AccessListEntry' +Transaction1559Unsigned: + type: object + title: EIP-1559 transaction. + required: + - type + - nonce + - gas + - value + - input + - maxFeePerGas + - maxPriorityFeePerGas + - chainId + - accessList + properties: + type: + title: type + $ref: '#/components/schemas/byte' + nonce: + title: nonce + $ref: '#/components/schemas/uint' + to: + title: to address + $ref: '#/components/schemas/address' + gas: + title: gas limit + $ref: '#/components/schemas/uint' + value: + title: value + $ref: '#/components/schemas/uint' + input: + title: input data + $ref: '#/components/schemas/bytes' + maxPriorityFeePerGas: + title: max priority fee per gas + description: Maximum fee per gas the sender is willing to pay to miners in wei + $ref: '#/components/schemas/uint' + maxFeePerGas: + title: max fee per gas + description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei + $ref: '#/components/schemas/uint' + accessList: + title: accessList + description: EIP-2930 access list + $ref: '#/components/schemas/AccessList' + chainId: + title: chainId + description: Chain ID that this transaction is valid on. + $ref: '#/components/schemas/uint' +Transaction2930Unsigned: + type: object + title: EIP-2930 transaction. + required: + - type + - nonce + - gas + - value + - input + - gasPrice + - chainId + - accessList + properties: + type: + title: type + $ref: '#/components/schemas/byte' + nonce: + title: nonce + $ref: '#/components/schemas/uint' + to: + title: to address + $ref: '#/components/schemas/address' + gas: + title: gas limit + $ref: '#/components/schemas/uint' + value: + title: value + $ref: '#/components/schemas/uint' + input: + title: input data + $ref: '#/components/schemas/bytes' + gasPrice: + title: gas price + description: The gas price willing to be paid by the sender in wei + $ref: '#/components/schemas/uint' + accessList: + title: accessList + description: EIP-2930 access list + $ref: '#/components/schemas/AccessList' + chainId: + title: chainId + description: Chain ID that this transaction is valid on. + $ref: '#/components/schemas/uint' +TransactionLegacyUnsigned: + type: object + title: Legacy transaction. + required: + - type + - nonce + - gas + - value + - input + - gasPrice + properties: + type: + title: type + $ref: '#/components/schemas/byte' + nonce: + title: nonce + $ref: '#/components/schemas/uint' + to: + title: to address + $ref: '#/components/schemas/address' + gas: + title: gas limit + $ref: '#/components/schemas/uint' + value: + title: value + $ref: '#/components/schemas/uint' + input: + title: input data + $ref: '#/components/schemas/bytes' + gasPrice: + title: gas price + description: The gas price willing to be paid by the sender in wei + $ref: '#/components/schemas/uint' + chainId: + title: chainId + description: Chain ID that this transaction is valid on. + $ref: '#/components/schemas/uint' +TransactionUnsigned: + oneOf: + - $ref: '#/components/schemas/Transaction1559Unsigned' + - $ref: '#/components/schemas/Transaction2930Unsigned' + - $ref: '#/components/schemas/TransactionLegacyUnsigned' +Transaction1559Signed: + title: Signed 1559 Transaction + type: object + allOf: + - $ref: '#/components/schemas/Transaction1559Unsigned' + - title: EIP-1559 transaction signature properties. + required: + - yParity + - r + - s + properties: + yParity: + title: yParity + description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. + $ref: '#/components/schemas/uint' + r: + title: r + $ref: '#/components/schemas/uint' + s: + title: s + $ref: '#/components/schemas/uint' +Transaction2930Signed: + title: Signed 2930 Transaction + type: object + allOf: + - $ref: '#/components/schemas/Transaction2930Unsigned' + - title: EIP-2930 transaction signature properties. + required: + - yParity + - r + - s + properties: + yParity: + title: yParity + description: The parity (0 for even, 1 for odd) of the y-value of the secp256k1 signature. + $ref: '#/components/schemas/uint' + r: + title: r + $ref: '#/components/schemas/uint' + s: + title: s + $ref: '#/components/schemas/uint' +TransactionLegacySigned: + title: Signed Legacy Transaction + type: object + allOf: + - $ref: '#/components/schemas/TransactionLegacyUnsigned' + - title: Legacy transaction signature properties. + required: + - v + - r + - s + properties: + v: + title: v + $ref: '#/components/schemas/uint' + r: + title: r + $ref: '#/components/schemas/uint' + s: + title: s + $ref: '#/components/schemas/uint' +TransactionSigned: + oneOf: + - $ref: '#/components/schemas/Transaction1559Signed' + - $ref: '#/components/schemas/Transaction2930Signed' + - $ref: '#/components/schemas/TransactionLegacySigned' +TransactionInfo: + type: object + title: Transaction information + allOf: + - title: Contextual information + required: + - blockHash + - blockNumber + - from + - hash + - transactionIndex + properties: + blockHash: + title: block hash + $ref: '#/components/schemas/hash32' + blockNumber: + title: block number + $ref: '#/components/schemas/uint' + from: + title: from address + $ref: '#/components/schemas/address' + hash: + title: transaction hash + $ref: '#/components/schemas/hash32' + transactionIndex: + title: transaction index + $ref: '#/components/schemas/uint' + - $ref: '#/components/schemas/TransactionSigned' +GenericTransaction: + type: object + title: Transaction object generic to all types + properties: + type: + title: type + $ref: '#/components/schemas/byte' + nonce: + title: nonce + $ref: '#/components/schemas/uint' + to: + title: to address + $ref: '#/components/schemas/address' + from: + title: from address + $ref: '#/components/schemas/address' + gas: + title: gas limit + $ref: '#/components/schemas/uint' + value: + title: value + $ref: '#/components/schemas/uint' + input: + title: input data + $ref: '#/components/schemas/bytes' + gasPrice: + title: gas price + description: The gas price willing to be paid by the sender in wei + $ref: '#/components/schemas/uint' + maxPriorityFeePerGas: + title: max priority fee per gas + description: Maximum fee per gas the sender is willing to pay to miners in wei + $ref: '#/components/schemas/uint' + maxFeePerGas: + title: max fee per gas + description: The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei + $ref: '#/components/schemas/uint' + accessList: + title: accessList + description: EIP-2930 access list + $ref: '#/components/schemas/AccessList' + chainId: + title: chainId + description: Chain ID that this transaction is valid on. + $ref: '#/components/schemas/uint' + diff --git a/openrpc/templates/cli.gotmpl b/openrpc/templates/cli.gotmpl new file mode 100644 index 0000000..4fb2c28 --- /dev/null +++ b/openrpc/templates/cli.gotmpl @@ -0,0 +1,10 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +package main + +import "github.com/gregdhill/go-openrpc/cmd" + +func main() { + cmd.Execute() +} + diff --git a/openrpc/templates/cli_cmd.gotmpl b/openrpc/templates/cli_cmd.gotmpl new file mode 100644 index 0000000..ab7cbc7 --- /dev/null +++ b/openrpc/templates/cli_cmd.gotmpl @@ -0,0 +1,300 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +package cmd + +import ( + "strconv" + "strings" + "errors" + "fmt" + "log" + "github.com/spf13/cobra" + + "net/http" + "io/ioutil" + "bytes" + "os" + + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/viper" + rpct "github.com/gregdhill/go-openrpc/rpc" + "encoding/json" + +) + + +var cfgFile string +var rpcAddr string + +{{- $cliName := programName }} + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "{{ $cliName }}", + Short: "{{ .Info.Title }} CLI", + Long: `This is an auto-generated CLI interface for an Open-RPC compliant API. + +Open-RPC Version: {{ .Info.Version }} + +Run '{{ $cliName }} completion --help' to learn about auto-auto-completion! It's easy! + `, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// completionCmd represents the completion command +var completionCmd = &cobra.Command{ + Use: "completion", + Short: "Generates bash completion scripts", + Long: `To load completion run + +. <({{ $cliName }} completion) + +To configure your bash shell to load completions for each session add to your bashrc + +# ~/.bashrc or ~/.profile +. <({{ $cliName }} completion) +`, + Run: func(cmd *cobra.Command, args []string) { + rootCmd.GenBashCompletion(os.Stdout); + }, +} + +var errJSONRPC = errors.New("json rpc did return error") +func makeJSONRPCRequest(name string, params []byte) ([]byte, error) { + reqBody := rpct.RPCRequest{ + JSONRPC: "2.0", + Method: name, + Params: params, + ID: os.Getpid(), // TODO + } + + reqBod, err := json.Marshal(reqBody) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", rpcAddr, bytes.NewBuffer(reqBod)) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", "application/json") + + client := &http.Client{} + + resp, err := client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + body, _ := ioutil.ReadAll(resp.Body) + + if resp.StatusCode != 200 { + err = errors.New("request errored") + return body, err + } + + errResponse := rpct.RPCErrorResponse{} + err = json.Unmarshal(body, &errResponse) + if err != nil { + return body, err + } + if errResponse.Error != nil { + // Did get error response from server. + return body, errJSONRPC + } + + return body, nil +} + +func handleJSONRPCResponse(body []byte, err error) { + fmt.Println(string(body)) + if err == nil { + os.Exit(0) + } + if err == errJSONRPC { + os.Exit(1) + } + os.Exit(2) +} + +// marshalParams returns a JSONified map or array +// If any of the values contain an "=", then a map will +// be used. +// When using a map, if not ALL values contain an =, +// then an error will be thrown. +func marshalParams(params []string) ([]byte, error) { + + paramsMapT := make(map[string]interface{}) + paramsArrayT := []interface{}{} + + if len(params) == 0 { + return json.Marshal(paramsArrayT) + } + + useArray := true + + for _, a := range params { + if strings.Contains(a, "=") { + useArray = false + break + } + } + for _, a := range params { + if !useArray && !strings.Contains(a, "=") { + return nil, errors.New("invalid params - when using '=' syntax for an object parameter, all values must be of the format key=value") + } + + var key, val string + if !useArray { + kv := strings.Split(a, "=") + if len(kv) != 2 { + return nil, errors.New("invalid params, syntax be k=v, got: " + a) + } + key, val = kv[0], kv[1] + } else { + val = a + } + + if vint, err := strconv.Atoi(val); err == nil { + paramsMapT[key] = vint + paramsArrayT = append(paramsArrayT, vint) + } else if vbool, err := strconv.ParseBool(val); err == nil { + paramsMapT[key] = vbool + paramsArrayT = append(paramsArrayT, vbool) + } else { + paramsMapT[key] = val + paramsArrayT = append(paramsArrayT, val) + } + } + + + /* + if verbose { + log.Println("request", ) + } + */ + + if useArray { + return json.Marshal(paramsArrayT) + } + return json.Marshal(paramsMapT) +} + +{{ $components := .Components }} +{{ range .Methods }} + +{{ $paramsLength := (len .Params) }} + +var {{ .Name | camelCase | lowerFirst }}Cmd = &cobra.Command{ + Use: "{{ .Name }}", + Short: "{{ .Summary }}", + Long: ` + +Params: {{ if eq (len .Params) 0 }}<NONE> +{{ else}} + +{{- range $index, $element := .Params }} +{{- $d := lookupContentDescriptor $components $element }} + +- ({{$index}}):{{if $d.Required }} [Required] {{end}}<{{ $d.Name }}> +{{ derefSchema $components $element.Schema | schemaAsJSONPretty | sanitizeBackticks }} + +{{- end }} +{{ end -}} + +Returns: +{{- $r := lookupContentDescriptor $components .Result }} +{{ derefSchema $components $r.Schema | schemaAsJSONPretty | sanitizeBackticks }} + +{{- if ne .ExternalDocs.URL ""}} + +For more information see {{- printf "%s" .ExternalDocs.Description }}: {{- printf "%s" .ExternalDocs.URL }} +{{- end}} + `, + {{if .Deprecated -}} + Deprecated: "DEPRECATED: Use at your own risk.", + PreRun: func(cmd *cobra.Command, args []string) { + log.Println("WARNING: This method ({{.Name}}) is deprecated. Use at your own risk.") + }, + {{- end }} + Run: func(cmd *cobra.Command, args []string) { + + // len params: {{ $paramsLength }} + params, err := marshalParams(args) + if err != nil { + log.Fatalln(err) + } + body, err := makeJSONRPCRequest("{{.Name}}", params) + handleJSONRPCResponse(body, err) + }, +} + +{{- end }} + + + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func init() { + cobra.OnInitialize(initConfig) + + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + {{- $defaultAddr := "http://localhost:8545" }} + {{- if gt (len .Servers) 0 }} + {{- $serverZ := slice .Servers 0 }} + {{- $defaultAddr = $serverZ.URL }} + {{- end }} + + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.{{ $cliName }}.yaml)") + rootCmd.PersistentFlags().StringVar(&rpcAddr, "http-addr", "{{ $defaultAddr }}", "Address for JSON-RPC HTTP calls") + + + // Cobra also supports local flags, which will only run + // when this action is called directly. + rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + + rootCmd.AddCommand(completionCmd) +{{- range .Methods }} + rootCmd.AddCommand({{.Name | camelCase | lowerFirst }}Cmd) +{{- end }} +} + + +// initConfig reads in config file and ENV variables if set. +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + + // Search config in home directory with name ".{{ $cliName }}" (without extension). + viper.AddConfigPath(home) + viper.SetConfigName(".{{ $cliName }}") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + if err := viper.ReadInConfig(); err == nil { + fmt.Println("Using config file:", viper.ConfigFileUsed()) + } +} diff --git a/openrpc/templates/example-proxy-server.gotmpl b/openrpc/templates/example-proxy-server.gotmpl new file mode 100644 index 0000000..c7bb475 --- /dev/null +++ b/openrpc/templates/example-proxy-server.gotmpl @@ -0,0 +1,163 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +// This example program starts a basic HTTP server that would act as a proxy +// to the upstream server described by an Open-RPC configuration. + +package main + +import ( + "log" + "net/http" + rpct "github.com/gregdhill/go-openrpc/rpc" + "encoding/json" + "reflect" + "bytes" + "io/ioutil" +) + + +// https://github.com/a8m/reflect-examples#wrap-a-reflectvalue-with-pointer-t--t +func ptr(v reflect.Value) reflect.Value { + pt := reflect.PtrTo(v.Type()) + pv := reflect.New(pt.Elem()) + pv.Elem().Set(v) + return pv +} + +func ResultToStruct(msg json.RawMessage, res interface{}) error { + var err error + val := reflect.ValueOf(res) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + // Get first (and only field) + field := val.Field(0) + if field.CanSet() { + pf := ptr(field) + err = json.Unmarshal(msg, pf.Interface()) + if err != nil { + return err + } + field.Set(pf.Elem()) + } + return nil +} + +var gethClientRPC string + +type exampleRPCService struct{} + +{{- range .Methods }} +{{- $name := .Name | camelCase }} +{{- $params := (maybeMethodParams .) }} +{{- $result := (maybeMethodResult .) }} +{{- $method := printf "%s" $name }} +{{- $original_method := printf "%s" $name }} +{{- if $params }} +{{- $method = printf "%s(params *rpct.%s)" $method $params }} +{{- else }} +{{- $method = printf "%s()" $method }} +{{- end }} +{{- if $result }} +{{- $method = printf "%s (result *rpct.%s, err error)" $method $result }} +{{- else }} +{{- $method = printf "%s error" $method $result }} +{{- end }} +{{ printf "func (s *exampleRPCService) %s {" $method }} +{{- if $params }} +{{ printf "defer log.Println(\"%s\", \"params=\", params)" .Name }} +{{- end }} +{{ printf "defer log.Println(`%s`)" .Name }} + +req := rpct.RPCRequest{ + JSONRPC: "2.0", + Method: "{{ .Name }}", + Params: []byte("[]"), + ID: 1, + } + +{{- if $params }} + if params != nil { + set := []interface{}{} + val := reflect.ValueOf(params).Elem() + + for i := 0; i < val.NumField(); i++ { + valField := val.Field(i) + set = append(set, valField.Interface()) + } + + b, err := json.Marshal(set) + if err != nil { + return nil, err + } + + req.Params = b + } +{{- end }} + + reqB, err := json.Marshal(&req) + if err != nil { + return nil, err + } + log.Println("posting", string(reqB)) + buf := bytes.NewBuffer(reqB) + res, err := http.Post(gethClientRPC, "application/json", buf) + if err != nil { + log.Println("POST error:", err) + return nil, err + } + +{{- if $result }} + + gotB, err := ioutil.ReadAll(res.Body) + if err != nil { + log.Println("read body error:", err) + return nil, err + } + + // TODO: handle server error response + + gotRes := &struct{ + JSONRPC string `json:"jsonrpc"` + Result json.RawMessage `json:"result"` + ID interface{} `json:"id"` + }{} + + err = json.Unmarshal(gotB, gotRes) + if err != nil { + log.Println("json unmarshal error:", err, "data", string(gotB)) + return nil, err + } + log.Println("received OK response:", string(gotB)) + + wantRes := new(rpct.{{ $result }}) + err = ResultToStruct(gotRes.Result, wantRes) + if err != nil { + log.Println("result to struct error:", err, "result", gotRes.Result) + return nil, err + } + + return wantRes, nil + +{{- else }} + + return + +{{- end }} + +{{ printf "%s" "}" }} +{{- end }} + +func main() { + gethClientRPC = "http://localhost:8545" + service := new(exampleRPCService) + server := rpct.NewServer(service) + + s := http.Server{ + Addr: ":3000", + Handler: server, + } + log.Println("Expecting upstream eth RPC endpoint at", gethClientRPC) + log.Println("Serving on http://localhost:3000 ...") + log.Fatal(s.ListenAndServe()) +} \ No newline at end of file diff --git a/openrpc/templates/server.gotmpl b/openrpc/templates/server.gotmpl new file mode 100644 index 0000000..e5f07dd --- /dev/null +++ b/openrpc/templates/server.gotmpl @@ -0,0 +1,293 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "reflect" +) + +const JSONRPC = "2.0" + +type Code uint32 + +const ( + ErrUnknown Code = iota + ErrCouldNotParse + ErrInvalidRequest + ErrNotFound + ErrInvalidParams + ErrInternal + ErrServer +) + +func (c Code) Error() string { + return fmt.Sprintf("Error %d: %s", c, c.String()) +} + +func (c Code) String() string { + switch c { + case ErrCouldNotParse: + return "could not parse input" + case ErrInvalidRequest: + return "invalid request" + case ErrNotFound: + return "not found" + case ErrInvalidParams: + return "invalid parameters" + case ErrInternal: + return "internal error" + case ErrServer: + return "server error" + default: + return "unknown error" + } +} + +func (c Code) RPCError() *RPCError { + switch c { + case ErrCouldNotParse: + return NewRPCError(-32700, c.String()) + case ErrInvalidRequest: + return NewRPCError(-32600, c.String()) + case ErrNotFound: + return NewRPCError(-32601, c.String()) + case ErrInvalidParams: + return NewRPCError(-32602, c.String()) + case ErrInternal: + return NewRPCError(-32603, c.String()) + case ErrServer: + return NewRPCError(-32000, c.String()) + default: + return NewRPCError(-32099, c.String()) + } +} + +func (c Code) RPCErrorWithMessage(msg string) *RPCError { + resp := c.RPCError() + resp.Message = msg + return resp +} + +// https://www.jsonrpc.org/specification#request_object +type RPCRequest struct { + JSONRPC string `json:"jsonrpc"` + Method string `json:"method"` + Params json.RawMessage `json:"params"` + ID interface{} `json:"id"` +} + +// https://www.jsonrpc.org/specification#response_object +type RPCResultResponse struct { + JSONRPC string `json:"jsonrpc"` + Result interface{} `json:"result"` + ID interface{} `json:"id"` +} + +// https://www.jsonrpc.org/specification#response_object +type RPCErrorResponse struct { + JSONRPC string `json:"jsonrpc"` + Error *RPCError `json:"error"` + ID interface{} `json:"id"` +} + +// https://www.jsonrpc.org/specification#error_object +type RPCError struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data,omitempty"` +} + +func NewRPCError(code int, msg string) *RPCError { + return &RPCError{Code: code, Message: msg} +} + +type Server struct { + service GoOpenRPCService +} + +func NewServer(rpc GoOpenRPCService) *Server { + return &Server{rpc} +} + +func (srv *Server) HandleHTTP(rpcPath string) { + http.Handle(rpcPath, srv) +} + +// https://github.com/a8m/reflect-examples#wrap-a-reflectvalue-with-pointer-t--t +func ptr(v reflect.Value) reflect.Value { + pt := reflect.PtrTo(v.Type()) + pv := reflect.New(pt.Elem()) + pv.Elem().Set(v) + return pv +} + +func ParamsToStruct(msg json.RawMessage, req interface{}) error { + // by-name + err := json.Unmarshal(msg, req) + if err == nil { + return nil + } + + // by-position + params := make([]json.RawMessage, 0) + err = json.Unmarshal(msg, ¶ms) + if err != nil { + return err + } + val := reflect.ValueOf(req) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + + for i, p := range params { + if i >= val.NumField() { + break + } + field := val.Field(i) + if field.CanSet() { + pf := ptr(field) + err = json.Unmarshal(p, pf.Interface()) + if err != nil { + return err + } + field.Set(pf.Elem()) + } + } + return nil +} + +func StructToResult(in interface{}) interface{} { + val := reflect.ValueOf(in) + if val.Kind() == reflect.Ptr { + val = val.Elem() + } + if val.Kind() != reflect.Struct { + return in + } + if val.NumField() == 1 { + return val.Field(0).Interface() + } else if val.NumField() > 1 { + result := make([]interface{}, 0) + for i := 0; i < val.NumField(); i++ { + field := val.Field(i) + if val.Kind() == reflect.Ptr { + field = field.Elem() + } + + if field.Kind() == reflect.Slice { + for i := 0; i < field.Len(); i++ { + result = append(result, field.Index(i).Interface()) + } + } else if field.CanInterface() { + result = append(result, field.Interface()) + } + } + return result + } else { + return nil + } +} + +func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.Method == http.MethodOptions { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET") + w.Header().Set("Access-Control-Allow-Headers", "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range") + w.Header().Set("Accept-Range", "bytes") + w.WriteHeader(http.StatusOK) + w.Write([]byte{}) + return + } else if r.Method != http.MethodPost { + WriteError(w, "", ErrInternal.RPCError()) + return + } + + data, err := ioutil.ReadAll(r.Body) + if err != nil { + WriteError(w, nil, ErrInvalidRequest.RPCError()) + return + } + r.Body.Close() + + in := new(RPCRequest) + err = json.Unmarshal(data, in) + if err != nil { + WriteError(w, nil, ErrCouldNotParse.RPCError()) + return + } + + if in.JSONRPC != JSONRPC || in.Method == "" || in.ID == nil { + WriteError(w, nil, ErrInvalidParams.RPCError()) + return + } + + var out interface{} + + switch in.Method { + {{- range .Methods }} + case "{{ .Name }}": + {{- $name := .Name | camelCase }} + {{- $params := maybeMethodParams . }} + {{- $result := maybeMethodResult . }} + + {{- if $params }} + req := new({{ $params }}) + err = ParamsToStruct(in.Params, req) + if err == nil { + {{- if $result }} + out, err = srv.service.{{ $name }}(req) + {{- else }} + err = srv.service.{{ $name }}(req) + {{- end }} + } + {{- else }} + {{- if $result }} + out, err = srv.service.{{ $name }}() + {{- else }} + err = srv.service.{{ $name }}() + {{- end }} + {{- end }} + + {{- end }} + } + + if err != nil { + WriteError(w, in.ID, ErrInternal.RPCErrorWithMessage(err.Error())) + return + } + + WriteData(w, in.ID, out) +} + +func WriteError(w http.ResponseWriter, id interface{}, resp *RPCError) { + data, err := json.Marshal(&RPCErrorResponse{ + JSONRPC: JSONRPC, + Error: resp, + ID: id, + }) + if err != nil { + panic(err) + } + w.Header().Set("Content-Type", "application/json") + w.Write(data) +} + +func WriteData(w http.ResponseWriter, id interface{}, result interface{}) { + resp := &RPCResultResponse{ + JSONRPC: JSONRPC, + ID: id, + Result: StructToResult(result), + } + data, err := json.Marshal(resp) + if err != nil { + WriteError(w, id, ErrInternal.RPCError()) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + w.Write(data) +} \ No newline at end of file diff --git a/openrpc/templates/types.gotmpl b/openrpc/templates/types.gotmpl new file mode 100644 index 0000000..7c88656 --- /dev/null +++ b/openrpc/templates/types.gotmpl @@ -0,0 +1,37 @@ +// Code generated by go-openrpc. DO NOT EDIT. + +package main + +type GoOpenRPCService interface { +{{- range .Methods }} +{{- $name := .Name | camelCase }} +{{- $params := (maybeMethodParams .) }} +{{- $result := (maybeMethodResult .) }} +{{- $method := printf "%s" $name }} +{{- if $params }} +{{- $method = printf "%s(*%s)" $method $params }} +{{- else }} +{{- $method = printf "%s()" $method }} +{{- end }} +{{- if $result }} +{{- $method = printf "%s (*%s, error)" $method $result }} +{{- else }} +{{- $method = printf "%s error" $method $result }} +{{- end }} +{{ maybeMethodComment . }} +{{ printf "%s" $method }} +{{- end }} +} + +{{- range (getObjects .Objects) }} +{{ printf "type %s struct {" .Name }} +{{- range (getFields .Fields) }} +{{ maybeFieldComment .Desc }} +{{- if (eq .Name .Type) }} +{{ printf "%s" .Name }} +{{- else }} +{{ printf "%s %s `json:\"%s\"`" .Name .Type (lowerFirst .Name) }} +{{- end }} +{{- end }} +{{ printf "}" }} +{{- end }} diff --git a/openrpc/types/objects.go b/openrpc/types/objects.go new file mode 100644 index 0000000..e84b970 --- /dev/null +++ b/openrpc/types/objects.go @@ -0,0 +1,78 @@ +package types + +import "gfx.cafe/open/jrpc/openrpc/util" + +type BasicType struct { + Desc string + Name string + Type string +} + +type FieldMap struct { + fields map[string]BasicType + keys []string +} + +func NewFieldMap() *FieldMap { + return &FieldMap{ + fields: make(map[string]BasicType, 0), + keys: make([]string, 0), + } +} + +func (fm *FieldMap) Set(key string, value BasicType) { + key = util.CamelCase(key) + value.Name = util.CamelCase(value.Name) + _, exists := fm.fields[key] + fm.fields[key] = value + if !exists { + fm.keys = append(fm.keys, key) + } +} + +func (fm *FieldMap) Get(key string) BasicType { + return fm.fields[key] +} + +func (fm *FieldMap) GetKeys() []string { + return fm.keys +} + +type ObjectMap struct { + objects map[string]*FieldMap + keys []string +} + +func NewObjectMap() *ObjectMap { + return &ObjectMap{ + objects: make(map[string]*FieldMap, 0), + keys: make([]string, 0), + } +} + +func (om *ObjectMap) Set(key string, value BasicType) { + if key == "" { + return + } else if value.Name == "" { + return + } else if util.CamelCase(key) == value.Type { + return + } + key = util.CamelCase(key) + _, exists := om.objects[key] + if !exists { + if om.objects[key] == nil { + om.objects[key] = NewFieldMap() + } + om.keys = append(om.keys, key) + } + om.objects[key].Set(value.Name, value) +} + +func (om *ObjectMap) Get(key string) *FieldMap { + return om.objects[key] +} + +func (om *ObjectMap) GetKeys() []string { + return om.keys +} diff --git a/openrpc/types/types.go b/openrpc/types/types.go new file mode 100644 index 0000000..9227c79 --- /dev/null +++ b/openrpc/types/types.go @@ -0,0 +1,265 @@ +package types + +import ( + "encoding/json" + "os" + "path" + "path/filepath" + + "github.com/go-openapi/spec" + "sigs.k8s.io/yaml" +) + +type Contact struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` + Email string `json:"email,omitempty"` +} + +type License struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +type Info struct { + Title string `json:"title"` + Description string `json:"description,omitempty"` + TermsOfService string `json:"termsOfService,omitempty"` + Contact *Contact `json:"contact,omitempty"` + License *License `json:"license,omitempty"` + Version string `json:"version"` +} + +type ServerVariable struct { + Enum []string `json:"enum,omitempty"` + Default string `json:"default,omitempty"` + Description string `json:"description,omitempty"` +} + +type Server struct { + Name string `json:"name"` + URL string `json:"url"` + Summary string `json:"summary,omitempty"` + Description string `json:"description,omitempty"` + Variables map[string]ServerVariable `json:"variables,omitempty"` +} + +type ExternalDocs struct { + Description string `json:"description,omitempty"` + URL string `json:"url,omitempty"` +} + +type Tag struct { + Name string `json:"name"` + Summary string `json:"summary,omitempty"` + Description string `json:"description,omitempty"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` +} + +type Content struct { + Name string `json:"name"` + Summary string `json:"summary,omitempty"` + Description string `json:"description,omitempty"` + Required bool `json:"required,omitempty"` + Deprecated bool `json:"deprecated,omitempty"` + Schema spec.Schema `json:"schema"` +} + +type ContentDescriptor struct { + Content +} + +func (cd *ContentDescriptor) UnmarshalJSON(data []byte) error { + cont := new(Content) + err := json.Unmarshal(data, cont) + if err != nil { + return err + } + cd.Content = *cont + + params := make(map[string]interface{}) + err = json.Unmarshal(data, ¶ms) + if err != nil { + return err + } + + if _, ok := params["$ref"]; ok { + sch := new(spec.Schema) + err = json.Unmarshal(data, sch) + if err != nil { + return err + } + cd.Schema = *sch + } + + return nil + +} + +// https://www.jsonrpc.org/specification#error_object +type Error struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data"` +} + +type Link struct { + Name string `json:"name"` + Description string `json:"description"` + Summary string `json:"summary"` + Method string `json:"method"` + Params map[string]interface{} `json:"params"` + Server Server `json:"server"` +} + +type Example struct { + Name string `json:"name"` + Summary string `json:"summary"` + Description string `json:"description"` + Value interface{} `json:"value"` + ExternalValue string `json:"externalValue"` +} + +type ExamplePairing struct { + Name string `json:"name"` + Description string `json:"description"` + Summary string `json:"summary"` + Params []Example `json:"params"` + Result Example `json:"result"` +} + +type Method struct { + Name string `json:"name"` + Tags []Tag `json:"tags,omitempty"` + Summary string `json:"summary,omitempty"` + Description string `json:"description,omitempty"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` + Params []*ContentDescriptor `json:"params"` + Result *ContentDescriptor `json:"result"` + Deprecated bool `json:"deprecated,omitempty"` + Servers []Server `json:"servers,omitempty"` + Errors []Error `json:"errors,omitempty"` + Links []Link `json:"links,omitempty"` + ParamStructure string `json:"paramStructure,omitempty"` + Examples []ExamplePairing `json:"examples,omitempty"` +} + +type Components struct { + ContentDescriptors map[string]*ContentDescriptor `json:"contentDescriptors,omitempty"` + Schemas map[string]spec.Schema `json:"schemas,omitempty"` + Examples map[string]Example `json:"examples,omitempty"` + Links map[string]Link `json:"links,omitempty"` + Errors map[string]Error `json:"errors,omitempty"` + ExamplePairingObjects map[string]ExamplePairing `json:"examplePairingObjects,omitempty"` + Tags map[string]Tag `json:"tags,omitempty"` +} + +type OpenRPCSpec1 struct { + OpenRPC string `json:"openrpc"` + Info Info `json:"info"` + Servers []Server `json:"servers"` + Methods []Method `json:"methods"` + Components Components `json:"components"` + ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` + + Objects *ObjectMap `json:"-"` +} + +func NewOpenRPCSpec1() *OpenRPCSpec1 { + return &OpenRPCSpec1{ + OpenRPC: "1.0.0", + Info: Info{ + Title: "gfx.cafe/open/jrpc/openrpc", + Version: "0.0.0", + }, + Servers: make([]Server, 0), + Methods: make([]Method, 0), + + Objects: NewObjectMap(), + } +} + +func (o *OpenRPCSpec1) AddSchemas(pth string) error { + dr, err := os.ReadDir(pth) + if err != nil { + return err + } + for _, v := range dr { + if v.IsDir() { + if err := o.AddSchemas(path.Join(pth, v.Name())); err != nil { + return err + } + } else { + if err := o.AddSchema(path.Join(pth, v.Name())); err != nil { + return err + } + } + } + return nil +} + +func (o *OpenRPCSpec1) AddSchema(pth string) error { + schem := map[string]spec.Schema{} + bts, err := os.ReadFile(pth) + if err != nil { + return err + } + ext := filepath.Ext(path.Base(pth)) + switch ext { + case ".json": + err = json.Unmarshal(bts, &schem) + case ".yml", ".yaml": + err = yaml.Unmarshal(bts, &schem) + } + if err != nil { + return err + } + if o.Components.Schemas == nil { + o.Components.Schemas = map[string]spec.Schema{} + } + for k, v := range schem { + o.Components.Schemas[k] = v + } + return nil +} + +func (o *OpenRPCSpec1) AddMethods(pth string) error { + dr, err := os.ReadDir(pth) + if err != nil { + return err + } + for _, v := range dr { + if v.IsDir() { + if err := o.AddMethods(path.Join(pth, v.Name())); err != nil { + return err + } + } else { + if err := o.AddMethod(path.Join(pth, v.Name())); err != nil { + return err + } + } + } + return nil +} + +func (o *OpenRPCSpec1) AddMethod(pth string) error { + var meth []Method + bts, err := os.ReadFile(pth) + if err != nil { + return err + } + switch filepath.Ext(path.Base(pth)) { + case ".json": + err = json.Unmarshal(bts, &meth) + case ".yml", ".yaml": + err = yaml.Unmarshal(bts, &meth) + if err != nil { + return err + } + } + if err != nil { + return err + } + o.Methods = append(o.Methods, meth...) + return nil +} diff --git a/openrpc/util/common.go b/openrpc/util/common.go new file mode 100644 index 0000000..d01c8d4 --- /dev/null +++ b/openrpc/util/common.go @@ -0,0 +1,54 @@ +package util + +import ( + "regexp" + "strings" + "unicode" + + "github.com/davecgh/go-spew/spew" +) + +func SanitizeBackticks(s string) string { + reg, err := regexp.Compile("`") + if err != nil { + panic(err.Error()) + } + s = reg.ReplaceAllString(s, "'") + return s +} + +func Slice(val []interface{}, index int) interface{} { + return val[index] +} + +func Inpect(val interface{}) string { + return spew.Sdump(val) +} + +func CamelCase(name string) string { + in := strings.Split(name, "_") + if len(in) == 0 { + return strings.Title(name) + } + out := make([]string, 0, len(in)) + for _, word := range in { + out = append(out, strings.Title(word)) + } + return strings.TrimSpace(strings.Join(out, "")) +} + +func LowerFirst(name string) string { + for i, v := range name { + return string(unicode.ToLower(v)) + name[i+1:] + } + return "" +} + +func FirstOf(opts ...string) string { + for _, opt := range opts { + if opt != "" { + return opt + } + } + return "" +} -- GitLab