diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb2d116a8..703f403bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,24 +68,3 @@ jobs: cache-to: type=gha,mode=max tags: ${{ steps.meta-indexer.outputs.tags }} labels: ${{ steps.meta-indexer.outputs.labels }} - - # Sandbox GUI - - - name: GUI image tags & labels - id: meta-gui - uses: docker/metadata-action@v3 - with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-gui - - - name: GUI image build & push - uses: docker/build-push-action@v2 - with: - context: . - file: build/sandbox/Dockerfile - build-args: | - TAG=4.6.0 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - tags: ${{ steps.meta-gui.outputs.tags }} - labels: ${{ steps.meta-gui.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ef945cf6..6bd894d6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: - "*.*.*" jobs: - build: + publish: name: Publish Github release runs-on: ubuntu-latest steps: @@ -26,3 +26,29 @@ jobs: # with: # environment: production # version: ${{ env.RELEASE_VERSION }} + + build: + name: Build sandbox GUI + runs-on: ubuntu-latest + env: + DOCKER_REGISTRY: ghcr.io + DOCKER_IMAGE_BASE: ${{ github.repository }} + steps: + - name: GUI image tags & labels + id: meta-gui + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}-gui + + - name: GUI image build & push + uses: docker/build-push-action@v2 + with: + context: . + file: build/sandbox/Dockerfile + build-args: | + TAG=4.6.0 + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: ${{ steps.meta-gui.outputs.tags }} + labels: ${{ steps.meta-gui.outputs.labels }} diff --git a/Makefile b/Makefile index 7af162a44..72c39ade1 100644 --- a/Makefile +++ b/Makefile @@ -89,3 +89,6 @@ sandbox-down: sandbox-clear: COMPOSE_PROJECT_NAME=bcdbox docker-compose -f docker-compose.flextesa.yml down -v + +generate: + go generate ./... \ No newline at end of file diff --git a/cmd/indexer/indexer/initializer.go b/cmd/indexer/indexer/initializer.go index b98bc52f4..d58e9346e 100644 --- a/cmd/indexer/indexer/initializer.go +++ b/cmd/indexer/indexer/initializer.go @@ -39,12 +39,12 @@ func (initializer Initializer) Init(ctx context.Context) error { // check first block in node and in database, compare its hash. // if hash is differed new periodic chain was started. logger.Info().Str("network", initializer.network.String()).Msg("checking for new periodic chain...") - header, err := initializer.rpc.GetHeader(ctx, 1) + blockHash, err := initializer.rpc.BlockHash(ctx, 1) if err != nil { return err } firstBlock, err := initializer.block.Get(1) - if err == nil && firstBlock.Hash != header.Hash { + if err == nil && firstBlock.Hash != blockHash { logger.Info().Str("network", initializer.network.String()).Msg("found new periodic chain") logger.Warning().Str("network", initializer.network.String()).Msg("drop database...") if err := initializer.repo.Drop(ctx); err != nil { diff --git a/go.mod b/go.mod index 095b9c515..3faea472d 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,6 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/go-pg/pg/v10 v10.10.6 github.com/go-playground/validator/v10 v10.14.1 - github.com/golang/mock v1.6.0 github.com/google/uuid v1.3.0 github.com/iancoleman/strcase v0.2.0 github.com/ipfs/go-cid v0.3.2 @@ -28,12 +27,12 @@ require ( github.com/pyroscope-io/client v0.7.2 github.com/robfig/cron/v3 v3.0.1 github.com/rs/zerolog v1.28.0 - github.com/schollz/progressbar/v3 v3.10.1 github.com/sergi/go-diff v1.2.0 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.8.3 github.com/tidwall/gjson v1.14.3 github.com/yhirose/go-peg v0.0.0-20210804202551-de25d6753cf1 + go.uber.org/mock v0.2.0 golang.org/x/crypto v0.12.0 golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 gopkg.in/yaml.v3 v3.0.1 @@ -62,10 +61,8 @@ require ( github.com/matryer/is v1.4.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.13 // indirect github.com/memcachier/mc/v3 v3.0.3 // indirect github.com/minio/sha256-simd v1.0.0 // indirect - github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -78,7 +75,6 @@ require ( github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pyroscope-io/godeltaprof v0.1.2 // indirect - github.com/rivo/uniseg v0.2.0 // indirect github.com/robfig/go-cache v0.0.0-20130306151617-9fc39e0dbf62 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/tidwall/match v1.1.1 // indirect @@ -93,7 +89,6 @@ require ( golang.org/x/arch v0.3.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/sys v0.11.0 // indirect - golang.org/x/term v0.11.0 // indirect golang.org/x/text v0.12.0 // indirect google.golang.org/protobuf v1.30.0 // indirect lukechampine.com/blake3 v1.1.6 // indirect diff --git a/go.sum b/go.sum index 2a77d5134..929eef563 100644 --- a/go.sum +++ b/go.sum @@ -77,8 +77,6 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -122,7 +120,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= 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/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw= github.com/karlseguin/ccache v2.0.3+incompatible h1:j68C9tWOROiOLWTS/kCGg9IcJG+ACqn5+0+t8Oh83UU= github.com/karlseguin/ccache v2.0.3+incompatible/go.mod h1:CM9tNPzT6EdRh14+jiW8mEF9mkNZuuE51qmgGYUB93w= github.com/karlseguin/expect v1.0.8 h1:Bb0H6IgBWQpadY25UDNkYPDB9ITqK1xnSoZfAq362fw= @@ -158,16 +155,12 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/memcachier/mc/v3 v3.0.3 h1:qii+lDiPKi36O4Xg+HVKwHu6Oq+Gt17b+uEiA0Drwv4= github.com/memcachier/mc/v3 v3.0.3/go.mod h1:GzjocBahcXPxt2cmqzknrgqCOmMxiSzhVKPOe90Tpug= github.com/microcosm-cc/bluemonday v1.0.20 h1:flpzsq4KU3QIYAYGV/szUat7H+GPOXR0B2JU5A1Wp8Y= github.com/microcosm-cc/bluemonday v1.0.20/go.mod h1:yfBmMi8mxvaZut3Yytv+jTXRY8mxyjJ0/kQBTElld50= github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo6g= github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= -github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -213,8 +206,6 @@ github.com/pyroscope-io/client v0.7.2 h1:OX2qdUQsS8RSkn/3C8isD7f/P0YiZQlRbAlecAa github.com/pyroscope-io/client v0.7.2/go.mod h1:FEocnjn+Ngzxy6EtU9ZxXWRvQ0+pffkrBxHLnPpxwi8= github.com/pyroscope-io/godeltaprof v0.1.2 h1:MdlEmYELd5w+lvIzmZvXGNMVzW2Qc9jDMuJaPOR75g4= github.com/pyroscope-io/godeltaprof v0.1.2/go.mod h1:psMITXp90+8pFenXkKIpNhrfmI9saQnPbba27VIaiQE= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/robfig/go-cache v0.0.0-20130306151617-9fc39e0dbf62 h1:pyecQtsPmlkCsMkYhT5iZ+sUXuwee+OvfuJjinEA3ko= @@ -225,8 +216,6 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= -github.com/schollz/progressbar/v3 v3.10.1 h1:6A8v8TIcCJL4yemlUJS9gdcpZ++Gy6toOh1JzKQkz+U= -github.com/schollz/progressbar/v3 v3.10.1/go.mod h1:R2djRgv58sn00AGysc4fN0ip4piOGd3z88K+zVBjczs= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= @@ -274,14 +263,14 @@ github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlV github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM= github.com/yhirose/go-peg v0.0.0-20210804202551-de25d6753cf1 h1:7iTmQ0lZwTtfm4XMgP5ezzWMDCjo7GTS0ZgCj6jpVzM= github.com/yhirose/go-peg v0.0.0-20210804202551-de25d6753cf1/go.mod h1:q2QWLflHsZxT6ixYcXveTYicEvxGh5Uv6CnI7f7BfjQ= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= +go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180910181607-0e37d006457b/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -292,18 +281,15 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL 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-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -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-20180906233101-161cd47e91fd/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-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= @@ -311,7 +297,6 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -326,8 +311,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w 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-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-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-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -335,16 +318,12 @@ golang.org/x/sys v0.0.0-20210923061019-b8560ed6a9b7/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/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/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/text v0.3.0/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= @@ -359,12 +338,7 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm 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-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -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= 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/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= diff --git a/internal/config/config.go b/internal/config/config.go index 785026d81..f95c1c70b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -208,7 +208,7 @@ func LoadDefaultConfig() (Config, error) { EnvironmentProd: "production.yml", EnvironmentBox: "sandbox.yml", EnvironmentDev: "../../configs/development.yml", - EnvironmentTestnets: "testnets.yml", + EnvironmentTestnets: "../../configs/testnets.yml", } env := os.Getenv(EnvironmentVar) diff --git a/internal/config/options.go b/internal/config/options.go index d0f1433b2..ab629245a 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -42,7 +42,7 @@ func WithRPC(rpcConfig map[string]RPCConfig) ContextOption { opts = append(opts, noderpc.WithLog()) } - ctx.RPC = noderpc.NewNodeRPC(rpcProvider.URI, opts...) + ctx.RPC = noderpc.NewWaitNodeRPC(rpcProvider.URI, opts...) } } } diff --git a/internal/models/account/repository.go b/internal/models/account/repository.go index 4328a5d3e..ba8e14e60 100644 --- a/internal/models/account/repository.go +++ b/internal/models/account/repository.go @@ -1,6 +1,6 @@ package account -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/account/mock.go -package=account -typed type Repository interface { Get(address string) (Account, error) } diff --git a/internal/models/bigmapaction/repository.go b/internal/models/bigmapaction/repository.go index e45a92de0..525cdfbda 100644 --- a/internal/models/bigmapaction/repository.go +++ b/internal/models/bigmapaction/repository.go @@ -1,6 +1,6 @@ package bigmapaction -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/bigmapaction/mock.go -package=bigmapaction -typed type Repository interface { Get(ptr, limit, offset int64) ([]BigMapAction, error) } diff --git a/internal/models/bigmapdiff/repository.go b/internal/models/bigmapdiff/repository.go index a59fdc583..34d608c31 100644 --- a/internal/models/bigmapdiff/repository.go +++ b/internal/models/bigmapdiff/repository.go @@ -1,6 +1,6 @@ package bigmapdiff -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/bigmapdiff/mock.go -package=bigmapdiff -typed type Repository interface { Get(ctx GetContext) ([]Bucket, error) GetByAddress(address string) ([]BigMapDiff, error) diff --git a/internal/models/block/repository.go b/internal/models/block/repository.go index 65d4502c0..b426ef9bd 100644 --- a/internal/models/block/repository.go +++ b/internal/models/block/repository.go @@ -1,6 +1,6 @@ package block -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/block/mock.go -package=block -typed type Repository interface { Get(level int64) (Block, error) Last() (Block, error) diff --git a/internal/models/contract/repository.go b/internal/models/contract/repository.go index 1c7549094..7cd6d6c73 100644 --- a/internal/models/contract/repository.go +++ b/internal/models/contract/repository.go @@ -6,7 +6,7 @@ import ( "github.com/baking-bad/bcdhub/internal/models/types" ) -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/contract/mock.go -package=contract -typed type Repository interface { Get(address string) (Contract, error) GetAll(filters map[string]interface{}) ([]Contract, error) @@ -22,7 +22,7 @@ type Repository interface { FindOne(tags types.Tags) (Contract, error) } -// ScriptRepository - +//go:generate mockgen -source=$GOFILE -destination=../mock/contract/mock.go -package=contract -typed type ScriptRepository interface { GetScripts(limit, offset int) ([]Script, error) ByHash(hash string) (Script, error) @@ -34,7 +34,7 @@ type ScriptRepository interface { Views(id int64) ([]byte, error) } -// ConstantRepository - +//go:generate mockgen -source=$GOFILE -destination=../mock/contract/mock.go -package=contract -typed type ConstantRepository interface { Get(address string) (GlobalConstant, error) All(addresses ...string) ([]GlobalConstant, error) diff --git a/internal/models/domains/repository.go b/internal/models/domains/repository.go index bed95719e..b122362f8 100644 --- a/internal/models/domains/repository.go +++ b/internal/models/domains/repository.go @@ -4,7 +4,7 @@ import ( "github.com/baking-bad/bcdhub/internal/models/contract" ) -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/domains/mock.go -package=domains -typed type Repository interface { BigMapDiffs(lastID, size int64) ([]BigMapDiff, error) diff --git a/internal/models/interface.go b/internal/models/interface.go index 648dbffb4..f994fc98c 100644 --- a/internal/models/interface.go +++ b/internal/models/interface.go @@ -4,7 +4,7 @@ import ( "context" ) -// GeneralRepository - +//go:generate mockgen -source=$GOFILE -destination=mock/general.go -package=mock -typed type GeneralRepository interface { CreateTables() error DeleteByContract(indices []string, address string) error diff --git a/internal/models/migration/repository.go b/internal/models/migration/repository.go index bb114115e..324bbd134 100644 --- a/internal/models/migration/repository.go +++ b/internal/models/migration/repository.go @@ -1,6 +1,6 @@ package migration -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/migration/mock.go -package=migration -typed type Repository interface { Get(contractID int64) ([]Migration, error) } diff --git a/internal/models/mock/account/mock.go b/internal/models/mock/account/mock.go index fd977409f..8a628efe6 100644 --- a/internal/models/mock/account/mock.go +++ b/internal/models/mock/account/mock.go @@ -1,14 +1,18 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/account/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/account/mock.go -package=account -typed +// // Package account is a generated GoMock package. package account import ( reflect "reflect" - model "github.com/baking-bad/bcdhub/internal/models/account" - gomock "github.com/golang/mock/gomock" + account "github.com/baking-bad/bcdhub/internal/models/account" + gomock "go.uber.org/mock/gomock" ) // MockRepository is a mock of Repository interface. @@ -35,16 +39,40 @@ func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { } // Get mocks base method. -func (m *MockRepository) Get(address string) (model.Account, error) { +func (m *MockRepository) Get(address string) (account.Account, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", address) - ret0, _ := ret[0].(model.Account) + ret0, _ := ret[0].(account.Account) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockRepositoryMockRecorder) Get(address interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) Get(address any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 account.Account, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(string) (account.Account, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(string) (account.Account, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/bigmapaction/mock.go b/internal/models/mock/bigmapaction/mock.go index 7f69066cd..79b5903dd 100644 --- a/internal/models/mock/bigmapaction/mock.go +++ b/internal/models/mock/bigmapaction/mock.go @@ -1,49 +1,78 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/bigmapaction/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/bigmapaction/mock.go -package=bigmapaction -typed +// // Package bigmapaction is a generated GoMock package. package bigmapaction import ( - model "github.com/baking-bad/bcdhub/internal/models/bigmapaction" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + bigmapaction "github.com/baking-bad/bcdhub/internal/models/bigmapaction" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(ptr, limit, offset int64) ([]model.BigMapAction, error) { +// Get mocks base method. +func (m *MockRepository) Get(ptr, limit, offset int64) ([]bigmapaction.BigMapAction, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", ptr, limit, offset) - ret0, _ := ret[0].([]model.BigMapAction) + ret0, _ := ret[0].([]bigmapaction.BigMapAction) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(ptr, limit, offset interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(ptr, limit, offset any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ptr, limit, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ptr, limit, offset) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 []bigmapaction.BigMapAction, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(int64, int64, int64) ([]bigmapaction.BigMapAction, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(int64, int64, int64) ([]bigmapaction.BigMapAction, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/bigmapdiff/mock.go b/internal/models/mock/bigmapdiff/mock.go index 908e252fc..958169e8d 100644 --- a/internal/models/mock/bigmapdiff/mock.go +++ b/internal/models/mock/bigmapdiff/mock.go @@ -1,260 +1,625 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/bigmapdiff/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/bigmapdiff/mock.go -package=bigmapdiff -typed +// // Package bigmapdiff is a generated GoMock package. package bigmapdiff import ( - model "github.com/baking-bad/bcdhub/internal/models/bigmapdiff" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + bigmapdiff "github.com/baking-bad/bcdhub/internal/models/bigmapdiff" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(ctx model.GetContext) ([]model.Bucket, error) { +// Count mocks base method. +func (m *MockRepository) Count(ptr int64) (int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", ctx) - ret0, _ := ret[0].([]model.Bucket) + ret := m.ctrl.Call(m, "Count", ptr) + ret0, _ := ret[0].(int64) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(ctx interface{}) *gomock.Call { +// Count indicates an expected call of Count. +func (mr *MockRepositoryMockRecorder) Count(ptr any) *RepositoryCountCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ctx) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockRepository)(nil).Count), ptr) + return &RepositoryCountCall{Call: call} } -// GetByAddress mocks base method -func (m *MockRepository) GetByAddress(address string) ([]model.BigMapDiff, error) { +// RepositoryCountCall wrap *gomock.Call +type RepositoryCountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryCountCall) Return(arg0 int64, arg1 error) *RepositoryCountCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryCountCall) Do(f func(int64) (int64, error)) *RepositoryCountCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryCountCall) DoAndReturn(f func(int64) (int64, error)) *RepositoryCountCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Current mocks base method. +func (m *MockRepository) Current(keyHash string, ptr int64) (bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByAddress", address) - ret0, _ := ret[0].([]model.BigMapDiff) + ret := m.ctrl.Call(m, "Current", keyHash, ptr) + ret0, _ := ret[0].(bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByAddress indicates an expected call of GetByAddress -func (mr *MockRepositoryMockRecorder) GetByAddress(address interface{}) *gomock.Call { +// Current indicates an expected call of Current. +func (mr *MockRepositoryMockRecorder) Current(keyHash, ptr any) *RepositoryCurrentCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByAddress", reflect.TypeOf((*MockRepository)(nil).GetByAddress), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Current", reflect.TypeOf((*MockRepository)(nil).Current), keyHash, ptr) + return &RepositoryCurrentCall{Call: call} } -// GetForOperation mocks base method -func (m *MockRepository) GetForOperation(id int64) ([]model.BigMapDiff, error) { +// RepositoryCurrentCall wrap *gomock.Call +type RepositoryCurrentCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryCurrentCall) Return(arg0 bigmapdiff.BigMapState, arg1 error) *RepositoryCurrentCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryCurrentCall) Do(f func(string, int64) (bigmapdiff.BigMapState, error)) *RepositoryCurrentCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryCurrentCall) DoAndReturn(f func(string, int64) (bigmapdiff.BigMapState, error)) *RepositoryCurrentCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CurrentByContract mocks base method. +func (m *MockRepository) CurrentByContract(contract string) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetForOperation", id) - ret0, _ := ret[0].([]model.BigMapDiff) + ret := m.ctrl.Call(m, "CurrentByContract", contract) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CurrentByContract indicates an expected call of CurrentByContract. +func (mr *MockRepositoryMockRecorder) CurrentByContract(contract any) *RepositoryCurrentByContractCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentByContract", reflect.TypeOf((*MockRepository)(nil).CurrentByContract), contract) + return &RepositoryCurrentByContractCall{Call: call} +} + +// RepositoryCurrentByContractCall wrap *gomock.Call +type RepositoryCurrentByContractCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryCurrentByContractCall) Return(arg0 []bigmapdiff.BigMapState, arg1 error) *RepositoryCurrentByContractCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryCurrentByContractCall) Do(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryCurrentByContractCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryCurrentByContractCall) DoAndReturn(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryCurrentByContractCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockRepository) Get(ctx bigmapdiff.GetContext) ([]bigmapdiff.Bucket, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", ctx) + ret0, _ := ret[0].([]bigmapdiff.Bucket) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetForOperation indicates an expected call of GetForOperation -func (mr *MockRepositoryMockRecorder) GetForOperation(id interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(ctx any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForOperation", reflect.TypeOf((*MockRepository)(nil).GetForOperation), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ctx) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 []bigmapdiff.Bucket, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// GetByPtr mocks base method -func (m *MockRepository) GetByPtr(contract string, ptr int64) ([]model.BigMapState, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(bigmapdiff.GetContext) ([]bigmapdiff.Bucket, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(bigmapdiff.GetContext) ([]bigmapdiff.Bucket, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByAddress mocks base method. +func (m *MockRepository) GetByAddress(address string) ([]bigmapdiff.BigMapDiff, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetByAddress", address) + ret0, _ := ret[0].([]bigmapdiff.BigMapDiff) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetByAddress indicates an expected call of GetByAddress. +func (mr *MockRepositoryMockRecorder) GetByAddress(address any) *RepositoryGetByAddressCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByAddress", reflect.TypeOf((*MockRepository)(nil).GetByAddress), address) + return &RepositoryGetByAddressCall{Call: call} +} + +// RepositoryGetByAddressCall wrap *gomock.Call +type RepositoryGetByAddressCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByAddressCall) Return(arg0 []bigmapdiff.BigMapDiff, arg1 error) *RepositoryGetByAddressCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByAddressCall) Do(f func(string) ([]bigmapdiff.BigMapDiff, error)) *RepositoryGetByAddressCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByAddressCall) DoAndReturn(f func(string) ([]bigmapdiff.BigMapDiff, error)) *RepositoryGetByAddressCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByPtr mocks base method. +func (m *MockRepository) GetByPtr(contract string, ptr int64) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetByPtr", contract, ptr) - ret0, _ := ret[0].([]model.BigMapState) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByPtr indicates an expected call of GetByPtr -func (mr *MockRepositoryMockRecorder) GetByPtr(contract, ptr interface{}) *gomock.Call { +// GetByPtr indicates an expected call of GetByPtr. +func (mr *MockRepositoryMockRecorder) GetByPtr(contract, ptr any) *RepositoryGetByPtrCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByPtr", reflect.TypeOf((*MockRepository)(nil).GetByPtr), contract, ptr) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByPtr", reflect.TypeOf((*MockRepository)(nil).GetByPtr), contract, ptr) + return &RepositoryGetByPtrCall{Call: call} +} + +// RepositoryGetByPtrCall wrap *gomock.Call +type RepositoryGetByPtrCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByPtrCall) Return(arg0 []bigmapdiff.BigMapState, arg1 error) *RepositoryGetByPtrCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// GetByPtrAndKeyHash mocks base method -func (m *MockRepository) GetByPtrAndKeyHash(ptr int64, keyHash string, size, offset int64) ([]model.BigMapDiff, int64, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByPtrCall) Do(f func(string, int64) ([]bigmapdiff.BigMapState, error)) *RepositoryGetByPtrCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByPtrCall) DoAndReturn(f func(string, int64) ([]bigmapdiff.BigMapState, error)) *RepositoryGetByPtrCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByPtrAndKeyHash mocks base method. +func (m *MockRepository) GetByPtrAndKeyHash(ptr int64, keyHash string, size, offset int64) ([]bigmapdiff.BigMapDiff, int64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetByPtrAndKeyHash", ptr, keyHash, size, offset) - ret0, _ := ret[0].([]model.BigMapDiff) + ret0, _ := ret[0].([]bigmapdiff.BigMapDiff) ret1, _ := ret[1].(int64) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetByPtrAndKeyHash indicates an expected call of GetByPtrAndKeyHash -func (mr *MockRepositoryMockRecorder) GetByPtrAndKeyHash(ptr, keyHash, size, offset interface{}) *gomock.Call { +// GetByPtrAndKeyHash indicates an expected call of GetByPtrAndKeyHash. +func (mr *MockRepositoryMockRecorder) GetByPtrAndKeyHash(ptr, keyHash, size, offset any) *RepositoryGetByPtrAndKeyHashCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByPtrAndKeyHash", reflect.TypeOf((*MockRepository)(nil).GetByPtrAndKeyHash), ptr, keyHash, size, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByPtrAndKeyHash", reflect.TypeOf((*MockRepository)(nil).GetByPtrAndKeyHash), ptr, keyHash, size, offset) + return &RepositoryGetByPtrAndKeyHashCall{Call: call} +} + +// RepositoryGetByPtrAndKeyHashCall wrap *gomock.Call +type RepositoryGetByPtrAndKeyHashCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByPtrAndKeyHashCall) Return(arg0 []bigmapdiff.BigMapDiff, arg1 int64, arg2 error) *RepositoryGetByPtrAndKeyHashCall { + c.Call = c.Call.Return(arg0, arg1, arg2) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByPtrAndKeyHashCall) Do(f func(int64, string, int64, int64) ([]bigmapdiff.BigMapDiff, int64, error)) *RepositoryGetByPtrAndKeyHashCall { + c.Call = c.Call.Do(f) + return c } -// GetForAddress mocks base method -func (m *MockRepository) GetForAddress(address string) ([]model.BigMapState, error) { +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByPtrAndKeyHashCall) DoAndReturn(f func(int64, string, int64, int64) ([]bigmapdiff.BigMapDiff, int64, error)) *RepositoryGetByPtrAndKeyHashCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetForAddress mocks base method. +func (m *MockRepository) GetForAddress(address string) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetForAddress", address) - ret0, _ := ret[0].([]model.BigMapState) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetForAddress indicates an expected call of GetForAddress -func (mr *MockRepositoryMockRecorder) GetForAddress(address interface{}) *gomock.Call { +// GetForAddress indicates an expected call of GetForAddress. +func (mr *MockRepositoryMockRecorder) GetForAddress(address any) *RepositoryGetForAddressCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForAddress", reflect.TypeOf((*MockRepository)(nil).GetForAddress), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForAddress", reflect.TypeOf((*MockRepository)(nil).GetForAddress), address) + return &RepositoryGetForAddressCall{Call: call} +} + +// RepositoryGetForAddressCall wrap *gomock.Call +type RepositoryGetForAddressCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetForAddressCall) Return(arg0 []bigmapdiff.BigMapState, arg1 error) *RepositoryGetForAddressCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// GetValuesByKey mocks base method -func (m *MockRepository) GetValuesByKey(keyHash string) ([]model.BigMapState, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetForAddressCall) Do(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryGetForAddressCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetForAddressCall) DoAndReturn(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryGetForAddressCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetForOperation mocks base method. +func (m *MockRepository) GetForOperation(id int64) ([]bigmapdiff.BigMapDiff, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetValuesByKey", keyHash) - ret0, _ := ret[0].([]model.BigMapState) + ret := m.ctrl.Call(m, "GetForOperation", id) + ret0, _ := ret[0].([]bigmapdiff.BigMapDiff) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetValuesByKey indicates an expected call of GetValuesByKey -func (mr *MockRepositoryMockRecorder) GetValuesByKey(keyHash interface{}) *gomock.Call { +// GetForOperation indicates an expected call of GetForOperation. +func (mr *MockRepositoryMockRecorder) GetForOperation(id any) *RepositoryGetForOperationCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValuesByKey", reflect.TypeOf((*MockRepository)(nil).GetValuesByKey), keyHash) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetForOperation", reflect.TypeOf((*MockRepository)(nil).GetForOperation), id) + return &RepositoryGetForOperationCall{Call: call} } -// Count mocks base method -func (m *MockRepository) Count(ptr int64) (int64, error) { +// RepositoryGetForOperationCall wrap *gomock.Call +type RepositoryGetForOperationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetForOperationCall) Return(arg0 []bigmapdiff.BigMapDiff, arg1 error) *RepositoryGetForOperationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetForOperationCall) Do(f func(int64) ([]bigmapdiff.BigMapDiff, error)) *RepositoryGetForOperationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetForOperationCall) DoAndReturn(f func(int64) ([]bigmapdiff.BigMapDiff, error)) *RepositoryGetForOperationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetStats mocks base method. +func (m *MockRepository) GetStats(ptr int64) (bigmapdiff.Stats, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Count", ptr) - ret0, _ := ret[0].(int64) + ret := m.ctrl.Call(m, "GetStats", ptr) + ret0, _ := ret[0].(bigmapdiff.Stats) ret1, _ := ret[1].(error) return ret0, ret1 } -// Count indicates an expected call of Count -func (mr *MockRepositoryMockRecorder) Count(ptr interface{}) *gomock.Call { +// GetStats indicates an expected call of GetStats. +func (mr *MockRepositoryMockRecorder) GetStats(ptr any) *RepositoryGetStatsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockRepository)(nil).Count), ptr) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStats", reflect.TypeOf((*MockRepository)(nil).GetStats), ptr) + return &RepositoryGetStatsCall{Call: call} +} + +// RepositoryGetStatsCall wrap *gomock.Call +type RepositoryGetStatsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetStatsCall) Return(arg0 bigmapdiff.Stats, arg1 error) *RepositoryGetStatsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetStatsCall) Do(f func(int64) (bigmapdiff.Stats, error)) *RepositoryGetStatsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetStatsCall) DoAndReturn(f func(int64) (bigmapdiff.Stats, error)) *RepositoryGetStatsCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// Current mocks base method -func (m *MockRepository) Current(keyHash string, ptr int64) (model.BigMapState, error) { +// GetValuesByKey mocks base method. +func (m *MockRepository) GetValuesByKey(keyHash string) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Current", keyHash, ptr) - ret0, _ := ret[0].(model.BigMapState) + ret := m.ctrl.Call(m, "GetValuesByKey", keyHash) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// Current indicates an expected call of Current -func (mr *MockRepositoryMockRecorder) Current(keyHash, ptr interface{}) *gomock.Call { +// GetValuesByKey indicates an expected call of GetValuesByKey. +func (mr *MockRepositoryMockRecorder) GetValuesByKey(keyHash any) *RepositoryGetValuesByKeyCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Current", reflect.TypeOf((*MockRepository)(nil).Current), keyHash, ptr) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValuesByKey", reflect.TypeOf((*MockRepository)(nil).GetValuesByKey), keyHash) + return &RepositoryGetValuesByKeyCall{Call: call} +} + +// RepositoryGetValuesByKeyCall wrap *gomock.Call +type RepositoryGetValuesByKeyCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetValuesByKeyCall) Return(arg0 []bigmapdiff.BigMapState, arg1 error) *RepositoryGetValuesByKeyCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetValuesByKeyCall) Do(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryGetValuesByKeyCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetValuesByKeyCall) DoAndReturn(f func(string) ([]bigmapdiff.BigMapState, error)) *RepositoryGetValuesByKeyCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// CurrentByContract mocks base method -func (m *MockRepository) CurrentByContract(contract string) ([]model.BigMapState, error) { +// Keys mocks base method. +func (m *MockRepository) Keys(ctx bigmapdiff.GetContext) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CurrentByContract", contract) - ret0, _ := ret[0].([]model.BigMapState) + ret := m.ctrl.Call(m, "Keys", ctx) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// CurrentByContract indicates an expected call of CurrentByContract -func (mr *MockRepositoryMockRecorder) CurrentByContract(contract interface{}) *gomock.Call { +// Keys indicates an expected call of Keys. +func (mr *MockRepositoryMockRecorder) Keys(ctx any) *RepositoryKeysCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentByContract", reflect.TypeOf((*MockRepository)(nil).CurrentByContract), contract) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockRepository)(nil).Keys), ctx) + return &RepositoryKeysCall{Call: call} +} + +// RepositoryKeysCall wrap *gomock.Call +type RepositoryKeysCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryKeysCall) Return(states []bigmapdiff.BigMapState, err error) *RepositoryKeysCall { + c.Call = c.Call.Return(states, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryKeysCall) Do(f func(bigmapdiff.GetContext) ([]bigmapdiff.BigMapState, error)) *RepositoryKeysCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryKeysCall) DoAndReturn(f func(bigmapdiff.GetContext) ([]bigmapdiff.BigMapState, error)) *RepositoryKeysCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// Previous mocks base method -func (m *MockRepository) Previous(arg0 []model.BigMapDiff) ([]model.BigMapDiff, error) { +// LastDiff mocks base method. +func (m *MockRepository) LastDiff(ptr int64, keyHash string, skipRemoved bool) (bigmapdiff.BigMapDiff, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Previous", arg0) - ret0, _ := ret[0].([]model.BigMapDiff) + ret := m.ctrl.Call(m, "LastDiff", ptr, keyHash, skipRemoved) + ret0, _ := ret[0].(bigmapdiff.BigMapDiff) ret1, _ := ret[1].(error) return ret0, ret1 } -// Previous indicates an expected call of Previous -func (mr *MockRepositoryMockRecorder) Previous(arg0 interface{}) *gomock.Call { +// LastDiff indicates an expected call of LastDiff. +func (mr *MockRepositoryMockRecorder) LastDiff(ptr, keyHash, skipRemoved any) *RepositoryLastDiffCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Previous", reflect.TypeOf((*MockRepository)(nil).Previous), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LastDiff", reflect.TypeOf((*MockRepository)(nil).LastDiff), ptr, keyHash, skipRemoved) + return &RepositoryLastDiffCall{Call: call} +} + +// RepositoryLastDiffCall wrap *gomock.Call +type RepositoryLastDiffCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryLastDiffCall) Return(arg0 bigmapdiff.BigMapDiff, arg1 error) *RepositoryLastDiffCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryLastDiffCall) Do(f func(int64, string, bool) (bigmapdiff.BigMapDiff, error)) *RepositoryLastDiffCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryLastDiffCall) DoAndReturn(f func(int64, string, bool) (bigmapdiff.BigMapDiff, error)) *RepositoryLastDiffCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetStats mocks base method -func (m *MockRepository) GetStats(ptr int64) (model.Stats, error) { +// Previous mocks base method. +func (m *MockRepository) Previous(arg0 []bigmapdiff.BigMapDiff) ([]bigmapdiff.BigMapDiff, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetStats", ptr) - ret0, _ := ret[0].(model.Stats) + ret := m.ctrl.Call(m, "Previous", arg0) + ret0, _ := ret[0].([]bigmapdiff.BigMapDiff) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetStats indicates an expected call of GetStats -func (mr *MockRepositoryMockRecorder) GetStats(ptr interface{}) *gomock.Call { +// Previous indicates an expected call of Previous. +func (mr *MockRepositoryMockRecorder) Previous(arg0 any) *RepositoryPreviousCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStats", reflect.TypeOf((*MockRepository)(nil).GetStats), ptr) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Previous", reflect.TypeOf((*MockRepository)(nil).Previous), arg0) + return &RepositoryPreviousCall{Call: call} +} + +// RepositoryPreviousCall wrap *gomock.Call +type RepositoryPreviousCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryPreviousCall) Return(arg0 []bigmapdiff.BigMapDiff, arg1 error) *RepositoryPreviousCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryPreviousCall) Do(f func([]bigmapdiff.BigMapDiff) ([]bigmapdiff.BigMapDiff, error)) *RepositoryPreviousCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryPreviousCall) DoAndReturn(f func([]bigmapdiff.BigMapDiff) ([]bigmapdiff.BigMapDiff, error)) *RepositoryPreviousCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// StatesChangedAfter mocks base method -func (m *MockRepository) StatesChangedAfter(level int64) ([]model.BigMapState, error) { +// StatesChangedAfter mocks base method. +func (m *MockRepository) StatesChangedAfter(level int64) ([]bigmapdiff.BigMapState, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StatesChangedAfter", level) - ret0, _ := ret[0].([]model.BigMapState) + ret0, _ := ret[0].([]bigmapdiff.BigMapState) ret1, _ := ret[1].(error) return ret0, ret1 } -// StatesChangedAfter indicates an expected call of StatesChangedAfter -func (mr *MockRepositoryMockRecorder) StatesChangedAfter(level interface{}) *gomock.Call { +// StatesChangedAfter indicates an expected call of StatesChangedAfter. +func (mr *MockRepositoryMockRecorder) StatesChangedAfter(level any) *RepositoryStatesChangedAfterCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatesChangedAfter", reflect.TypeOf((*MockRepository)(nil).StatesChangedAfter), level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StatesChangedAfter", reflect.TypeOf((*MockRepository)(nil).StatesChangedAfter), level) + return &RepositoryStatesChangedAfterCall{Call: call} } -// LastDiff mocks base method -func (m *MockRepository) LastDiff(ptr int64, keyHash string, skipRemoved bool) (model.BigMapDiff, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "LastDiff", ptr, keyHash, skipRemoved) - ret0, _ := ret[0].(model.BigMapDiff) - ret1, _ := ret[1].(error) - return ret0, ret1 +// RepositoryStatesChangedAfterCall wrap *gomock.Call +type RepositoryStatesChangedAfterCall struct { + *gomock.Call } -// LastDiff indicates an expected call of LastDiff -func (mr *MockRepositoryMockRecorder) LastDiff(ptr, keyHash, skipRemoved interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LastDiff", reflect.TypeOf((*MockRepository)(nil).LastDiff), ptr, keyHash, skipRemoved) +// Return rewrite *gomock.Call.Return +func (c *RepositoryStatesChangedAfterCall) Return(arg0 []bigmapdiff.BigMapState, arg1 error) *RepositoryStatesChangedAfterCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// Keys mocks base method -func (m *MockRepository) Keys(ctx model.GetContext) ([]model.BigMapState, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Keys", ctx) - ret0, _ := ret[0].([]model.BigMapState) - ret1, _ := ret[1].(error) - return ret0, ret1 +// Do rewrite *gomock.Call.Do +func (c *RepositoryStatesChangedAfterCall) Do(f func(int64) ([]bigmapdiff.BigMapState, error)) *RepositoryStatesChangedAfterCall { + c.Call = c.Call.Do(f) + return c } -// Keys indicates an expected call of Keys -func (mr *MockRepositoryMockRecorder) Keys(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Keys", reflect.TypeOf((*MockRepository)(nil).Keys), ctx) +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryStatesChangedAfterCall) DoAndReturn(f func(int64) ([]bigmapdiff.BigMapState, error)) *RepositoryStatesChangedAfterCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/block/mock.go b/internal/models/mock/block/mock.go index a949d249d..371dadd13 100644 --- a/internal/models/mock/block/mock.go +++ b/internal/models/mock/block/mock.go @@ -1,64 +1,117 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/block/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/block/mock.go -package=block -typed +// // Package block is a generated GoMock package. package block import ( - model "github.com/baking-bad/bcdhub/internal/models/block" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + block "github.com/baking-bad/bcdhub/internal/models/block" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(level int64) (model.Block, error) { +// Get mocks base method. +func (m *MockRepository) Get(level int64) (block.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", level) - ret0, _ := ret[0].(model.Block) + ret0, _ := ret[0].(block.Block) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(level interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(level any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), level) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 block.Block, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(int64) (block.Block, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(int64) (block.Block, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// Last mocks base method -func (m *MockRepository) Last() (model.Block, error) { +// Last mocks base method. +func (m *MockRepository) Last() (block.Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Last") - ret0, _ := ret[0].(model.Block) + ret0, _ := ret[0].(block.Block) ret1, _ := ret[1].(error) return ret0, ret1 } -// Last indicates an expected call of Last -func (mr *MockRepositoryMockRecorder) Last() *gomock.Call { +// Last indicates an expected call of Last. +func (mr *MockRepositoryMockRecorder) Last() *RepositoryLastCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Last", reflect.TypeOf((*MockRepository)(nil).Last)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Last", reflect.TypeOf((*MockRepository)(nil).Last)) + return &RepositoryLastCall{Call: call} +} + +// RepositoryLastCall wrap *gomock.Call +type RepositoryLastCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryLastCall) Return(arg0 block.Block, arg1 error) *RepositoryLastCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryLastCall) Do(f func() (block.Block, error)) *RepositoryLastCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryLastCall) DoAndReturn(f func() (block.Block, error)) *RepositoryLastCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/contract/mock.go b/internal/models/mock/contract/mock.go index 6ecf2bd11..df1efa0d7 100644 --- a/internal/models/mock/contract/mock.go +++ b/internal/models/mock/contract/mock.go @@ -1,146 +1,358 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/contract/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/contract/mock.go -package=contract -typed +// // Package contract is a generated GoMock package. package contract import ( - model "github.com/baking-bad/bcdhub/internal/models/contract" - types "github.com/baking-bad/bcdhub/internal/models/types" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + contract "github.com/baking-bad/bcdhub/internal/models/contract" + types "github.com/baking-bad/bcdhub/internal/models/types" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(address string) (model.Contract, error) { +// Count mocks base method. +func (m *MockRepository) Count() (int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Count") + ret0, _ := ret[0].(int) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Count indicates an expected call of Count. +func (mr *MockRepositoryMockRecorder) Count() *RepositoryCountCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockRepository)(nil).Count)) + return &RepositoryCountCall{Call: call} +} + +// RepositoryCountCall wrap *gomock.Call +type RepositoryCountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryCountCall) Return(arg0 int, arg1 error) *RepositoryCountCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryCountCall) Do(f func() (int, error)) *RepositoryCountCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryCountCall) DoAndReturn(f func() (int, error)) *RepositoryCountCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// FindOne mocks base method. +func (m *MockRepository) FindOne(tags types.Tags) (contract.Contract, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FindOne", tags) + ret0, _ := ret[0].(contract.Contract) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FindOne indicates an expected call of FindOne. +func (mr *MockRepositoryMockRecorder) FindOne(tags any) *RepositoryFindOneCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindOne", reflect.TypeOf((*MockRepository)(nil).FindOne), tags) + return &RepositoryFindOneCall{Call: call} +} + +// RepositoryFindOneCall wrap *gomock.Call +type RepositoryFindOneCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryFindOneCall) Return(arg0 contract.Contract, arg1 error) *RepositoryFindOneCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryFindOneCall) Do(f func(types.Tags) (contract.Contract, error)) *RepositoryFindOneCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryFindOneCall) DoAndReturn(f func(types.Tags) (contract.Contract, error)) *RepositoryFindOneCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockRepository) Get(address string) (contract.Contract, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", address) - ret0, _ := ret[0].(model.Contract) + ret0, _ := ret[0].(contract.Contract) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(address interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(address any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 contract.Contract, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// GetAll mocks base method -func (m *MockRepository) GetAll(filters map[string]interface{}) ([]model.Contract, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(string) (contract.Contract, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(string) (contract.Contract, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetAll mocks base method. +func (m *MockRepository) GetAll(filters map[string]any) ([]contract.Contract, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAll", filters) - ret0, _ := ret[0].([]model.Contract) + ret0, _ := ret[0].([]contract.Contract) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetAll indicates an expected call of GetAll -func (mr *MockRepositoryMockRecorder) GetAll(filters interface{}) *gomock.Call { +// GetAll indicates an expected call of GetAll. +func (mr *MockRepositoryMockRecorder) GetAll(filters any) *RepositoryGetAllCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockRepository)(nil).GetAll), filters) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockRepository)(nil).GetAll), filters) + return &RepositoryGetAllCall{Call: call} +} + +// RepositoryGetAllCall wrap *gomock.Call +type RepositoryGetAllCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetAllCall) Return(arg0 []contract.Contract, arg1 error) *RepositoryGetAllCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetAllCall) Do(f func(map[string]any) ([]contract.Contract, error)) *RepositoryGetAllCall { + c.Call = c.Call.Do(f) + return c } -// GetRandom mocks base method -func (m *MockRepository) GetRandom() (model.Contract, error) { +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetAllCall) DoAndReturn(f func(map[string]any) ([]contract.Contract, error)) *RepositoryGetAllCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetRandom mocks base method. +func (m *MockRepository) GetRandom() (contract.Contract, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRandom") - ret0, _ := ret[0].(model.Contract) + ret0, _ := ret[0].(contract.Contract) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetRandom indicates an expected call of GetRandom -func (mr *MockRepositoryMockRecorder) GetRandom() *gomock.Call { +// GetRandom indicates an expected call of GetRandom. +func (mr *MockRepositoryMockRecorder) GetRandom() *RepositoryGetRandomCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRandom", reflect.TypeOf((*MockRepository)(nil).GetRandom)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRandom", reflect.TypeOf((*MockRepository)(nil).GetRandom)) + return &RepositoryGetRandomCall{Call: call} +} + +// RepositoryGetRandomCall wrap *gomock.Call +type RepositoryGetRandomCall struct { + *gomock.Call } -// GetTokens mocks base method -func (m *MockRepository) GetTokens(tokenInterface string, offset, size int64) ([]model.Contract, int64, error) { +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetRandomCall) Return(arg0 contract.Contract, arg1 error) *RepositoryGetRandomCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetRandomCall) Do(f func() (contract.Contract, error)) *RepositoryGetRandomCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetRandomCall) DoAndReturn(f func() (contract.Contract, error)) *RepositoryGetRandomCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetTokens mocks base method. +func (m *MockRepository) GetTokens(tokenInterface string, offset, size int64) ([]contract.Contract, int64, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTokens", tokenInterface, offset, size) - ret0, _ := ret[0].([]model.Contract) + ret0, _ := ret[0].([]contract.Contract) ret1, _ := ret[1].(int64) ret2, _ := ret[2].(error) return ret0, ret1, ret2 } -// GetTokens indicates an expected call of GetTokens -func (mr *MockRepositoryMockRecorder) GetTokens(tokenInterface, offset, size interface{}) *gomock.Call { +// GetTokens indicates an expected call of GetTokens. +func (mr *MockRepositoryMockRecorder) GetTokens(tokenInterface, offset, size any) *RepositoryGetTokensCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTokens", reflect.TypeOf((*MockRepository)(nil).GetTokens), tokenInterface, offset, size) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTokens", reflect.TypeOf((*MockRepository)(nil).GetTokens), tokenInterface, offset, size) + return &RepositoryGetTokensCall{Call: call} +} + +// RepositoryGetTokensCall wrap *gomock.Call +type RepositoryGetTokensCall struct { + *gomock.Call } -// RecentlyCalled mocks base method -func (m *MockRepository) RecentlyCalled(offset, size int64) ([]model.Contract, error) { +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetTokensCall) Return(arg0 []contract.Contract, arg1 int64, arg2 error) *RepositoryGetTokensCall { + c.Call = c.Call.Return(arg0, arg1, arg2) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetTokensCall) Do(f func(string, int64, int64) ([]contract.Contract, int64, error)) *RepositoryGetTokensCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetTokensCall) DoAndReturn(f func(string, int64, int64) ([]contract.Contract, int64, error)) *RepositoryGetTokensCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RecentlyCalled mocks base method. +func (m *MockRepository) RecentlyCalled(offset, size int64) ([]contract.Contract, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RecentlyCalled", offset, size) - ret0, _ := ret[0].([]model.Contract) + ret0, _ := ret[0].([]contract.Contract) ret1, _ := ret[1].(error) return ret0, ret1 } -// RecentlyCalled indicates an expected call of RecentlyCalled -func (mr *MockRepositoryMockRecorder) RecentlyCalled(offset, size interface{}) *gomock.Call { +// RecentlyCalled indicates an expected call of RecentlyCalled. +func (mr *MockRepositoryMockRecorder) RecentlyCalled(offset, size any) *RepositoryRecentlyCalledCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecentlyCalled", reflect.TypeOf((*MockRepository)(nil).RecentlyCalled), offset, size) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecentlyCalled", reflect.TypeOf((*MockRepository)(nil).RecentlyCalled), offset, size) + return &RepositoryRecentlyCalledCall{Call: call} } -// Count mocks base method -func (m *MockRepository) Count() (int, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Count") - ret0, _ := ret[0].(int) - ret1, _ := ret[1].(error) - return ret0, ret1 +// RepositoryRecentlyCalledCall wrap *gomock.Call +type RepositoryRecentlyCalledCall struct { + *gomock.Call } -// Count indicates an expected call of Count -func (mr *MockRepositoryMockRecorder) Count() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Count", reflect.TypeOf((*MockRepository)(nil).Count)) +// Return rewrite *gomock.Call.Return +func (c *RepositoryRecentlyCalledCall) Return(arg0 []contract.Contract, arg1 error) *RepositoryRecentlyCalledCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryRecentlyCalledCall) Do(f func(int64, int64) ([]contract.Contract, error)) *RepositoryRecentlyCalledCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryRecentlyCalledCall) DoAndReturn(f func(int64, int64) ([]contract.Contract, error)) *RepositoryRecentlyCalledCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// Script mocks base method -func (m *MockRepository) Script(address, symLink string) (model.Script, error) { +// Script mocks base method. +func (m *MockRepository) Script(address, symLink string) (contract.Script, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Script", address, symLink) - ret0, _ := ret[0].(model.Script) + ret0, _ := ret[0].(contract.Script) ret1, _ := ret[1].(error) return ret0, ret1 } -// Script indicates an expected call of Script -func (mr *MockRepositoryMockRecorder) Script(address, symLink interface{}) *gomock.Call { +// Script indicates an expected call of Script. +func (mr *MockRepositoryMockRecorder) Script(address, symLink any) *RepositoryScriptCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Script", reflect.TypeOf((*MockRepository)(nil).Script), address, symLink) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Script", reflect.TypeOf((*MockRepository)(nil).Script), address, symLink) + return &RepositoryScriptCall{Call: call} +} + +// RepositoryScriptCall wrap *gomock.Call +type RepositoryScriptCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryScriptCall) Return(arg0 contract.Script, arg1 error) *RepositoryScriptCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// ScriptPart mocks base method +// Do rewrite *gomock.Call.Do +func (c *RepositoryScriptCall) Do(f func(string, string) (contract.Script, error)) *RepositoryScriptCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryScriptCall) DoAndReturn(f func(string, string) (contract.Script, error)) *RepositoryScriptCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ScriptPart mocks base method. func (m *MockRepository) ScriptPart(address, symLink, part string) ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ScriptPart", address, symLink, part) @@ -149,110 +361,177 @@ func (m *MockRepository) ScriptPart(address, symLink, part string) ([]byte, erro return ret0, ret1 } -// ScriptPart indicates an expected call of ScriptPart -func (mr *MockRepositoryMockRecorder) ScriptPart(address, symLink, part interface{}) *gomock.Call { +// ScriptPart indicates an expected call of ScriptPart. +func (mr *MockRepositoryMockRecorder) ScriptPart(address, symLink, part any) *RepositoryScriptPartCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptPart", reflect.TypeOf((*MockRepository)(nil).ScriptPart), address, symLink, part) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ScriptPart", reflect.TypeOf((*MockRepository)(nil).ScriptPart), address, symLink, part) + return &RepositoryScriptPartCall{Call: call} } -// FindOne mocks base method -func (m *MockRepository) FindOne(tags types.Tags) (model.Contract, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "FindOne", tags) - ret0, _ := ret[0].(model.Contract) - ret1, _ := ret[1].(error) - return ret0, ret1 +// RepositoryScriptPartCall wrap *gomock.Call +type RepositoryScriptPartCall struct { + *gomock.Call } -// FindOne indicates an expected call of FindOne -func (mr *MockRepositoryMockRecorder) FindOne(tags interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindOne", reflect.TypeOf((*MockRepository)(nil).FindOne), tags) +// Return rewrite *gomock.Call.Return +func (c *RepositoryScriptPartCall) Return(arg0 []byte, arg1 error) *RepositoryScriptPartCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryScriptPartCall) Do(f func(string, string, string) ([]byte, error)) *RepositoryScriptPartCall { + c.Call = c.Call.Do(f) + return c } -// MockScriptRepository is a mock of ScriptRepository interface +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryScriptPartCall) DoAndReturn(f func(string, string, string) ([]byte, error)) *RepositoryScriptPartCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockScriptRepository is a mock of ScriptRepository interface. type MockScriptRepository struct { ctrl *gomock.Controller recorder *MockScriptRepositoryMockRecorder } -// MockScriptRepositoryMockRecorder is the mock recorder for MockScriptRepository +// MockScriptRepositoryMockRecorder is the mock recorder for MockScriptRepository. type MockScriptRepositoryMockRecorder struct { mock *MockScriptRepository } -// NewMockScriptRepository creates a new mock instance +// NewMockScriptRepository creates a new mock instance. func NewMockScriptRepository(ctrl *gomock.Controller) *MockScriptRepository { mock := &MockScriptRepository{ctrl: ctrl} mock.recorder = &MockScriptRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockScriptRepository) EXPECT() *MockScriptRepositoryMockRecorder { return m.recorder } -// GetScripts mocks base method -func (m *MockScriptRepository) GetScripts(limit, offset int) ([]model.Script, error) { +// ByHash mocks base method. +func (m *MockScriptRepository) ByHash(hash string) (contract.Script, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetScripts", limit, offset) - ret0, _ := ret[0].([]model.Script) + ret := m.ctrl.Call(m, "ByHash", hash) + ret0, _ := ret[0].(contract.Script) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetScripts indicates an expected call of GetScripts -func (mr *MockScriptRepositoryMockRecorder) GetScripts(limit, offset interface{}) *gomock.Call { +// ByHash indicates an expected call of ByHash. +func (mr *MockScriptRepositoryMockRecorder) ByHash(hash any) *ScriptRepositoryByHashCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScripts", reflect.TypeOf((*MockScriptRepository)(nil).GetScripts), limit, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ByHash", reflect.TypeOf((*MockScriptRepository)(nil).ByHash), hash) + return &ScriptRepositoryByHashCall{Call: call} } -// ByHash mocks base method -func (m *MockScriptRepository) ByHash(hash string) (model.Script, error) { +// ScriptRepositoryByHashCall wrap *gomock.Call +type ScriptRepositoryByHashCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryByHashCall) Return(arg0 contract.Script, arg1 error) *ScriptRepositoryByHashCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryByHashCall) Do(f func(string) (contract.Script, error)) *ScriptRepositoryByHashCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryByHashCall) DoAndReturn(f func(string) (contract.Script, error)) *ScriptRepositoryByHashCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Code mocks base method. +func (m *MockScriptRepository) Code(id int64) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ByHash", hash) - ret0, _ := ret[0].(model.Script) + ret := m.ctrl.Call(m, "Code", id) + ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } -// ByHash indicates an expected call of ByHash -func (mr *MockScriptRepositoryMockRecorder) ByHash(hash interface{}) *gomock.Call { +// Code indicates an expected call of Code. +func (mr *MockScriptRepositoryMockRecorder) Code(id any) *ScriptRepositoryCodeCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ByHash", reflect.TypeOf((*MockScriptRepository)(nil).ByHash), hash) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Code", reflect.TypeOf((*MockScriptRepository)(nil).Code), id) + return &ScriptRepositoryCodeCall{Call: call} } -// UpdateProjectID mocks base method -func (m *MockScriptRepository) UpdateProjectID(script []model.Script) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateProjectID", script) - ret0, _ := ret[0].(error) - return ret0 +// ScriptRepositoryCodeCall wrap *gomock.Call +type ScriptRepositoryCodeCall struct { + *gomock.Call } -// UpdateProjectID indicates an expected call of UpdateProjectID -func (mr *MockScriptRepositoryMockRecorder) UpdateProjectID(script interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProjectID", reflect.TypeOf((*MockScriptRepository)(nil).UpdateProjectID), script) +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryCodeCall) Return(arg0 []byte, arg1 error) *ScriptRepositoryCodeCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// Code mocks base method -func (m *MockScriptRepository) Code(id int64) ([]byte, error) { +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryCodeCall) Do(f func(int64) ([]byte, error)) *ScriptRepositoryCodeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryCodeCall) DoAndReturn(f func(int64) ([]byte, error)) *ScriptRepositoryCodeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetScripts mocks base method. +func (m *MockScriptRepository) GetScripts(limit, offset int) ([]contract.Script, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Code", id) - ret0, _ := ret[0].([]byte) + ret := m.ctrl.Call(m, "GetScripts", limit, offset) + ret0, _ := ret[0].([]contract.Script) ret1, _ := ret[1].(error) return ret0, ret1 } -// Code indicates an expected call of Code -func (mr *MockScriptRepositoryMockRecorder) Code(id interface{}) *gomock.Call { +// GetScripts indicates an expected call of GetScripts. +func (mr *MockScriptRepositoryMockRecorder) GetScripts(limit, offset any) *ScriptRepositoryGetScriptsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Code", reflect.TypeOf((*MockScriptRepository)(nil).Code), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScripts", reflect.TypeOf((*MockScriptRepository)(nil).GetScripts), limit, offset) + return &ScriptRepositoryGetScriptsCall{Call: call} +} + +// ScriptRepositoryGetScriptsCall wrap *gomock.Call +type ScriptRepositoryGetScriptsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryGetScriptsCall) Return(arg0 []contract.Script, arg1 error) *ScriptRepositoryGetScriptsCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// Parameter mocks base method +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryGetScriptsCall) Do(f func(int, int) ([]contract.Script, error)) *ScriptRepositoryGetScriptsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryGetScriptsCall) DoAndReturn(f func(int, int) ([]contract.Script, error)) *ScriptRepositoryGetScriptsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Parameter mocks base method. func (m *MockScriptRepository) Parameter(id int64) ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Parameter", id) @@ -261,13 +540,37 @@ func (m *MockScriptRepository) Parameter(id int64) ([]byte, error) { return ret0, ret1 } -// Parameter indicates an expected call of Parameter -func (mr *MockScriptRepositoryMockRecorder) Parameter(id interface{}) *gomock.Call { +// Parameter indicates an expected call of Parameter. +func (mr *MockScriptRepositoryMockRecorder) Parameter(id any) *ScriptRepositoryParameterCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Parameter", reflect.TypeOf((*MockScriptRepository)(nil).Parameter), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Parameter", reflect.TypeOf((*MockScriptRepository)(nil).Parameter), id) + return &ScriptRepositoryParameterCall{Call: call} +} + +// ScriptRepositoryParameterCall wrap *gomock.Call +type ScriptRepositoryParameterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryParameterCall) Return(arg0 []byte, arg1 error) *ScriptRepositoryParameterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryParameterCall) Do(f func(int64) ([]byte, error)) *ScriptRepositoryParameterCall { + c.Call = c.Call.Do(f) + return c } -// Storage mocks base method +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryParameterCall) DoAndReturn(f func(int64) ([]byte, error)) *ScriptRepositoryParameterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Storage mocks base method. func (m *MockScriptRepository) Storage(id int64) ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Storage", id) @@ -276,13 +579,75 @@ func (m *MockScriptRepository) Storage(id int64) ([]byte, error) { return ret0, ret1 } -// Storage indicates an expected call of Storage -func (mr *MockScriptRepositoryMockRecorder) Storage(id interface{}) *gomock.Call { +// Storage indicates an expected call of Storage. +func (mr *MockScriptRepositoryMockRecorder) Storage(id any) *ScriptRepositoryStorageCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Storage", reflect.TypeOf((*MockScriptRepository)(nil).Storage), id) + return &ScriptRepositoryStorageCall{Call: call} +} + +// ScriptRepositoryStorageCall wrap *gomock.Call +type ScriptRepositoryStorageCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryStorageCall) Return(arg0 []byte, arg1 error) *ScriptRepositoryStorageCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryStorageCall) Do(f func(int64) ([]byte, error)) *ScriptRepositoryStorageCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryStorageCall) DoAndReturn(f func(int64) ([]byte, error)) *ScriptRepositoryStorageCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpdateProjectID mocks base method. +func (m *MockScriptRepository) UpdateProjectID(script []contract.Script) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateProjectID", script) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateProjectID indicates an expected call of UpdateProjectID. +func (mr *MockScriptRepositoryMockRecorder) UpdateProjectID(script any) *ScriptRepositoryUpdateProjectIDCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Storage", reflect.TypeOf((*MockScriptRepository)(nil).Storage), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateProjectID", reflect.TypeOf((*MockScriptRepository)(nil).UpdateProjectID), script) + return &ScriptRepositoryUpdateProjectIDCall{Call: call} } -// Views mocks base method +// ScriptRepositoryUpdateProjectIDCall wrap *gomock.Call +type ScriptRepositoryUpdateProjectIDCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryUpdateProjectIDCall) Return(arg0 error) *ScriptRepositoryUpdateProjectIDCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryUpdateProjectIDCall) Do(f func([]contract.Script) error) *ScriptRepositoryUpdateProjectIDCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryUpdateProjectIDCall) DoAndReturn(f func([]contract.Script) error) *ScriptRepositoryUpdateProjectIDCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Views mocks base method. func (m *MockScriptRepository) Views(id int64) ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Views", id) @@ -291,110 +656,254 @@ func (m *MockScriptRepository) Views(id int64) ([]byte, error) { return ret0, ret1 } -// Views indicates an expected call of Views -func (mr *MockScriptRepositoryMockRecorder) Views(id interface{}) *gomock.Call { +// Views indicates an expected call of Views. +func (mr *MockScriptRepositoryMockRecorder) Views(id any) *ScriptRepositoryViewsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Views", reflect.TypeOf((*MockScriptRepository)(nil).Views), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Views", reflect.TypeOf((*MockScriptRepository)(nil).Views), id) + return &ScriptRepositoryViewsCall{Call: call} +} + +// ScriptRepositoryViewsCall wrap *gomock.Call +type ScriptRepositoryViewsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ScriptRepositoryViewsCall) Return(arg0 []byte, arg1 error) *ScriptRepositoryViewsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ScriptRepositoryViewsCall) Do(f func(int64) ([]byte, error)) *ScriptRepositoryViewsCall { + c.Call = c.Call.Do(f) + return c } -// MockConstantRepository is a mock of ConstantRepository interface +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ScriptRepositoryViewsCall) DoAndReturn(f func(int64) ([]byte, error)) *ScriptRepositoryViewsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// MockConstantRepository is a mock of ConstantRepository interface. type MockConstantRepository struct { ctrl *gomock.Controller recorder *MockConstantRepositoryMockRecorder } -// MockConstantRepositoryMockRecorder is the mock recorder for MockConstantRepository +// MockConstantRepositoryMockRecorder is the mock recorder for MockConstantRepository. type MockConstantRepositoryMockRecorder struct { mock *MockConstantRepository } -// NewMockConstantRepository creates a new mock instance +// NewMockConstantRepository creates a new mock instance. func NewMockConstantRepository(ctrl *gomock.Controller) *MockConstantRepository { mock := &MockConstantRepository{ctrl: ctrl} mock.recorder = &MockConstantRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockConstantRepository) EXPECT() *MockConstantRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockConstantRepository) Get(address string) (model.GlobalConstant, error) { +// All mocks base method. +func (m *MockConstantRepository) All(addresses ...string) ([]contract.GlobalConstant, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", address) - ret0, _ := ret[0].(model.GlobalConstant) + varargs := []any{} + for _, a := range addresses { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "All", varargs...) + ret0, _ := ret[0].([]contract.GlobalConstant) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockConstantRepositoryMockRecorder) Get(address interface{}) *gomock.Call { +// All indicates an expected call of All. +func (mr *MockConstantRepositoryMockRecorder) All(addresses ...any) *ConstantRepositoryAllCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockConstantRepository)(nil).Get), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "All", reflect.TypeOf((*MockConstantRepository)(nil).All), addresses...) + return &ConstantRepositoryAllCall{Call: call} +} + +// ConstantRepositoryAllCall wrap *gomock.Call +type ConstantRepositoryAllCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ConstantRepositoryAllCall) Return(arg0 []contract.GlobalConstant, arg1 error) *ConstantRepositoryAllCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ConstantRepositoryAllCall) Do(f func(...string) ([]contract.GlobalConstant, error)) *ConstantRepositoryAllCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ConstantRepositoryAllCall) DoAndReturn(f func(...string) ([]contract.GlobalConstant, error)) *ConstantRepositoryAllCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// All mocks base method -func (m *MockConstantRepository) All(addresses ...string) ([]model.GlobalConstant, error) { +// ContractList mocks base method. +func (m *MockConstantRepository) ContractList(address string, size, offset int64) ([]contract.Contract, error) { m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range addresses { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "All", varargs...) - ret0, _ := ret[0].([]model.GlobalConstant) + ret := m.ctrl.Call(m, "ContractList", address, size, offset) + ret0, _ := ret[0].([]contract.Contract) ret1, _ := ret[1].(error) return ret0, ret1 } -// All indicates an expected call of All -func (mr *MockConstantRepositoryMockRecorder) All(addresses ...interface{}) *gomock.Call { +// ContractList indicates an expected call of ContractList. +func (mr *MockConstantRepositoryMockRecorder) ContractList(address, size, offset any) *ConstantRepositoryContractListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "All", reflect.TypeOf((*MockConstantRepository)(nil).All), addresses...) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContractList", reflect.TypeOf((*MockConstantRepository)(nil).ContractList), address, size, offset) + return &ConstantRepositoryContractListCall{Call: call} +} + +// ConstantRepositoryContractListCall wrap *gomock.Call +type ConstantRepositoryContractListCall struct { + *gomock.Call } -// List mocks base method -func (m *MockConstantRepository) List(size, offset int64, orderBy, sort string) ([]model.ListGlobalConstantItem, error) { +// Return rewrite *gomock.Call.Return +func (c *ConstantRepositoryContractListCall) Return(arg0 []contract.Contract, arg1 error) *ConstantRepositoryContractListCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ConstantRepositoryContractListCall) Do(f func(string, int64, int64) ([]contract.Contract, error)) *ConstantRepositoryContractListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ConstantRepositoryContractListCall) DoAndReturn(f func(string, int64, int64) ([]contract.Contract, error)) *ConstantRepositoryContractListCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ForContract mocks base method. +func (m *MockConstantRepository) ForContract(address string, size, offset int64) ([]contract.GlobalConstant, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "List", size, offset, orderBy, sort) - ret0, _ := ret[0].([]model.ListGlobalConstantItem) + ret := m.ctrl.Call(m, "ForContract", address, size, offset) + ret0, _ := ret[0].([]contract.GlobalConstant) ret1, _ := ret[1].(error) return ret0, ret1 } -// List indicates an expected call of List -func (mr *MockConstantRepositoryMockRecorder) List(size, offset, orderBy, sort interface{}) *gomock.Call { +// ForContract indicates an expected call of ForContract. +func (mr *MockConstantRepositoryMockRecorder) ForContract(address, size, offset any) *ConstantRepositoryForContractCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockConstantRepository)(nil).List), size, offset, orderBy, sort) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForContract", reflect.TypeOf((*MockConstantRepository)(nil).ForContract), address, size, offset) + return &ConstantRepositoryForContractCall{Call: call} +} + +// ConstantRepositoryForContractCall wrap *gomock.Call +type ConstantRepositoryForContractCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ConstantRepositoryForContractCall) Return(arg0 []contract.GlobalConstant, arg1 error) *ConstantRepositoryForContractCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ConstantRepositoryForContractCall) Do(f func(string, int64, int64) ([]contract.GlobalConstant, error)) *ConstantRepositoryForContractCall { + c.Call = c.Call.Do(f) + return c } -// ForContract mocks base method -func (m *MockConstantRepository) ForContract(address string, size, offset int64) ([]model.GlobalConstant, error) { +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ConstantRepositoryForContractCall) DoAndReturn(f func(string, int64, int64) ([]contract.GlobalConstant, error)) *ConstantRepositoryForContractCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Get mocks base method. +func (m *MockConstantRepository) Get(address string) (contract.GlobalConstant, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ForContract", address, size, offset) - ret0, _ := ret[0].([]model.GlobalConstant) + ret := m.ctrl.Call(m, "Get", address) + ret0, _ := ret[0].(contract.GlobalConstant) ret1, _ := ret[1].(error) return ret0, ret1 } -// ForContract indicates an expected call of ForContract -func (mr *MockConstantRepositoryMockRecorder) ForContract(address, size, offset interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockConstantRepositoryMockRecorder) Get(address any) *ConstantRepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForContract", reflect.TypeOf((*MockConstantRepository)(nil).ForContract), address, size, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockConstantRepository)(nil).Get), address) + return &ConstantRepositoryGetCall{Call: call} +} + +// ConstantRepositoryGetCall wrap *gomock.Call +type ConstantRepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ConstantRepositoryGetCall) Return(arg0 contract.GlobalConstant, arg1 error) *ConstantRepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// ContractList mocks base method -func (m *MockConstantRepository) ContractList(address string, size, offset int64) ([]model.Contract, error) { +// Do rewrite *gomock.Call.Do +func (c *ConstantRepositoryGetCall) Do(f func(string) (contract.GlobalConstant, error)) *ConstantRepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ConstantRepositoryGetCall) DoAndReturn(f func(string) (contract.GlobalConstant, error)) *ConstantRepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// List mocks base method. +func (m *MockConstantRepository) List(size, offset int64, orderBy, sort string) ([]contract.ListGlobalConstantItem, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContractList", address, size, offset) - ret0, _ := ret[0].([]model.Contract) + ret := m.ctrl.Call(m, "List", size, offset, orderBy, sort) + ret0, _ := ret[0].([]contract.ListGlobalConstantItem) ret1, _ := ret[1].(error) return ret0, ret1 } -// ContractList indicates an expected call of ContractList -func (mr *MockConstantRepositoryMockRecorder) ContractList(address, size, offset interface{}) *gomock.Call { +// List indicates an expected call of List. +func (mr *MockConstantRepositoryMockRecorder) List(size, offset, orderBy, sort any) *ConstantRepositoryListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContractList", reflect.TypeOf((*MockConstantRepository)(nil).ContractList), address, size, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockConstantRepository)(nil).List), size, offset, orderBy, sort) + return &ConstantRepositoryListCall{Call: call} +} + +// ConstantRepositoryListCall wrap *gomock.Call +type ConstantRepositoryListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *ConstantRepositoryListCall) Return(arg0 []contract.ListGlobalConstantItem, arg1 error) *ConstantRepositoryListCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *ConstantRepositoryListCall) Do(f func(int64, int64, string, string) ([]contract.ListGlobalConstantItem, error)) *ConstantRepositoryListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *ConstantRepositoryListCall) DoAndReturn(f func(int64, int64, string, string) ([]contract.ListGlobalConstantItem, error)) *ConstantRepositoryListCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/domains/mock.go b/internal/models/mock/domains/mock.go index 9f78fe262..fcaadfaf2 100644 --- a/internal/models/mock/domains/mock.go +++ b/internal/models/mock/domains/mock.go @@ -1,78 +1,131 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/domains/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/domains/mock.go -package=domains -typed +// // Package domains is a generated GoMock package. package domains import ( - contract "github.com/baking-bad/bcdhub/internal/models/contract" - models "github.com/baking-bad/bcdhub/internal/models/domains" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + contract "github.com/baking-bad/bcdhub/internal/models/contract" + domains "github.com/baking-bad/bcdhub/internal/models/domains" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// BigMapDiffs mocks base method -func (m *MockRepository) BigMapDiffs(lastID, size int64) ([]models.BigMapDiff, error) { +// BigMapDiffs mocks base method. +func (m *MockRepository) BigMapDiffs(lastID, size int64) ([]domains.BigMapDiff, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "BigMapDiffs", lastID, size) - ret0, _ := ret[0].([]models.BigMapDiff) + ret0, _ := ret[0].([]domains.BigMapDiff) ret1, _ := ret[1].(error) return ret0, ret1 } -// BigMapDiffs indicates an expected call of BigMapDiffs -func (mr *MockRepositoryMockRecorder) BigMapDiffs(lastID, size interface{}) *gomock.Call { +// BigMapDiffs indicates an expected call of BigMapDiffs. +func (mr *MockRepositoryMockRecorder) BigMapDiffs(lastID, size any) *RepositoryBigMapDiffsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BigMapDiffs", reflect.TypeOf((*MockRepository)(nil).BigMapDiffs), lastID, size) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BigMapDiffs", reflect.TypeOf((*MockRepository)(nil).BigMapDiffs), lastID, size) + return &RepositoryBigMapDiffsCall{Call: call} +} + +// RepositoryBigMapDiffsCall wrap *gomock.Call +type RepositoryBigMapDiffsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryBigMapDiffsCall) Return(arg0 []domains.BigMapDiff, arg1 error) *RepositoryBigMapDiffsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryBigMapDiffsCall) Do(f func(int64, int64) ([]domains.BigMapDiff, error)) *RepositoryBigMapDiffsCall { + c.Call = c.Call.Do(f) + return c } -// Same mocks base method -func (m *MockRepository) Same(network string, c contract.Contract, limit, offset int, availiableNetworks ...string) ([]models.Same, error) { +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryBigMapDiffsCall) DoAndReturn(f func(int64, int64) ([]domains.BigMapDiff, error)) *RepositoryBigMapDiffsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Same mocks base method. +func (m *MockRepository) Same(network string, c contract.Contract, limit, offset int, availiableNetworks ...string) ([]domains.Same, error) { m.ctrl.T.Helper() - varargs := []interface{}{network, c, limit, offset} + varargs := []any{network, c, limit, offset} for _, a := range availiableNetworks { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Same", varargs...) - ret0, _ := ret[0].([]models.Same) + ret0, _ := ret[0].([]domains.Same) ret1, _ := ret[1].(error) return ret0, ret1 } -// Same indicates an expected call of Same -func (mr *MockRepositoryMockRecorder) Same(network, c, limit, offset interface{}, availiableNetworks ...interface{}) *gomock.Call { +// Same indicates an expected call of Same. +func (mr *MockRepositoryMockRecorder) Same(network, c, limit, offset any, availiableNetworks ...any) *RepositorySameCall { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{network, c, limit, offset}, availiableNetworks...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Same", reflect.TypeOf((*MockRepository)(nil).Same), varargs...) + varargs := append([]any{network, c, limit, offset}, availiableNetworks...) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Same", reflect.TypeOf((*MockRepository)(nil).Same), varargs...) + return &RepositorySameCall{Call: call} +} + +// RepositorySameCall wrap *gomock.Call +type RepositorySameCall struct { + *gomock.Call } -// SameCount mocks base method +// Return rewrite *gomock.Call.Return +func (c_2 *RepositorySameCall) Return(arg0 []domains.Same, arg1 error) *RepositorySameCall { + c_2.Call = c_2.Call.Return(arg0, arg1) + return c_2 +} + +// Do rewrite *gomock.Call.Do +func (c_2 *RepositorySameCall) Do(f func(string, contract.Contract, int, int, ...string) ([]domains.Same, error)) *RepositorySameCall { + c_2.Call = c_2.Call.Do(f) + return c_2 +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c_2 *RepositorySameCall) DoAndReturn(f func(string, contract.Contract, int, int, ...string) ([]domains.Same, error)) *RepositorySameCall { + c_2.Call = c_2.Call.DoAndReturn(f) + return c_2 +} + +// SameCount mocks base method. func (m *MockRepository) SameCount(c contract.Contract, availiableNetworks ...string) (int, error) { m.ctrl.T.Helper() - varargs := []interface{}{c} + varargs := []any{c} for _, a := range availiableNetworks { varargs = append(varargs, a) } @@ -82,9 +135,33 @@ func (m *MockRepository) SameCount(c contract.Contract, availiableNetworks ...st return ret0, ret1 } -// SameCount indicates an expected call of SameCount -func (mr *MockRepositoryMockRecorder) SameCount(c interface{}, availiableNetworks ...interface{}) *gomock.Call { +// SameCount indicates an expected call of SameCount. +func (mr *MockRepositoryMockRecorder) SameCount(c any, availiableNetworks ...any) *RepositorySameCountCall { mr.mock.ctrl.T.Helper() - varargs := append([]interface{}{c}, availiableNetworks...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SameCount", reflect.TypeOf((*MockRepository)(nil).SameCount), varargs...) + varargs := append([]any{c}, availiableNetworks...) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SameCount", reflect.TypeOf((*MockRepository)(nil).SameCount), varargs...) + return &RepositorySameCountCall{Call: call} +} + +// RepositorySameCountCall wrap *gomock.Call +type RepositorySameCountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c_2 *RepositorySameCountCall) Return(arg0 int, arg1 error) *RepositorySameCountCall { + c_2.Call = c_2.Call.Return(arg0, arg1) + return c_2 +} + +// Do rewrite *gomock.Call.Do +func (c_2 *RepositorySameCountCall) Do(f func(contract.Contract, ...string) (int, error)) *RepositorySameCountCall { + c_2.Call = c_2.Call.Do(f) + return c_2 +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c_2 *RepositorySameCountCall) DoAndReturn(f func(contract.Contract, ...string) (int, error)) *RepositorySameCountCall { + c_2.Call = c_2.Call.DoAndReturn(f) + return c_2 } diff --git a/internal/models/mock/general.go b/internal/models/mock/general.go index 679a872a5..3b21f9d32 100644 --- a/internal/models/mock/general.go +++ b/internal/models/mock/general.go @@ -1,40 +1,83 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/interface.go - +// Source: interface.go +// +// Generated by this command: +// +// mockgen -source=interface.go -destination=mock/general.go -package=mock -typed +// // Package mock is a generated GoMock package. package mock import ( context "context" - models "github.com/baking-bad/bcdhub/internal/models" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + models "github.com/baking-bad/bcdhub/internal/models" + gomock "go.uber.org/mock/gomock" ) -// MockGeneralRepository is a mock of GeneralRepository interface +// MockGeneralRepository is a mock of GeneralRepository interface. type MockGeneralRepository struct { ctrl *gomock.Controller recorder *MockGeneralRepositoryMockRecorder } -// MockGeneralRepositoryMockRecorder is the mock recorder for MockGeneralRepository +// MockGeneralRepositoryMockRecorder is the mock recorder for MockGeneralRepository. type MockGeneralRepositoryMockRecorder struct { mock *MockGeneralRepository } -// NewMockGeneralRepository creates a new mock instance +// NewMockGeneralRepository creates a new mock instance. func NewMockGeneralRepository(ctrl *gomock.Controller) *MockGeneralRepository { mock := &MockGeneralRepository{ctrl: ctrl} mock.recorder = &MockGeneralRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockGeneralRepository) EXPECT() *MockGeneralRepositoryMockRecorder { return m.recorder } -// CreateTables mocks base method +// BulkDelete mocks base method. +func (m *MockGeneralRepository) BulkDelete(arg0 context.Context, arg1 []models.Model) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BulkDelete", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// BulkDelete indicates an expected call of BulkDelete. +func (mr *MockGeneralRepositoryMockRecorder) BulkDelete(arg0, arg1 any) *GeneralRepositoryBulkDeleteCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BulkDelete", reflect.TypeOf((*MockGeneralRepository)(nil).BulkDelete), arg0, arg1) + return &GeneralRepositoryBulkDeleteCall{Call: call} +} + +// GeneralRepositoryBulkDeleteCall wrap *gomock.Call +type GeneralRepositoryBulkDeleteCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryBulkDeleteCall) Return(arg0 error) *GeneralRepositoryBulkDeleteCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryBulkDeleteCall) Do(f func(context.Context, []models.Model) error) *GeneralRepositoryBulkDeleteCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryBulkDeleteCall) DoAndReturn(f func(context.Context, []models.Model) error) *GeneralRepositoryBulkDeleteCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// CreateTables mocks base method. func (m *MockGeneralRepository) CreateTables() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateTables") @@ -42,13 +85,37 @@ func (m *MockGeneralRepository) CreateTables() error { return ret0 } -// CreateTables indicates an expected call of CreateTables -func (mr *MockGeneralRepositoryMockRecorder) CreateTables() *gomock.Call { +// CreateTables indicates an expected call of CreateTables. +func (mr *MockGeneralRepositoryMockRecorder) CreateTables() *GeneralRepositoryCreateTablesCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTables", reflect.TypeOf((*MockGeneralRepository)(nil).CreateTables)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateTables", reflect.TypeOf((*MockGeneralRepository)(nil).CreateTables)) + return &GeneralRepositoryCreateTablesCall{Call: call} +} + +// GeneralRepositoryCreateTablesCall wrap *gomock.Call +type GeneralRepositoryCreateTablesCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryCreateTablesCall) Return(arg0 error) *GeneralRepositoryCreateTablesCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryCreateTablesCall) Do(f func() error) *GeneralRepositoryCreateTablesCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryCreateTablesCall) DoAndReturn(f func() error) *GeneralRepositoryCreateTablesCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// DeleteByContract mocks base method +// DeleteByContract mocks base method. func (m *MockGeneralRepository) DeleteByContract(indices []string, address string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteByContract", indices, address) @@ -56,27 +123,75 @@ func (m *MockGeneralRepository) DeleteByContract(indices []string, address strin return ret0 } -// DeleteByContract indicates an expected call of DeleteByContract -func (mr *MockGeneralRepositoryMockRecorder) DeleteByContract(indices, address interface{}) *gomock.Call { +// DeleteByContract indicates an expected call of DeleteByContract. +func (mr *MockGeneralRepositoryMockRecorder) DeleteByContract(indices, address any) *GeneralRepositoryDeleteByContractCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteByContract", reflect.TypeOf((*MockGeneralRepository)(nil).DeleteByContract), indices, address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteByContract", reflect.TypeOf((*MockGeneralRepository)(nil).DeleteByContract), indices, address) + return &GeneralRepositoryDeleteByContractCall{Call: call} } -// GetByID mocks base method -func (m *MockGeneralRepository) GetByID(output models.Model) error { +// GeneralRepositoryDeleteByContractCall wrap *gomock.Call +type GeneralRepositoryDeleteByContractCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryDeleteByContractCall) Return(arg0 error) *GeneralRepositoryDeleteByContractCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryDeleteByContractCall) Do(f func([]string, string) error) *GeneralRepositoryDeleteByContractCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryDeleteByContractCall) DoAndReturn(f func([]string, string) error) *GeneralRepositoryDeleteByContractCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Drop mocks base method. +func (m *MockGeneralRepository) Drop(ctx context.Context) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByID", output) + ret := m.ctrl.Call(m, "Drop", ctx) ret0, _ := ret[0].(error) return ret0 } -// GetByID indicates an expected call of GetByID -func (mr *MockGeneralRepositoryMockRecorder) GetByID(output interface{}) *gomock.Call { +// Drop indicates an expected call of Drop. +func (mr *MockGeneralRepositoryMockRecorder) Drop(ctx any) *GeneralRepositoryDropCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockGeneralRepository)(nil).GetByID), output) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Drop", reflect.TypeOf((*MockGeneralRepository)(nil).Drop), ctx) + return &GeneralRepositoryDropCall{Call: call} +} + +// GeneralRepositoryDropCall wrap *gomock.Call +type GeneralRepositoryDropCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryDropCall) Return(arg0 error) *GeneralRepositoryDropCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryDropCall) Do(f func(context.Context) error) *GeneralRepositoryDropCall { + c.Call = c.Call.Do(f) + return c } -// GetAll mocks base method +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryDropCall) DoAndReturn(f func(context.Context) error) *GeneralRepositoryDropCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetAll mocks base method. func (m *MockGeneralRepository) GetAll(index string) ([]models.Model, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAll", index) @@ -85,27 +200,75 @@ func (m *MockGeneralRepository) GetAll(index string) ([]models.Model, error) { return ret0, ret1 } -// GetAll indicates an expected call of GetAll -func (mr *MockGeneralRepositoryMockRecorder) GetAll(index interface{}) *gomock.Call { +// GetAll indicates an expected call of GetAll. +func (mr *MockGeneralRepositoryMockRecorder) GetAll(index any) *GeneralRepositoryGetAllCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockGeneralRepository)(nil).GetAll), index) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockGeneralRepository)(nil).GetAll), index) + return &GeneralRepositoryGetAllCall{Call: call} } -// UpdateDoc mocks base method -func (m *MockGeneralRepository) UpdateDoc(model models.Model) error { +// GeneralRepositoryGetAllCall wrap *gomock.Call +type GeneralRepositoryGetAllCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryGetAllCall) Return(arg0 []models.Model, arg1 error) *GeneralRepositoryGetAllCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryGetAllCall) Do(f func(string) ([]models.Model, error)) *GeneralRepositoryGetAllCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryGetAllCall) DoAndReturn(f func(string) ([]models.Model, error)) *GeneralRepositoryGetAllCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByID mocks base method. +func (m *MockGeneralRepository) GetByID(output models.Model) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateDoc", model) + ret := m.ctrl.Call(m, "GetByID", output) ret0, _ := ret[0].(error) return ret0 } -// UpdateDoc indicates an expected call of UpdateDoc -func (mr *MockGeneralRepositoryMockRecorder) UpdateDoc(model interface{}) *gomock.Call { +// GetByID indicates an expected call of GetByID. +func (mr *MockGeneralRepositoryMockRecorder) GetByID(output any) *GeneralRepositoryGetByIDCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDoc", reflect.TypeOf((*MockGeneralRepository)(nil).UpdateDoc), model) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockGeneralRepository)(nil).GetByID), output) + return &GeneralRepositoryGetByIDCall{Call: call} +} + +// GeneralRepositoryGetByIDCall wrap *gomock.Call +type GeneralRepositoryGetByIDCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryGetByIDCall) Return(arg0 error) *GeneralRepositoryGetByIDCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryGetByIDCall) Do(f func(models.Model) error) *GeneralRepositoryGetByIDCall { + c.Call = c.Call.Do(f) + return c } -// IsRecordNotFound mocks base method +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryGetByIDCall) DoAndReturn(f func(models.Model) error) *GeneralRepositoryGetByIDCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// IsRecordNotFound mocks base method. func (m *MockGeneralRepository) IsRecordNotFound(err error) bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "IsRecordNotFound", err) @@ -113,13 +276,37 @@ func (m *MockGeneralRepository) IsRecordNotFound(err error) bool { return ret0 } -// IsRecordNotFound indicates an expected call of IsRecordNotFound -func (mr *MockGeneralRepositoryMockRecorder) IsRecordNotFound(err interface{}) *gomock.Call { +// IsRecordNotFound indicates an expected call of IsRecordNotFound. +func (mr *MockGeneralRepositoryMockRecorder) IsRecordNotFound(err any) *GeneralRepositoryIsRecordNotFoundCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRecordNotFound", reflect.TypeOf((*MockGeneralRepository)(nil).IsRecordNotFound), err) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRecordNotFound", reflect.TypeOf((*MockGeneralRepository)(nil).IsRecordNotFound), err) + return &GeneralRepositoryIsRecordNotFoundCall{Call: call} +} + +// GeneralRepositoryIsRecordNotFoundCall wrap *gomock.Call +type GeneralRepositoryIsRecordNotFoundCall struct { + *gomock.Call } -// Save mocks base method +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryIsRecordNotFoundCall) Return(arg0 bool) *GeneralRepositoryIsRecordNotFoundCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryIsRecordNotFoundCall) Do(f func(error) bool) *GeneralRepositoryIsRecordNotFoundCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryIsRecordNotFoundCall) DoAndReturn(f func(error) bool) *GeneralRepositoryIsRecordNotFoundCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Save mocks base method. func (m *MockGeneralRepository) Save(ctx context.Context, items []models.Model) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Save", ctx, items) @@ -127,27 +314,37 @@ func (m *MockGeneralRepository) Save(ctx context.Context, items []models.Model) return ret0 } -// Save indicates an expected call of Save -func (mr *MockGeneralRepositoryMockRecorder) Save(ctx, items interface{}) *gomock.Call { +// Save indicates an expected call of Save. +func (mr *MockGeneralRepositoryMockRecorder) Save(ctx, items any) *GeneralRepositorySaveCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Save", reflect.TypeOf((*MockGeneralRepository)(nil).Save), ctx, items) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Save", reflect.TypeOf((*MockGeneralRepository)(nil).Save), ctx, items) + return &GeneralRepositorySaveCall{Call: call} } -// BulkDelete mocks base method -func (m *MockGeneralRepository) BulkDelete(arg0 context.Context, arg1 []models.Model) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "BulkDelete", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 +// GeneralRepositorySaveCall wrap *gomock.Call +type GeneralRepositorySaveCall struct { + *gomock.Call } -// BulkDelete indicates an expected call of BulkDelete -func (mr *MockGeneralRepositoryMockRecorder) BulkDelete(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BulkDelete", reflect.TypeOf((*MockGeneralRepository)(nil).BulkDelete), arg0, arg1) +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositorySaveCall) Return(arg0 error) *GeneralRepositorySaveCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositorySaveCall) Do(f func(context.Context, []models.Model) error) *GeneralRepositorySaveCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositorySaveCall) DoAndReturn(f func(context.Context, []models.Model) error) *GeneralRepositorySaveCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// TablesExist mocks base method +// TablesExist mocks base method. func (m *MockGeneralRepository) TablesExist() bool { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "TablesExist") @@ -155,22 +352,70 @@ func (m *MockGeneralRepository) TablesExist() bool { return ret0 } -// TablesExist indicates an expected call of TablesExist -func (mr *MockGeneralRepositoryMockRecorder) TablesExist() *gomock.Call { +// TablesExist indicates an expected call of TablesExist. +func (mr *MockGeneralRepositoryMockRecorder) TablesExist() *GeneralRepositoryTablesExistCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TablesExist", reflect.TypeOf((*MockGeneralRepository)(nil).TablesExist)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TablesExist", reflect.TypeOf((*MockGeneralRepository)(nil).TablesExist)) + return &GeneralRepositoryTablesExistCall{Call: call} } -// Drop mocks base method -func (m *MockGeneralRepository) Drop(ctx context.Context) error { +// GeneralRepositoryTablesExistCall wrap *gomock.Call +type GeneralRepositoryTablesExistCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryTablesExistCall) Return(arg0 bool) *GeneralRepositoryTablesExistCall { + c.Call = c.Call.Return(arg0) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryTablesExistCall) Do(f func() bool) *GeneralRepositoryTablesExistCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryTablesExistCall) DoAndReturn(f func() bool) *GeneralRepositoryTablesExistCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// UpdateDoc mocks base method. +func (m *MockGeneralRepository) UpdateDoc(model models.Model) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Drop", ctx) + ret := m.ctrl.Call(m, "UpdateDoc", model) ret0, _ := ret[0].(error) return ret0 } -// Drop indicates an expected call of Drop -func (mr *MockGeneralRepositoryMockRecorder) Drop(ctx interface{}) *gomock.Call { +// UpdateDoc indicates an expected call of UpdateDoc. +func (mr *MockGeneralRepositoryMockRecorder) UpdateDoc(model any) *GeneralRepositoryUpdateDocCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Drop", reflect.TypeOf((*MockGeneralRepository)(nil).Drop), ctx) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateDoc", reflect.TypeOf((*MockGeneralRepository)(nil).UpdateDoc), model) + return &GeneralRepositoryUpdateDocCall{Call: call} +} + +// GeneralRepositoryUpdateDocCall wrap *gomock.Call +type GeneralRepositoryUpdateDocCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *GeneralRepositoryUpdateDocCall) Return(err error) *GeneralRepositoryUpdateDocCall { + c.Call = c.Call.Return(err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *GeneralRepositoryUpdateDocCall) Do(f func(models.Model) error) *GeneralRepositoryUpdateDocCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *GeneralRepositoryUpdateDocCall) DoAndReturn(f func(models.Model) error) *GeneralRepositoryUpdateDocCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/migration/mock.go b/internal/models/mock/migration/mock.go index 880be3a0d..db076ccbd 100644 --- a/internal/models/mock/migration/mock.go +++ b/internal/models/mock/migration/mock.go @@ -1,49 +1,78 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/migration/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/migration/mock.go -package=migration -typed +// // Package migration is a generated GoMock package. package migration import ( - model "github.com/baking-bad/bcdhub/internal/models/migration" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + migration "github.com/baking-bad/bcdhub/internal/models/migration" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(contractID int64) ([]model.Migration, error) { +// Get mocks base method. +func (m *MockRepository) Get(contractID int64) ([]migration.Migration, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", contractID) - ret0, _ := ret[0].([]model.Migration) + ret0, _ := ret[0].([]migration.Migration) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(contractID interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(contractID any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), contractID) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), contractID) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 []migration.Migration, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(int64) ([]migration.Migration, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(int64) ([]migration.Migration, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/operation/mock.go b/internal/models/mock/operation/mock.go index 8c29ccd72..72ebc59d4 100644 --- a/internal/models/mock/operation/mock.go +++ b/internal/models/mock/operation/mock.go @@ -1,234 +1,551 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/operation/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/operation/mock.go -package=operation -typed +// // Package operation is a generated GoMock package. package operation import ( - account "github.com/baking-bad/bcdhub/internal/models/account" - model "github.com/baking-bad/bcdhub/internal/models/operation" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + account "github.com/baking-bad/bcdhub/internal/models/account" + operation "github.com/baking-bad/bcdhub/internal/models/operation" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// GetByAccount mocks base method -func (m *MockRepository) GetByAccount(acc account.Account, size uint64, filters map[string]interface{}) (model.Pageable, error) { +// ContractStats mocks base method. +func (m *MockRepository) ContractStats(address string) (operation.ContractStats, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByAccount", acc, size, filters) - ret0, _ := ret[0].(model.Pageable) + ret := m.ctrl.Call(m, "ContractStats", address) + ret0, _ := ret[0].(operation.ContractStats) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByAccount indicates an expected call of GetByAccount -func (mr *MockRepositoryMockRecorder) GetByAccount(acc, size, filters interface{}) *gomock.Call { +// ContractStats indicates an expected call of ContractStats. +func (mr *MockRepositoryMockRecorder) ContractStats(address any) *RepositoryContractStatsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByAccount", reflect.TypeOf((*MockRepository)(nil).GetByAccount), acc, size, filters) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContractStats", reflect.TypeOf((*MockRepository)(nil).ContractStats), address) + return &RepositoryContractStatsCall{Call: call} } -// Last mocks base method -func (m *MockRepository) Last(filter map[string]interface{}, lastID int64) (model.Operation, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Last", filter, lastID) - ret0, _ := ret[0].(model.Operation) - ret1, _ := ret[1].(error) - return ret0, ret1 +// RepositoryContractStatsCall wrap *gomock.Call +type RepositoryContractStatsCall struct { + *gomock.Call } -// Last indicates an expected call of Last -func (mr *MockRepositoryMockRecorder) Last(filter, lastID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Last", reflect.TypeOf((*MockRepository)(nil).Last), filter, lastID) +// Return rewrite *gomock.Call.Return +func (c *RepositoryContractStatsCall) Return(arg0 operation.ContractStats, arg1 error) *RepositoryContractStatsCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// GetByHash mocks base method -func (m *MockRepository) GetByHash(hash []byte) ([]model.Operation, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryContractStatsCall) Do(f func(string) (operation.ContractStats, error)) *RepositoryContractStatsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryContractStatsCall) DoAndReturn(f func(string) (operation.ContractStats, error)) *RepositoryContractStatsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// EventsCount mocks base method. +func (m *MockRepository) EventsCount(accountID int64) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByHash", hash) - ret0, _ := ret[0].([]model.Operation) + ret := m.ctrl.Call(m, "EventsCount", accountID) + ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByHash indicates an expected call of GetByHash -func (mr *MockRepositoryMockRecorder) GetByHash(hash interface{}) *gomock.Call { +// EventsCount indicates an expected call of EventsCount. +func (mr *MockRepositoryMockRecorder) EventsCount(accountID any) *RepositoryEventsCountCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByHash", reflect.TypeOf((*MockRepository)(nil).GetByHash), hash) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsCount", reflect.TypeOf((*MockRepository)(nil).EventsCount), accountID) + return &RepositoryEventsCountCall{Call: call} +} + +// RepositoryEventsCountCall wrap *gomock.Call +type RepositoryEventsCountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryEventsCountCall) Return(arg0 int, arg1 error) *RepositoryEventsCountCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryEventsCountCall) Do(f func(int64) (int, error)) *RepositoryEventsCountCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryEventsCountCall) DoAndReturn(f func(int64) (int, error)) *RepositoryEventsCountCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetByHashAndCounter mocks base method -func (m *MockRepository) GetByHashAndCounter(hash []byte, counter int64) ([]model.Operation, error) { +// Get mocks base method. +func (m *MockRepository) Get(filter map[string]any, size int64, sort bool) ([]operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByHashAndCounter", hash, counter) - ret0, _ := ret[0].([]model.Operation) + ret := m.ctrl.Call(m, "Get", filter, size, sort) + ret0, _ := ret[0].([]operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByHashAndCounter indicates an expected call of GetByHashAndCounter -func (mr *MockRepositoryMockRecorder) GetByHashAndCounter(hash, counter interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(filter, size, sort any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByHashAndCounter", reflect.TypeOf((*MockRepository)(nil).GetByHashAndCounter), hash, counter) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), filter, size, sort) + return &RepositoryGetCall{Call: call} } -// GetImplicitOperation mocks base method -func (m *MockRepository) GetImplicitOperation(counter int64) (model.Operation, error) { +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 []operation.Operation, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(map[string]any, int64, bool) ([]operation.Operation, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(map[string]any, int64, bool) ([]operation.Operation, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByAccount mocks base method. +func (m *MockRepository) GetByAccount(acc account.Account, size uint64, filters map[string]any) (operation.Pageable, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetImplicitOperation", counter) - ret0, _ := ret[0].(model.Operation) + ret := m.ctrl.Call(m, "GetByAccount", acc, size, filters) + ret0, _ := ret[0].(operation.Pageable) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetImplicitOperation indicates an expected call of GetImplicitOperation -func (mr *MockRepositoryMockRecorder) GetImplicitOperation(counter interface{}) *gomock.Call { +// GetByAccount indicates an expected call of GetByAccount. +func (mr *MockRepositoryMockRecorder) GetByAccount(acc, size, filters any) *RepositoryGetByAccountCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetImplicitOperation", reflect.TypeOf((*MockRepository)(nil).GetImplicitOperation), counter) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByAccount", reflect.TypeOf((*MockRepository)(nil).GetByAccount), acc, size, filters) + return &RepositoryGetByAccountCall{Call: call} +} + +// RepositoryGetByAccountCall wrap *gomock.Call +type RepositoryGetByAccountCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByAccountCall) Return(arg0 operation.Pageable, arg1 error) *RepositoryGetByAccountCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByAccountCall) Do(f func(account.Account, uint64, map[string]any) (operation.Pageable, error)) *RepositoryGetByAccountCall { + c.Call = c.Call.Do(f) + return c } -// OPG mocks base method -func (m *MockRepository) OPG(address string, size, lastID int64) ([]model.OPG, error) { +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByAccountCall) DoAndReturn(f func(account.Account, uint64, map[string]any) (operation.Pageable, error)) *RepositoryGetByAccountCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByHash mocks base method. +func (m *MockRepository) GetByHash(hash []byte) ([]operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "OPG", address, size, lastID) - ret0, _ := ret[0].([]model.OPG) + ret := m.ctrl.Call(m, "GetByHash", hash) + ret0, _ := ret[0].([]operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// OPG indicates an expected call of OPG -func (mr *MockRepositoryMockRecorder) OPG(address, size, lastID interface{}) *gomock.Call { +// GetByHash indicates an expected call of GetByHash. +func (mr *MockRepositoryMockRecorder) GetByHash(hash any) *RepositoryGetByHashCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OPG", reflect.TypeOf((*MockRepository)(nil).OPG), address, size, lastID) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByHash", reflect.TypeOf((*MockRepository)(nil).GetByHash), hash) + return &RepositoryGetByHashCall{Call: call} } -// Origination mocks base method -func (m *MockRepository) Origination(accountID int64) (model.Operation, error) { +// RepositoryGetByHashCall wrap *gomock.Call +type RepositoryGetByHashCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByHashCall) Return(arg0 []operation.Operation, arg1 error) *RepositoryGetByHashCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByHashCall) Do(f func([]byte) ([]operation.Operation, error)) *RepositoryGetByHashCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByHashCall) DoAndReturn(f func([]byte) ([]operation.Operation, error)) *RepositoryGetByHashCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByHashAndCounter mocks base method. +func (m *MockRepository) GetByHashAndCounter(hash []byte, counter int64) ([]operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Origination", accountID) - ret0, _ := ret[0].(model.Operation) + ret := m.ctrl.Call(m, "GetByHashAndCounter", hash, counter) + ret0, _ := ret[0].([]operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// Origination indicates an expected call of Origination -func (mr *MockRepositoryMockRecorder) Origination(accountID interface{}) *gomock.Call { +// GetByHashAndCounter indicates an expected call of GetByHashAndCounter. +func (mr *MockRepositoryMockRecorder) GetByHashAndCounter(hash, counter any) *RepositoryGetByHashAndCounterCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Origination", reflect.TypeOf((*MockRepository)(nil).Origination), accountID) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByHashAndCounter", reflect.TypeOf((*MockRepository)(nil).GetByHashAndCounter), hash, counter) + return &RepositoryGetByHashAndCounterCall{Call: call} +} + +// RepositoryGetByHashAndCounterCall wrap *gomock.Call +type RepositoryGetByHashAndCounterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByHashAndCounterCall) Return(arg0 []operation.Operation, arg1 error) *RepositoryGetByHashAndCounterCall { + c.Call = c.Call.Return(arg0, arg1) + return c } -// Get mocks base method -func (m *MockRepository) Get(filter map[string]interface{}, size int64, sort bool) ([]model.Operation, error) { +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByHashAndCounterCall) Do(f func([]byte, int64) ([]operation.Operation, error)) *RepositoryGetByHashAndCounterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByHashAndCounterCall) DoAndReturn(f func([]byte, int64) ([]operation.Operation, error)) *RepositoryGetByHashAndCounterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByID mocks base method. +func (m *MockRepository) GetByID(id int64) (operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Get", filter, size, sort) - ret0, _ := ret[0].([]model.Operation) + ret := m.ctrl.Call(m, "GetByID", id) + ret0, _ := ret[0].(operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(filter, size, sort interface{}) *gomock.Call { +// GetByID indicates an expected call of GetByID. +func (mr *MockRepositoryMockRecorder) GetByID(id any) *RepositoryGetByIDCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), filter, size, sort) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockRepository)(nil).GetByID), id) + return &RepositoryGetByIDCall{Call: call} +} + +// RepositoryGetByIDCall wrap *gomock.Call +type RepositoryGetByIDCall struct { + *gomock.Call } -// GetByIDs mocks base method -func (m *MockRepository) GetByIDs(ids ...int64) ([]model.Operation, error) { +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByIDCall) Return(arg0 operation.Operation, arg1 error) *RepositoryGetByIDCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByIDCall) Do(f func(int64) (operation.Operation, error)) *RepositoryGetByIDCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByIDCall) DoAndReturn(f func(int64) (operation.Operation, error)) *RepositoryGetByIDCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetByIDs mocks base method. +func (m *MockRepository) GetByIDs(ids ...int64) ([]operation.Operation, error) { m.ctrl.T.Helper() - varargs := []interface{}{} + varargs := []any{} for _, a := range ids { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetByIDs", varargs...) - ret0, _ := ret[0].([]model.Operation) + ret0, _ := ret[0].([]operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByIDs indicates an expected call of GetByIDs -func (mr *MockRepositoryMockRecorder) GetByIDs(ids ...interface{}) *gomock.Call { +// GetByIDs indicates an expected call of GetByIDs. +func (mr *MockRepositoryMockRecorder) GetByIDs(ids ...any) *RepositoryGetByIDsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByIDs", reflect.TypeOf((*MockRepository)(nil).GetByIDs), ids...) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByIDs", reflect.TypeOf((*MockRepository)(nil).GetByIDs), ids...) + return &RepositoryGetByIDsCall{Call: call} +} + +// RepositoryGetByIDsCall wrap *gomock.Call +type RepositoryGetByIDsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByIDsCall) Return(arg0 []operation.Operation, arg1 error) *RepositoryGetByIDsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByIDsCall) Do(f func(...int64) ([]operation.Operation, error)) *RepositoryGetByIDsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByIDsCall) DoAndReturn(f func(...int64) ([]operation.Operation, error)) *RepositoryGetByIDsCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetByID mocks base method -func (m *MockRepository) GetByID(id int64) (model.Operation, error) { +// GetImplicitOperation mocks base method. +func (m *MockRepository) GetImplicitOperation(counter int64) (operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByID", id) - ret0, _ := ret[0].(model.Operation) + ret := m.ctrl.Call(m, "GetImplicitOperation", counter) + ret0, _ := ret[0].(operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByID indicates an expected call of GetByID -func (mr *MockRepositoryMockRecorder) GetByID(id interface{}) *gomock.Call { +// GetImplicitOperation indicates an expected call of GetImplicitOperation. +func (mr *MockRepositoryMockRecorder) GetImplicitOperation(counter any) *RepositoryGetImplicitOperationCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockRepository)(nil).GetByID), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetImplicitOperation", reflect.TypeOf((*MockRepository)(nil).GetImplicitOperation), counter) + return &RepositoryGetImplicitOperationCall{Call: call} +} + +// RepositoryGetImplicitOperationCall wrap *gomock.Call +type RepositoryGetImplicitOperationCall struct { + *gomock.Call } -// ListEvents mocks base method -func (m *MockRepository) ListEvents(accountID, size, offset int64) ([]model.Operation, error) { +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetImplicitOperationCall) Return(arg0 operation.Operation, arg1 error) *RepositoryGetImplicitOperationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetImplicitOperationCall) Do(f func(int64) (operation.Operation, error)) *RepositoryGetImplicitOperationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetImplicitOperationCall) DoAndReturn(f func(int64) (operation.Operation, error)) *RepositoryGetImplicitOperationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Last mocks base method. +func (m *MockRepository) Last(filter map[string]any, lastID int64) (operation.Operation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Last", filter, lastID) + ret0, _ := ret[0].(operation.Operation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Last indicates an expected call of Last. +func (mr *MockRepositoryMockRecorder) Last(filter, lastID any) *RepositoryLastCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Last", reflect.TypeOf((*MockRepository)(nil).Last), filter, lastID) + return &RepositoryLastCall{Call: call} +} + +// RepositoryLastCall wrap *gomock.Call +type RepositoryLastCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryLastCall) Return(arg0 operation.Operation, arg1 error) *RepositoryLastCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryLastCall) Do(f func(map[string]any, int64) (operation.Operation, error)) *RepositoryLastCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryLastCall) DoAndReturn(f func(map[string]any, int64) (operation.Operation, error)) *RepositoryLastCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// ListEvents mocks base method. +func (m *MockRepository) ListEvents(accountID, size, offset int64) ([]operation.Operation, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ListEvents", accountID, size, offset) - ret0, _ := ret[0].([]model.Operation) + ret0, _ := ret[0].([]operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// ListEvents indicates an expected call of ListEvents -func (mr *MockRepositoryMockRecorder) ListEvents(accountID, size, offset interface{}) *gomock.Call { +// ListEvents indicates an expected call of ListEvents. +func (mr *MockRepositoryMockRecorder) ListEvents(accountID, size, offset any) *RepositoryListEventsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEvents", reflect.TypeOf((*MockRepository)(nil).ListEvents), accountID, size, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEvents", reflect.TypeOf((*MockRepository)(nil).ListEvents), accountID, size, offset) + return &RepositoryListEventsCall{Call: call} } -// EventsCount mocks base method -func (m *MockRepository) EventsCount(accountID int64) (int, error) { +// RepositoryListEventsCall wrap *gomock.Call +type RepositoryListEventsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryListEventsCall) Return(arg0 []operation.Operation, arg1 error) *RepositoryListEventsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryListEventsCall) Do(f func(int64, int64, int64) ([]operation.Operation, error)) *RepositoryListEventsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryListEventsCall) DoAndReturn(f func(int64, int64, int64) ([]operation.Operation, error)) *RepositoryListEventsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// OPG mocks base method. +func (m *MockRepository) OPG(address string, size, lastID int64) ([]operation.OPG, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "EventsCount", accountID) - ret0, _ := ret[0].(int) + ret := m.ctrl.Call(m, "OPG", address, size, lastID) + ret0, _ := ret[0].([]operation.OPG) ret1, _ := ret[1].(error) return ret0, ret1 } -// EventsCount indicates an expected call of EventsCount -func (mr *MockRepositoryMockRecorder) EventsCount(accountID interface{}) *gomock.Call { +// OPG indicates an expected call of OPG. +func (mr *MockRepositoryMockRecorder) OPG(address, size, lastID any) *RepositoryOPGCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EventsCount", reflect.TypeOf((*MockRepository)(nil).EventsCount), accountID) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OPG", reflect.TypeOf((*MockRepository)(nil).OPG), address, size, lastID) + return &RepositoryOPGCall{Call: call} } -// ContractStats mocks base method -func (m *MockRepository) ContractStats(address string) (model.ContractStats, error) { +// RepositoryOPGCall wrap *gomock.Call +type RepositoryOPGCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryOPGCall) Return(arg0 []operation.OPG, arg1 error) *RepositoryOPGCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryOPGCall) Do(f func(string, int64, int64) ([]operation.OPG, error)) *RepositoryOPGCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryOPGCall) DoAndReturn(f func(string, int64, int64) ([]operation.OPG, error)) *RepositoryOPGCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// Origination mocks base method. +func (m *MockRepository) Origination(accountID int64) (operation.Operation, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ContractStats", address) - ret0, _ := ret[0].(model.ContractStats) + ret := m.ctrl.Call(m, "Origination", accountID) + ret0, _ := ret[0].(operation.Operation) ret1, _ := ret[1].(error) return ret0, ret1 } -// ContractStats indicates an expected call of ContractStats -func (mr *MockRepositoryMockRecorder) ContractStats(address interface{}) *gomock.Call { +// Origination indicates an expected call of Origination. +func (mr *MockRepositoryMockRecorder) Origination(accountID any) *RepositoryOriginationCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContractStats", reflect.TypeOf((*MockRepository)(nil).ContractStats), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Origination", reflect.TypeOf((*MockRepository)(nil).Origination), accountID) + return &RepositoryOriginationCall{Call: call} +} + +// RepositoryOriginationCall wrap *gomock.Call +type RepositoryOriginationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryOriginationCall) Return(arg0 operation.Operation, arg1 error) *RepositoryOriginationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryOriginationCall) Do(f func(int64) (operation.Operation, error)) *RepositoryOriginationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryOriginationCall) DoAndReturn(f func(int64) (operation.Operation, error)) *RepositoryOriginationCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/protocol/mock.go b/internal/models/mock/protocol/mock.go index 25b8b56b3..ce05605ac 100644 --- a/internal/models/mock/protocol/mock.go +++ b/internal/models/mock/protocol/mock.go @@ -1,108 +1,195 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/protocol/repository.go - +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/protocol/mock.go -package=protocol -typed +// // Package protocol is a generated GoMock package. package protocol import ( - model "github.com/baking-bad/bcdhub/internal/models/protocol" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + protocol "github.com/baking-bad/bcdhub/internal/models/protocol" + gomock "go.uber.org/mock/gomock" ) -// MockRepository is a mock of Repository interface +// MockRepository is a mock of Repository interface. type MockRepository struct { ctrl *gomock.Controller recorder *MockRepositoryMockRecorder } -// MockRepositoryMockRecorder is the mock recorder for MockRepository +// MockRepositoryMockRecorder is the mock recorder for MockRepository. type MockRepositoryMockRecorder struct { mock *MockRepository } -// NewMockRepository creates a new mock instance +// NewMockRepository creates a new mock instance. func NewMockRepository(ctrl *gomock.Controller) *MockRepository { mock := &MockRepository{ctrl: ctrl} mock.recorder = &MockRepositoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { return m.recorder } -// Get mocks base method -func (m *MockRepository) Get(hash string, level int64) (model.Protocol, error) { +// Get mocks base method. +func (m *MockRepository) Get(hash string, level int64) (protocol.Protocol, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", hash, level) - ret0, _ := ret[0].(model.Protocol) + ret0, _ := ret[0].(protocol.Protocol) ret1, _ := ret[1].(error) return ret0, ret1 } -// Get indicates an expected call of Get -func (mr *MockRepositoryMockRecorder) Get(hash, level interface{}) *gomock.Call { +// Get indicates an expected call of Get. +func (mr *MockRepositoryMockRecorder) Get(hash, level any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), hash, level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), hash, level) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 protocol.Protocol, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(string, int64) (protocol.Protocol, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(string, int64) (protocol.Protocol, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetAll mocks base method -func (m *MockRepository) GetAll() ([]model.Protocol, error) { +// GetAll mocks base method. +func (m *MockRepository) GetAll() ([]protocol.Protocol, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAll") - ret0, _ := ret[0].([]model.Protocol) + ret0, _ := ret[0].([]protocol.Protocol) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetAll indicates an expected call of GetAll -func (mr *MockRepositoryMockRecorder) GetAll() *gomock.Call { +// GetAll indicates an expected call of GetAll. +func (mr *MockRepositoryMockRecorder) GetAll() *RepositoryGetAllCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockRepository)(nil).GetAll)) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAll", reflect.TypeOf((*MockRepository)(nil).GetAll)) + return &RepositoryGetAllCall{Call: call} +} + +// RepositoryGetAllCall wrap *gomock.Call +type RepositoryGetAllCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetAllCall) Return(response []protocol.Protocol, err error) *RepositoryGetAllCall { + c.Call = c.Call.Return(response, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetAllCall) Do(f func() ([]protocol.Protocol, error)) *RepositoryGetAllCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetAllCall) DoAndReturn(f func() ([]protocol.Protocol, error)) *RepositoryGetAllCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetByNetworkWithSort mocks base method -func (m *MockRepository) GetByNetworkWithSort(sortField, order string) ([]model.Protocol, error) { +// GetByID mocks base method. +func (m *MockRepository) GetByID(id int64) (protocol.Protocol, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByNetworkWithSort", sortField, order) - ret0, _ := ret[0].([]model.Protocol) + ret := m.ctrl.Call(m, "GetByID", id) + ret0, _ := ret[0].(protocol.Protocol) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByNetworkWithSort indicates an expected call of GetByNetworkWithSort -func (mr *MockRepositoryMockRecorder) GetByNetworkWithSort(sortField, order interface{}) *gomock.Call { +// GetByID indicates an expected call of GetByID. +func (mr *MockRepositoryMockRecorder) GetByID(id any) *RepositoryGetByIDCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByNetworkWithSort", reflect.TypeOf((*MockRepository)(nil).GetByNetworkWithSort), sortField, order) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockRepository)(nil).GetByID), id) + return &RepositoryGetByIDCall{Call: call} +} + +// RepositoryGetByIDCall wrap *gomock.Call +type RepositoryGetByIDCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByIDCall) Return(response protocol.Protocol, err error) *RepositoryGetByIDCall { + c.Call = c.Call.Return(response, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByIDCall) Do(f func(int64) (protocol.Protocol, error)) *RepositoryGetByIDCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByIDCall) DoAndReturn(f func(int64) (protocol.Protocol, error)) *RepositoryGetByIDCall { + c.Call = c.Call.DoAndReturn(f) + return c } -// GetByID mocks base method -func (m *MockRepository) GetByID(id int64) (model.Protocol, error) { +// GetByNetworkWithSort mocks base method. +func (m *MockRepository) GetByNetworkWithSort(sortField, order string) ([]protocol.Protocol, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetByID", id) - ret0, _ := ret[0].(model.Protocol) + ret := m.ctrl.Call(m, "GetByNetworkWithSort", sortField, order) + ret0, _ := ret[0].([]protocol.Protocol) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetByID indicates an expected call of GetByID -func (mr *MockRepositoryMockRecorder) GetByID(id interface{}) *gomock.Call { +// GetByNetworkWithSort indicates an expected call of GetByNetworkWithSort. +func (mr *MockRepositoryMockRecorder) GetByNetworkWithSort(sortField, order any) *RepositoryGetByNetworkWithSortCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByID", reflect.TypeOf((*MockRepository)(nil).GetByID), id) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByNetworkWithSort", reflect.TypeOf((*MockRepository)(nil).GetByNetworkWithSort), sortField, order) + return &RepositoryGetByNetworkWithSortCall{Call: call} } -// CheckChainID mocks base method -func (m *MockRepository) CheckChainID(chainID string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CheckChainID", chainID) - ret0, _ := ret[0].(error) - return ret0 +// RepositoryGetByNetworkWithSortCall wrap *gomock.Call +type RepositoryGetByNetworkWithSortCall struct { + *gomock.Call } -// CheckChainID indicates an expected call of CheckChainID -func (mr *MockRepositoryMockRecorder) CheckChainID(chainID interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckChainID", reflect.TypeOf((*MockRepository)(nil).CheckChainID), chainID) +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetByNetworkWithSortCall) Return(response []protocol.Protocol, err error) *RepositoryGetByNetworkWithSortCall { + c.Call = c.Call.Return(response, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetByNetworkWithSortCall) Do(f func(string, string) ([]protocol.Protocol, error)) *RepositoryGetByNetworkWithSortCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetByNetworkWithSortCall) DoAndReturn(f func(string, string) ([]protocol.Protocol, error)) *RepositoryGetByNetworkWithSortCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/smart_rollup/mock.go b/internal/models/mock/smart_rollup/mock.go index 0d8dd2b72..0372bb762 100644 --- a/internal/models/mock/smart_rollup/mock.go +++ b/internal/models/mock/smart_rollup/mock.go @@ -1,14 +1,18 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/smart_rollup/repository.go - -// Package model is a generated GoMock package. -package smartrollup +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/smart_rollup/mock.go -package=smart_rollup -typed +// +// Package smart_rollup is a generated GoMock package. +package smart_rollup import ( reflect "reflect" - model "github.com/baking-bad/bcdhub/internal/models/smart_rollup" - gomock "github.com/golang/mock/gomock" + smartrollup "github.com/baking-bad/bcdhub/internal/models/smart_rollup" + gomock "go.uber.org/mock/gomock" ) // MockRepository is a mock of Repository interface. @@ -35,31 +39,79 @@ func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { } // Get mocks base method. -func (m *MockRepository) Get(address string) (model.SmartRollup, error) { +func (m *MockRepository) Get(address string) (smartrollup.SmartRollup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", address) - ret0, _ := ret[0].(model.SmartRollup) + ret0, _ := ret[0].(smartrollup.SmartRollup) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockRepositoryMockRecorder) Get(address interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) Get(address any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), address) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 smartrollup.SmartRollup, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(string) (smartrollup.SmartRollup, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(string) (smartrollup.SmartRollup, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // List mocks base method. -func (m *MockRepository) List(limit, offset int64, sort string) ([]model.SmartRollup, error) { +func (m *MockRepository) List(limit, offset int64, sort string) ([]smartrollup.SmartRollup, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "List", limit, offset, sort) - ret0, _ := ret[0].([]model.SmartRollup) + ret0, _ := ret[0].([]smartrollup.SmartRollup) ret1, _ := ret[1].(error) return ret0, ret1 } // List indicates an expected call of List. -func (mr *MockRepositoryMockRecorder) List(limit, offset, sort interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) List(limit, offset, sort any) *RepositoryListCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRepository)(nil).List), limit, offset, sort) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRepository)(nil).List), limit, offset, sort) + return &RepositoryListCall{Call: call} +} + +// RepositoryListCall wrap *gomock.Call +type RepositoryListCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryListCall) Return(arg0 []smartrollup.SmartRollup, arg1 error) *RepositoryListCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryListCall) Do(f func(int64, int64, string) ([]smartrollup.SmartRollup, error)) *RepositoryListCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryListCall) DoAndReturn(f func(int64, int64, string) ([]smartrollup.SmartRollup, error)) *RepositoryListCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/mock/ticket/mock.go b/internal/models/mock/ticket/mock.go index 57047f75a..52eaebc26 100644 --- a/internal/models/mock/ticket/mock.go +++ b/internal/models/mock/ticket/mock.go @@ -1,14 +1,18 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/models/ticket/repository.go - -// Package mock_ticket is a generated GoMock package. +// Source: repository.go +// +// Generated by this command: +// +// mockgen -source=repository.go -destination=../mock/ticket/mock.go -package=ticket -typed +// +// Package ticket is a generated GoMock package. package ticket import ( reflect "reflect" - model "github.com/baking-bad/bcdhub/internal/models/ticket" - gomock "github.com/golang/mock/gomock" + ticket "github.com/baking-bad/bcdhub/internal/models/ticket" + gomock "go.uber.org/mock/gomock" ) // MockRepository is a mock of Repository interface. @@ -35,33 +39,81 @@ func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder { } // ForOperation mocks base method. -func (m *MockRepository) ForOperation(operationId int64) ([]model.TicketUpdate, error) { +func (m *MockRepository) ForOperation(operationId int64) ([]ticket.TicketUpdate, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ForOperation", operationId) - ret0, _ := ret[0].([]model.TicketUpdate) + ret0, _ := ret[0].([]ticket.TicketUpdate) ret1, _ := ret[1].(error) return ret0, ret1 } // ForOperation indicates an expected call of ForOperation. -func (mr *MockRepositoryMockRecorder) ForOperation(operationId interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) ForOperation(operationId any) *RepositoryForOperationCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForOperation", reflect.TypeOf((*MockRepository)(nil).ForOperation), operationId) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ForOperation", reflect.TypeOf((*MockRepository)(nil).ForOperation), operationId) + return &RepositoryForOperationCall{Call: call} +} + +// RepositoryForOperationCall wrap *gomock.Call +type RepositoryForOperationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryForOperationCall) Return(arg0 []ticket.TicketUpdate, arg1 error) *RepositoryForOperationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryForOperationCall) Do(f func(int64) ([]ticket.TicketUpdate, error)) *RepositoryForOperationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryForOperationCall) DoAndReturn(f func(int64) ([]ticket.TicketUpdate, error)) *RepositoryForOperationCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Get mocks base method. -func (m *MockRepository) Get(ticketer string, limit, offset int64) ([]model.TicketUpdate, error) { +func (m *MockRepository) Get(ticketer string, limit, offset int64) ([]ticket.TicketUpdate, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Get", ticketer, limit, offset) - ret0, _ := ret[0].([]model.TicketUpdate) + ret0, _ := ret[0].([]ticket.TicketUpdate) ret1, _ := ret[1].(error) return ret0, ret1 } // Get indicates an expected call of Get. -func (mr *MockRepositoryMockRecorder) Get(ticketer, limit, offset interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) Get(ticketer, limit, offset any) *RepositoryGetCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ticketer, limit, offset) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRepository)(nil).Get), ticketer, limit, offset) + return &RepositoryGetCall{Call: call} +} + +// RepositoryGetCall wrap *gomock.Call +type RepositoryGetCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryGetCall) Return(arg0 []ticket.TicketUpdate, arg1 error) *RepositoryGetCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryGetCall) Do(f func(string, int64, int64) ([]ticket.TicketUpdate, error)) *RepositoryGetCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryGetCall) DoAndReturn(f func(string, int64, int64) ([]ticket.TicketUpdate, error)) *RepositoryGetCall { + c.Call = c.Call.DoAndReturn(f) + return c } // Has mocks base method. @@ -74,7 +126,31 @@ func (m *MockRepository) Has(contractID int64) (bool, error) { } // Has indicates an expected call of Has. -func (mr *MockRepositoryMockRecorder) Has(contractID interface{}) *gomock.Call { +func (mr *MockRepositoryMockRecorder) Has(contractID any) *RepositoryHasCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockRepository)(nil).Has), contractID) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockRepository)(nil).Has), contractID) + return &RepositoryHasCall{Call: call} +} + +// RepositoryHasCall wrap *gomock.Call +type RepositoryHasCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *RepositoryHasCall) Return(arg0 bool, arg1 error) *RepositoryHasCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *RepositoryHasCall) Do(f func(int64) (bool, error)) *RepositoryHasCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *RepositoryHasCall) DoAndReturn(f func(int64) (bool, error)) *RepositoryHasCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/models/operation/repository.go b/internal/models/operation/repository.go index bc8484f3f..e3c68567e 100644 --- a/internal/models/operation/repository.go +++ b/internal/models/operation/repository.go @@ -4,7 +4,7 @@ import ( "github.com/baking-bad/bcdhub/internal/models/account" ) -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/operation/mock.go -package=operation -typed type Repository interface { GetByAccount(acc account.Account, size uint64, filters map[string]interface{}) (Pageable, error) // Last - get last operation by `filters` with not empty deffated_storage. diff --git a/internal/models/protocol/repository.go b/internal/models/protocol/repository.go index 056633a24..20bb3fa0d 100644 --- a/internal/models/protocol/repository.go +++ b/internal/models/protocol/repository.go @@ -1,6 +1,6 @@ package protocol -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/protocol/mock.go -package=protocol -typed type Repository interface { Get(hash string, level int64) (Protocol, error) GetAll() (response []Protocol, err error) diff --git a/internal/models/smart_rollup/repository.go b/internal/models/smart_rollup/repository.go index 9d3dd3c3d..280b09f41 100644 --- a/internal/models/smart_rollup/repository.go +++ b/internal/models/smart_rollup/repository.go @@ -1,6 +1,6 @@ package smartrollup -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/smart_rollup/mock.go -package=smart_rollup -typed type Repository interface { Get(address string) (SmartRollup, error) List(limit, offset int64, sort string) ([]SmartRollup, error) diff --git a/internal/models/ticket/repository.go b/internal/models/ticket/repository.go index 71506dead..1630f68f0 100644 --- a/internal/models/ticket/repository.go +++ b/internal/models/ticket/repository.go @@ -1,6 +1,6 @@ package ticket -// Repository - +//go:generate mockgen -source=$GOFILE -destination=../mock/ticket/mock.go -package=ticket -typed type Repository interface { Get(ticketer string, limit, offset int64) ([]TicketUpdate, error) Has(contractID int64) (bool, error) diff --git a/internal/noderpc/interface.go b/internal/noderpc/interface.go index e3819a364..9032d05aa 100644 --- a/internal/noderpc/interface.go +++ b/internal/noderpc/interface.go @@ -3,8 +3,11 @@ package noderpc import "context" // INode - +// +//go:generate mockgen -source=$GOFILE -destination=mock.go -package=noderpc -typed type INode interface { Block(context.Context, int64) (Block, error) + BlockHash(context.Context, int64) (string, error) GetHead(context.Context) (Header, error) GetHeader(context.Context, int64) (Header, error) GetScriptJSON(context.Context, string, int64) (Script, error) diff --git a/internal/noderpc/mock.go b/internal/noderpc/mock.go index adde36483..0ca5393c0 100644 --- a/internal/noderpc/mock.go +++ b/internal/noderpc/mock.go @@ -1,39 +1,44 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: internal/noderpc/interface.go - +// Source: interface.go +// +// Generated by this command: +// +// mockgen -source=interface.go -destination=mock.go -package=noderpc -typed +// // Package noderpc is a generated GoMock package. package noderpc import ( context "context" - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "go.uber.org/mock/gomock" ) -// MockINode is a mock of INode interface +// MockINode is a mock of INode interface. type MockINode struct { ctrl *gomock.Controller recorder *MockINodeMockRecorder } -// MockINodeMockRecorder is the mock recorder for MockINode +// MockINodeMockRecorder is the mock recorder for MockINode. type MockINodeMockRecorder struct { mock *MockINode } -// NewMockINode creates a new mock instance +// NewMockINode creates a new mock instance. func NewMockINode(ctrl *gomock.Controller) *MockINode { mock := &MockINode{ctrl: ctrl} mock.recorder = &MockINodeMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockINode) EXPECT() *MockINodeMockRecorder { return m.recorder } -// Block mocks base method +// Block mocks base method. func (m *MockINode) Block(arg0 context.Context, arg1 int64) (Block, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Block", arg0, arg1) @@ -42,163 +47,427 @@ func (m *MockINode) Block(arg0 context.Context, arg1 int64) (Block, error) { return ret0, ret1 } -// Block indicates an expected call of Block -func (mr *MockINodeMockRecorder) Block(arg0, arg1 interface{}) *gomock.Call { +// Block indicates an expected call of Block. +func (mr *MockINodeMockRecorder) Block(arg0, arg1 any) *INodeBlockCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Block", reflect.TypeOf((*MockINode)(nil).Block), arg0, arg1) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Block", reflect.TypeOf((*MockINode)(nil).Block), arg0, arg1) + return &INodeBlockCall{Call: call} } -// GetHead mocks base method -func (m *MockINode) GetHead(arg0 context.Context) (Header, error) { +// INodeBlockCall wrap *gomock.Call +type INodeBlockCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeBlockCall) Return(arg0 Block, arg1 error) *INodeBlockCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeBlockCall) Do(f func(context.Context, int64) (Block, error)) *INodeBlockCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeBlockCall) DoAndReturn(f func(context.Context, int64) (Block, error)) *INodeBlockCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// BlockHash mocks base method. +func (m *MockINode) BlockHash(arg0 context.Context, arg1 int64) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetHead", arg0) - ret0, _ := ret[0].(Header) + ret := m.ctrl.Call(m, "BlockHash", arg0, arg1) + ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetHead indicates an expected call of GetHead -func (mr *MockINodeMockRecorder) GetHead(arg0 interface{}) *gomock.Call { +// BlockHash indicates an expected call of BlockHash. +func (mr *MockINodeMockRecorder) BlockHash(arg0, arg1 any) *INodeBlockHashCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHead", reflect.TypeOf((*MockINode)(nil).GetHead), arg0) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BlockHash", reflect.TypeOf((*MockINode)(nil).BlockHash), arg0, arg1) + return &INodeBlockHashCall{Call: call} } -// GetHeader mocks base method -func (m *MockINode) GetHeader(arg0 context.Context, arg1 int64) (Header, error) { +// INodeBlockHashCall wrap *gomock.Call +type INodeBlockHashCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeBlockHashCall) Return(arg0 string, arg1 error) *INodeBlockHashCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeBlockHashCall) Do(f func(context.Context, int64) (string, error)) *INodeBlockHashCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeBlockHashCall) DoAndReturn(f func(context.Context, int64) (string, error)) *INodeBlockHashCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetBigMapType mocks base method. +func (m *MockINode) GetBigMapType(ctx context.Context, ptr, level int64) (BigMap, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetHeader", arg0, arg1) - ret0, _ := ret[0].(Header) + ret := m.ctrl.Call(m, "GetBigMapType", ctx, ptr, level) + ret0, _ := ret[0].(BigMap) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetHeader indicates an expected call of GetHeader -func (mr *MockINodeMockRecorder) GetHeader(arg0, arg1 interface{}) *gomock.Call { +// GetBigMapType indicates an expected call of GetBigMapType. +func (mr *MockINodeMockRecorder) GetBigMapType(ctx, ptr, level any) *INodeGetBigMapTypeCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHeader", reflect.TypeOf((*MockINode)(nil).GetHeader), arg0, arg1) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBigMapType", reflect.TypeOf((*MockINode)(nil).GetBigMapType), ctx, ptr, level) + return &INodeGetBigMapTypeCall{Call: call} } -// GetScriptJSON mocks base method -func (m *MockINode) GetScriptJSON(arg0 context.Context, arg1 string, arg2 int64) (Script, error) { +// INodeGetBigMapTypeCall wrap *gomock.Call +type INodeGetBigMapTypeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetBigMapTypeCall) Return(arg0 BigMap, arg1 error) *INodeGetBigMapTypeCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetBigMapTypeCall) Do(f func(context.Context, int64, int64) (BigMap, error)) *INodeGetBigMapTypeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetBigMapTypeCall) DoAndReturn(f func(context.Context, int64, int64) (BigMap, error)) *INodeGetBigMapTypeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetBlockMetadata mocks base method. +func (m *MockINode) GetBlockMetadata(ctx context.Context, level int64) (Metadata, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetScriptJSON", arg0, arg1, arg2) - ret0, _ := ret[0].(Script) + ret := m.ctrl.Call(m, "GetBlockMetadata", ctx, level) + ret0, _ := ret[0].(Metadata) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetScriptJSON indicates an expected call of GetScriptJSON -func (mr *MockINodeMockRecorder) GetScriptJSON(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetBlockMetadata indicates an expected call of GetBlockMetadata. +func (mr *MockINodeMockRecorder) GetBlockMetadata(ctx, level any) *INodeGetBlockMetadataCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScriptJSON", reflect.TypeOf((*MockINode)(nil).GetScriptJSON), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockMetadata", reflect.TypeOf((*MockINode)(nil).GetBlockMetadata), ctx, level) + return &INodeGetBlockMetadataCall{Call: call} } -// GetRawScript mocks base method -func (m *MockINode) GetRawScript(ctx context.Context, address string, level int64) ([]byte, error) { +// INodeGetBlockMetadataCall wrap *gomock.Call +type INodeGetBlockMetadataCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetBlockMetadataCall) Return(metadata Metadata, err error) *INodeGetBlockMetadataCall { + c.Call = c.Call.Return(metadata, err) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetBlockMetadataCall) Do(f func(context.Context, int64) (Metadata, error)) *INodeGetBlockMetadataCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetBlockMetadataCall) DoAndReturn(f func(context.Context, int64) (Metadata, error)) *INodeGetBlockMetadataCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetContractBalance mocks base method. +func (m *MockINode) GetContractBalance(arg0 context.Context, arg1 string, arg2 int64) (int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetRawScript", ctx, address, level) - ret0, _ := ret[0].([]byte) + ret := m.ctrl.Call(m, "GetContractBalance", arg0, arg1, arg2) + ret0, _ := ret[0].(int64) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetRawScript indicates an expected call of GetRawScript -func (mr *MockINodeMockRecorder) GetRawScript(ctx, address, level interface{}) *gomock.Call { +// GetContractBalance indicates an expected call of GetContractBalance. +func (mr *MockINodeMockRecorder) GetContractBalance(arg0, arg1, arg2 any) *INodeGetContractBalanceCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRawScript", reflect.TypeOf((*MockINode)(nil).GetRawScript), ctx, address, level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractBalance", reflect.TypeOf((*MockINode)(nil).GetContractBalance), arg0, arg1, arg2) + return &INodeGetContractBalanceCall{Call: call} } -// GetScriptStorageRaw mocks base method -func (m *MockINode) GetScriptStorageRaw(arg0 context.Context, arg1 string, arg2 int64) ([]byte, error) { +// INodeGetContractBalanceCall wrap *gomock.Call +type INodeGetContractBalanceCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetContractBalanceCall) Return(arg0 int64, arg1 error) *INodeGetContractBalanceCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetContractBalanceCall) Do(f func(context.Context, string, int64) (int64, error)) *INodeGetContractBalanceCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetContractBalanceCall) DoAndReturn(f func(context.Context, string, int64) (int64, error)) *INodeGetContractBalanceCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetContractData mocks base method. +func (m *MockINode) GetContractData(arg0 context.Context, arg1 string, arg2 int64) (ContractData, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetScriptStorageRaw", arg0, arg1, arg2) - ret0, _ := ret[0].([]byte) + ret := m.ctrl.Call(m, "GetContractData", arg0, arg1, arg2) + ret0, _ := ret[0].(ContractData) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetScriptStorageRaw indicates an expected call of GetScriptStorageRaw -func (mr *MockINodeMockRecorder) GetScriptStorageRaw(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetContractData indicates an expected call of GetContractData. +func (mr *MockINodeMockRecorder) GetContractData(arg0, arg1, arg2 any) *INodeGetContractDataCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScriptStorageRaw", reflect.TypeOf((*MockINode)(nil).GetScriptStorageRaw), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractData", reflect.TypeOf((*MockINode)(nil).GetContractData), arg0, arg1, arg2) + return &INodeGetContractDataCall{Call: call} } -// GetContractBalance mocks base method -func (m *MockINode) GetContractBalance(arg0 context.Context, arg1 string, arg2 int64) (int64, error) { +// INodeGetContractDataCall wrap *gomock.Call +type INodeGetContractDataCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetContractDataCall) Return(arg0 ContractData, arg1 error) *INodeGetContractDataCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetContractDataCall) Do(f func(context.Context, string, int64) (ContractData, error)) *INodeGetContractDataCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetContractDataCall) DoAndReturn(f func(context.Context, string, int64) (ContractData, error)) *INodeGetContractDataCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetContractsByBlock mocks base method. +func (m *MockINode) GetContractsByBlock(arg0 context.Context, arg1 int64) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetContractBalance", arg0, arg1, arg2) - ret0, _ := ret[0].(int64) + ret := m.ctrl.Call(m, "GetContractsByBlock", arg0, arg1) + ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetContractBalance indicates an expected call of GetContractBalance -func (mr *MockINodeMockRecorder) GetContractBalance(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetContractsByBlock indicates an expected call of GetContractsByBlock. +func (mr *MockINodeMockRecorder) GetContractsByBlock(arg0, arg1 any) *INodeGetContractsByBlockCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractBalance", reflect.TypeOf((*MockINode)(nil).GetContractBalance), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractsByBlock", reflect.TypeOf((*MockINode)(nil).GetContractsByBlock), arg0, arg1) + return &INodeGetContractsByBlockCall{Call: call} } -// GetContractData mocks base method -func (m *MockINode) GetContractData(arg0 context.Context, arg1 string, arg2 int64) (ContractData, error) { +// INodeGetContractsByBlockCall wrap *gomock.Call +type INodeGetContractsByBlockCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetContractsByBlockCall) Return(arg0 []string, arg1 error) *INodeGetContractsByBlockCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetContractsByBlockCall) Do(f func(context.Context, int64) ([]string, error)) *INodeGetContractsByBlockCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetContractsByBlockCall) DoAndReturn(f func(context.Context, int64) ([]string, error)) *INodeGetContractsByBlockCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetCounter mocks base method. +func (m *MockINode) GetCounter(arg0 context.Context, arg1 string) (int64, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetContractData", arg0, arg1, arg2) - ret0, _ := ret[0].(ContractData) + ret := m.ctrl.Call(m, "GetCounter", arg0, arg1) + ret0, _ := ret[0].(int64) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetContractData indicates an expected call of GetContractData -func (mr *MockINodeMockRecorder) GetContractData(arg0, arg1, arg2 interface{}) *gomock.Call { +// GetCounter indicates an expected call of GetCounter. +func (mr *MockINodeMockRecorder) GetCounter(arg0, arg1 any) *INodeGetCounterCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractData", reflect.TypeOf((*MockINode)(nil).GetContractData), arg0, arg1, arg2) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCounter", reflect.TypeOf((*MockINode)(nil).GetCounter), arg0, arg1) + return &INodeGetCounterCall{Call: call} } -// GetOPG mocks base method -func (m *MockINode) GetOPG(ctx context.Context, block int64) ([]OperationGroup, error) { +// INodeGetCounterCall wrap *gomock.Call +type INodeGetCounterCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetCounterCall) Return(arg0 int64, arg1 error) *INodeGetCounterCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetCounterCall) Do(f func(context.Context, string) (int64, error)) *INodeGetCounterCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetCounterCall) DoAndReturn(f func(context.Context, string) (int64, error)) *INodeGetCounterCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetHead mocks base method. +func (m *MockINode) GetHead(arg0 context.Context) (Header, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOPG", ctx, block) - ret0, _ := ret[0].([]OperationGroup) + ret := m.ctrl.Call(m, "GetHead", arg0) + ret0, _ := ret[0].(Header) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetOPG indicates an expected call of GetOPG -func (mr *MockINodeMockRecorder) GetOPG(ctx, block interface{}) *gomock.Call { +// GetHead indicates an expected call of GetHead. +func (mr *MockINodeMockRecorder) GetHead(arg0 any) *INodeGetHeadCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOPG", reflect.TypeOf((*MockINode)(nil).GetOPG), ctx, block) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHead", reflect.TypeOf((*MockINode)(nil).GetHead), arg0) + return &INodeGetHeadCall{Call: call} } -// GetLightOPG mocks base method -func (m *MockINode) GetLightOPG(ctx context.Context, block int64) ([]LightOperationGroup, error) { +// INodeGetHeadCall wrap *gomock.Call +type INodeGetHeadCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetHeadCall) Return(arg0 Header, arg1 error) *INodeGetHeadCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetHeadCall) Do(f func(context.Context) (Header, error)) *INodeGetHeadCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetHeadCall) DoAndReturn(f func(context.Context) (Header, error)) *INodeGetHeadCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetHeader mocks base method. +func (m *MockINode) GetHeader(arg0 context.Context, arg1 int64) (Header, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetLightOPG", ctx, block) - ret0, _ := ret[0].([]LightOperationGroup) + ret := m.ctrl.Call(m, "GetHeader", arg0, arg1) + ret0, _ := ret[0].(Header) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetLightOPG indicates an expected call of GetLightOPG -func (mr *MockINodeMockRecorder) GetLightOPG(ctx, block interface{}) *gomock.Call { +// GetHeader indicates an expected call of GetHeader. +func (mr *MockINodeMockRecorder) GetHeader(arg0, arg1 any) *INodeGetHeaderCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLightOPG", reflect.TypeOf((*MockINode)(nil).GetLightOPG), ctx, block) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHeader", reflect.TypeOf((*MockINode)(nil).GetHeader), arg0, arg1) + return &INodeGetHeaderCall{Call: call} } -// GetContractsByBlock mocks base method -func (m *MockINode) GetContractsByBlock(arg0 context.Context, arg1 int64) ([]string, error) { +// INodeGetHeaderCall wrap *gomock.Call +type INodeGetHeaderCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetHeaderCall) Return(arg0 Header, arg1 error) *INodeGetHeaderCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetHeaderCall) Do(f func(context.Context, int64) (Header, error)) *INodeGetHeaderCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetHeaderCall) DoAndReturn(f func(context.Context, int64) (Header, error)) *INodeGetHeaderCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetLightOPG mocks base method. +func (m *MockINode) GetLightOPG(ctx context.Context, block int64) ([]LightOperationGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetContractsByBlock", arg0, arg1) - ret0, _ := ret[0].([]string) + ret := m.ctrl.Call(m, "GetLightOPG", ctx, block) + ret0, _ := ret[0].([]LightOperationGroup) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetContractsByBlock indicates an expected call of GetContractsByBlock -func (mr *MockINodeMockRecorder) GetContractsByBlock(arg0, arg1 interface{}) *gomock.Call { +// GetLightOPG indicates an expected call of GetLightOPG. +func (mr *MockINodeMockRecorder) GetLightOPG(ctx, block any) *INodeGetLightOPGCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContractsByBlock", reflect.TypeOf((*MockINode)(nil).GetContractsByBlock), arg0, arg1) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLightOPG", reflect.TypeOf((*MockINode)(nil).GetLightOPG), ctx, block) + return &INodeGetLightOPGCall{Call: call} } -// GetNetworkConstants mocks base method +// INodeGetLightOPGCall wrap *gomock.Call +type INodeGetLightOPGCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetLightOPGCall) Return(arg0 []LightOperationGroup, arg1 error) *INodeGetLightOPGCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetLightOPGCall) Do(f func(context.Context, int64) ([]LightOperationGroup, error)) *INodeGetLightOPGCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetLightOPGCall) DoAndReturn(f func(context.Context, int64) ([]LightOperationGroup, error)) *INodeGetLightOPGCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetNetworkConstants mocks base method. func (m *MockINode) GetNetworkConstants(arg0 context.Context, arg1 int64) (Constants, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNetworkConstants", arg0, arg1) @@ -207,113 +476,344 @@ func (m *MockINode) GetNetworkConstants(arg0 context.Context, arg1 int64) (Const return ret0, ret1 } -// GetNetworkConstants indicates an expected call of GetNetworkConstants -func (mr *MockINodeMockRecorder) GetNetworkConstants(arg0, arg1 interface{}) *gomock.Call { +// GetNetworkConstants indicates an expected call of GetNetworkConstants. +func (mr *MockINodeMockRecorder) GetNetworkConstants(arg0, arg1 any) *INodeGetNetworkConstantsCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNetworkConstants", reflect.TypeOf((*MockINode)(nil).GetNetworkConstants), arg0, arg1) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNetworkConstants", reflect.TypeOf((*MockINode)(nil).GetNetworkConstants), arg0, arg1) + return &INodeGetNetworkConstantsCall{Call: call} } -// RunCode mocks base method -func (m *MockINode) RunCode(arg0 context.Context, arg1, arg2, arg3 []byte, arg4, arg5, arg6, arg7, arg8 string, arg9, arg10 int64) (RunCodeResponse, error) { +// INodeGetNetworkConstantsCall wrap *gomock.Call +type INodeGetNetworkConstantsCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetNetworkConstantsCall) Return(arg0 Constants, arg1 error) *INodeGetNetworkConstantsCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetNetworkConstantsCall) Do(f func(context.Context, int64) (Constants, error)) *INodeGetNetworkConstantsCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetNetworkConstantsCall) DoAndReturn(f func(context.Context, int64) (Constants, error)) *INodeGetNetworkConstantsCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetOPG mocks base method. +func (m *MockINode) GetOPG(ctx context.Context, block int64) ([]OperationGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunCode", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) - ret0, _ := ret[0].(RunCodeResponse) + ret := m.ctrl.Call(m, "GetOPG", ctx, block) + ret0, _ := ret[0].([]OperationGroup) ret1, _ := ret[1].(error) return ret0, ret1 } -// RunCode indicates an expected call of RunCode -func (mr *MockINodeMockRecorder) RunCode(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 interface{}) *gomock.Call { +// GetOPG indicates an expected call of GetOPG. +func (mr *MockINodeMockRecorder) GetOPG(ctx, block any) *INodeGetOPGCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunCode", reflect.TypeOf((*MockINode)(nil).RunCode), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOPG", reflect.TypeOf((*MockINode)(nil).GetOPG), ctx, block) + return &INodeGetOPGCall{Call: call} } -// RunOperation mocks base method -func (m *MockINode) RunOperation(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6, arg7, arg8, arg9 int64, arg10 []byte) (OperationGroup, error) { +// INodeGetOPGCall wrap *gomock.Call +type INodeGetOPGCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetOPGCall) Return(arg0 []OperationGroup, arg1 error) *INodeGetOPGCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetOPGCall) Do(f func(context.Context, int64) ([]OperationGroup, error)) *INodeGetOPGCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetOPGCall) DoAndReturn(f func(context.Context, int64) ([]OperationGroup, error)) *INodeGetOPGCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetRawScript mocks base method. +func (m *MockINode) GetRawScript(ctx context.Context, address string, level int64) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunOperation", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) - ret0, _ := ret[0].(OperationGroup) + ret := m.ctrl.Call(m, "GetRawScript", ctx, address, level) + ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } -// RunOperation indicates an expected call of RunOperation -func (mr *MockINodeMockRecorder) RunOperation(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 interface{}) *gomock.Call { +// GetRawScript indicates an expected call of GetRawScript. +func (mr *MockINodeMockRecorder) GetRawScript(ctx, address, level any) *INodeGetRawScriptCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunOperation", reflect.TypeOf((*MockINode)(nil).RunOperation), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRawScript", reflect.TypeOf((*MockINode)(nil).GetRawScript), ctx, address, level) + return &INodeGetRawScriptCall{Call: call} } -// RunOperationLight mocks base method -func (m *MockINode) RunOperationLight(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6, arg7, arg8, arg9 int64, arg10 []byte) (LightOperationGroup, error) { +// INodeGetRawScriptCall wrap *gomock.Call +type INodeGetRawScriptCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetRawScriptCall) Return(arg0 []byte, arg1 error) *INodeGetRawScriptCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetRawScriptCall) Do(f func(context.Context, string, int64) ([]byte, error)) *INodeGetRawScriptCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetRawScriptCall) DoAndReturn(f func(context.Context, string, int64) ([]byte, error)) *INodeGetRawScriptCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetScriptJSON mocks base method. +func (m *MockINode) GetScriptJSON(arg0 context.Context, arg1 string, arg2 int64) (Script, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunOperationLight", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) - ret0, _ := ret[0].(LightOperationGroup) + ret := m.ctrl.Call(m, "GetScriptJSON", arg0, arg1, arg2) + ret0, _ := ret[0].(Script) ret1, _ := ret[1].(error) return ret0, ret1 } -// RunOperationLight indicates an expected call of RunOperationLight -func (mr *MockINodeMockRecorder) RunOperationLight(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 interface{}) *gomock.Call { +// GetScriptJSON indicates an expected call of GetScriptJSON. +func (mr *MockINodeMockRecorder) GetScriptJSON(arg0, arg1, arg2 any) *INodeGetScriptJSONCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunOperationLight", reflect.TypeOf((*MockINode)(nil).RunOperationLight), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScriptJSON", reflect.TypeOf((*MockINode)(nil).GetScriptJSON), arg0, arg1, arg2) + return &INodeGetScriptJSONCall{Call: call} } -// RunScriptView mocks base method -func (m *MockINode) RunScriptView(ctx context.Context, request RunScriptViewRequest) ([]byte, error) { +// INodeGetScriptJSONCall wrap *gomock.Call +type INodeGetScriptJSONCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetScriptJSONCall) Return(arg0 Script, arg1 error) *INodeGetScriptJSONCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetScriptJSONCall) Do(f func(context.Context, string, int64) (Script, error)) *INodeGetScriptJSONCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetScriptJSONCall) DoAndReturn(f func(context.Context, string, int64) (Script, error)) *INodeGetScriptJSONCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// GetScriptStorageRaw mocks base method. +func (m *MockINode) GetScriptStorageRaw(arg0 context.Context, arg1 string, arg2 int64) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RunScriptView", ctx, request) + ret := m.ctrl.Call(m, "GetScriptStorageRaw", arg0, arg1, arg2) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } -// RunScriptView indicates an expected call of RunScriptView -func (mr *MockINodeMockRecorder) RunScriptView(ctx, request interface{}) *gomock.Call { +// GetScriptStorageRaw indicates an expected call of GetScriptStorageRaw. +func (mr *MockINodeMockRecorder) GetScriptStorageRaw(arg0, arg1, arg2 any) *INodeGetScriptStorageRawCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunScriptView", reflect.TypeOf((*MockINode)(nil).RunScriptView), ctx, request) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScriptStorageRaw", reflect.TypeOf((*MockINode)(nil).GetScriptStorageRaw), arg0, arg1, arg2) + return &INodeGetScriptStorageRawCall{Call: call} } -// GetCounter mocks base method -func (m *MockINode) GetCounter(arg0 context.Context, arg1 string) (int64, error) { +// INodeGetScriptStorageRawCall wrap *gomock.Call +type INodeGetScriptStorageRawCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeGetScriptStorageRawCall) Return(arg0 []byte, arg1 error) *INodeGetScriptStorageRawCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeGetScriptStorageRawCall) Do(f func(context.Context, string, int64) ([]byte, error)) *INodeGetScriptStorageRawCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeGetScriptStorageRawCall) DoAndReturn(f func(context.Context, string, int64) ([]byte, error)) *INodeGetScriptStorageRawCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RunCode mocks base method. +func (m *MockINode) RunCode(arg0 context.Context, arg1, arg2, arg3 []byte, arg4, arg5, arg6, arg7, arg8 string, arg9, arg10 int64) (RunCodeResponse, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCounter", arg0, arg1) - ret0, _ := ret[0].(int64) + ret := m.ctrl.Call(m, "RunCode", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + ret0, _ := ret[0].(RunCodeResponse) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetCounter indicates an expected call of GetCounter -func (mr *MockINodeMockRecorder) GetCounter(arg0, arg1 interface{}) *gomock.Call { +// RunCode indicates an expected call of RunCode. +func (mr *MockINodeMockRecorder) RunCode(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 any) *INodeRunCodeCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCounter", reflect.TypeOf((*MockINode)(nil).GetCounter), arg0, arg1) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunCode", reflect.TypeOf((*MockINode)(nil).RunCode), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + return &INodeRunCodeCall{Call: call} } -// GetBigMapType mocks base method -func (m *MockINode) GetBigMapType(ctx context.Context, ptr, level int64) (BigMap, error) { +// INodeRunCodeCall wrap *gomock.Call +type INodeRunCodeCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeRunCodeCall) Return(arg0 RunCodeResponse, arg1 error) *INodeRunCodeCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeRunCodeCall) Do(f func(context.Context, []byte, []byte, []byte, string, string, string, string, string, int64, int64) (RunCodeResponse, error)) *INodeRunCodeCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeRunCodeCall) DoAndReturn(f func(context.Context, []byte, []byte, []byte, string, string, string, string, string, int64, int64) (RunCodeResponse, error)) *INodeRunCodeCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RunOperation mocks base method. +func (m *MockINode) RunOperation(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6, arg7, arg8, arg9 int64, arg10 []byte) (OperationGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBigMapType", ctx, ptr, level) - ret0, _ := ret[0].(BigMap) + ret := m.ctrl.Call(m, "RunOperation", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + ret0, _ := ret[0].(OperationGroup) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetBigMapType indicates an expected call of GetBigMapType -func (mr *MockINodeMockRecorder) GetBigMapType(ctx, ptr, level interface{}) *gomock.Call { +// RunOperation indicates an expected call of RunOperation. +func (mr *MockINodeMockRecorder) RunOperation(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 any) *INodeRunOperationCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBigMapType", reflect.TypeOf((*MockINode)(nil).GetBigMapType), ctx, ptr, level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunOperation", reflect.TypeOf((*MockINode)(nil).RunOperation), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + return &INodeRunOperationCall{Call: call} } -// GetBlockMetadata mocks base method -func (m *MockINode) GetBlockMetadata(ctx context.Context, level int64) (Metadata, error) { +// INodeRunOperationCall wrap *gomock.Call +type INodeRunOperationCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeRunOperationCall) Return(arg0 OperationGroup, arg1 error) *INodeRunOperationCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeRunOperationCall) Do(f func(context.Context, string, string, string, string, int64, int64, int64, int64, int64, []byte) (OperationGroup, error)) *INodeRunOperationCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeRunOperationCall) DoAndReturn(f func(context.Context, string, string, string, string, int64, int64, int64, int64, int64, []byte) (OperationGroup, error)) *INodeRunOperationCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RunOperationLight mocks base method. +func (m *MockINode) RunOperationLight(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5, arg6, arg7, arg8, arg9 int64, arg10 []byte) (LightOperationGroup, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBlockMetadata", ctx, level) - ret0, _ := ret[0].(Metadata) + ret := m.ctrl.Call(m, "RunOperationLight", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + ret0, _ := ret[0].(LightOperationGroup) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetBlockMetadata indicates an expected call of GetBlockMetadata -func (mr *MockINodeMockRecorder) GetBlockMetadata(ctx, level interface{}) *gomock.Call { +// RunOperationLight indicates an expected call of RunOperationLight. +func (mr *MockINodeMockRecorder) RunOperationLight(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 any) *INodeRunOperationLightCall { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlockMetadata", reflect.TypeOf((*MockINode)(nil).GetBlockMetadata), ctx, level) + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunOperationLight", reflect.TypeOf((*MockINode)(nil).RunOperationLight), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + return &INodeRunOperationLightCall{Call: call} +} + +// INodeRunOperationLightCall wrap *gomock.Call +type INodeRunOperationLightCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeRunOperationLightCall) Return(arg0 LightOperationGroup, arg1 error) *INodeRunOperationLightCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeRunOperationLightCall) Do(f func(context.Context, string, string, string, string, int64, int64, int64, int64, int64, []byte) (LightOperationGroup, error)) *INodeRunOperationLightCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeRunOperationLightCall) DoAndReturn(f func(context.Context, string, string, string, string, int64, int64, int64, int64, int64, []byte) (LightOperationGroup, error)) *INodeRunOperationLightCall { + c.Call = c.Call.DoAndReturn(f) + return c +} + +// RunScriptView mocks base method. +func (m *MockINode) RunScriptView(ctx context.Context, request RunScriptViewRequest) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "RunScriptView", ctx, request) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RunScriptView indicates an expected call of RunScriptView. +func (mr *MockINodeMockRecorder) RunScriptView(ctx, request any) *INodeRunScriptViewCall { + mr.mock.ctrl.T.Helper() + call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RunScriptView", reflect.TypeOf((*MockINode)(nil).RunScriptView), ctx, request) + return &INodeRunScriptViewCall{Call: call} +} + +// INodeRunScriptViewCall wrap *gomock.Call +type INodeRunScriptViewCall struct { + *gomock.Call +} + +// Return rewrite *gomock.Call.Return +func (c *INodeRunScriptViewCall) Return(arg0 []byte, arg1 error) *INodeRunScriptViewCall { + c.Call = c.Call.Return(arg0, arg1) + return c +} + +// Do rewrite *gomock.Call.Do +func (c *INodeRunScriptViewCall) Do(f func(context.Context, RunScriptViewRequest) ([]byte, error)) *INodeRunScriptViewCall { + c.Call = c.Call.Do(f) + return c +} + +// DoAndReturn rewrite *gomock.Call.DoAndReturn +func (c *INodeRunScriptViewCall) DoAndReturn(f func(context.Context, RunScriptViewRequest) ([]byte, error)) *INodeRunScriptViewCall { + c.Call = c.Call.DoAndReturn(f) + return c } diff --git a/internal/noderpc/pool.go b/internal/noderpc/pool.go index 762cce50a..d0d7a927f 100644 --- a/internal/noderpc/pool.go +++ b/internal/noderpc/pool.go @@ -126,6 +126,15 @@ func (p Pool) Block(ctx context.Context, level int64) (Block, error) { return data.Interface().(Block), nil } +// BlockHash - +func (p Pool) BlockHash(ctx context.Context, level int64) (string, error) { + data, err := p.call("BlockHash", ctx, level) + if err != nil { + return "", err + } + return data.Interface().(string), nil +} + // GetHead - func (p Pool) GetHead(ctx context.Context) (Header, error) { data, err := p.call("GetHead", ctx) diff --git a/internal/noderpc/rpc.go b/internal/noderpc/rpc.go index 1ec806940..9150b3716 100644 --- a/internal/noderpc/rpc.go +++ b/internal/noderpc/rpc.go @@ -233,6 +233,12 @@ func (rpc *NodeRPC) Block(ctx context.Context, level int64) (block Block, err er return } +// BlockHash - returns block's hash, its unique identifier. +func (rpc *NodeRPC) BlockHash(ctx context.Context, level int64) (hash string, err error) { + err = rpc.get(ctx, fmt.Sprintf("chains/main/blocks/%s/hash", getBlockString(level)), &hash) + return +} + // GetHead - get head func (rpc *NodeRPC) GetHead(ctx context.Context) (Header, error) { return rpc.GetHeader(ctx, 0) @@ -243,7 +249,7 @@ func (rpc *NodeRPC) GetLevel(ctx context.Context) (int64, error) { var head struct { Level int64 `json:"level"` } - if err := rpc.get(ctx, "chains/main/blocks/head/header", &head); err != nil { + if err := rpc.get(ctx, "chains/main/blocks/head/helpers/current_level", &head); err != nil { return 0, err } return head.Level, nil diff --git a/internal/parsers/operations/migration_test.go b/internal/parsers/operations/migration_test.go index a3981df7d..f25d04d32 100644 --- a/internal/parsers/operations/migration_test.go +++ b/internal/parsers/operations/migration_test.go @@ -12,8 +12,8 @@ import ( "github.com/baking-bad/bcdhub/internal/models/types" "github.com/baking-bad/bcdhub/internal/noderpc" "github.com/baking-bad/bcdhub/internal/parsers" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/assert" + "go.uber.org/mock/gomock" ) func TestMigration_Parse(t *testing.T) { diff --git a/internal/parsers/operations/operation_group_test.go b/internal/parsers/operations/operation_group_test.go index 050e58062..8e357ba1e 100644 --- a/internal/parsers/operations/operation_group_test.go +++ b/internal/parsers/operations/operation_group_test.go @@ -30,7 +30,7 @@ import ( "github.com/baking-bad/bcdhub/internal/noderpc" "github.com/baking-bad/bcdhub/internal/parsers" "github.com/go-pg/pg/v10" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func TestGroup_Parse(t *testing.T) { diff --git a/internal/parsers/storage/babylon_test.go b/internal/parsers/storage/babylon_test.go index 3f072f644..f8a944cfa 100644 --- a/internal/parsers/storage/babylon_test.go +++ b/internal/parsers/storage/babylon_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/assert" mock_bmd "github.com/baking-bad/bcdhub/internal/models/mock/bigmapdiff" - "github.com/golang/mock/gomock" + "go.uber.org/mock/gomock" ) func newTestBabylon(repoCtrl *gomock.Controller) (*Babylon, *mock_bmd.MockRepository) { diff --git a/internal/tzkt/consts.go b/internal/tzkt/consts.go deleted file mode 100644 index 4c83c80f9..000000000 --- a/internal/tzkt/consts.go +++ /dev/null @@ -1,12 +0,0 @@ -package tzkt - -// Contract types -const ( - ContractKindSmart = "smart_contract" - ContractKindDelegator = "delegator_contract" - ContractKindAll = "all" -) - -const ( - userAgent = "BCD" -) diff --git a/internal/tzkt/data.go b/internal/tzkt/data.go deleted file mode 100644 index 3f8e0a235..000000000 --- a/internal/tzkt/data.go +++ /dev/null @@ -1,153 +0,0 @@ -package tzkt - -import ( - stdJSON "encoding/json" - "time" -) - -// Head - -type Head struct { - Level int64 `json:"level"` - Hash string `json:"hash"` - Timestamp time.Time `json:"timestamp"` -} - -// Address - -type Address struct { - Alias string `json:"alias,omitempty"` - Address string `json:"address"` - Active bool `json:"active"` -} - -// Origination - -type Origination struct { - ID int64 `json:"id"` - Type string `json:"type"` - Level int64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Hash string `json:"hash"` - Counter int64 `json:"counter"` - Sender Address `json:"sender"` - GasLimit int64 `json:"gasLimit"` - GasUsed int64 `json:"gasUsed"` - StorageLimit int64 `json:"storageLimit"` - StorageUsed int64 `json:"storageUsed"` - BakerFee int64 `json:"bakerFee"` - StorageFee int64 `json:"storageFee"` - AllocationFee int64 `json:"allocationFee"` - ContractBalance int64 `json:"contractBalance"` - ContractManager Address `json:"contractManager"` - ContractDelegate Address `json:"contractDelegate,omitempty"` - Status string `json:"status"` - OriginatedContract struct { - Kind string `json:"kind"` - Address string `json:"address"` - } `json:"originatedContract"` -} - -// SystemOperation - -type SystemOperation struct { - Type string `json:"type"` - ID int64 `json:"id"` - Level int64 `json:"level"` - Timestamp time.Time `json:"timestamp"` - Kind string `json:"kind"` - Account Address `json:"account"` - BalanceChange int64 `json:"balanceChange"` -} - -// Account - -type Account struct { - Type string `json:"type"` - Kind string `json:"kind"` - Alias string `json:"alias"` - Address string `json:"address"` - Balance int64 `json:"balance"` - Creator *Address `json:"creator,omitempty"` - Manager *Address `json:"manager,omitempty"` - Delegate *Address `json:"delegate,omitempty"` - DelegationLevel int64 `json:"delegationLevel"` - DelegationTime time.Time `json:"delegationTime"` - NumContracts int64 `json:"numContracts"` - NumDelegations int64 `json:"numDelegations"` - NumOriginations int64 `json:"numOriginations"` - NumTransactions int64 `json:"numTransactions"` - NumReveals int64 `json:"numReveals"` - NumMigrations int64 `json:"numMigrations"` - FirstActivity int64 `json:"firstActivity"` - FirstActivityTime time.Time `json:"firstActivityTime"` - LastActivity int64 `json:"lastActivity"` - LastActivityTime time.Time `json:"lastActivityTime"` -} - -// Alias - -type Alias struct { - Alias *string `json:"alias"` - Address *string `json:"address"` -} - -// Contract - -type Contract struct { - Alias *string `json:"alias"` - Address string `json:"address"` - Creator *Alias `json:"creator"` - Manager *Alias `json:"manager"` - Delegate *Alias `json:"delegate"` -} - -// Protocol - -type Protocol struct { - Code int64 `json:"code"` - Hash string `json:"hash"` - StartLevel int64 `json:"firstLevel"` - LastLevel int64 `json:"lastLevel"` - Metadata ProtocolMetadata `json:"metadata"` - Constants Constants `json:"constants"` -} - -// Constants - -type Constants struct { - CostPerByte int64 `json:"byteCost"` - HardGasLimitPerOperation int64 `json:"hardOperationGasLimit"` - HardStorageLimitPerOperation int64 `json:"hardOperationStorageLimit"` - TimeBetweenBlocks int64 `json:"timeBetweenBlocks"` -} - -// ProtocolMetadata - -type ProtocolMetadata struct { - Alias string `json:"alias"` -} - -// MempoolOperation - -type MempoolOperation struct { - Raw stdJSON.RawMessage `json:"-"` - Body MempoolOperationBody `json:"-"` -} - -// MempoolOperationBody - -type MempoolOperationBody struct { - Amount int64 `json:"amount,string"` - Branch string `json:"branch"` - Counter int64 `json:"counter,string"` - CreatedAt string `json:"created_at"` - Destination string `json:"destination"` - Errors stdJSON.RawMessage `json:"errors,omitempty"` - Fee int64 `json:"fee,string"` - GasLimit int64 `json:"gas_limit,string"` - Hash string `json:"hash"` - Kind string `json:"kind"` - Node string `json:"node"` - Parameters stdJSON.RawMessage `json:"parameters"` - Protocol string `json:"protocol"` - Signature string `json:"signature"` - Source string `json:"source"` - Status string `json:"status"` - StorageLimit int64 `json:"storage_limit,string"` - Timestamp int64 `json:"timestamp"` -} - -// UnmarshalJSON - -func (mo *MempoolOperation) UnmarshalJSON(data []byte) error { - mo.Raw = data - return json.Unmarshal(data, &mo.Body) -} diff --git a/internal/tzkt/interface.go b/internal/tzkt/interface.go deleted file mode 100644 index 50fe8137d..000000000 --- a/internal/tzkt/interface.go +++ /dev/null @@ -1,6 +0,0 @@ -package tzkt - -// Service - -type Service interface { - GetMempool(address string) ([]MempoolOperation, error) -} diff --git a/internal/tzkt/mock.go b/internal/tzkt/mock.go deleted file mode 100644 index 7e4fe18a3..000000000 --- a/internal/tzkt/mock.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: interface.go - -// Package mock_tzkt is a generated GoMock package. -package tzkt - -import ( - gomock "github.com/golang/mock/gomock" - reflect "reflect" -) - -// MockService is a mock of Service interface -type MockService struct { - ctrl *gomock.Controller - recorder *MockServiceMockRecorder -} - -// MockServiceMockRecorder is the mock recorder for MockService -type MockServiceMockRecorder struct { - mock *MockService -} - -// NewMockService creates a new mock instance -func NewMockService(ctrl *gomock.Controller) *MockService { - mock := &MockService{ctrl: ctrl} - mock.recorder = &MockServiceMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockService) EXPECT() *MockServiceMockRecorder { - return m.recorder -} - -// GetMempool mocks base method -func (m *MockService) GetMempool(address string) ([]MempoolOperation, error) { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMempool", address) - ret0, _ := ret[0].([]MempoolOperation) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetMempool indicates an expected call of GetMempool -func (mr *MockServiceMockRecorder) GetMempool(address interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMempool", reflect.TypeOf((*MockService)(nil).GetMempool), address) -} diff --git a/internal/tzkt/request.go b/internal/tzkt/request.go deleted file mode 100644 index 6521135c0..000000000 --- a/internal/tzkt/request.go +++ /dev/null @@ -1,149 +0,0 @@ -package tzkt - -import ( - "fmt" - "net/http" - "strings" - "time" - - "github.com/baking-bad/bcdhub/internal/helpers" - "github.com/baking-bad/bcdhub/internal/logger" - jsoniter "github.com/json-iterator/go" - "github.com/pkg/errors" -) - -var json = jsoniter.ConfigCompatibleWithStandardLibrary - -// TzKT - -type TzKT struct { - Host string - client http.Client - - retryCount int -} - -// NewTzKT - -func NewTzKT(host string, timeout time.Duration) *TzKT { - t := http.DefaultTransport.(*http.Transport).Clone() - t.MaxIdleConns = 100 - t.MaxConnsPerHost = 100 - t.MaxIdleConnsPerHost = 100 - - return &TzKT{ - Host: host, - client: http.Client{ - Timeout: timeout, - Transport: t, - }, - retryCount: 3, - } -} - -// nolint -func (t *TzKT) request(method, endpoint string, params map[string]string, response interface{}) error { - uri := helpers.URLJoin(t.Host, endpoint) - - req, err := http.NewRequest(method, uri, nil) - if err != nil { - return errors.Errorf("[http.NewRequest] %s", err) - } - q := req.URL.Query() - for key, value := range params { - q.Add(key, value) - } - req.URL.RawQuery = q.Encode() - req.Header.Set("User-Agent", userAgent) - - var resp *http.Response - count := 0 - for ; count < t.retryCount; count++ { - if resp, err = t.client.Do(req); err != nil { - logger.Warning().Msgf("Attempt #%d: %s", count+1, err.Error()) - continue - } - break - } - - if count == t.retryCount { - return errors.Errorf("Max HTTP request retry exceeded") - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return fmt.Errorf("got error response %v with code %d", resp, resp.StatusCode) - } - - return json.NewDecoder(resp.Body).Decode(response) -} - -// GetHead - return head -func (t *TzKT) GetHead() (resp Head, err error) { - err = t.request("GET", "head", nil, &resp) - return -} - -// GetAccounts - returns account by filters -func (t *TzKT) GetAccounts(kind string, page, limit int64) (resp []Account, err error) { - params := map[string]string{} - if kind != "" && kind != ContractKindAll { - params["kind"] = kind - } - if limit == 0 { - limit = 1000 - } - params["limit"] = fmt.Sprintf("%d", limit) - params["offset.pg"] = fmt.Sprintf("%d", page) - - err = t.request("GET", "contracts", params, &resp) - return -} - -// GetAliases - returns aliases map in format map[address]alias -func (t *TzKT) GetAliases() (map[string]string, error) { - params := map[string]string{} - - params["limit"] = "10000" - params["kind.in"] = "smart_contract,asset" - params["select.fields"] = "alias,address,creator,manager,delegate" - - var contracts []Contract - if err := t.request("GET", "contracts", params, &contracts); err != nil { - return nil, fmt.Errorf("request error %w", err) - } - - aliases := make(map[string]string) - for _, c := range contracts { - if c.Alias != nil { - aliases[c.Address] = sanitize(*c.Alias) - } - - if c.Creator != nil { - if c.Creator.Alias != nil && c.Creator.Address != nil { - aliases[*c.Creator.Address] = sanitize(*c.Creator.Alias) - } - } - - if c.Manager != nil { - if c.Manager.Alias != nil && c.Manager.Address != nil { - aliases[*c.Manager.Address] = sanitize(*c.Manager.Alias) - } - } - - if c.Delegate != nil { - if c.Delegate.Alias != nil && c.Delegate.Address != nil { - aliases[*c.Delegate.Address] = sanitize(*c.Delegate.Alias) - } - } - } - return aliases, nil -} - -func sanitize(alias string) string { - return strings.ReplaceAll(alias, "'", "’") -} - -// GetProtocols - -func (t *TzKT) GetProtocols() (resp []Protocol, err error) { - err = t.request("GET", "protocols", nil, &resp) - return -} diff --git a/scripts/migration/main.go b/scripts/migration/main.go index fdf9dfe45..7fc7a7534 100644 --- a/scripts/migration/main.go +++ b/scripts/migration/main.go @@ -14,7 +14,6 @@ import ( ) var migrationsList = []migrations.Migration{ - &migrations.GetAliases{}, &migrations.DefaultEntrypoint{}, &migrations.FindLostContracts{}, &migrations.BigMapStateCount{}, diff --git a/scripts/migration/migrations/get_aliases.go b/scripts/migration/migrations/get_aliases.go deleted file mode 100644 index ec9ed1f8d..000000000 --- a/scripts/migration/migrations/get_aliases.go +++ /dev/null @@ -1,68 +0,0 @@ -package migrations - -import ( - "context" - "time" - - "github.com/baking-bad/bcdhub/internal/config" - "github.com/baking-bad/bcdhub/internal/logger" - "github.com/baking-bad/bcdhub/internal/models/account" - "github.com/baking-bad/bcdhub/internal/models/types" - "github.com/baking-bad/bcdhub/internal/tzkt" - "github.com/go-pg/pg/v10" - "github.com/schollz/progressbar/v3" -) - -// GetAliases - -type GetAliases struct{} - -// Key - -func (m *GetAliases) Key() string { - return "get_aliases" -} - -// Description - -func (m *GetAliases) Description() string { - return "get aliases from TzKT" -} - -// Do - migrate function -func (m *GetAliases) Do(ctx *config.Context) error { - logger.Info().Msg("Starting get aliases...") - - cfg := ctx.Config.TzKT["mainnet"] - timeout := time.Duration(cfg.Timeout) * time.Second - - api := tzkt.NewTzKT(cfg.URI, timeout) - logger.Info().Msg("TzKT API initialized") - - aliases, err := api.GetAliases() - if err != nil { - return err - } - logger.Info().Msgf("Got %d aliases from tzkt api", len(aliases)) - logger.Info().Msg("Saving aliases...") - - return ctx.StorageDB.DB.RunInTransaction(context.Background(), func(tx *pg.Tx) error { - bar := progressbar.NewOptions(len(aliases), progressbar.OptionSetPredictTime(false), progressbar.OptionClearOnFinish(), progressbar.OptionShowCount()) - for address, alias := range aliases { - if err := bar.Add(1); err != nil { - return err - } - - acc := account.Account{ - Address: address, - Type: types.NewAccountType(address), - Alias: alias, - } - - if _, err := tx.Model(&acc). - OnConflict("(address) DO UPDATE"). - Set("alias = ?alias"). - Insert(); err != nil { - return err - } - } - return nil - }) -}