diff --git a/.chglog/CHANGELOG.tpl.md b/.chglog/CHANGELOG.tpl.md new file mode 100755 index 00000000..0ab1e9e3 --- /dev/null +++ b/.chglog/CHANGELOG.tpl.md @@ -0,0 +1,30 @@ +{{ range .Versions }} + +## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) + +{{ range .CommitGroups -}} +### {{ .Title }} + +{{ range .Commits -}} +* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }} ([{{ .Hash.Short }}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }})) +{{ end }} +{{ end -}} + +{{- if .RevertCommits -}} +### Reverts + +{{ range .RevertCommits -}} +* {{ .Revert.Header }} +{{ end }} +{{ end -}} + +{{- if .NoteGroups -}} +{{ range .NoteGroups -}} +### {{ .Title }} + +{{ range .Notes }} +{{ .Body }} +{{ end }} +{{ end -}} +{{ end -}} +{{ end -}} \ No newline at end of file diff --git a/.chglog/config.yml b/.chglog/config.yml new file mode 100755 index 00000000..f8e8fad2 --- /dev/null +++ b/.chglog/config.yml @@ -0,0 +1,21 @@ +style: github +template: CHANGELOG.tpl.md +info: + title: CHANGELOG + repository_url: https://github.com/aeternity/aepp-sdk-go +options: + commit_groups: + title_maps: + feat: Features + fix: Bug Fixes + perf: Performance Improvements + refactor: Code Refactoring + header: + pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$" + pattern_maps: + - Type + - Scope + - Subject + notes: + keywords: + - BREAKING CHANGE \ No newline at end of file diff --git a/.env b/.env index 8af25d51..8c29baf3 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -TAG=v5.2.0 -COMPILER_TAG=v4.0.0 +TAG=v6.0.0 +COMPILER_TAG=v6.0.0 diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 60819ce0..a48bb61b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,72 +1,45 @@ -name: Go -on: - push: - tags: - - refs/tags/* +name: Test, build, and release +on: [push, pull_request] jobs: - - build: - name: Build + main: runs-on: ubuntu-latest steps: - - - name: Set up Go 1.13 - uses: actions/setup-go@v1 + - uses: actions/setup-go@v2 with: - go-version: 1.13 - id: go + go-version: 1.16 - - name: Check out code into the Go module directory - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - - name: Get dependencies + - name: Lint run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure + go get honnef.co/go/tools/cmd/staticcheck@v0.2.0 + make lint - fi + - run: make test-unit + - run: docker-compose up -d + - name: Ensure that node is running + run: | + while [[ `curl -s -o /dev/null -w %{http_code} localhost:3013/api` != 200 ]]; do + sleep 0.2; + done + - run: make test-integration - name: Build + if: true != startsWith(github.ref, 'refs/tags/') run: make build-release - - name: Create Release - id: create_release - uses: actions/create-release@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build release + if: startsWith(github.ref, 'refs/tags/') + run: make build-release + + - name: Publish release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + files: | + dist/windows.zip + dist/darwin.zip + dist/linux.zip draft: true - prerelease: false - - name: Upload Release Asset - Windows - id: upload-release-asset-win - uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/windows.zip - asset_name: windows.zip - asset_content_type: application/zip - - name: Upload Release Asset - Mac - id: upload-release-asset-darwin - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/darwin.zip - asset_name: darwin.zip - asset_content_type: application/zip - - name: Upload Release Asset - Linux - id: upload-release-asset-linux - uses: actions/upload-release-asset@v1.0.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/linux.zip - asset_name: linux.zip - asset_content_type: application/zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 03e39e83..4aac5020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,96 +1,893 @@ -# Change Log -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## [v9.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v8.0.0...v9.0.0) (2021-06-15) -# (2019-04-09) +### Bug Fixes + +* define items field to fix generation error ([2c42678](https://github.com/aeternity/aepp-sdk-go/commit/2c42678cbfa9f2090d83708137f788f0b3ddd186)) +* define items field to fix generation error ([c688250](https://github.com/aeternity/aepp-sdk-go/commit/c68825043940cd5f05701962a3b392a87c9c90dd)) +* revert serialisation to string of compiler models ([bfbb64a](https://github.com/aeternity/aepp-sdk-go/commit/bfbb64af006bea341cb243e5adf9bbb664fd6533)) +* remove incompatible definitions ([1f4d7b9](https://github.com/aeternity/aepp-sdk-go/commit/1f4d7b9908b8fcb997fae3043ae5744a8a4afa1e)) +* remove incompatible definitions ([fd9ff9b](https://github.com/aeternity/aepp-sdk-go/commit/fd9ff9be9aad0e5f5786be3fc9efc06a1be5c42b)) +* don't fail on getting nonce for new account ([8ef7545](https://github.com/aeternity/aepp-sdk-go/commit/8ef75452876d294455cb3718ad7c70e39846d6f3)) +* don't panic on Invalid tx ([06b545a](https://github.com/aeternity/aepp-sdk-go/commit/06b545aa5466d11f87a83c95af94f7855d5649ad)) +* **big-int:** add missed ContextValidate method ([31b0075](https://github.com/aeternity/aepp-sdk-go/commit/31b00759c72f6266df81e52f995bf2586424ad46)) +* **node-error:** revert removed String method ([90ae4b4](https://github.com/aeternity/aepp-sdk-go/commit/90ae4b4e29d6ed09a2e75ca7ef3f5778f4d84d63)) +* **node-error:** revert removed String method ([2ed984c](https://github.com/aeternity/aepp-sdk-go/commit/2ed984c3dec106b46f7623e8010219a0f5f74660)) +* **node-error:** revert removed String method ([ae6f6df](https://github.com/aeternity/aepp-sdk-go/commit/ae6f6dfffa7c08b4534421efacb0d20cc3b98e3c)) + +### Chore + +* regenerate changelog ([d416701](https://github.com/aeternity/aepp-sdk-go/commit/d416701ec67d37fb1cdfead4f9bc41bdccdd9342)) +* remove unused bytecode ([25e16bf](https://github.com/aeternity/aepp-sdk-go/commit/25e16bf2765ca01838e190a81d49760c8eb1b90c)) +* setup changelog generator ([113e1a4](https://github.com/aeternity/aepp-sdk-go/commit/113e1a431d5ea28995ad53f220fd653c9fc62d47)) +* bump version to 9 ([2464486](https://github.com/aeternity/aepp-sdk-go/commit/246448630ce6310ec473d912b8eb3e57c55c547a)) +* remove extra dependencies using `go mod tidy` ([03de926](https://github.com/aeternity/aepp-sdk-go/commit/03de926eda007b7771da98f4ee779b75fde9d9ea)) +* enable Iris protocol ([26f720c](https://github.com/aeternity/aepp-sdk-go/commit/26f720c2afd67676ae8881bd3bbc16c649ea947a)) +* update compiler api to 6.0.0 ([1fa699c](https://github.com/aeternity/aepp-sdk-go/commit/1fa699cda050152f675589e8429e43de1e5bf375)) +* manually fix generic_tx.go according to readme ([62fb47d](https://github.com/aeternity/aepp-sdk-go/commit/62fb47d6fc3b65e893cb3417781c656ec4302d2a)) +* run generic_tx_json_fix.py ([b09ee44](https://github.com/aeternity/aepp-sdk-go/commit/b09ee441b81ddb4ff015a008cd51423f4c4364d5)) +* regenerate node api ([e4e5daf](https://github.com/aeternity/aepp-sdk-go/commit/e4e5daf8d6fb75365b9a1ea2ab1abf88c2596777)) +* manually fix generic_tx.go according to readme ([bfc7047](https://github.com/aeternity/aepp-sdk-go/commit/bfc7047f70f02371b44e173a74fa0aad5c98ce5a)) +* update node api to 6.0.0 ([e7984a9](https://github.com/aeternity/aepp-sdk-go/commit/e7984a9c7b5adbc42f22e5d599e7c69f7bf9ce46)) +* run generic_tx_json_fix.py ([580ce75](https://github.com/aeternity/aepp-sdk-go/commit/580ce75c0596cee8c1c3bc4d194594bc267c4452)) +* regenerate node api ([ae79858](https://github.com/aeternity/aepp-sdk-go/commit/ae79858595cd54218a6b43b4d42fbe12b47f9c71)) +* update node api to 5.11.0 ([9af9723](https://github.com/aeternity/aepp-sdk-go/commit/9af9723bc698c8a48129e8282ed678b1ee936b14)) +* fix linter errors manually ([2257666](https://github.com/aeternity/aepp-sdk-go/commit/2257666bd16a3ceefe45d8ee2aed2546e87e1da9)) +* manually fix generic_tx.go according to readme ([01126e1](https://github.com/aeternity/aepp-sdk-go/commit/01126e129a16914a49b4fa11a1a99ae1da9fcebe)) +* run generic_tx_json_fix.py ([e4fa90f](https://github.com/aeternity/aepp-sdk-go/commit/e4fa90f4782d5afdea62acaabb82b26e00adabe0)) +* regenerate node api using latest go-swagger ([4cdc679](https://github.com/aeternity/aepp-sdk-go/commit/4cdc679300a456bb48b15b6dd74720c21363aac6)) +* process node.js ([9cae02a](https://github.com/aeternity/aepp-sdk-go/commit/9cae02a2ef33343947f03459a1058ed870c524bd)) +* update api readme ([037ddbd](https://github.com/aeternity/aepp-sdk-go/commit/037ddbddc4824d384ef866453300628f451e6d7e)) +* regenerate compiler api ([9624325](https://github.com/aeternity/aepp-sdk-go/commit/9624325568b28f6cbcb6533edc8374660216031d)) +* update compiler api to 4.3.2 ([2ca70fb](https://github.com/aeternity/aepp-sdk-go/commit/2ca70fbc9e8181e530aba650ff2d92eb89adcd54)) +* reformat compiler api with jq ([3150369](https://github.com/aeternity/aepp-sdk-go/commit/3150369b75ec4d2ba411e3cde2f1c70e8c021f50)) +* regenerate compiler api using latest go-swagger ([f6713eb](https://github.com/aeternity/aepp-sdk-go/commit/f6713eb870e8b073cf6ee97e4ce987096806de16)) +* switch to a not deprecated linter package ([4e223f8](https://github.com/aeternity/aepp-sdk-go/commit/4e223f8384700c9c38492a15c2646806efc790d0)) +* simplify node configuration ([315f5ae](https://github.com/aeternity/aepp-sdk-go/commit/315f5aecd25fc224f138ba11a98bd9549f6352a8)) +* run tests at GitHub Actions ([bbce116](https://github.com/aeternity/aepp-sdk-go/commit/bbce116ae190b8fe4665225ebe38b2dcfc1b4197)) +* **changelog:** rename sections and add links ([0aa5091](https://github.com/aeternity/aepp-sdk-go/commit/0aa5091145253adad56489964428e1c040961024)) + +### Ci + +* simplify configuration ([672d3ba](https://github.com/aeternity/aepp-sdk-go/commit/672d3ba5d7fb47a326e194d27548f6b582f3124b)) + +### Code Refactoring + +* drop old nodes support and compiler switch ([f8ab7a5](https://github.com/aeternity/aepp-sdk-go/commit/f8ab7a5bd5eabe9033b62f57399a72b310cbefb6)) +* fix linter errors manually ([52a8066](https://github.com/aeternity/aepp-sdk-go/commit/52a8066c8304f1222c9eb322e7a52c1132abe11b)) +* fix linter errors manually ([f78ad17](https://github.com/aeternity/aepp-sdk-go/commit/f78ad177e3401345d69af43b6013d1b23da88c5c)) +* simplify Makefile ([daef543](https://github.com/aeternity/aepp-sdk-go/commit/daef54318c6c5ef0c5ce3b6004055da429a6837b)) +* remove Jenkins-related report package ([815a94f](https://github.com/aeternity/aepp-sdk-go/commit/815a94f40ab298e329b25698882e94adf97f076d)) +* update go version ([e548512](https://github.com/aeternity/aepp-sdk-go/commit/e548512a2d6344327ab71486ebe23d6522aa3589)) +* update dependencies ([5e71e07](https://github.com/aeternity/aepp-sdk-go/commit/5e71e07d94e7d0c73d5b23fe7be14b6f7658fd70)) +* depend on organisation fork of rlp for aeternity ([8f661f0](https://github.com/aeternity/aepp-sdk-go/commit/8f661f014c6f18935176c638e1e77a63a70e436d)) +* update node URLs ([a2648aa](https://github.com/aeternity/aepp-sdk-go/commit/a2648aafd76889c7f3defb5891297f1fa92ca089)) + +### Docs + +* add go-swagger version ([ab5ab0d](https://github.com/aeternity/aepp-sdk-go/commit/ab5ab0dd077db5fe3036bbdf3f6fbed41b02af53)) + +### Test + +* fix oracle ([0ff2f08](https://github.com/aeternity/aepp-sdk-go/commit/0ff2f08570bac6692038b3f0a510a399ac32f23c)) +* generate random name to don't cleanup node each run ([078f642](https://github.com/aeternity/aepp-sdk-go/commit/078f6422f9b7f80b4b1c233366ea7028ae2a11c2)) +* fix GA ([951b02e](https://github.com/aeternity/aepp-sdk-go/commit/951b02e65bdba73e2166c43c49859ff1a40205a3)) +* update bob address because of lack of private key ([2967e12](https://github.com/aeternity/aepp-sdk-go/commit/2967e12747a664193ee575c587eec378bab378e9)) +* don't connect to incompatible public testnet ([d56bb06](https://github.com/aeternity/aepp-sdk-go/commit/d56bb0653c7281e698050cb52c9203c6f07e23f9)) + + + +## [v8.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v7.0.1...v8.0.0) (2020-01-07) + +### Bug Fixes + +* DefaultOracleListener never returns an error ([35d42a8](https://github.com/aeternity/aepp-sdk-go/commit/35d42a8ce85555454bd70f210edd9191e2037574)) +* aens_test.go uses the TxReceipt's features ([8cc0af8](https://github.com/aeternity/aepp-sdk-go/commit/8cc0af8807012e5753cca27f94de2707b08019f5)) +* node.Infoer functionality moved to Context.NodeInfo() ([97453a4](https://github.com/aeternity/aepp-sdk-go/commit/97453a4cf6babb654e5d995a7af60274e85eab32)) +* avoid naet.NodeInterface whenever possible when writing functions that use naet.Node. Each function that uses the node should specify explicitly its methods that it uses from naet.Node, perhaps by defining its own interface locally. ([245f5e3](https://github.com/aeternity/aepp-sdk-go/commit/245f5e30f80807df452266e0989fa9302ee8a804)) +* alternate way of getting a bytes version of Uint64 using binary.BigEndian.PutUint64() ([e403a29](https://github.com/aeternity/aepp-sdk-go/commit/e403a296720d899b1b809515419e201ae3766a48)) + +### Chore + +* bump version to 8 ([42123be](https://github.com/aeternity/aepp-sdk-go/commit/42123be29e8a7efa11434e622c7ec676291df9eb)) +* fix linter complaints ([c459dc6](https://github.com/aeternity/aepp-sdk-go/commit/c459dc64bab8e13417bae47406281ed8fe459371)) +* comments and exported CompileEncoder interface from aeternity ([dd4e371](https://github.com/aeternity/aepp-sdk-go/commit/dd4e371013f3f42b5be2b7d605e71dbd00a65129)) +* .env v5.2.0 ([9cc1a20](https://github.com/aeternity/aepp-sdk-go/commit/9cc1a20342bd2256b4a4d482e4544f8247f609d4)) +* rename INTEGRATION_TEST_SENDER_PRIVATE_KEY to AETERNITY_ALICE_PRIVATE_KEY ([07d4a51](https://github.com/aeternity/aepp-sdk-go/commit/07d4a51889568ca0dc127aa98cb159f268ab9dd0)) + +### Code Refactoring + +* Context.SignBroadcast as well as SignBroadcastWait ([6260ed9](https://github.com/aeternity/aepp-sdk-go/commit/6260ed9afb75c54604118b777b4900765721084c)) +* integrationtest NewContext no longer returns an err ([12c2047](https://github.com/aeternity/aepp-sdk-go/commit/12c2047ee447bdb489a84768d1ba8f2a3ece6de5)) +* NewContext doesn't need to return an error after all; TxReceipt.Tx should not be a pointer to an interface ([1dbe992](https://github.com/aeternity/aepp-sdk-go/commit/1dbe992ef2894f52eb07bbeb82e8e3fbb6ede4a5)) +* getTransactionByHashHeighter interface renamed to transactionWaiter ([30e6487](https://github.com/aeternity/aepp-sdk-go/commit/30e648758e2cca507da206045f2dd90427ca9334)) +* NewContext does not need to return error after all. ErrWaitTransaction type was too complicated for its usefulness ([a6b5cb1](https://github.com/aeternity/aepp-sdk-go/commit/a6b5cb110d701306cc8d68f57198f9fece155371)) +* remove unused WaitTransactionForXBlocks() ([035fcb5](https://github.com/aeternity/aepp-sdk-go/commit/035fcb5a985bdd4bb7bbc7385f345307f626a994)) +* use aeternity.SignBroadcast(), aeternity.WaitSynchronous() or ctx.SignBroadcastWait() throughout the codebase ([74f46d9](https://github.com/aeternity/aepp-sdk-go/commit/74f46d99d09c56d96ffca5ae19782f1df6df2372)) +* aeternity.WaitSynchronous() ([13b8b55](https://github.com/aeternity/aepp-sdk-go/commit/13b8b550a9c79508bf826a86951d89d194b3e1c9)) +* it is not yet time to remove broadcastWaitTransactionNodeCapabilities ([e94898a](https://github.com/aeternity/aepp-sdk-go/commit/e94898a9afce51ef8ffc350cd2211ccf76d6bd95)) +* introduced TxReceipt.Watch(), which replaces SignBroadcastWait. but not sure yet how to use it with existing code ([d56cecb](https://github.com/aeternity/aepp-sdk-go/commit/d56cecb241eb92a52c9b3ebbb57cd4059415a360)) +* Oraclize can now Listen and Register if Oracle was not previously registered ([f20236e](https://github.com/aeternity/aepp-sdk-go/commit/f20236e01d3dcc7a58b7f835d0c5297c7e0d1bda)) +* make ChainPollInterval useful, 1s by default ([04136e9](https://github.com/aeternity/aepp-sdk-go/commit/04136e98987e7d76c38c08c125e50f4c5c815ce0)) +* Oracles uses Context, beginning refactor to mimic http.Listen/Parser/Handler ([9367aeb](https://github.com/aeternity/aepp-sdk-go/commit/9367aeb72eb8b240d331f37a3717f78205d032fe)) +* naet.Node.Info() returns netowrkID and node version for use with HLL ([6601570](https://github.com/aeternity/aepp-sdk-go/commit/66015706c72b10cd05ed23121b03596e44e9978e)) +* AENS uses Context ([2fa3dbb](https://github.com/aeternity/aepp-sdk-go/commit/2fa3dbbc0a8d65d68b51ba0aef6ba0ead4949b47)) +* Contracts uses Context ([d7ea73a](https://github.com/aeternity/aepp-sdk-go/commit/d7ea73a1670c7195886a64c999b4b94ecdf4638c)) +* Context struct with ContextInterface ([000f1ed](https://github.com/aeternity/aepp-sdk-go/commit/000f1eddccb6712ce0c7cb862434d815ed5f7263)) +* SignBroadcastWaitTransaction returns a *TxReceipt ([479607f](https://github.com/aeternity/aepp-sdk-go/commit/479607f30069bb3e4e2c26822ce37344887d6511)) +* introduce TxReceipt, Context. 2nd level functions are now methods of Context ([b02675c](https://github.com/aeternity/aepp-sdk-go/commit/b02675c0c80725066226ddc7fc2d7456af3161dc)) +* Noncer now returns the current height in addition to the recommended TTL, so NewNameUpdateTx does not need separate ttler, noncer input arguments and does not have to call ttler twice. transactions.GenerateTTLNoncer renamed to NewTTLNoncer ([e8aa318](https://github.com/aeternity/aepp-sdk-go/commit/e8aa3188225fad4489d8e4384f1f8b5bed17bc6b)) +* AENS higher level TestRegisterName uses Broadcaster; CreateContract returns ctID; CallContract introduced ([6b8280f](https://github.com/aeternity/aepp-sdk-go/commit/6b8280fa8dfe262ec92267baf19f3cd85e4607c5)) +* try to use Broadcaster struct in higher level interface ([9cf81a8](https://github.com/aeternity/aepp-sdk-go/commit/9cf81a809f576dee3511a6f6248ef819f5b3293c)) +* introducing Broadcaster{} struct, which is like Context{} but only handles broadcasting ([0f3625c](https://github.com/aeternity/aepp-sdk-go/commit/0f3625ce783af3c600121a96688fef7fce23e389)) + +### Docs + +* DESIGN.md explains the current state of the Go SDK ([f878a75](https://github.com/aeternity/aepp-sdk-go/commit/f878a75ed5ec43f8e08fa6b0a093129bb2f5eca4)) +* add comments for higher level interface constructs ([157e24c](https://github.com/aeternity/aepp-sdk-go/commit/157e24ce26880f8df735f50de83753cd4a47428a)) +* comments for Context{} ([f0a24e4](https://github.com/aeternity/aepp-sdk-go/commit/f0a24e4ca76ed672b6259bd5c2b13d035fd8ebfa)) + +### Feature + +* beta DefaultCallResultListener. There's probably a better way to do this, but this seems to work. ([7d31909](https://github.com/aeternity/aepp-sdk-go/commit/7d31909bc8e842e03c96e7ec8905e8b4623195db)) +* Node now supports GetTransactionInfoByHash, required for contract call return values ([116fa9d](https://github.com/aeternity/aepp-sdk-go/commit/116fa9d09038bb7c259ef18450d3975e7ae4a416)) +* NamePointer generalized to allow for arbitrary pointer types, as well as account_pubkey, oracle_pubkey, contract_pubkey, channel types ([6f62f04](https://github.com/aeternity/aepp-sdk-go/commit/6f62f041728004daab663d06d7707f1b3a91f0f5)) +* CreateOracle, ListenOracleQueries higher level convenience functions. New naet.Node capability required: GetOracleQueriesByPubkey ([8b3d66d](https://github.com/aeternity/aepp-sdk-go/commit/8b3d66d9ce6c324e1cc46ea847f27cc8ebfd9fef)) + +### Features + +* OracleRegisterTx.ID(), OracleQueryTx.ID() methods ([f55cd2d](https://github.com/aeternity/aepp-sdk-go/commit/f55cd2de47af1b7467bd13de7347b94ec9bcec0d)) + +### Tests + +* TestSignBroadcast, TestfindVMABIVersion ([fd88f51](https://github.com/aeternity/aepp-sdk-go/commit/fd88f51bb70e435050bc35c64def2956447a1fe7)) +* TxReceipt.Watch unittest ([21a82d4](https://github.com/aeternity/aepp-sdk-go/commit/21a82d4eee6e0e300b9156829442cddea20dc57d)) +* integration test for oraclize ([c515139](https://github.com/aeternity/aepp-sdk-go/commit/c515139a7004bb7ed89c16b5c86ec5f9f7ba58dc)) + + + +## [v7.0.1](https://github.com/aeternity/aepp-sdk-go/compare/v7...v7.0.1) (2019-11-25) + +### Bug Fixes + +* account sign not updated to use SerializeTx() ([9217c01](https://github.com/aeternity/aepp-sdk-go/commit/9217c01fa9c51752a1ae1d15d8269a28fe3a7fc9)) +* make ABIVersion==3 a const ([0f45e0a](https://github.com/aeternity/aepp-sdk-go/commit/0f45e0a7edd023c2b17966d91eb3e3a8245cf185)) +* docker-compose v1.24 changed behaviour to complain about duplicate mountpoints. Also expose apparently does not automatically publish ports to the host anymore ([8df9761](https://github.com/aeternity/aepp-sdk-go/commit/8df976131d6d49e210d90c0a61165fedff604b94)) + +### Chore + +* rename GetWalletPath() to CheckWalletExists() ([ec08cb9](https://github.com/aeternity/aepp-sdk-go/commit/ec08cb9ddd6c2d75dc28e87e1d84105bb1ea1e31)) + +### Docs + +* HD wallet example, moved package aeternity example from context_test.go to helpers_test.go. README.md rewritten. Assume little to no knowledge of Go (assume blockchain knowledge). Make it easier for beginners to know where to look for which code examples. ([5498789](https://github.com/aeternity/aepp-sdk-go/commit/549878913bb4c38f180f5108dc2fe7e98b2bb104)) + +### Features + +* updated fee calculation for FATE Contract Calls ([d5c1b18](https://github.com/aeternity/aepp-sdk-go/commit/d5c1b18848a8d41f4f5cc7b3318cddc54782621c)) + +### Maintain + +* it works with node v5.0.2 ([0563b58](https://github.com/aeternity/aepp-sdk-go/commit/0563b584bd9f1d16fe75cc1adbb0145b50a250e5)) + + + +## [v7](https://github.com/aeternity/aepp-sdk-go/compare/v7.0.0...v7) (2019-11-06) + + + +## [v7.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v6.0.0...v7.0.0) (2019-11-06) + +### Bug Fixes + +* updated config.go QueryTTLValue, ResponseTTLValue changed Config Defaults Oracle Response unittest ([a7cfbc5](https://github.com/aeternity/aepp-sdk-go/commit/a7cfbc531ba87d2291b301386ec2000db157fa4e)) +* some New*Tx arguments were left over ([0d4c9b1](https://github.com/aeternity/aepp-sdk-go/commit/0d4c9b148becbd4a62c1bc2ea727a9297c3d6366)) +* Default OracleTTLValue introduced; Oracles have a ABIVersion, not a VMVersion ([24b005e](https://github.com/aeternity/aepp-sdk-go/commit/24b005e1b33b3ea3c09ed9ec8384a24ec53adda7)) +* namesalt was accidentally used for namefee ([2ee99ca](https://github.com/aeternity/aepp-sdk-go/commit/2ee99ca02199efa818f7a5f9687edadf693c1305)) +* go 1.13 changed package import behaviour, causing test flags to be parsed before they were declared https://github.com/golang/go/issues/31859 In case anyone else lands here and is looking for a simple answer: ([1e8cf5b](https://github.com/aeternity/aepp-sdk-go/commit/1e8cf5bd8e959ea17e73ee277f7c147c585d188d)) +* SignBroadcastWaitTransaction and friends shoud take interface instead of *naet.Node ([5848d92](https://github.com/aeternity/aepp-sdk-go/commit/5848d9264a7719592a67fbeb4a6684969523aa58)) +* package aeternity accidentally imported v1 of aepp-sdk-go ([25fec10](https://github.com/aeternity/aepp-sdk-go/commit/25fec10c40ae86826de9465fad8e0699615d60f0)) +* update config values for Lima Default Compiler Backend is FATE (updated VMVersion/ABIVersion too) Default GasLimit is lowered (previously was larger than protocol's microblock gas limit of 6e6) ([59d65fb](https://github.com/aeternity/aepp-sdk-go/commit/59d65fb29a782f76cd0415eac4c4b53d47ed89e8)) +* package aeternity was wrongly importing aepp-sdk-go without a major version ([b9fb5aa](https://github.com/aeternity/aepp-sdk-go/commit/b9fb5aa5e6447aea07d4fc36bc4b6003ece8b8eb)) + +### Chore + +* update aepp-sdk-go import paths to v7 ([961a75b](https://github.com/aeternity/aepp-sdk-go/commit/961a75b0f447e156fa2f66afe14651656d9c8736)) +* update go.mod, go.sum ([5986f00](https://github.com/aeternity/aepp-sdk-go/commit/5986f0053a2b186a1aa9e816f9db80eb3e00a7d2)) +* integration test testdata is now FATE bytecode ([501001e](https://github.com/aeternity/aepp-sdk-go/commit/501001e94d635002e7a0ff1f3dc67690031c6ade)) +* use SignBroadcastWaitTransaction in integration tests ([20f2cdb](https://github.com/aeternity/aepp-sdk-go/commit/20f2cdb04a780944cc74fc13f0dd23e363cca625)) +* feel comfortable about removing Default Config Tx RLP serialization unittest cases now ([4458c06](https://github.com/aeternity/aepp-sdk-go/commit/4458c061a3a7018d1fa37ab6e79af70e9c6bb8f8)) +* update go.mod ([920a6b7](https://github.com/aeternity/aepp-sdk-go/commit/920a6b76b3a27f8f3a47875db1b8b14aef5c18f6)) +* update to compiler v4.0.0 ([1e1d3c7](https://github.com/aeternity/aepp-sdk-go/commit/1e1d3c7d90faa1ab7ad7e028a6d4e041b7be6eeb)) +* private testnet node should upgrade to Lima consensus ASAP ([6918690](https://github.com/aeternity/aepp-sdk-go/commit/691869078de2951b853c58dfa12972501f451eb1)) +* WaitForTransactionForXBlocks could really use a config parameter that has a suggested waiting time in blocks ([ae20c6a](https://github.com/aeternity/aepp-sdk-go/commit/ae20c6ae8a8cdf9ca5b81ca94d9c9fcbeb9ce385)) + +### Code Refactoring + +* restrict HD wallet functionality to only deriving aeternity addresses ([6f37c3b](https://github.com/aeternity/aepp-sdk-go/commit/6f37c3b5778a491bebce6745a92d9d07bc4f6ff7)) +* Transaction interface now includes the TransactionFeeCalculable methods ([4575526](https://github.com/aeternity/aepp-sdk-go/commit/45755269610c36af6cdc00a7270f1626796de929)) +* Transaction fee calculation reworked to accomodate the different gas calculation equation for Oracle*Txs ([1875246](https://github.com/aeternity/aepp-sdk-go/commit/18752460e1692a4b68d0c37ccd4fe5776eb6cf9d)) +* cmd uses TTLer/Noncer ([2e3924f](https://github.com/aeternity/aepp-sdk-go/commit/2e3924f6d6cc954b31d5e05fc082d848117f0319)) +* integration tests use TTLer/Noncer method ([87f5777](https://github.com/aeternity/aepp-sdk-go/commit/87f577770345f47fc421bc7c211bf41d4268a826)) +* CreateTTLer, CreateNoncer, GenerateTTLNoncer, CreateTTLNoncer ([5f06729](https://github.com/aeternity/aepp-sdk-go/commit/5f067294f1d1afc457de2e154fc7ace5d145ecc2)) +* GA transactions follow new closure system ([8dadb77](https://github.com/aeternity/aepp-sdk-go/commit/8dadb776917761b39bf8ab3cd770fbd0020d7b00)) +* removal of Context struct ([e0801a9](https://github.com/aeternity/aepp-sdk-go/commit/e0801a90c1c53f55de06e6cd20f2b461c11cfc24)) +* Contract*Tx constructors now do the work previously done by Context ([529a6a0](https://github.com/aeternity/aepp-sdk-go/commit/529a6a07cd2f33eee0d81f0f7a0182364336308e)) +* Oracle*Tx constructors now do the work of Context ([f549966](https://github.com/aeternity/aepp-sdk-go/commit/f5499663d45669893a4ac8e64fd4b225ee2ad7fb)) +* SpendTx, AENS transaction constructors now do a lot of hard work previously done by Context move GetTTL/GetNextNonce to package transactions ([40f5481](https://github.com/aeternity/aepp-sdk-go/commit/40f5481295a5905a764fbf9698de5e561838b01f)) + +### Docs + +* comments for NameID, ErrWaitTransaction ([a4d7386](https://github.com/aeternity/aepp-sdk-go/commit/a4d7386843f945eef652c6da46af1754d30d7472)) + +### Feature + +* AEX-10 HD Wallet and mnemonic support ([df76365](https://github.com/aeternity/aepp-sdk-go/commit/df763655f8f654fc99036833f9d1a2c4ee44c0a0)) +* WaitTransactionForXBlocks and its derivatives now return a ErrWaitTransaction struct which helps callers distinguish between network errors and transaction acceptance errors ([6b4725b](https://github.com/aeternity/aepp-sdk-go/commit/6b4725b7cb4e4013a6086ee033dd25ef344f2b08)) +* integration tests for higher level ([c9ee7fb](https://github.com/aeternity/aepp-sdk-go/commit/c9ee7fb041f1a9457d7a4d02f68fd3fcc56431e2)) +* higher level AENS supports NameFee ([d7bf5fd](https://github.com/aeternity/aepp-sdk-go/commit/d7bf5fd3cc36f155ab3e06eee94ffce64bd1158a)) +* update AENS integration tests for Lima HF ([8d9962d](https://github.com/aeternity/aepp-sdk-go/commit/8d9962df17b668fb239da21d237f2be1a453da88)) +* Lima HF NameClaimTx update and NameID calculation changes ([be88be8](https://github.com/aeternity/aepp-sdk-go/commit/be88be8a7dbe487431f9a4fe9d42b913a37c9209)) +* AENS auction config params ([b51ebb3](https://github.com/aeternity/aepp-sdk-go/commit/b51ebb33e429ee6cea07112a18fd8cea61bf4c96)) +* test with node v5.0.0-rc.5 ([bc13ca2](https://github.com/aeternity/aepp-sdk-go/commit/bc13ca20eb1e78c7b8f8dfd647f014d20ca6382a)) +* new name hashing scheme after Lima HF ([237cb40](https://github.com/aeternity/aepp-sdk-go/commit/237cb40c44243b394b98ab294151811bbd63bde0)) +* RegisterName(), CreateContract() ([f6a1ed2](https://github.com/aeternity/aepp-sdk-go/commit/f6a1ed291b611c7d7316511e273097e592d176e2)) + +### Features + +* improve vanity account generation experience ([51440e8](https://github.com/aeternity/aepp-sdk-go/commit/51440e8d919f04f2861b3c7a702714ed751e0c34)) + + + +## [v6.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v5.1.2...v6.0.0) (2019-10-10) + +### Bug Fixes + +* ExampleGetTransactionType test was failing when run as part of the unittest suite, but working properly when run individually. This is because TransactionTypes map was being modified somewhere. Instead of investigating what changed it (non-obvious), I simply wrapped TransactionTypes map in a function to provide the const map behaviour originally intended. ([a7fdfae](https://github.com/aeternity/aepp-sdk-go/commit/a7fdfae03a900d484396aa286f906472ab920f51)) +* compiler_test.go was not using config package ([35d0eae](https://github.com/aeternity/aepp-sdk-go/commit/35d0eaede96072faa8421ac49c9191e240d6aa0a)) +* ensure all import paths have aepp-sdk-go/v5 ([23bf23a](https://github.com/aeternity/aepp-sdk-go/commit/23bf23abc67fef8d1cb8fac45dd5fa2ece59c9f4)) +* account's testdata/ folder was not moved with it into account/ ([8f9a4f0](https://github.com/aeternity/aepp-sdk-go/commit/8f9a4f0db69f3b4565460e4106a0b106b651212e)) + +### Chore + +* import paths to aepp-sdk-go/v6 ([bd8ba2a](https://github.com/aeternity/aepp-sdk-go/commit/bd8ba2a3375af65b8a7aeaba4b82a34a2501b3d7)) +* there is no need to test the output of CompileContract, just that it finished without error ([71a5ba5](https://github.com/aeternity/aepp-sdk-go/commit/71a5ba5c05c3dcedaf1f58872fa9da538aa952ac)) +* goimports moved aeternity import in ga_test.go ([373bdd0](https://github.com/aeternity/aepp-sdk-go/commit/373bdd01261a6c667a323fbfe619eacb625e7f6b)) +* update golden file for simplestorage_bytecode.txt compiler v4.0.0-rc4 ([143f004](https://github.com/aeternity/aepp-sdk-go/commit/143f004f233ce1b166b33d88a992830c68cbe93a)) +* functionality required of api/updatedict.py has changed since last editing node v3's swagger.json file ([e851cfc](https://github.com/aeternity/aepp-sdk-go/commit/e851cfc32d869043a8ac27dc512c46fc43c1a33c)) +* aeternity.VerifySignedTx should be in package transactions ([0c8699e](https://github.com/aeternity/aepp-sdk-go/commit/0c8699e077fe15deb8a325e8fedb77fa57fd5da2)) +* move prefixes in package binary to their own file ([b905bc7](https://github.com/aeternity/aepp-sdk-go/commit/b905bc73eeed3304e066829fcb65005b4e1af9e6)) +* config.Config was stuttering ([f41d335](https://github.com/aeternity/aepp-sdk-go/commit/f41d335a35c1608c5a5f1dfe54322ba4b3540880)) +* remove redundant 'Account' in package account's functions ([8f6b689](https://github.com/aeternity/aepp-sdk-go/commit/8f6b689f7f29c4b90e07ed62a0bf19a104518b9f)) + +### Code Refactoring + +* package models split into models, transactions ([06c5532](https://github.com/aeternity/aepp-sdk-go/commit/06c5532581ce91d9e760c0294e86e3b994cfde4e)) +* integration tests follow aeternity split ([c4648ae](https://github.com/aeternity/aepp-sdk-go/commit/c4648ae46e8ad8bcae4211e7ce2c4970dd214ce8)) +* cmd follows the new aeternity split ([329766b](https://github.com/aeternity/aepp-sdk-go/commit/329766b6474d65a78977ab99ef2c5e154ad44a6d)) +* split aeternity package ([3638ebd](https://github.com/aeternity/aepp-sdk-go/commit/3638ebdc781bd4d4c388fee8f86c8294037b115a)) +* split identifiers.go into hashing.go/transactions.go, where they are used ([c05d256](https://github.com/aeternity/aepp-sdk-go/commit/c05d256b9b299821118d2473f56835254fccf65f)) +* standardize on *big.Int being passed everywhere, not big.Int ([1311831](https://github.com/aeternity/aepp-sdk-go/commit/1311831932bece09211ee11565061581bfab7056)) +* move hashing_test.go unittests to their respective locations too ([e613f71](https://github.com/aeternity/aepp-sdk-go/commit/e613f717250fe7195de267d3c6b10cdfba4f2af5)) +* break up hashing.go to reduce dependencies. According to Go practice, too much DRY leads to too many dependencies, thus some duplication is allowed. leftPadByteSlice, buildOracleQueryID, buildContractID moved to transactions.go Namehash moved to helpers.go randomBytes duplicated in generateCommitmentID and moved to keystore.go:KeystoreSeal uuidV4 moved to keystore.go generateCommitmentID/computeCommitmentID moved to helpers.go buildRLPMessage, buildIDTag, readIDTag moved to transactions.go ([5188c43](https://github.com/aeternity/aepp-sdk-go/commit/5188c439c25ddd75664e64135cb8929b4b0be43d)) + +### Config + +* we shouldn't need utils.Int outside of swagguard ([4e24ba3](https://github.com/aeternity/aepp-sdk-go/commit/4e24ba37091b68ab59525ad74aff086b33cde689)) + +### Doc + +* README points to code examples instead ([1904f0e](https://github.com/aeternity/aepp-sdk-go/commit/1904f0e9a6762e13feee677f6c564f3e3f03c997)) +* made a Context example from the Spend transaction test ([d0d5ad1](https://github.com/aeternity/aepp-sdk-go/commit/d0d5ad14c373ddd130725055bfd0fcc95eef940e)) + +### Docs + +* ExampleSerialize/DeserializeTx, ExampleGetTransactionType, ExampleSignHashTx, ExampleVerifySignedTx ([40e2171](https://github.com/aeternity/aepp-sdk-go/commit/40e2171f853d7f60a627e6058e532ab2948ec1a6)) +* Contract example ([54b4da5](https://github.com/aeternity/aepp-sdk-go/commit/54b4da5ed8744569cdfabb857c3c9b9291e7db57)) +* doc.go files for each package ([e2c56d4](https://github.com/aeternity/aepp-sdk-go/commit/e2c56d4b1e7841abd2327607946b4e1c4ef16a1e)) +* updated api/README.md ([b29a4e7](https://github.com/aeternity/aepp-sdk-go/commit/b29a4e78346cb37e4db04267f487496186dc5ffd)) +* received many problems about setup, added documentation to README ([58a63c4](https://github.com/aeternity/aepp-sdk-go/commit/58a63c402131f31a67d0dbff831ecb0d40dc1b8a)) + +### Feature + +* node v5.0.0-rc4 support, swagger.json rewriting utils updated ([0bbef47](https://github.com/aeternity/aepp-sdk-go/commit/0bbef475ca80c1d3bb10fc5b686b0a1b8b9585a4)) +* compiler v4.0.0-rc5 swagger json, .env also updated ([f57b042](https://github.com/aeternity/aepp-sdk-go/commit/f57b0425d303e4f4cb0d2c122e03fa6286437545)) +* compiler v4.0.0-rc5 support. CompileContractForbidden was renamed to CompileContractBadRequest ([55abe33](https://github.com/aeternity/aepp-sdk-go/commit/55abe33e3c8f4daa2498361fa15d7c5679e46b03)) +* no need to cancel transaction fee size out anymore when calculating the fee ([39d115b](https://github.com/aeternity/aepp-sdk-go/commit/39d115bd2ad9edf3234b6b546d4a104b01cae818)) +* accurate tx fee calculation with unittests ([ba9403b](https://github.com/aeternity/aepp-sdk-go/commit/ba9403b089b23192ae426c3b9ab77bbd0b678076)) +* swagger.json from node v5.0.0-rc.2 ([a8c7955](https://github.com/aeternity/aepp-sdk-go/commit/a8c795525979d4057fb3f50a0183c212ffece811)) +* support node v5.0.0-rc.2 ([2df1c10](https://github.com/aeternity/aepp-sdk-go/commit/2df1c10761cee3e702a06d1db4c874d44d11552d)) + + + +## [v5.1.2](https://github.com/aeternity/aepp-sdk-go/compare/v5.1.1...v5.1.2) (2019-09-14) + +### Bug Fixes + +* Compiler's Error models changed slightly - ensuring that they all return the underlying Reason ([caf7069](https://github.com/aeternity/aepp-sdk-go/commit/caf70697462d2bf813c4ad7aeb3ba180cc815df1)) + +### Feature + +* basic support for compiler v4.0.0-rc4 ([152bac5](https://github.com/aeternity/aepp-sdk-go/commit/152bac531c027367cf66c3dfdb5e00637a94a7c2)) + + + +## [v5.1.1](https://github.com/aeternity/aepp-sdk-go/compare/v5.1.0...v5.1.1) (2019-09-12) + +### Bug Fixes + +* aepp-sdk-go was importing v1 of itself, causing havoc for module support. Now v5 should be totally standalone. ([852dc24](https://github.com/aeternity/aepp-sdk-go/commit/852dc24b33ab3d024af46c57b7c574f8a2ccfa07)) + +### Chore + +* reenable Contract tests in api_test.go. Using hardcoded fee/GasLimit values - can only be found through trial and error. TODO: improve user experience here! ([8732f08](https://github.com/aeternity/aepp-sdk-go/commit/8732f0832e08a1a540de0631e3ec9dacd8996e3f)) + + + +## [v5.1.0](https://github.com/aeternity/aepp-sdk-go/compare/v5.0.0...v5.1.0) (2019-09-11) + +### Bug Fixes + +* Versions before Lima had inconsistent naming for OracleResponse/OracleRespondTx. Now it is standardized to OracleRespondTx ([acbe52c](https://github.com/aeternity/aepp-sdk-go/commit/acbe52c1ebb1cacf9cdd1d13ff2529c619fc8293)) +* move away from custom signBroadcast() code for integration tests. Integration tests should look like example code from now on ([18547a1](https://github.com/aeternity/aepp-sdk-go/commit/18547a1e2ea9724aa59a18d16349b187ae7fbaa9)) +* OracleConfig.VMVersion should be uint16, not uint64 ([3cb08f7](https://github.com/aeternity/aepp-sdk-go/commit/3cb08f74f4c472936e47ce61e5194101045cfe13)) +* Context.OracleRegisterTx helper had a named argument abiVersion but it's actually VMVersion ([755d779](https://github.com/aeternity/aepp-sdk-go/commit/755d77906ecbdd7e5fa2ba942f19838a7b43467c)) +* README.md had wrong example code. Oops. ([93e2651](https://github.com/aeternity/aepp-sdk-go/commit/93e2651df4cd86b32f4de33c413c68bf8890d1df)) +* stringer interface also wants a String() method with a non-pointer receiver ([ac3533c](https://github.com/aeternity/aepp-sdk-go/commit/ac3533c6f762eb1473eef85fdd987934c91eac6f)) +* PrintGenerationByHeight() was swallowing errors and not printing out transactions in a generation ([8a9f619](https://github.com/aeternity/aepp-sdk-go/commit/8a9f619c6400cdd2b4624b6d4814a116f6cb1f19)) +* utils.BigInt.MarshalJSON() should, surprisingly, NOT have a pointer receiver. This allows json.Marshal() to work on it. ([ebd8af4](https://github.com/aeternity/aepp-sdk-go/commit/ebd8af4a757ebcbed850dcdf95508eaa07852372)) + +### Chore + +* README was not updated somehow, updating again ([1b7c26d](https://github.com/aeternity/aepp-sdk-go/commit/1b7c26d6be52f7e7be582f9bfeeaf93cdec672c0)) +* better comments for config, internal functions Examples for Encode/Decode functions ([0b6e64b](https://github.com/aeternity/aepp-sdk-go/commit/0b6e64b91087085e551898511c74f33c1e058fd8)) +* Tx.Gas renamed to GasLimit. GasPrice moved from Contracts to Config.Client (since it is a constant, used in all tx fee calculations) Cleaned up unused PreclaimFee, ClaimFee, UpdateFee in AENSConfig ([4260720](https://github.com/aeternity/aepp-sdk-go/commit/426072071aa7f8083bf7ac0d5f64006393b7cdd4)) +* cleaned up outdated CLI docs ([922444a](https://github.com/aeternity/aepp-sdk-go/commit/922444a74701c0d85c87a76035ffe883890c949b)) +* improved comments in some places ([f69d9fe](https://github.com/aeternity/aepp-sdk-go/commit/f69d9fe1be71678b609199bf7fdead0193fce0ea)) +* better comments for helpers.go ([7344548](https://github.com/aeternity/aepp-sdk-go/commit/73445489b6106560839c529e8d9c54dc8ab2fc86)) +* ChainPollInterval typo ([beab494](https://github.com/aeternity/aepp-sdk-go/commit/beab494c1418127e007115a51a618109838e2239)) +* updated Contract struct unittest for the new Payable field ([314997b](https://github.com/aeternity/aepp-sdk-go/commit/314997b223a5f31238e1a16525a733effc01b308)) +* standardize on returning pointers for Transaction structs ([b5e6c1c](https://github.com/aeternity/aepp-sdk-go/commit/b5e6c1ce0f7a3f435c6465f3b2a1b57fe1af5eb2)) +* use consts in config for some config parameters ([2d85818](https://github.com/aeternity/aepp-sdk-go/commit/2d858186eb1c7460a692f3d97369a90efcd129ad)) +* update .env to node v5 rc1, compiler v4-rc2 ([a4902a4](https://github.com/aeternity/aepp-sdk-go/commit/a4902a43c558309ed3c73d05b9e0c5ff8d4eb726)) +* update .env to lima/compiler v4 rc1 ([9bd8065](https://github.com/aeternity/aepp-sdk-go/commit/9bd8065458805ad4369f4e46a7680e6dcad90805)) +* use more reference-quality BlindAuth smart contract for golden smart contracts package, use it in GA integration test ([18c973c](https://github.com/aeternity/aepp-sdk-go/commit/18c973c5e01f9735e7549af4d6d2b12565402eed)) +* finish integration test coverage for compiler swagger interface ([811756c](https://github.com/aeternity/aepp-sdk-go/commit/811756c84fa4d080712480be6260059d7f999585)) +* contracts and their bytecodes and calldata were getting too much to manage so introduced a 'golden' package to store them all. Only useful for code which just needs some contract artifact but won't care what it really is. ([20b7979](https://github.com/aeternity/aepp-sdk-go/commit/20b79796f9c79124fff8ca6eb4b1088c0ecc8736)) + +### Cleanup + +* newly calculated dependencies, tidied up struct tags in config.go ([27c28a2](https://github.com/aeternity/aepp-sdk-go/commit/27c28a275421a2788f6aa18551aa5fe08c8769f8)) + +### Code Refactoring + +* Replaced Helpers with closures for GetTTL, GetNextNonce, GetAnythingByName. standardizing referring to *aeternity.Node as 'node' better comments for helpers.go ([3c1ad87](https://github.com/aeternity/aepp-sdk-go/commit/3c1ad87c2b11a8952d4fbbd5cb0122039ba8a9ad)) +* BroadcastTransaction removed - it was only used in the CLI chain broadcast subcommand, and when used for other code, recalculates the hash needlessly. hashing.go hash() renamed to Blake2bHash() ([7bf70e4](https://github.com/aeternity/aepp-sdk-go/commit/7bf70e4fd8c73684927e241505792db2a3a06c07)) +* integration tests use gotest.tools/golden so that compiler tests can easily update values. Support Lima AEVM/FATE option. ([8618d52](https://github.com/aeternity/aepp-sdk-go/commit/8618d5245690d7c19e453601356868b6a094634f)) +* removing golden package that was shared between package cmd and integration_test, because infrastructure was too complex for the benefit it provided. cmd and integration_test will have their own golden contract variables, in separate files. Tests will show if these are out of date for the compiler. ([490e19f](https://github.com/aeternity/aepp-sdk-go/commit/490e19f4f83f024de9e1c3eeaa1d4f3e39884ed0)) +* aeternity.Config.Compiler struct. Introduced configuration consts for several parameters. ([6f08984](https://github.com/aeternity/aepp-sdk-go/commit/6f089841bac7e9787690c438396e56f4fd48aee4)) +* SignBroadcast() is useful enough that it should be a helper, as SignBroadcastTransaction() WaitForTransactionUntilHeight() required wrapping code, but WaitForTransactionForXBlocks() is more useful ([eda4f69](https://github.com/aeternity/aepp-sdk-go/commit/eda4f696b1eb18e26fdaf4cbf4ff90031702aea2)) + +### Feature + +* SignBroadcastWaitTransaction() ([733cde4](https://github.com/aeternity/aepp-sdk-go/commit/733cde4ea9222b0d3b09bca644e24e7c0a06a036)) +* Contract struct supports Lima RLP serialization ([df1249b](https://github.com/aeternity/aepp-sdk-go/commit/df1249bd9860a32073fce8fdc5e53a641cf5d96c)) +* support for compiler v4's FATE/AEVM backend switch ([0c263d3](https://github.com/aeternity/aepp-sdk-go/commit/0c263d3d3bf13c73533bcf8d0045181b3a95909e)) +* compiler 4.0.0-rc1 support ([4cb9265](https://github.com/aeternity/aepp-sdk-go/commit/4cb9265b52f63aefa13c00ece373b5adad6f963b)) + + + +## [v5.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v4.0.1...v5.0.0) (2019-08-13) +### Bug Fixes + +* GAMetaTx.Tx only accepts a *SignedTx, not just any Transaction (interface) ([b5ebe72](https://github.com/aeternity/aepp-sdk-go/commit/b5ebe72b3d3fce6da20fd6449d93dfff2881a007)) +* now that rlpae deserializes big.Int(0) from 0x00 more correctly, the Equal method on the Tx struct is unnecessary ([b622992](https://github.com/aeternity/aepp-sdk-go/commit/b622992c5633fe207520a5420f10d9395814badb)) +* Tx struct JSON() method did not serialize big.Ints properly, so they were always coming out as 0 ([a19900f](https://github.com/aeternity/aepp-sdk-go/commit/a19900fd78b0f0ba1a36f7d072e6c688abf70cde)) +* Config.Client.Contracts.VMVersion updated for node v3 ([de87f33](https://github.com/aeternity/aepp-sdk-go/commit/de87f3342a22707480d39ce4705c3086121b4f8d)) +* working unittest for Contract struct, no need for embedded contract struct, comments ([7bad2d2](https://github.com/aeternity/aepp-sdk-go/commit/7bad2d23403eea4e85b34691c951594ac4fc044b)) +* BroadcastTransaction shouldn't ignore returned errors anymore ([aab5748](https://github.com/aeternity/aepp-sdk-go/commit/aab574811b9235a1be45046f811551f86940df3a)) +* update Sophia contract in integration test ([f893b51](https://github.com/aeternity/aepp-sdk-go/commit/f893b5134e341f44ad3cfb11a03f63e7346e8501)) +* Sophia 3.2 needed changes to the 'should compile' test contract ([ecf96d3](https://github.com/aeternity/aepp-sdk-go/commit/ecf96d316de4a242c8b1604ce2f98cc607b1442b)) +* SpendTx Payload should actually be a bytearray ([361aea5](https://github.com/aeternity/aepp-sdk-go/commit/361aea5409f431ae67f612b4d734844b38c93a8b)) +* BigInt implements the MarshalJSON() interface, fixing JSON serialization of the tx structs ([8d2bcb3](https://github.com/aeternity/aepp-sdk-go/commit/8d2bcb3a87703052fd0c8f4b29d70c9c19172d86)) + +### Chore + +* update go module version to v5 ([e29afb3](https://github.com/aeternity/aepp-sdk-go/commit/e29afb3e995362cf4ad767984a4485eb2de473c0)) +* update README.md for refactored Tx signing ([46c899c](https://github.com/aeternity/aepp-sdk-go/commit/46c899c5d875f534c623aca8bc797a97c331a90a)) +* fix misspelt words ([443fcb5](https://github.com/aeternity/aepp-sdk-go/commit/443fcb534451f4e9cdeed5afd6bf44aa1e541821)) +* cleanup SpendTx code, better name for embedded spendrlp struct ([46be029](https://github.com/aeternity/aepp-sdk-go/commit/46be029512c41bb83f2d611ac2487cad8038db8c)) +* comments for SignedTx struct ([0abf617](https://github.com/aeternity/aepp-sdk-go/commit/0abf61750b573a3277b9136b4a476866726bb062)) +* rename transaction RLP unittests to EncodeRLP ([823f14b](https://github.com/aeternity/aepp-sdk-go/commit/823f14b85b48892183cea9b3768addd6defd0276)) +* update README.md for refactored code ([a9af711](https://github.com/aeternity/aepp-sdk-go/commit/a9af711bff418a843e0e711077c837ca140e61f6)) +* another unittest for GAAttachTx ([de102db](https://github.com/aeternity/aepp-sdk-go/commit/de102db471f28542d72777dfe4df8914708f8d41)) +* move compiler-url option in CLI to root command to be next to --external-api ([b15da47](https://github.com/aeternity/aepp-sdk-go/commit/b15da47d4c8c7b7faff82d2c2bc95c85a9004f60)) +* comment for aeternity.GetHeightAccounter ([1908df4](https://github.com/aeternity/aepp-sdk-go/commit/1908df4a23c2826087c263e7d1fbd2edd2c503c2)) +* Unit tests for most datatypes in CLI inspect subcommand. refactor: break CLI inspect subcommand down so it is unit testable. ([578e69b](https://github.com/aeternity/aepp-sdk-go/commit/578e69b4658c57c55869f25dac5224e2af76494e)) +* use node v3.3.0, compiler v3.2.0 ([abc1ae7](https://github.com/aeternity/aepp-sdk-go/commit/abc1ae7a09529eac1df6fd82675020c30f217750)) +* api.go wrap to 80 chars ([a575059](https://github.com/aeternity/aepp-sdk-go/commit/a575059b3d24bea9c191643bde36ff3eded9ed46)) +* comments for Node{} individual interfaces ([a6f7f54](https://github.com/aeternity/aepp-sdk-go/commit/a6f7f54545b7c4c81b0597f564d3b7bb333eb144)) +* remove var names from aeternity.NodeInterface ([54ac957](https://github.com/aeternity/aepp-sdk-go/commit/54ac957c929d623211a5a3673462f0edff044551)) +* setupNetwork() in integration_test should accept a bool argument for debug ([7d2db5f](https://github.com/aeternity/aepp-sdk-go/commit/7d2db5fb24c63177cb30ae651b912f814f236d16)) +* update README.md with how to use the Node/Context ([593494e](https://github.com/aeternity/aepp-sdk-go/commit/593494e7ad0bd1dd0216172e6910516d2b45dada)) +* spend_test should use WaitForTransactionUntilHeight() to check for transaction parsing issues ([ce86e49](https://github.com/aeternity/aepp-sdk-go/commit/ce86e49d0e51178bdfa3cb60b3e6843753d2b1d4)) +* update tested node version to v3.3.0 ([c66c1ee](https://github.com/aeternity/aepp-sdk-go/commit/c66c1ee328a4799858cfdcf674d336af99c12a02)) + +### Code Refactoring + +* GAAttachTx DecodeRLP support ([e1b8f97](https://github.com/aeternity/aepp-sdk-go/commit/e1b8f973e0877cbc386edde79020e507940bc629)) +* All this refactoring has happened to enable CLI account sign to work in this way ([4f39e9c](https://github.com/aeternity/aepp-sdk-go/commit/4f39e9c1245fffd16a906c67032697e3ccec1a44)) +* SignedTx deserialization possible + unittest ([56ed4ac](https://github.com/aeternity/aepp-sdk-go/commit/56ed4ac2b28a7c5b814ae52b902c9cc813db0748)) +* Contract Txs implement DecodeRLP() ([9b0c0dd](https://github.com/aeternity/aepp-sdk-go/commit/9b0c0dd73412a752a1f5df57ca33e06512fa2242)) +* Oracle Txs implement DecodeRLP() ([01fc623](https://github.com/aeternity/aepp-sdk-go/commit/01fc623a3831ad254b9ef9ca6311a532f90a92fb)) +* DecodeRLP for NameTransferTx, ReadRLP() methods that simplify error handling when ID Tag reading introduced. Consistency everywhere within tx_aens.go, tx_aens_test.go. TODO: POST JSON to debug endpoints within Tx unittests ([21fbb64](https://github.com/aeternity/aepp-sdk-go/commit/21fbb64f1856c2f4d97cd1947951487b77f40e8c)) +* AENS Tx structs except NameUpdateTx have DecodeRLP() ([3359273](https://github.com/aeternity/aepp-sdk-go/commit/33592730f44e1b995e232fb5a2bedc8c1b8a0a17)) +* TransactionTypes hashmap between ObjectTag identifiers and Tx structs; DeserializeTx(), GetTransactionType(), Transaction interface ([6d720ca](https://github.com/aeternity/aepp-sdk-go/commit/6d720ca62bca0af6968b60f3a5c0faf230cd451e)) +* break out Tx structs into their own files ([1b08e52](https://github.com/aeternity/aepp-sdk-go/commit/1b08e524303ad1dc382b617c21110a0d62eb8cd2)) +* SpendTx struct deserialization ([b5c3812](https://github.com/aeternity/aepp-sdk-go/commit/b5c381299ec84b272362afeea9acd056e9c85f5e)) +* readIDTag() introduced ([ca758c9](https://github.com/aeternity/aepp-sdk-go/commit/ca758c939861936e7cd2847e23d5f55cf5c529fc)) +* remove old transaction signing code in favour of the SignedTx struct ([f84f224](https://github.com/aeternity/aepp-sdk-go/commit/f84f2243eaa681aa78b9daed1cc5776dfd9a83d9)) +* change transaction signing to use the SignedTx{} struct ([6e4e2f5](https://github.com/aeternity/aepp-sdk-go/commit/6e4e2f581e90bb2b01fd56c9287b4e5bf6a71bfa)) +* initial SignedTx{} struct ([9848314](https://github.com/aeternity/aepp-sdk-go/commit/984831473df6f9011aaacc771871fdad2241de26)) +* comments for GA Integration test (not working) ([d80cba6](https://github.com/aeternity/aepp-sdk-go/commit/d80cba66dde0f33010bc3a8f30f96d027f616780)) +* simplified GA integration test contract ([f976269](https://github.com/aeternity/aepp-sdk-go/commit/f976269f11bdf987bb438610363d74aa1a084b77)) +* Tx structs implement rlp.Encoder interface instead of custom RLP() method ([b0289e0](https://github.com/aeternity/aepp-sdk-go/commit/b0289e0f86c61bb11a13072280b0874ae3925c43)) +* rename BaseEncodeTx() to SerializeTx() ([c872a19](https://github.com/aeternity/aepp-sdk-go/commit/c872a1954299190139ba56d0883de3df082e9358)) +* aeternity.NewContextFromURL(url, address) is introduced. Because it creates Helpers within itself, it hinders mocking and thus is not suited for use within the SDK. SDK level code should create the aeternity.Context{} struct directly without a constructor. As SDK code constructs the Context{} struct directly, it is now independent from the interface that it presents to the SDK using code (NewContextFromURL) ([58dc332](https://github.com/aeternity/aepp-sdk-go/commit/58dc332c0cba5d6382197f18e2db7f10f9ce11f7)) +* api_test no need for a new Context for AENS, Oracle, and Spend type transactions! ([801e206](https://github.com/aeternity/aepp-sdk-go/commit/801e20617a4dae1e6caa758ea10bc9e30a2c11b4)) +* integration tests use Helper{} struct instead of passing the node client directly to Context{} ([0f03064](https://github.com/aeternity/aepp-sdk-go/commit/0f03064c839746fde26c248b2ebe7498fd20afc5)) +* tx spend/contract subcommand unittests should rely on HelperInterface, not API Interfaces. Also, fixed tx spend issue where it was printing what you wanted, instead of the actual tx's parameters ([a4faff0](https://github.com/aeternity/aepp-sdk-go/commit/a4faff0f46a65e461cfaa11a52be917ac9a9a8b6)) +* removing Node from Context. Context helper methods only depend on the Helpers. This makes testing much easier (for the CLI mocks) ([b31e6b8](https://github.com/aeternity/aepp-sdk-go/commit/b31e6b803a05ce459bc0107fc901afaf79ecf317)) +* split out helper functions into 'Helpers' struct ([6de6315](https://github.com/aeternity/aepp-sdk-go/commit/6de63159a8e043d4c8a95ed09b4ef71ae32a9d3e)) +* move CLI unittest mock structs to one file for manageability ([411d668](https://github.com/aeternity/aepp-sdk-go/commit/411d668852c44611404aec756d62f13d74a0061a)) +* helpers GetTTL(), GetNextNonce(), GetTTLNonce() are now vars so you can mock them out with other anonymous functions ([2a3cbd0](https://github.com/aeternity/aepp-sdk-go/commit/2a3cbd0662782c83f7c6ffd9785991100d62cb5c)) +* CLI tx contract deploy unittest does not depend on network connection ([f7c38f6](https://github.com/aeternity/aepp-sdk-go/commit/f7c38f66e6a1fe9ebd7ac55505362eddc650af4a)) +* CLI contract subcommand unittests now offline/online ([1852973](https://github.com/aeternity/aepp-sdk-go/commit/185297371fde2678e5c59162efba44226d0745c1)) +* package cmd move test helper functions into separate test_utils.go ([317367d](https://github.com/aeternity/aepp-sdk-go/commit/317367d457b53eb4375e5697050852f1a6d5ca61)) +* compiler.go interfaces for each method ([bd6fcc2](https://github.com/aeternity/aepp-sdk-go/commit/bd6fcc25f8923e2ea210366cfb2398ac4a380924)) +* CLI tx spend unittest no longer needs a network connection ([e36bc54](https://github.com/aeternity/aepp-sdk-go/commit/e36bc548c1a7242f3b02a8d7e380bd1dd21919ab)) +* CLI account unittests do not need network anymore ([9049f6c](https://github.com/aeternity/aepp-sdk-go/commit/9049f6ce089f7bd7d6a751c602c083f69cea20c8)) +* New pattern in chain, chain_test.go: online/offline tests update comment because newAeNode() and newCompiler() are no longer vars ([e8d589b](https://github.com/aeternity/aepp-sdk-go/commit/e8d589bae8772032148aa2422c8f066945485459)) +* interfaces on every method of the Node{} struct make it possible to granularly mock it out in cmd ([371eeb4](https://github.com/aeternity/aepp-sdk-go/commit/371eeb4c58cf0dc1bc4132fa4554062a1ebfca74)) +* moved terminal.go from aeternity/ to cmd/, getErrorReason() was only used by api.go so moved there instead ([c769bc0](https://github.com/aeternity/aepp-sdk-go/commit/c769bc0e7534af47865df132f2a5cd19af4bc4c3)) + +### Feature + +* GAMetaTx works, integration test checks with a SpendTx GAMetaTx.EncodeRLP(): serialize the wrapped SignedTx into a plain bytearray before including it in the RLP GAMetaTx.GaID: this should be an AccountID ([45007df](https://github.com/aeternity/aepp-sdk-go/commit/45007df57de3dd3609985d2285a14e286742192d)) +* SignHashTx() detects if it is a GAMetaTx and if so makes the SignedTx with no signatures instead ([a384743](https://github.com/aeternity/aepp-sdk-go/commit/a384743f1932da66c7246276340c8b51ae91f7f0)) +* GAMetaTx DecodeRLP() support (untested). NewGAMetaTx() now wraps the Tx in an empty SignedTx for you ([1c18110](https://github.com/aeternity/aepp-sdk-go/commit/1c181100c1d3c923fda1143fe1bf65d6aecef786)) +* NamePreclaimTx DecodeRLP() and unittest ([c4dfeba](https://github.com/aeternity/aepp-sdk-go/commit/c4dfeba6bd031941b2a6860a441a8d5a060d313a)) +* GAMetaTx initial struct ([43cef35](https://github.com/aeternity/aepp-sdk-go/commit/43cef3577ceb828aae09ed1663cb5e1e1c755206)) +* oracle integration test is now idempotent ([a613619](https://github.com/aeternity/aepp-sdk-go/commit/a6136198ff2b6a55ee0d6dff40703969ade47926)) +* integration test funding function to make tests idempotent ([c1f99d8](https://github.com/aeternity/aepp-sdk-go/commit/c1f99d89d855cdf3d3b99472bd783b602edf4f6a)) +* initial Generalized Accounts integration test ([bd30589](https://github.com/aeternity/aepp-sdk-go/commit/bd305891cbf049b24640faf0bdce05aec440d5ce)) +* GAAttachTx with working RLP serialization ([2cd3552](https://github.com/aeternity/aepp-sdk-go/commit/2cd355291d13369649ca616e13c6deb4f4f05883)) +* Contract struct parses cb_ contracts and gives relevant details ([52f8332](https://github.com/aeternity/aepp-sdk-go/commit/52f83322e71c246c825d43bb188bf550bfc2813e)) +* preliminary GAAttachTx ([6da7312](https://github.com/aeternity/aepp-sdk-go/commit/6da73124a0d9ff65af8c07c4c201a003c61f4547)) +* NewContextFromURL() accepts a debug parameter ([23b62a1](https://github.com/aeternity/aepp-sdk-go/commit/23b62a18da8b1dfe64b5eb1b5a86c8b31393aeec)) +* Helper{} functions to lookup Accounts, Oracles, Contracts, Channels with AENS ([b00ea77](https://github.com/aeternity/aepp-sdk-go/commit/b00ea772b2918c0f497bc359fc07a1b667cd870b)) +* CLI AENS lookup ([d9d5eaf](https://github.com/aeternity/aepp-sdk-go/commit/d9d5eaf6991696df824380fdeb1cf701398d4c75)) +* helper function to look up a Name's account_pubkey Pointer ([680f502](https://github.com/aeternity/aepp-sdk-go/commit/680f5029bd9db5f34f6cb0d06b70038c7c1d4e5a)) +* CLI contract generateaci command with unittest. Output format could be improved ([70ba5f4](https://github.com/aeternity/aepp-sdk-go/commit/70ba5f4f1881d19b4bc11ff278bb6cdd5921299e)) +* NewSpendTx() ensures only valid UTF-8 is used as the SpendTx payload ([41fb8d4](https://github.com/aeternity/aepp-sdk-go/commit/41fb8d44dd400d1115ede7312f781d8bb4cbcf04)) +* Context.SpendTx helper, NewContext() constructor ([0275d3c](https://github.com/aeternity/aepp-sdk-go/commit/0275d3ca63a30bd0d87df0a510534d03f8c809df)) + + + +## [v4.0.1](https://github.com/aeternity/aepp-sdk-go/compare/v4.0.0...v4.0.1) (2019-07-05) + +### Bug Fixes + +* **version:** update the module with semantic import versioning ([1d5621c](https://github.com/aeternity/aepp-sdk-go/commit/1d5621c89faf8a129fcdbef6b865a14de644dca0)) + + + +## [v4.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v3.0.0...v4.0.0) (2019-07-03) + +### Bug Fixes + +* renamed swagguard tests to differentiate between node and compiler swagger code ([5793b1f](https://github.com/aeternity/aepp-sdk-go/commit/5793b1f74b36bbe756a4f98e67e65a7226e71c1c)) +* NameRevoke doesn't need an Address ([799bb71](https://github.com/aeternity/aepp-sdk-go/commit/799bb710076f0eacb2471e31e029647045c8b94e)) +* CLI chain top was crashing when printing time because node v3.0.1 defines time now as Uint64, not int64 ([23cf1c0](https://github.com/aeternity/aepp-sdk-go/commit/23cf1c0aefbd517041e08e8153b62159eac75047)) +* contracts, oracle integration tests did not get their model types updated ([5710128](https://github.com/aeternity/aepp-sdk-go/commit/5710128137a03f36eb74d288bd2d79c97034a695)) + +### Chore + +* proper comments for Compiler endpoints ([5c1a91e](https://github.com/aeternity/aepp-sdk-go/commit/5c1a91e3bac8fef9ee7b09753fc80ccbf2ae5152)) +* CLI contract subcommand tests for encodeCalldata, compile ([5955bc4](https://github.com/aeternity/aepp-sdk-go/commit/5955bc467262578719bda27161252f8511599507)) +* Golang - unlike %#v, %+v doesn't print integers in hex ([11f8af3](https://github.com/aeternity/aepp-sdk-go/commit/11f8af3fcf50ae7e77f1724bc262a2ccbcd71be9)) +* Client{} method unittests against testnet WIP ([95b57d6](https://github.com/aeternity/aepp-sdk-go/commit/95b57d68af0bc1ce73bd248eb948faed5c7fafbc)) + +### Code Refactoring + +* break logic/network part of some chain subcommands out, so that the network can be mocked out ([d4be4d6](https://github.com/aeternity/aepp-sdk-go/commit/d4be4d627b7de023232ddf06bbfa7c50d12622b5)) +* many helper structs were redundant. Now they are all reduced down to Context{}, which stores only a Node connection and Address on which to query the nonce. Signing is to be done totally separately, the helpers only create unsigned txs ([62a7590](https://github.com/aeternity/aepp-sdk-go/commit/62a75908a62d5173409e8cb30960cf09ad1b39e9)) +* Client{} helper struct renamed to Node. So, Node is a connection to a node. Compiler is a connection to a compiler. ([568853e](https://github.com/aeternity/aepp-sdk-go/commit/568853efb092cc3b6de6aca7c6327ac5e1cde376)) +* Contract{} helper struct does not need to know the Account. It just needs a ak_ public key. In fact many helper structs should be refactored this way in the future. ([1a4cb39](https://github.com/aeternity/aepp-sdk-go/commit/1a4cb39c3a47b6b7670a72ad0a1c43dfcff4b0cf)) +* move node swagger generated code into swagguard/node ([2e644fd](https://github.com/aeternity/aepp-sdk-go/commit/2e644fdaceb82971dc6bf8d114a3fcb188c533c2)) +* Client API tests moved to integrationtest package, tested node version bumped to v3.1.0 ([428343e](https://github.com/aeternity/aepp-sdk-go/commit/428343ea4be8975e8283d44623da79f7656879cd)) +* EncodedHash, EncodedPubkey, EncodedValue, EncodedByteArray -> string ([0d365f8](https://github.com/aeternity/aepp-sdk-go/commit/0d365f8141ec8f507e8650c2e3634952eacf40ed)) +* UInt16, UInt32, UInt64 -> type: integer, format: uint* ([6d3bd5c](https://github.com/aeternity/aepp-sdk-go/commit/6d3bd5cfa0b9d8dc3de379c444ab5624af3b7f02)) +* urlComponents() does not belong in helpers. It is a function used only once in node.go Comments for Contract* structs and constructors ([7e4286e](https://github.com/aeternity/aepp-sdk-go/commit/7e4286e24a00ee001280d6bb5a2d992569a798b2)) +* API refactoring to use more interfaces and be unit testable Client{} is now a struct that has methods that correspond directly to the node's endpoints helpers.go helper functions that implement useful business logic like GetTTLNonce, WaitForTransactionUntilHeight, BroadcastTransaction etc. now take an interface instead of being attached to Client{}, making them testable. Unittest for WaitForTransactionUntilHeight() AENS/Contract/Oracle helpers stay as they are. Not much testing needed there since they only use GetTTLNonce. ([25ef16e](https://github.com/aeternity/aepp-sdk-go/commit/25ef16e415a564abd0d152c5736643602bc28067)) +* Client{} API* methods renamed to not have an API prefix. See Dave Cheney's advice on naming ([6610ae8](https://github.com/aeternity/aepp-sdk-go/commit/6610ae8a403561177b6560e3d4a9cf63bbc8916e)) + +### Feature + +* CLI contract decodeCalldata subcommand, tx deploy subcommand and integrationtest (fails because alice does not exist on mainnet) refactor: argument validation moved into IsAddress(), IsBytecode(), IsTransaction() ([fe8c046](https://github.com/aeternity/aepp-sdk-go/commit/fe8c04666c76121811f7dcb25b21d6ca06ed2d0b)) +* CLI contract encode(Calldata) subcommand ([b6f00e1](https://github.com/aeternity/aepp-sdk-go/commit/b6f00e1bc2ddc66b4f7a90c338fc786d2ef6335e)) +* CLI contract compile subcommand with --compiler-url option ([ae0891b](https://github.com/aeternity/aepp-sdk-go/commit/ae0891b501b741bc8ec8f2278e9760c62581fcc7)) +* preliminary support for compiler's HTTP endpoints. Contract{} helper struct gets a *Compiler attribute ([0bdf629](https://github.com/aeternity/aepp-sdk-go/commit/0bdf629835d468406eabf5ad835b32479b04ce2b)) +* compiler v3.1.0 swagger spec and generated code ([e98eb32](https://github.com/aeternity/aepp-sdk-go/commit/e98eb323ef41bfa1a6018e855c7b314de7c39ebd)) + +### Rlp + +* use own fork of go-ethereum rlp. Remove rlp/ from aepp-sdk-go repo. ([96ddd4a](https://github.com/aeternity/aepp-sdk-go/commit/96ddd4a7f5108a1256a9bd624e3694ade2e1ea9f)) + + + +## [v3.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v2.2.0...v3.0.0) (2019-06-06) + +### Bug Fixes + +* Error.Reason dereferencing and generic_tx deserialization ([9988115](https://github.com/aeternity/aepp-sdk-go/commit/99881157b59af5bf9fb175a8373975d2c071795a)) +* tx verify unittest was failing ([6dccb3c](https://github.com/aeternity/aepp-sdk-go/commit/6dccb3c0b914e765bc7bf913145cd582986c3b2f)) +* FeeEstimate should be less brittle by not looking for a specific value ([ff7e74f](https://github.com/aeternity/aepp-sdk-go/commit/ff7e74ff2fe05843c111749d46a562d6e886021e)) +* oracle integration test was brittle when it queried the node too quickly for OracleRespondTx stage ([90ed1a2](https://github.com/aeternity/aepp-sdk-go/commit/90ed1a24a4ff41fa5c2b7663e512d76aeeb99683)) +* forgot to update OracleRegisterTx ABIVersion in a unittest ([1079858](https://github.com/aeternity/aepp-sdk-go/commit/1079858b11563f823a79ee423857f70e5859f9ed)) +* oracle integration test could be brittle because it didn't wait after the OracleRegisterTx to query the node by oraclepubkey ([77c4e20](https://github.com/aeternity/aepp-sdk-go/commit/77c4e2099477627b97e635aa34e2ddd4e8d345d5)) + +### Chore + +* big.Int constructor rename NewBigIntFromString -> NewIntFromString RequireBigIntFromString -> RequireIntFromString NewBigIntFromUint64 -> NewIntFromUint64 ([0846805](https://github.com/aeternity/aepp-sdk-go/commit/08468055e751f5bb25b418e9e1d7c60bb66fc54e)) +* BigInt's own Cmp() simplifies code in LargerThanComparisons() ([5c356e4](https://github.com/aeternity/aepp-sdk-go/commit/5c356e420d8f096d193b342c74c1a0604a7c0b5a)) +* cleanup utils, cmd was the only package using it ([21f6e2f](https://github.com/aeternity/aepp-sdk-go/commit/21f6e2fdfcfd3133c0faefa46d38a761bb96b8ad)) +* better comment for UnmarshalJSON ([2d86bb3](https://github.com/aeternity/aepp-sdk-go/commit/2d86bb3d197563523005631bcf1c768d146a39e1)) +* better names for 'utils' ([c4186c2](https://github.com/aeternity/aepp-sdk-go/commit/c4186c29ccff960776dcb9b49a928df8999d8cb1)) + +### Code Refactoring + +* BigInt newtype has a working Set(), allowing UnmarshalJSON() to work properly ([6ef4866](https://github.com/aeternity/aepp-sdk-go/commit/6ef4866fe38ac79a808f51af0577777b70ea7617)) +* terminal printIf() recognizes big.Int and prints accordingly ([54fce99](https://github.com/aeternity/aepp-sdk-go/commit/54fce99c83fa7356c0f12ad920e7b5e88a2b0643)) +* transaction structs now cast to utils.BigInt whenever necessary ([df11145](https://github.com/aeternity/aepp-sdk-go/commit/df11145bcc0475aae03c1fba913eb79357e371d9)) +* utils.BigInt is now just a type aliased big.Int ([62768a9](https://github.com/aeternity/aepp-sdk-go/commit/62768a90908ff5f8faab6caafd2e855e6bcd316b)) +* integration tests cleaned up with closures and test setup functions. More robust because it waits longer in delayableCode ([b3dc468](https://github.com/aeternity/aepp-sdk-go/commit/b3dc468597ed1a5b01b083c9bd8f8bb2fa37fe5f)) +* setupNetwork(), setupAccounts(), usage of t.Log(), go-ish variable naming. Includes Spend Transaction Integration Test ([f8951c1](https://github.com/aeternity/aepp-sdk-go/commit/f8951c190aa32b33b0094977e56c9906981ff65f)) +* BigInt LargerThanZero functions return a bool, not an error ([454d0a7](https://github.com/aeternity/aepp-sdk-go/commit/454d0a78248fcfefdb641a3ca7ade077aa466e4b)) + +### Feature + +* update .env for v3.0.1 integration test docker image ([1c0ffdc](https://github.com/aeternity/aepp-sdk-go/commit/1c0ffdc21fd9397a63bdda214bc27cb99d70b7cc)) +* tx structs, unittests, helpers, config, api updated to support v3.0.1 types ([e90ecfc](https://github.com/aeternity/aepp-sdk-go/commit/e90ecfc369588fb4b85d55c2a566f14f3fe9c83f)) +* go-swagger v3.0.1 generated code ([63844f9](https://github.com/aeternity/aepp-sdk-go/commit/63844f9d11bc4563f63ce908d920855b6505a9c8)) +* aeternity node v3.0.1 swagger.json ([2bd3ca0](https://github.com/aeternity/aepp-sdk-go/commit/2bd3ca0fb2d2277aa1d7403899923e862b5ad7c8)) + + + +## [v2.2.0](https://github.com/aeternity/aepp-sdk-go/compare/v2.1.0...v2.2.0) (2019-05-27) + +### Bug Fixes + +* tx verify was using blank env variable as a default instead of the built in default. TX verification works now ([2106cae](https://github.com/aeternity/aepp-sdk-go/commit/2106cae5e0ff76dbf110b449b8be0dff553eb9da)) +* cmd: tx spend queries node for Nonce if not specified. also accepts text payload ([b2879fb](https://github.com/aeternity/aepp-sdk-go/commit/b2879fbfedc46f66be8363dc196b45bdc8dab163)) +* CLI --json flag now works ([911392d](https://github.com/aeternity/aepp-sdk-go/commit/911392d70ee931cc3b073afad09373df41e49455)) +* terminal pretty printer also prints BigInt's value/amount ([3f239a1](https://github.com/aeternity/aepp-sdk-go/commit/3f239a15c6e6fbb3f2625d254e82938da86cb6bc)) +* calcFeeContract wasn't paying attention to the base gas multiplier ([934ef00](https://github.com/aeternity/aepp-sdk-go/commit/934ef0003865ecdf6e54116d7347c4fd051133b6)) +* swagger.json get_generation_by_height should be uint64 (manual fix) ([a5b5a87](https://github.com/aeternity/aepp-sdk-go/commit/a5b5a87107a60f987b6bd107802369a208cedcb0)) +* make no_implicit_int64() filter print out what it did ([efdb963](https://github.com/aeternity/aepp-sdk-go/commit/efdb9631b4fd7958b76049ddd61b9141728913f4)) +* generated.models.Error is patched to satisfy the Error interface. This dereferences the error.Reason pointer if the models.Error is passed as a pointer ([5806eb9](https://github.com/aeternity/aepp-sdk-go/commit/5806eb946db865050ff4c2d7eb25a4ce117149b3)) +* unittest for GenericTx deserialization ([d293f30](https://github.com/aeternity/aepp-sdk-go/commit/d293f30b720b1ba7cf3605eda9e28a7f02f0c156)) +* GenericTx was not deserializing properly into go-swagger models. generated code was not parsing node responses that involved GenericTx. First fixed in 2cccbeaefd49e8a037af5b4b2029d697477e683b but resurfaced after regenerating from new swagger.json make go-swagger generated *Tx models return SpendTx, not SpendTxJSON closes [#54](https://github.com/aeternity/aepp-sdk-go/issues/54) ([4716a8e](https://github.com/aeternity/aepp-sdk-go/commit/4716a8e64ce030e04eeddf1ff7120cda1bc8b18e)) +* canonical NameUpdateTx RLP serialization seems to want NamePointers in the reverse order than specified in the JSON. ([f2bc093](https://github.com/aeternity/aepp-sdk-go/commit/f2bc09355f2549d2176a809827594e4c9e25a17d)) + +### Chore + +* break integration tests up, make AENS test use random names ([571c9c2](https://github.com/aeternity/aepp-sdk-go/commit/571c9c22dd67a47a23d1c7f9035b4cd38e75ad4c)) +* Transactions tests should test with fixed values and Config Defaults ([3686578](https://github.com/aeternity/aepp-sdk-go/commit/3686578d83b8f5f2633b32fb1ce6b7dc8923d1f9)) +* AENS integration test now includes NameTransfer, NameRevoke ([7f1c37b](https://github.com/aeternity/aepp-sdk-go/commit/7f1c37bddaf5c32c0c86d3852181b9dd3d4a7bab)) +* NameUpdateTx unittest with 4 pointers, just in case ordering issues pop up ([14fa242](https://github.com/aeternity/aepp-sdk-go/commit/14fa242621d13df530fb6d76dc8d35f692b7e7c2)) +* another python tool to quickly edit _tx_json.go files ([2794c74](https://github.com/aeternity/aepp-sdk-go/commit/2794c74e9be57e91b66d50611483b6928c33f668)) +* improved tools to rewrite swagger.json ([ed9e6bd](https://github.com/aeternity/aepp-sdk-go/commit/ed9e6bd2f607ccd5d49233952ae7ead2513cf62f)) +* standardize field names across transactions ([07aa8a7](https://github.com/aeternity/aepp-sdk-go/commit/07aa8a77e5cc0ebe4cf6c6f5b97d9d3dd64f9807)) +* cleanup - comments and casing ([3169ca7](https://github.com/aeternity/aepp-sdk-go/commit/3169ca74c2dae188ef8fc9d76b7a3b9cbc89e02f)) +* Oracle Integration Test, OracleRegister, OracleExtend ([df5bef7](https://github.com/aeternity/aepp-sdk-go/commit/df5bef7610682bf85489f97664398a30d5c34e5f)) +* small unittest to test that generated models.Error has its Reason automatically dereferenced when printing it ([1f0df4d](https://github.com/aeternity/aepp-sdk-go/commit/1f0df4d2147afca366f072a9f868ec5eff4d7e42)) +* cleanup obsolete code ([ef86705](https://github.com/aeternity/aepp-sdk-go/commit/ef86705d78fc50fe62c8fe9d3d0e216b9ceade81)) +* AENS integration test generalize to name as a variable, do not use stdin n as prompt to continue. use aeternity helpers instead ([cb5e252](https://github.com/aeternity/aepp-sdk-go/commit/cb5e252780a83bed052b897e833a221566695705)) +* AENS workflow integration test ([db9ad5c](https://github.com/aeternity/aepp-sdk-go/commit/db9ad5c216eff1bdbcbc8ab3069c342fb12a8414)) +* test genesis account is now richer in private testnet for integration tests ([897e78b](https://github.com/aeternity/aepp-sdk-go/commit/897e78bfe2b4b98f6e843c68fb7676575f2248a2)) + +### Code Refactoring + +* separate AENS/Oracle/Contract helpers from aeternity node HTTP client. Also renamed them. Now, 1 helper = 1 account, and they can share the same http client instance ([2174b08](https://github.com/aeternity/aepp-sdk-go/commit/2174b089756a0956a23bb1cbfa44b9784c614a70)) +* renaming to prepare for Client/Helper change ([ac47d04](https://github.com/aeternity/aepp-sdk-go/commit/ac47d04d5cc5ba687dfece6c8a5e8ee298f4d4ab)) +* no need for SpendTxnormal vs SpendTxLarge anymore ([0fe777e](https://github.com/aeternity/aepp-sdk-go/commit/0fe777e1ee30ad8a33dfc658133c612772af7221)) +* ContractConfig - Amount added, Gas/GasPrice as BigInt ([3ab86f5](https://github.com/aeternity/aepp-sdk-go/commit/3ab86f538cc78db2849bfdc25a569fa97353fc00)) +* Contract transactions now use utils.BigInt for Gas ([61df44d](https://github.com/aeternity/aepp-sdk-go/commit/61df44d91a2bb08f1dcf29206eb8fed1101db1d5)) +* Gas, GasPrice now in utils.BigInt instead of uint64. updatedict.py changed to do this too. edit.py no longer used, dropping. ([bd5e5a6](https://github.com/aeternity/aepp-sdk-go/commit/bd5e5a654f85d3ebb1c5192b6a09e3e66860578d)) +* fee estimation ([b6f1054](https://github.com/aeternity/aepp-sdk-go/commit/b6f10545f58ee65b75bc455bcd9056575a9ed9a2)) +* rename TxTTL, TxFee back to Fee, TTL so that all Txs have a standard name. This might be useful for interfaces later ([1aa0418](https://github.com/aeternity/aepp-sdk-go/commit/1aa0418725161440d9a7037cc4225b85054fed5b)) +* Config includes BaseGas, GasPerByte, GasPrice for all Transaction types, not just Oracle/Contract ([890267e](https://github.com/aeternity/aepp-sdk-go/commit/890267e588d5a07fe8aebaf080c388b2312c40c0)) +* Tx interface does not include JSON() method. This was more trouble than it was worth ([5d59dca](https://github.com/aeternity/aepp-sdk-go/commit/5d59dcac7de1ace14845482cd96ccafb8136be8e)) +* NamePointer struct now embeds models.NamePointer. This gives automatic JSON serialization ([4729a9e](https://github.com/aeternity/aepp-sdk-go/commit/4729a9ed93d4e93a971d63aa50a804c3354285b7)) +* NamePointer is now a struct of its own ([a2de13a](https://github.com/aeternity/aepp-sdk-go/commit/a2de13a3c17636bb1c8b7f9772094587053c4fce)) + +### Docs + +* TODO consider refactoring WaitForTransactionUntilHeight ([03af1ab](https://github.com/aeternity/aepp-sdk-go/commit/03af1aba6b648d8c9aeb5d6cbcc8c41173484ca9)) +* added comment for NamePointer.EncodeRLP() ([0788935](https://github.com/aeternity/aepp-sdk-go/commit/07889351d723e4c48fc3b01497312b5f8a7b25f7)) +* add minor comments on exported functions ([df01f3e](https://github.com/aeternity/aepp-sdk-go/commit/df01f3ec24f1d49204177eb36be21ed5228c007a)) + +### Feature + +* Fee estimation for SpendTx, AENS Txs, and Contract Txs ([225da65](https://github.com/aeternity/aepp-sdk-go/commit/225da659eb1441f8e384c91f46027f1b1fe7577d)) + +### Features + +* helpers for Contract transactions ([92a1ed8](https://github.com/aeternity/aepp-sdk-go/commit/92a1ed8da4d4a2198a1c8461b33f6ee23a21480f)) +* prototype Contract Integration Test ([07cb5df](https://github.com/aeternity/aepp-sdk-go/commit/07cb5dfd88868104ad86ff37ec7f74b90047adf7)) +* Contract Call Tx works ([ac88116](https://github.com/aeternity/aepp-sdk-go/commit/ac88116c47063d78296541ec8e7ff3c7205cd491)) +* APIGetContractByID (needed for integration test) ([1bf0497](https://github.com/aeternity/aepp-sdk-go/commit/1bf049775494ccb16bfad51bbc15718a6c864b90)) +* Contract ID attached to ContractCreateTx struct, encodeVMABI function and unittests, ContractCreateTx unittests test common VM/ABI combinations ([9bf402a](https://github.com/aeternity/aepp-sdk-go/commit/9bf402a97a973195bceced0d0f74326291921df5)) +* calculate contract ID ([a072966](https://github.com/aeternity/aepp-sdk-go/commit/a072966de3c1d8187c55781036d33f9ea87694b8)) +* Fee Estimation for SpendTx, Name*Tx ([8cff1a8](https://github.com/aeternity/aepp-sdk-go/commit/8cff1a81ef77d5b7fe34175b12d7306c7dfaa2b9)) +* ContractCallTx, not working yet ([bb74df6](https://github.com/aeternity/aepp-sdk-go/commit/bb74df6c163a9f6a96cf01122cceef2e3b18ff1d)) +* ContractCreateTx works ([74ac97a](https://github.com/aeternity/aepp-sdk-go/commit/74ac97ad7d73b0674b5158a3a92b9705245e722d)) +* add the aesophia compiler image to the docker-compose ([d58baa2](https://github.com/aeternity/aepp-sdk-go/commit/d58baa20699c5ca344c54a120556def7fdc7e652)) +* generated code for v2.4.0 swagger.json ([6e79cf2](https://github.com/aeternity/aepp-sdk-go/commit/6e79cf2a4d77c57ec593cad68be51d1c250480f2)) +* support aeternity v2.4.0 node ([5b0f04f](https://github.com/aeternity/aepp-sdk-go/commit/5b0f04fc294932965ac23b2c8c5285054e9b421e)) +* helper functions for NameTransferTx, NameRevokeTx ([4f5ba90](https://github.com/aeternity/aepp-sdk-go/commit/4f5ba90c95fc483145cc829f33a6935b97a006e2)) +* NameRevokeTx, NameTransferTx and their unittests ([1c9eb4e](https://github.com/aeternity/aepp-sdk-go/commit/1c9eb4e46f557842824cd31df14b7f224aa70c07)) +* OracleRespondTx integration test ([aa9a742](https://github.com/aeternity/aepp-sdk-go/commit/aa9a7424240699208cf7507449f2a6c355756395)) +* OracleRespondTx struct, RLP() and JSON() serialization and unittests ([4fd8171](https://github.com/aeternity/aepp-sdk-go/commit/4fd8171b2a368e8fbd5e43529f74d1cc3933c87c)) +* OracleRespondTx prerequisites: APIGetOracleQueriesByPubkey(), buildOracleQueryID(), leftPadByteSlice() and unittests ([db05b75](https://github.com/aeternity/aepp-sdk-go/commit/db05b75cfaac52402cee55979d090bb721272390)) +* OracleQueryTx works. Unittest reference value taken from node, not JS SDK. Integration test updated. ([24f5f87](https://github.com/aeternity/aepp-sdk-go/commit/24f5f874852b5a6b6fb531bd7c8b0c102f492ece)) +* Oracle helper functions for OracleRegisterTx, OracleExtendTx ([0964c8c](https://github.com/aeternity/aepp-sdk-go/commit/0964c8cc0a1801f83a9befada0c618e785d97965)) +* account address will ask for confirmation before printing private key ([5de88b5](https://github.com/aeternity/aepp-sdk-go/commit/5de88b5425309aab6eae8d6cee03efacbb346476)) +* vanity account search takes regular expressions that can match anywhere ([e119c1d](https://github.com/aeternity/aepp-sdk-go/commit/e119c1d51baad95ca198abd7617e27f964e68b3a)) +* AENS integration test now tests NamePreclaim, NameClaim, NameUpdate for simple ak_ type pointers ([d675cf2](https://github.com/aeternity/aepp-sdk-go/commit/d675cf2b12380e816409e1c132c575a3775283ba)) + +### Test + +* Contracts Integration Test, working ([309363d](https://github.com/aeternity/aepp-sdk-go/commit/309363d5f6bd2f574bfa02e72e77dc7890b67385)) +* TestContractCallTx_FeeEstimate makes sure that the fee estimate is working properly ([d750d14](https://github.com/aeternity/aepp-sdk-go/commit/d750d14a47981bdbedf9ed82ca3fa9c05620c3e3)) + + + +## [v2.1.0](https://github.com/aeternity/aepp-sdk-go/compare/v2.0.0...v2.1.0) (2019-04-26) ### Bug Fixes -* Ae.WithAccount() was not copying the Account object to the Oracle struct ([ef9eab6](https://github.com/aeternity/aepp-sdk-go/commit/ef9eab6)) -* Aens.NameClaimTx helper should pass the plaintext name down to the actual function ([c976216](https://github.com/aeternity/aepp-sdk-go/commit/c976216)) -* AENS.UpdateFee specified, made into a BigInt ([de42965](https://github.com/aeternity/aepp-sdk-go/commit/de42965)) -* disabled OracleQueryTx, aepp-sdk-js reference RLP serialization is more reliable than aepp-sdk-python atm ([88e7ac4](https://github.com/aeternity/aepp-sdk-go/commit/88e7ac4)) -* integration test now works with BigInt's pointer receivers ([d373565](https://github.com/aeternity/aepp-sdk-go/commit/d373565)) -* integration test was broken after BigInt.Int was changed from copy-by-value to pointer, because swagger did not know it had to initialize BigInt.Int when creating a BigInt. Fixed. ([b9dd2f3](https://github.com/aeternity/aepp-sdk-go/commit/b9dd2f3)) -* NameClaimTx correct serialization in JSON and RLP formats ([0e6799d](https://github.com/aeternity/aepp-sdk-go/commit/0e6799d)) -* NameClaimTx salt 256bit bytearray was being converted to uint64 and back, which mangles the bytes. Solved by making it a BigInt, which has proper 32 byte big endian representation with Bytes() ([45ff92d](https://github.com/aeternity/aepp-sdk-go/commit/45ff92d)) -* OracleExtendTx.RLP() use t.Fee.Int instead of t.Fee.Bytes() for RLP serialization ([857338f](https://github.com/aeternity/aepp-sdk-go/commit/857338f)) -* OracleQueryTx.RLP() was not correct, renamed members of OracleRespondTx ([b679804](https://github.com/aeternity/aepp-sdk-go/commit/b679804)) -* rearranged function arguments and correct param types in OracleRegisterTx() ([7c47342](https://github.com/aeternity/aepp-sdk-go/commit/7c47342)) -* rearranged function arguments and correct param types in OracleRegisterTx() ([2b00541](https://github.com/aeternity/aepp-sdk-go/commit/2b00541)) -* renamed helper function arguments to accomodate different kinds of TTLs in other transaction types ([2970997](https://github.com/aeternity/aepp-sdk-go/commit/2970997)) -* renamed helper function arguments to accomodate different kinds of TTLs in other transaction types ([5697537](https://github.com/aeternity/aepp-sdk-go/commit/5697537)) -* rlp Encode() was encoding 0 value of uint64 as 0x00, but big.Int 0 value as 0x80. Changed big.Int 0 value to 0x00 ([e21c6f5](https://github.com/aeternity/aepp-sdk-go/commit/e21c6f5)) -* SpendTx, OracleRegisterTx RLP() methods should always use big.Int.Int while serializing, not the big.Int directly, because otherwise there will be a list within a list ([fcaa28d](https://github.com/aeternity/aepp-sdk-go/commit/fcaa28d)) -* tx command shouldn't use BaseEncodeTx() as a returned function ([21c5a7c](https://github.com/aeternity/aepp-sdk-go/commit/21c5a7c)) -* uint64/big.Int instead of int64 for certain variables in config.go ([1c65c9a](https://github.com/aeternity/aepp-sdk-go/commit/1c65c9a)) -* uint64/big.Int instead of int64 for certain variables in config.go ([4c76f06](https://github.com/aeternity/aepp-sdk-go/commit/4c76f06)) +* generated.models.Error is patched to satisfy the Error interface. This dereferences the error.Reason pointer if the models.Error is passed as a pointer ([14ce6ed](https://github.com/aeternity/aepp-sdk-go/commit/14ce6ed347333f1ee0888cdebcc1f031aa74af7f)) +* unittest for GenericTx deserialization ([1c17e40](https://github.com/aeternity/aepp-sdk-go/commit/1c17e402c31eb0ff9a84e27f596e8b10375946dd)) +* GenericTx was not deserializing properly into go-swagger models. generated code was not parsing node responses that involved GenericTx. First fixed in 2cccbeaefd49e8a037af5b4b2029d697477e683b but resurfaced after regenerating from new swagger.json make go-swagger generated *Tx models return SpendTx, not SpendTxJSON closes [#54](https://github.com/aeternity/aepp-sdk-go/issues/54) ([b2b9cd5](https://github.com/aeternity/aepp-sdk-go/commit/b2b9cd536f70ac8cf52886b75ec819a6a8e28938)) +* canonical NameUpdateTx RLP serialization seems to want NamePointers in the reverse order than specified in the JSON. ([cc6a56e](https://github.com/aeternity/aepp-sdk-go/commit/cc6a56edd33e5505a49e92c7664aa11bf868c735)) + +### Chore + +* standardize field names across transactions ([aaca2e5](https://github.com/aeternity/aepp-sdk-go/commit/aaca2e58d461b49f3393f0caf3822aa1666b042c)) +* cleanup - comments and casing ([21b68d9](https://github.com/aeternity/aepp-sdk-go/commit/21b68d991fd6c39b0ef46215740c24625a4785d7)) +* Oracle Integration Test, OracleRegister, OracleExtend ([46a4192](https://github.com/aeternity/aepp-sdk-go/commit/46a41920731e847e358f9b8b9747ba2a23e8e9a7)) +* small unittest to test that generated models.Error has its Reason automatically dereferenced when printing it ([839c5b2](https://github.com/aeternity/aepp-sdk-go/commit/839c5b2ed7505babbb2a4c42b390e8140bacde1d)) +* cleanup obsolete code ([053837c](https://github.com/aeternity/aepp-sdk-go/commit/053837cf7f801e41fd8cad477bc6777ecb244c53)) +* AENS integration test generalize to name as a variable, do not use stdin n as prompt to continue. use aeternity helpers instead ([ffc4f8a](https://github.com/aeternity/aepp-sdk-go/commit/ffc4f8ab65cced275827afe15d1a3f672ea9d697)) +* AENS workflow integration test ([152947c](https://github.com/aeternity/aepp-sdk-go/commit/152947c4ff9cce110391859045f05185b56e3007)) +* test genesis account is now richer in private testnet for integration tests ([91dff09](https://github.com/aeternity/aepp-sdk-go/commit/91dff0937b2fde2e963341661aa747ee916f5b5c)) + +### Code Refactoring + +* Tx interface does not include JSON() method. This was more trouble than it was worth ([f79c27b](https://github.com/aeternity/aepp-sdk-go/commit/f79c27b399d08ddb6520ca4db453d9f69cf7dfd8)) +* NamePointer struct now embeds models.NamePointer. This gives automatic JSON serialization ([ccff0a6](https://github.com/aeternity/aepp-sdk-go/commit/ccff0a6944b8f6692ee6e948dd970a2a2b2bfe0c)) +* NamePointer is now a struct of its own ([9bd57e9](https://github.com/aeternity/aepp-sdk-go/commit/9bd57e9a68a00c436f0186e863c3eb7d4c630172)) + +### Docs + +* TODO consider refactoring WaitForTransactionUntilHeight ([b8a4f0c](https://github.com/aeternity/aepp-sdk-go/commit/b8a4f0c4fd111aea9cd2fc19a93d62133eb74f0f)) +* added comment for NamePointer.EncodeRLP() ([72e28be](https://github.com/aeternity/aepp-sdk-go/commit/72e28be32700e012689ba8d310e370b21af72dfc)) +* add minor comments on exported functions ([8eb5d88](https://github.com/aeternity/aepp-sdk-go/commit/8eb5d88b9b8d46e00450d26472a151a0f916d2de)) + +### Features + +* OracleRespondTx integration test ([d7c5696](https://github.com/aeternity/aepp-sdk-go/commit/d7c5696900b376f088f094579f7ee644eae7a0d1)) +* OracleRespondTx struct, RLP() and JSON() serialization and unittests ([680262a](https://github.com/aeternity/aepp-sdk-go/commit/680262a397f711d0bb9bcd1025de1192fe18be79)) +* OracleRespondTx prerequisites: APIGetOracleQueriesByPubkey(), buildOracleQueryID(), leftPadByteSlice() and unittests ([c656fb4](https://github.com/aeternity/aepp-sdk-go/commit/c656fb487c360ba297eac19e7870ab07f082447d)) +* OracleQueryTx works. Unittest reference value taken from node, not JS SDK. Integration test updated. ([346f8f3](https://github.com/aeternity/aepp-sdk-go/commit/346f8f323a649b16a31225eda3fdc542dd1d4a5e)) +* Oracle helper functions for OracleRegisterTx, OracleExtendTx ([73f908c](https://github.com/aeternity/aepp-sdk-go/commit/73f908c72521f35e8ef7eff5d4b6d11b93ec2075)) +* account address will ask for confirmation before printing private key ([cb80311](https://github.com/aeternity/aepp-sdk-go/commit/cb80311c20bd70ae178b8805ec79798f53844ea0)) +* vanity account search takes regular expressions that can match anywhere ([9612610](https://github.com/aeternity/aepp-sdk-go/commit/961261084b3a11aeecc253660cc013ec0fcecdf9)) +* AENS integration test now tests NamePreclaim, NameClaim, NameUpdate for simple ak_ type pointers ([f31085e](https://github.com/aeternity/aepp-sdk-go/commit/f31085e5a3b5dbb73d063e40d18c071a27a5c45b)) + + +## [v2.0.0](https://github.com/aeternity/aepp-sdk-go/compare/v1.0.2...v2.0.0) (2019-04-09) + +### Bug Fixes + +* NameClaimTx salt 256bit bytearray was being converted to uint64 and back, which mangles the bytes. Solved by making it a BigInt, which has proper 32 byte big endian representation with Bytes() ([45ff92d](https://github.com/aeternity/aepp-sdk-go/commit/45ff92da01bdedc8e7d82c943c49c17c0de63bba)) +* disabled OracleQueryTx, aepp-sdk-js reference RLP serialization is more reliable than aepp-sdk-python atm ([88e7ac4](https://github.com/aeternity/aepp-sdk-go/commit/88e7ac456e128cfbbc8a357315ebe7b5ac7b2d00)) +* Aens.NameClaimTx helper should pass the plaintext name down to the actual function ([c976216](https://github.com/aeternity/aepp-sdk-go/commit/c976216ce70335fd202215044fb025b3351fabac)) +* NameClaimTx correct serialization in JSON and RLP formats ([0e6799d](https://github.com/aeternity/aepp-sdk-go/commit/0e6799d5d4a6769d1049f0dce45162b6451113f8)) +* AENS.UpdateFee specified, made into a BigInt ([de42965](https://github.com/aeternity/aepp-sdk-go/commit/de429656195f2b9581329d0a9808d5bf6c88081a)) +* integration test was broken after BigInt.Int was changed from copy-by-value to pointer, because swagger did not know it had to initialize BigInt.Int when creating a BigInt. Fixed. ([b9dd2f3](https://github.com/aeternity/aepp-sdk-go/commit/b9dd2f3f12c3c9e6ce1dce2d8debd54d6c541613)) +* OracleQueryTx.RLP() was not correct, renamed members of OracleRespondTx ([b679804](https://github.com/aeternity/aepp-sdk-go/commit/b679804138246754f6abbb68368d5536a9adebef)) +* OracleExtendTx.RLP() use t.Fee.Int instead of t.Fee.Bytes() for RLP serialization ([857338f](https://github.com/aeternity/aepp-sdk-go/commit/857338f3088aa6f27c3ec380b11b68e3b21effa7)) +* integration test now works with BigInt's pointer receivers ([d373565](https://github.com/aeternity/aepp-sdk-go/commit/d373565eaa2e26cd1b62f1ef59ef3114e6f633b6)) +* tx command shouldn't use BaseEncodeTx() as a returned function ([21c5a7c](https://github.com/aeternity/aepp-sdk-go/commit/21c5a7c1732368631963c961c5f8587fc37ee745)) +* SpendTx, OracleRegisterTx RLP() methods should always use utils.BigInt.Int while serializing, not the utils.BigInt directly, because otherwise there will be a list within a list ([fcaa28d](https://github.com/aeternity/aepp-sdk-go/commit/fcaa28da23b443c2c82f58592b03dc2580196121)) +* rlp Encode() was encoding 0 value of uint64 as 0x00, but big.Int 0 value as 0x80. Changed big.Int 0 value to 0x00 ([e21c6f5](https://github.com/aeternity/aepp-sdk-go/commit/e21c6f5d635e7ca13041d729a9619d8821d030f2)) +* Ae.WithAccount() was not copying the Account object to the Oracle struct ([ef9eab6](https://github.com/aeternity/aepp-sdk-go/commit/ef9eab68e47a912495b88c1191238ab0a0940358)) +* renamed helper function arguments to accomodate different kinds of TTLs in other transaction types ([5697537](https://github.com/aeternity/aepp-sdk-go/commit/5697537685e72aa3032ea7bff2bceb9e047ef345)) +* rearranged function arguments and correct param types in OracleRegisterTx() ([2b00541](https://github.com/aeternity/aepp-sdk-go/commit/2b00541eea5b147ae61a7d5e66918bfadfe31a08)) +* uint64/utils.BigInt instead of int64 for certain variables in config.go ([4c76f06](https://github.com/aeternity/aepp-sdk-go/commit/4c76f064735070550e5632ed5a19f3e298ad4852)) + +### Chore + +* separate salt generation from calculating the commitmentId, so we can unittest commitmentId generation against GET /v2/debug/names/commitment-id ([4881ad9](https://github.com/aeternity/aepp-sdk-go/commit/4881ad9211360da8b2256fdb05a75614aa6b7291)) +* tx dumpraw unittest ([cef5b99](https://github.com/aeternity/aepp-sdk-go/commit/cef5b9990f4c2956536ca66e556356018dc3691e)) +* unittests for OracleExtendTx ([c6ca727](https://github.com/aeternity/aepp-sdk-go/commit/c6ca72798cbff34dbf9aeb0e601fb80d4c4a19e8)) +* **release:** 2.0.0 ([7852cf0](https://github.com/aeternity/aepp-sdk-go/commit/7852cf075e5e307c4ee3cdb0f4ec1d7fe8785a55)) + +### Cleanup + +* deleted handwritten unittests, use new generated ones. More unittests that reliably check for RLP serialization. getRLPSerialized() is a convenience function that quickly gives you the RLP deserialized representation ([fb9dc82](https://github.com/aeternity/aepp-sdk-go/commit/fb9dc82087a45c1788b6806374a6b9c9673db645)) +* transaction unittest should not be in helpers, whose role needs to be redefined anyway. New OracleRegisterTx unittest ([b5230e6](https://github.com/aeternity/aepp-sdk-go/commit/b5230e6af202b4929bc9cace129bf2d243d3f5a9)) +* helpers_test.go should use new BigInt constructor methods ([1869bc7](https://github.com/aeternity/aepp-sdk-go/commit/1869bc7ef0e4c280359281478e0c66dbb0f41e9a)) +* fix minor typo in node.go ([7cd0bd5](https://github.com/aeternity/aepp-sdk-go/commit/7cd0bd57e9ca960f6628730d59ca263751014112)) + +### Code Refactoring + +* helper functions now return the Tx structs, which then need to be separately base64 encoded. However, TTL and Nonce are automatically determined, because that was just tedious ([40fa167](https://github.com/aeternity/aepp-sdk-go/commit/40fa1679c42e170da4cc88ab2d29aafe2e63e8c8)) +* Namehash() exported because it is useful when you need to debug AENS ([d4ac51d](https://github.com/aeternity/aepp-sdk-go/commit/d4ac51db38e341e9390a18a6f22633158694970a)) +* AENS Tx fees should be denominated in BigInt ([db198cf](https://github.com/aeternity/aepp-sdk-go/commit/db198cf3f43bcf6b31ba0ef347e236b57bffd7a2)) +* transactions_test does not have to be an aeternity_test package - this creates more problems for now. Leave aeternity_test to code that tests the user convenience stuff above this level ([9b0cc65](https://github.com/aeternity/aepp-sdk-go/commit/9b0cc65c98f0f542e652926ed7c7a69771e16a82)) +* utils.BigInt should embed a *big.Int after all, not a big.Int. Also, its methods should have pointer receivers, not value receivers. This lets us use big.Int's methods, since they are defined on the pointer see https://stackoverflow.com/questions/55337900/marshaljson-a-type-with-an-embedded-type-ends-up-as-instead-of-the-value/55338067[#55338067](https://github.com/aeternity/aepp-sdk-go/issues/55338067) ([218578a](https://github.com/aeternity/aepp-sdk-go/commit/218578a809e7e1dcb57373e1e05401150a8fd2ce)) +* integration test uses new Tx struct method ([b9dcdc1](https://github.com/aeternity/aepp-sdk-go/commit/b9dcdc16939e7a00cfc04b53c762269dd1637023)) +* Tx struct methods now use a pointer receiver Also cleaned up unittests ([fe513d8](https://github.com/aeternity/aepp-sdk-go/commit/fe513d8b6d6a7d1d285086213514a64de9e7ac01)) +* Tx structs should have exported fields ([42d94ac](https://github.com/aeternity/aepp-sdk-go/commit/42d94ac15c20c1f2c38f755b959f8649d8a68ad2)) +* BaseEncodeTx() doesn't need to return a function - it can just convert within itself ([533ae43](https://github.com/aeternity/aepp-sdk-go/commit/533ae43654f701cc420aee35320c9fedcf41791b)) +* many helper functions not needed anymore. Commenting out to focus on other issues ([69bef33](https://github.com/aeternity/aepp-sdk-go/commit/69bef33e898919c51446fe300ccd9de8eaa45eb2)) +* cmd/tx.go uses new refactored SpendTx struct ([f48377d](https://github.com/aeternity/aepp-sdk-go/commit/f48377dca2b2f40c3daf3b96a0987a8fe186c75d)) +* made Transaction functions Go-ish, with structs and interfaces. More unittests, but some failing due to big.Int 0-value serialization issue ([99ca385](https://github.com/aeternity/aepp-sdk-go/commit/99ca385266b8c92510ed70bffe33fa40eed62e91)) +* DecodeRLPMessage() exported. Now we can have deep debugging functions from the cmd package, for example ([31de960](https://github.com/aeternity/aepp-sdk-go/commit/31de9601653b7281bde0f587adfe68780dfda5a0)) +* BroadcastTransaction() helper becomes part of Ae struct, so aeClient.BroadcastTransaction() ([1f1652c](https://github.com/aeternity/aepp-sdk-go/commit/1f1652cb8b9b18f699c40d75f672ca996e305fd2)) +* Ae.GetTTL/Nonce() is for SDK user convenience - under the hood, they use unexported normal functions getTTL/getNonce() ([7cd8679](https://github.com/aeternity/aepp-sdk-go/commit/7cd8679b50d35ef1ed8df231983d56e2c331991e)) + +### Docs + +* show how to use the SDK ([7895e74](https://github.com/aeternity/aepp-sdk-go/commit/7895e744cacc0027bc745622ac5bdad295b252ec)) +* comments for JSON() methods ([d1a5f64](https://github.com/aeternity/aepp-sdk-go/commit/d1a5f644d995fd9a40e4fd0cec3b3efc9150adbf)) +* explain the TTL types in AENS ([9265779](https://github.com/aeternity/aepp-sdk-go/commit/9265779a39b7f6c9336f50f0e36bde5bbb782555)) + +### Feature + +* fleshing out NameUpdateTx, especially the JSON and Pointers overhaul. buildPointers is completely different now. Still does not work 100% ([6d460af](https://github.com/aeternity/aepp-sdk-go/commit/6d460af2af5aa15e7f09dd12e3fe0d32534b7353)) ### Features -* account vanity generator ([3b5c5bd](https://github.com/aeternity/aepp-sdk-go/commit/3b5c5bd)) -* AENS transactions in new struct format, given JSON() methods, some types fixed. ([edabb99](https://github.com/aeternity/aepp-sdk-go/commit/edabb99)) -* CLI tx dumpraw command (helps with debugging) ([05516cd](https://github.com/aeternity/aepp-sdk-go/commit/05516cd)) -* OracleQueryTx struct revision, unittest structure (but no working test) ([41f9821](https://github.com/aeternity/aepp-sdk-go/commit/41f9821)) -* OracleQueryTx, OracleRespondTx structs ([be508b1](https://github.com/aeternity/aepp-sdk-go/commit/be508b1)) -* OracleRegisterTx, OracleExtendTx. Incomplete unittest ([7c7dbcb](https://github.com/aeternity/aepp-sdk-go/commit/7c7dbcb)) -* OracleRegisterTx, OracleExtendTx. Incomplete unittest ([f41a021](https://github.com/aeternity/aepp-sdk-go/commit/f41a021)) -* OracleRegisterTxStr() helper function ([a178c87](https://github.com/aeternity/aepp-sdk-go/commit/a178c87)) -* OracleRegisterTxStr() helper function ([a654936](https://github.com/aeternity/aepp-sdk-go/commit/a654936)) -* Tx structs now feature a JSON() serialization that uses swagger models ([944daa7](https://github.com/aeternity/aepp-sdk-go/commit/944daa7)) +* account vanity generator chore: chain broadcast unittest ([3b5c5bd](https://github.com/aeternity/aepp-sdk-go/commit/3b5c5bd47db127cbd0b54c26d52aeb896e861de5)) +* OracleQueryTx struct revision, unittest structure (but no working test) ([41f9821](https://github.com/aeternity/aepp-sdk-go/commit/41f9821f1df415a4de37e293188f0a4a77a5b47e)) +* OracleQueryTx, OracleRespondTx structs ([be508b1](https://github.com/aeternity/aepp-sdk-go/commit/be508b114cbaa8a6038c2a31bcb4078a0b6437db)) +* AENS transactions in new struct format, given JSON() methods, some types fixed. Tx interface now includes the JSON() method ([edabb99](https://github.com/aeternity/aepp-sdk-go/commit/edabb99178c92c4867b18584285fffeb9f93fe3c)) +* Tx structs now feature a JSON() serialization that uses swagger models ([944daa7](https://github.com/aeternity/aepp-sdk-go/commit/944daa70ccd0abcdd52835079c8598db3c389217)) +* CLI tx dumpraw command (helps with debugging) ([05516cd](https://github.com/aeternity/aepp-sdk-go/commit/05516cd87b50fef8246c03c7d3f97342e28fae83)) +* OracleRegisterTxStr() helper function ([a654936](https://github.com/aeternity/aepp-sdk-go/commit/a654936622d2769a4c22e95485b858fce5f52993)) +* OracleRegisterTx, OracleExtendTx. Incomplete unittest ([f41a021](https://github.com/aeternity/aepp-sdk-go/commit/f41a0210080500a65c70f684af221f59c01edda2)) + +### Style + +* rename nodeCli to nodeClient - less confusing ([f1aaf15](https://github.com/aeternity/aepp-sdk-go/commit/f1aaf15eaef8d129226cdc9e9e2e436171b83dca)) + + +## [v1.0.2](https://github.com/aeternity/aepp-sdk-go/compare/0.25.0-0.1.0-alpha...v1.0.2) (2019-03-20) +### AENS -# 0.25.0-0.1.0-alpha (2018-11-22) +* fees and salts are now uint64 ([09c2ea4](https://github.com/aeternity/aepp-sdk-go/commit/09c2ea463617453ddeb8f5ee5781a99f53279c19)) +### Aeternity +* Base58/64 Encode/Decode functions now exported ([4a17065](https://github.com/aeternity/aepp-sdk-go/commit/4a17065c9d2009bef9d65572860373646e57f301)) -# 0.22.0-0.1.0-alpha (2018-09-19) +### Aeternity_test +* TestSpendTransactionWithNode integration test ([084e9f3](https://github.com/aeternity/aepp-sdk-go/commit/084e9f38854dc21cbdc51a147bc510072c46063d)) + +### Api + +* added design comment on Ae.API*() methods ([5762cbf](https://github.com/aeternity/aepp-sdk-go/commit/5762cbf33e1c577ebc99acf99b5a35b39ca52be7)) + +### Bug Fixes + +* renamed helper function arguments to accomodate different kinds of TTLs in other transaction types ([2970997](https://github.com/aeternity/aepp-sdk-go/commit/297099784a95b3339af4c9326a790a32aff998e4)) +* rearranged function arguments and correct param types in OracleRegisterTx() ([7c47342](https://github.com/aeternity/aepp-sdk-go/commit/7c47342fb7a8320a34eed985db3c056fe4256bd4)) +* uint64/utils.BigInt instead of int64 for certain variables in config.go ([1c65c9a](https://github.com/aeternity/aepp-sdk-go/commit/1c65c9a3ef0b2f5faa0e38fcbbf4119a18f5731e)) + +### Chain + +* added ttl and networkid command ([a25c0a9](https://github.com/aeternity/aepp-sdk-go/commit/a25c0a93f117ff7ee136ba4c41779c103aaf60d0)) + +### Chore + +* helpers_test.go should use new BigInt constructor methods ([a0325fc](https://github.com/aeternity/aepp-sdk-go/commit/a0325fc9d64ce8b8b109a3f52cc7ce954e93517d)) +* fix minor typo in node.go ([5b80101](https://github.com/aeternity/aepp-sdk-go/commit/5b801014e86261ea0a6a2f4d3ceded5f9d9997a4)) + +### Cmd + +* tx spend better help message for --nonce ([226427e](https://github.com/aeternity/aepp-sdk-go/commit/226427e3f71bc636c93da377e8ee300fffb1b79d)) +* tx spend accepts ttl, nonce TODO: ACTUALLY IMPLEMENT IT ([109f432](https://github.com/aeternity/aepp-sdk-go/commit/109f43202ad28c9dd990bbded5f9bc686ce470e0)) +* removed intermediate nodeExternalURL variable. Now the single source of truth for Node URL and NetworkID is aeternity.Config.Epoch. Until helper functions accept these via arguments, this allows dependent code to change Node URL and NetworkID as well without worrying that it might be touched elsewhere. ([a340ec1](https://github.com/aeternity/aepp-sdk-go/commit/a340ec1a1fbdcdfacc904e6096d7f393b1d4a09f)) +* amount, fee are now always processed as uint64 ([4520db9](https://github.com/aeternity/aepp-sdk-go/commit/4520db95bb3007f79adea2ded4c9995098143aca)) +* account balance unittest for when an account was found, and not found. Need to rework terminal.go to unwrap model.Error messages properly ([5ba5fba](https://github.com/aeternity/aepp-sdk-go/commit/5ba5fbaf6b7ea00282996b4cc89f7d5018ecbbb9)) +* tx spend unittest reenable ([c939931](https://github.com/aeternity/aepp-sdk-go/commit/c9399310f4803f2fd67b1758ed3a9439b052283a)) +* inspect unittest and error object ([d52eb1e](https://github.com/aeternity/aepp-sdk-go/commit/d52eb1e1a24dc996b18fc6cea31cdd14d4363069)) +* account unittests use t.Error() instead of t.Fatal, renamed Test*() functions ([84719cd](https://github.com/aeternity/aepp-sdk-go/commit/84719cd7b27126b08483b14dc825e9338c218c37)) +* chain use error return objects ([5093af2](https://github.com/aeternity/aepp-sdk-go/commit/5093af229e8310c038e81bbe2ed8b0ca856671df)) +* tx unittests (failing) ([c396532](https://github.com/aeternity/aepp-sdk-go/commit/c396532f80f101c5a8cead0d5f9c62d4861e2d99)) +* tx return error objects. Now that Config is hardcoded, I can reference it directly for the --fee argument ([bcea426](https://github.com/aeternity/aepp-sdk-go/commit/bcea4262d8f6fab3038153298c811e82060692af)) +* tx uses named functions now ([52c6a10](https://github.com/aeternity/aepp-sdk-go/commit/52c6a109e261a991246121a42c9d9a10831e483f)) +* account subcommands return errors. This helps in testing, and keeps it simple ([ccdf565](https://github.com/aeternity/aepp-sdk-go/commit/ccdf565c7b8b54b44ea80b6084c2c067683d3f16)) +* separated functions from cobra commands, some unittests. --password now belongs to account command, not its subcommands ([6bd18f7](https://github.com/aeternity/aepp-sdk-go/commit/6bd18f76647ec50b57b86d8a7be469fab4066212)) +* inspect unittest (MORE TESTS) ([f10e442](https://github.com/aeternity/aepp-sdk-go/commit/f10e442232d66bc2950fd39153f414eb4250deda)) +* chain unittests ([721eca4](https://github.com/aeternity/aepp-sdk-go/commit/721eca4db5dbe7af4c2cff8efa98fc9e311a17d5)) +* removed aeCli as a global variable, so each subcommand has to instantiate its own aeCli now. This helps go-vet detect problems where I would otherwise only get nil reference panics because aeCli wasn't initialized yet ([321b199](https://github.com/aeternity/aepp-sdk-go/commit/321b199ea109899dbdd26c748e5e1d43de100903)) +* tx broadcast -> chain broadcast ([a11a62d](https://github.com/aeternity/aepp-sdk-go/commit/a11a62d4b5f4921fd5d56624e902e1d49eb68306)) + +### Code Refactoring + +* BroadcastTransaction() helper becomes part of Ae struct, so aeClient.BroadcastTransaction() ([adb1b7f](https://github.com/aeternity/aepp-sdk-go/commit/adb1b7faec47df7b7fa6294685ee4ba8d38f1b05)) +* Ae.GetTTL/Nonce() is for SDK user convenience - under the hood, they use unexported normal functions getTTL/getNonce() ([76a0ff6](https://github.com/aeternity/aepp-sdk-go/commit/76a0ff64a354be37cd41abb55bab03955fd36348)) + +### Config + +* use sdk-mainnet.aepps.com ([68c4ff7](https://github.com/aeternity/aepp-sdk-go/commit/68c4ff7937f81135c17209635b62650cdae5f038)) + +### Features +* OracleRegisterTxStr() helper function ([a178c87](https://github.com/aeternity/aepp-sdk-go/commit/a178c8738fd40518af1576618d4c08552fbb4e6f)) +* OracleRegisterTx, OracleExtendTx. Incomplete unittest ([7c7dbcb](https://github.com/aeternity/aepp-sdk-go/commit/7c7dbcb49909a9d0d7ee1fb1e03741879f8b7a40)) -## [1.0.0-alpha] +### Generated -### Added +* updated to 2.0.0 ([3e7114b](https://github.com/aeternity/aepp-sdk-go/commit/3e7114b8c5c14608f008f2051617906ee60fc585)) -- New subcommands `tx verify`, `tx broadcast`, `tx spend`, `account sign` +### Gitignore -### Changed +* ignore docker-compose.override.yml ([5c23a85](https://github.com/aeternity/aepp-sdk-go/commit/5c23a85f682d95342b5df86bc625b740d41ab14b)) -- `account spend`, `account sign` support the `--password` flag -- default tx fee is now 20000, in line with other SDKs +### Helpers -### Removed +* GetNextNonce, GetTTL renamed and exported, SpendTransaction->SpendTxStr, signature changed. All helper functions require ttl, nonce as arguments ([3eb5e14](https://github.com/aeternity/aepp-sdk-go/commit/3eb5e140325840a93b826028fa9d7d2c52f3faf3)) +* TestSpendTransaction ([7beb27f](https://github.com/aeternity/aepp-sdk-go/commit/7beb27fc152e6f132b0a6edda2146ec8c2deb3e9)) +### README -### Fixed +* single line swagger generation command ([944a56c](https://github.com/aeternity/aepp-sdk-go/commit/944a56c8e42f7046acfc4c59fa3f83b72de5abbc)) -- keystore.json reader was not reading kdfparams properly -- rlp from go-ethereum was encoding 0 values differently from Python/Erlang implementations +### Rlp +* fixing 0 encoding issue ([991f2b4](https://github.com/aeternity/aepp-sdk-go/commit/991f2b4385af85985c2a1de356f4455498ec8ee1)) -## [0.25.0-0.1.0-alpha] +### Style -### Added +* rename nodeCli to nodeClient - less confusing ([528eba0](https://github.com/aeternity/aepp-sdk-go/commit/528eba032794778d3d75c90bc72d9196beb3853e)) -- Add compatibility with epoch v0.25.0 +### Swagger -### Removed +* Custom Bigint ([9d3c604](https://github.com/aeternity/aepp-sdk-go/commit/9d3c6044dc5fa014d9ba531ff6b07c2433ba5c95)) -- Remove compatibility with epoch < v0.25.0 +### Utils -### Changed +* BigInt implements UnmarshalJSON and MarshalJSON. Unittests included for peace of mind, although code does not actually do much. ([b6714c8](https://github.com/aeternity/aepp-sdk-go/commit/b6714c81fd32499d0fd284ff949be8042a42a14c)) +* BigInt now uses big.Int as embedded struct. Validation unittest. ([5a4a67b](https://github.com/aeternity/aepp-sdk-go/commit/5a4a67b1f518e8a1f85efbd29f23c2ec5096aa49)) -- Change keystore implementation with xsalsa-poly1305/argon2id + +## [0.25.0-0.1.0-alpha](https://github.com/aeternity/aepp-sdk-go/compare/0.22.0-0.1.0-alpha...0.25.0-0.1.0-alpha) (2018-11-22) -## [0.22.0-0.1.0-alpha] -### Added + +## 0.22.0-0.1.0-alpha (2018-09-19) -- First alpha release of the appe-sdk-go -- Add compatibility with epoch v0.22.0 -- Add command line interface supporting inspection of the chain -- Add command line interface supporting spend transaction diff --git a/DESIGN.md b/DESIGN.md index 0240e12e..4be92995 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -28,14 +28,11 @@ Let's start from the bottom upwards. # Testing ## Unit tests -`go test $(go list ./... |grep -v integration_test)` +`make test-unit` ## Integration tests ``` # ensure .env has the node/compiler versions you want to test -docker-compose up node compiler - -export AETERNITY_ALICE_PRIVATE_KEY=..... -export AETERNITY_BOB_PRIVATE_KEY=..... -go test ./integration_test -count=1 # count is needed because Go caches test results if they were successful. +docker-compose up +make test-integration ``` \ No newline at end of file diff --git a/Dockerfile.ci b/Dockerfile.ci deleted file mode 100644 index 6bc03ccb..00000000 --- a/Dockerfile.ci +++ /dev/null @@ -1,12 +0,0 @@ -# Heads-Up: This Dockerfile is *exclusively* used for CI. It is referenced by -# Jenkinsfile and should not be used by any other means. - -FROM golang:1-alpine - -USER root - -RUN apk add --no-cache curl git make - -WORKDIR /go/src/app - -RUN curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b25eda0b..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,52 +0,0 @@ -pipeline { - agent { - dockerfile { - filename 'Dockerfile.ci' - args '-v /etc/group:/etc/group:ro ' + - '-v /etc/passwd:/etc/passwd:ro ' + - '-v /var/lib/jenkins:/var/lib/jenkins ' + - '-v /usr/bin/docker:/usr/bin/docker:ro ' + - '--network=host' - } - } - - environment { - DOCKER_COMPOSE = "docker-compose -p ${env.BUILD_TAG} -H 127.0.0.1:2376" - } - - stages { - stage('Pre Test') { - steps { - sh 'go version' - sh 'go get github.com/tebeka/go2xunit' - sh 'go get -u github.com/golang/lint/golint' - sh 'go mod download' - } - } - - stage('Test') { - steps { - withCredentials([usernamePassword(credentialsId: 'genesis-wallet', - usernameVariable: 'WALLET_PUB', - passwordVariable: 'WALLET_PRIV')]) { - sh "${env.DOCKER_COMPOSE} run sdk sh -c 'make lint && make test' " - } - } - } - - stage('Build') { - steps { - sh "${env.DOCKER_COMPOSE} run sdk make build-dist" - } - } - } - } - - post { - always { - junit 'test-results.xml' - archive 'dist/*' - sh 'docker-compose -H localhost:2376 down -v ||:' - } - } -} \ No newline at end of file diff --git a/Makefile b/Makefile index 63872db1..fbc044db 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,15 @@ GOFILES = $(shell find . -name '*.go' -not -path './vendor/*') -GOPACKAGES = $(shell go list ./... | grep -v /vendor/) -GIT_DESCR = $(shell git describe --tags --always) +GOPACKAGES_UNIT = $(shell go list ./... | grep -v /vendor/ | grep -v integration_test) +GIT_DESCR = $(shell git describe --tags --always) APP=aecli -# build output folder OUTPUTFOLDER = dist -# docker image -DOCKER_IMAGE = aeternity/aepps-sdk-go -DOCKER_TAG = $(shell git describe --tags --always) -# build paramters -OS = linux ARCH = amd64 -.PHONY: list -list: - @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs - default: build -workdir: - mkdir -p dist - -build: build-dist - -build-dist: $(GOFILES) +build: $(GOFILES) @echo build binary to $(OUTPUTFOLDER) - GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build -ldflags "-X main.Version=$(GIT_DESCR)" -o $(OUTPUTFOLDER)/$(APP) . + CGO_ENABLED=0 go build -ldflags "-X main.Version=$(GIT_DESCR)" -o $(OUTPUTFOLDER)/$(APP) . @echo copy resources cp -r README.md LICENSE $(OUTPUTFOLDER) @echo done @@ -45,47 +30,28 @@ build-release: zip -r $(OUTPUTFOLDER)/$(OS).zip $(OUTPUTFOLDER)/$(OS) @echo done -test: test-all +test: test-unit test-integration -test-all: - @go test -v $(GOPACKAGES) -coverprofile .testCoverage.txt +test-unit: + go test -v $(GOPACKAGES_UNIT) -bench: bench-all +test-integration: + go test -v ./integration_test -bench-all: - @go test -bench -v $(GOPACKAGES) +bench: + go test -bench -v ./... -lint: lint-all +lint: + staticcheck ./... -lint-all: - @golint -set_exit_status $(GOPACKAGES) - -install: build-dist - @cp dist/aecli $(GOPATH)/bin +install: build + @cp $(OUTPUTFOLDER)/$(APP) $(GOPATH)/bin @echo copied to GOPATH/bin clean: @echo remove $(OUTPUTFOLDER) folder - @rm -rf dist + @rm -rf $(OUTPUTFOLDER) @echo done -docker: docker-build - -docker-build: build-dist - @echo copy resources - @cp config/settings.docker.yaml $(OUTPUTFOLDER)/settings.yaml - @echo build image - docker build -t $(DOCKER_IMAGE):$(DOCKER_TAG) -f ./build/docker/Dockerfile . - @echo done - -docker-push: docker-build - @echo push image - docker tag $(DOCKER_IMAGE):$(DOCKER_TAG) $(DOCKER_IMAGE):latest - docker push $(DOCKER_IMAGE) - @echo done - -docker-run: - @docker run -p 1804:1804 $(DOCKER_IMAGE) - -debug-start: - @go run main.go -c config/settings.sample.yaml --debug start +changelog: + git-chglog -o CHANGELOG.md diff --git a/README.md b/README.md index 7d989deb..6233422f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ golang sdk for aeternity blockchain `go get github.com/aeternity/aepp-sdk-go` If your project uses Go Modules (go.mod, go.sum files), you must include the major version in the import line like this: -`import github.com/aepp-sdk-go/v8/aeternity` +`import github.com/aepp-sdk-go/v9/aeternity` If your project won't use Go Modules (no go.mod, go.sum files), ensure your `$GOPATH/src/github.com/aeternity/aepp-sdk-go` is on the correct branch. Then your import should be: `import github.com/aepp-sdk-go/aeternity` diff --git a/account/account.go b/account/account.go index 9e693900..93f228b3 100644 --- a/account/account.go +++ b/account/account.go @@ -8,7 +8,7 @@ import ( "os" "path/filepath" - "github.com/aeternity/aepp-sdk-go/v8/binary" + "github.com/aeternity/aepp-sdk-go/v9/binary" "golang.org/x/crypto/ed25519" ) @@ -21,7 +21,7 @@ type Account struct { func loadFromPrivateKeyRaw(privb []byte) (account *Account, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("Invalid private key") + err = fmt.Errorf("invalid private key") } }() account = loadFromPrivateKey(ed25519.PrivateKey(privb)) diff --git a/account/bip32.go b/account/bip32.go index 06ac4b5d..ba093860 100644 --- a/account/bip32.go +++ b/account/bip32.go @@ -10,7 +10,7 @@ import ( // ErrHardenedChildPublicKey is returned when trying to create a hardened child // from a public key. -var ErrHardenedChildPublicKey = errors.New("Can't create hardened child from public key") +var ErrHardenedChildPublicKey = errors.New("can't create hardened child from public key") // ErrHardenedOnly is returned when a node in the path is not hardened. var ErrHardenedOnly = errors.New("ed25519 only works with hardened children") diff --git a/account/keystore.go b/account/keystore.go index c82c176a..340da348 100644 --- a/account/keystore.go +++ b/account/keystore.go @@ -7,7 +7,7 @@ import ( "fmt" "time" - config "github.com/aeternity/aepp-sdk-go/v8/config" + config "github.com/aeternity/aepp-sdk-go/v9/config" uuid "github.com/satori/go.uuid" "golang.org/x/crypto/argon2" "golang.org/x/crypto/nacl/secretbox" @@ -59,6 +59,9 @@ func KeystoreOpen(data []byte, password string) (account *Account, err error) { } // build the key from the password salt, err := hex.DecodeString(k.Crypto.KdfParams.Salt) + if err != nil { + return + } argonKey := argon2.IDKey([]byte(password), salt, k.Crypto.KdfParams.Opslimit, k.Crypto.KdfParams.Memlimit, @@ -68,14 +71,20 @@ func KeystoreOpen(data []byte, password string) (account *Account, err error) { copy(key[:], argonKey) // retrieve the nonce v, err := hex.DecodeString(k.Crypto.CipherParams.Nonce) + if err != nil { + return + } var decryptNonce [24]byte copy(decryptNonce[:], v) // now retrieve the cypertext v, err = hex.DecodeString(k.Crypto.Ciphertext) - // + if err != nil { + return + } + decrypted, ok := secretbox.Open(nil, v, &decryptNonce, &key) if !ok { - err = fmt.Errorf("Cannot decrypt secret") + err = fmt.Errorf("cannot decrypt secret") return } // now load the account @@ -97,7 +106,7 @@ func randomBytes(n int) ([]byte, error) { } // KeystoreSeal create an encrypted json keystore with the private key of the account -func KeystoreSeal(account *Account, password string) (j []byte, e error) { +func KeystoreSeal(account *Account, password string) (j []byte, err error) { // normalize pwd salt, err := randomBytes(16) if err != nil { diff --git a/aeternity/aens.go b/aeternity/aens.go index 19aeec82..2deedf0c 100644 --- a/aeternity/aens.go +++ b/aeternity/aens.go @@ -3,8 +3,8 @@ package aeternity import ( "math/big" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) // AENS is a higher level interface to AENS functionalities. diff --git a/aeternity/context.go b/aeternity/context.go index 91cfc3e4..05864841 100644 --- a/aeternity/context.go +++ b/aeternity/context.go @@ -1,9 +1,9 @@ package aeternity import ( - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) type transactionSender interface { @@ -100,6 +100,9 @@ func (c *Context) SignBroadcast(tx transactions.Transaction, blocks uint64) (txR // mined. func (c *Context) SignBroadcastWait(tx transactions.Transaction, blocks uint64) (txReceipt *TxReceipt, err error) { txReceipt, err = c.SignBroadcast(tx, blocks) + if err != nil { + return + } err = WaitSynchronous(txReceipt, blocks, c.txSender) return } diff --git a/aeternity/contracts.go b/aeternity/contracts.go index 1fab8642..a23a8afd 100644 --- a/aeternity/contracts.go +++ b/aeternity/contracts.go @@ -3,10 +3,10 @@ package aeternity import ( "time" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) type callResultListener interface { @@ -44,12 +44,12 @@ func DefaultCallResultListener(node callResultListener, txHash string, callResul } // Deploy lets one deploy a contract with minimum fuss. -func (c *Contract) Deploy(source, function string, args []string, backend string) (ctID string, createTxReceipt *TxReceipt, err error) { - bytecode, err := c.ctx.Compiler().CompileContract(source, backend) +func (c *Contract) Deploy(source, function string, args []string) (ctID string, createTxReceipt *TxReceipt, err error) { + bytecode, err := c.ctx.Compiler().CompileContract(source) if err != nil { return } - calldata, err := c.ctx.Compiler().EncodeCalldata(source, function, args, backend) + calldata, err := c.ctx.Compiler().EncodeCalldata(source, function, args) if err != nil { return } @@ -58,7 +58,7 @@ func (c *Contract) Deploy(source, function string, args []string, backend string if err != nil { return } - VMVersion, ABIVersion, err := findVMABIVersion(version, backend) + VMVersion, ABIVersion, err := findVMABIVersion(version) if err != nil { return } @@ -78,8 +78,8 @@ func (c *Contract) Deploy(source, function string, args []string, backend string // Call calls a smart contract's function, automatically calling the // compiler to transform the arguments into bytecode. -func (c *Contract) Call(ctID, source, function string, args []string, backend string) (txReceipt *TxReceipt, err error) { - callData, err := c.ctx.Compiler().EncodeCalldata(source, function, args, backend) +func (c *Contract) Call(ctID, source, function string, args []string) (txReceipt *TxReceipt, err error) { + callData, err := c.ctx.Compiler().EncodeCalldata(source, function, args) if err != nil { return } diff --git a/aeternity/helpers.go b/aeternity/helpers.go index 5e050733..e9d97608 100644 --- a/aeternity/helpers.go +++ b/aeternity/helpers.go @@ -6,10 +6,10 @@ import ( "math/big" "time" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) // GetAnythingByNameFunc describes a function that returns lookup results for a @@ -150,7 +150,7 @@ func (t *TxReceipt) Watch(mined chan bool, waitBlocks uint64, node transactionWa } if tx.BlockHeight.LargerThanZero() { - bh := big.Int(tx.BlockHeight) + bh := big.Int(*tx.BlockHeight) t.BlockHeight = bh.Uint64() t.BlockHash = *tx.BlockHash t.Mined = true @@ -163,14 +163,9 @@ func (t *TxReceipt) Watch(mined chan bool, waitBlocks uint64, node transactionWa mined <- false } -func findVMABIVersion(nodeVersion, compilerBackend string) (VMVersion, ABIVersion uint16, err error) { - if nodeVersion[0] == '5' && compilerBackend == "fate" { - return 5, 3, nil - } else if nodeVersion[0] == '5' && compilerBackend == "aevm" { - return 6, 1, nil - } else if nodeVersion[0] == '4' { - return 4, 1, nil - } else { - return 0, 0, errors.New("Other node versions unsupported") +func findVMABIVersion(nodeVersion string) (VMVersion, ABIVersion uint16, err error) { + if nodeVersion[0] == '6' { + return 7, 3, nil } + return 0, 0, errors.New("node is unsupported") } diff --git a/aeternity/helpers_test.go b/aeternity/helpers_test.go index 92edd6a7..32d2e6f7 100644 --- a/aeternity/helpers_test.go +++ b/aeternity/helpers_test.go @@ -6,12 +6,12 @@ import ( "testing" "time" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/transactions" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/transactions" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) type mockNodeForTxReceiptWatch struct { @@ -31,7 +31,7 @@ func (m *mockNodeForTxReceiptWatch) GetTransactionByHash(hash string) (tx *model bh := "bh_someblockhash" tx = &models.GenericSignedTx{ BlockHash: &bh, - BlockHeight: utils.BigInt{}, + BlockHeight: &utils.BigInt{}, Hash: &hash, Signatures: nil, } @@ -100,7 +100,7 @@ func Example() { fmt.Println("Could not create alice's Account:", err) } - bobAddress := "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v" + bobAddress := "ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks" // create a connection to a node, represented by *Node node := naet.NewNode("http://localhost:3013", false) @@ -166,7 +166,7 @@ func TestSignBroadcast(t *testing.T) { args: args{ tx: &transactions.SpendTx{ SenderID: "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi", - RecipientID: "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v", + RecipientID: "ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks", Amount: &big.Int{}, Fee: &big.Int{}, Payload: nil, @@ -184,7 +184,7 @@ func TestSignBroadcast(t *testing.T) { args: args{ tx: &transactions.SpendTx{ SenderID: "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi", - RecipientID: "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v", + RecipientID: "ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks", Amount: &big.Int{}, Fee: &big.Int{}, Payload: nil, @@ -212,7 +212,6 @@ func TestSignBroadcast(t *testing.T) { func Test_findVMABIVersion(t *testing.T) { type args struct { nodeVersion string - compilerBackend string } tests := []struct { name string @@ -222,53 +221,24 @@ func Test_findVMABIVersion(t *testing.T) { wantErr bool }{ { - name: "node version 5, FATE backend", + name: "node version 6, FATE backend", args: args{ - nodeVersion: "5", - compilerBackend: "fate", + nodeVersion: "6", }, - wantVMVersion: 5, + wantVMVersion: 7, wantABIVersion: 3, }, - { - name: "node version 5, AEVM backend", - args: args{ - nodeVersion: "5", - compilerBackend: "aevm", - }, - wantVMVersion: 6, - wantABIVersion: 1, - }, - { - name: "node version 4, AEVM backend", - args: args{ - nodeVersion: "4", - compilerBackend: "aevm", - }, - wantVMVersion: 4, - wantABIVersion: 1, - }, - { - name: "node version 4, does not actually support FATE, so it should return answer for AEVM anyway", - args: args{ - nodeVersion: "4", - compilerBackend: "fate", - }, - wantVMVersion: 4, - wantABIVersion: 1, - }, { name: "Other versions of the node are not supported", args: args{ nodeVersion: "3", - compilerBackend: "aevm", }, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - gotVMVersion, gotABIVersion, err := findVMABIVersion(tt.args.nodeVersion, tt.args.compilerBackend) + gotVMVersion, gotABIVersion, err := findVMABIVersion(tt.args.nodeVersion) if (err != nil) != tt.wantErr { t.Errorf("findVMABIVersion() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/aeternity/oracles.go b/aeternity/oracles.go index 9c6eb1c0..6323a1f3 100644 --- a/aeternity/oracles.go +++ b/aeternity/oracles.go @@ -6,11 +6,11 @@ import ( "strings" "time" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) type oracleListener func(node oracleInfoer, oracleID string, queryChan chan *models.OracleQuery, errChan chan error, listenInterval time.Duration) @@ -112,13 +112,16 @@ func (o *Oracle) respondToQueries(queryChan chan *models.OracleQuery, errChan ch fmt.Println("Received query", *q.ID, qStr) resp, err := o.Handler(qStr) if err != nil { - fmt.Println("Error responding to OracleQuery - reason:", err) + fmt.Println("Error responding to OracleQuery", err) } respTx, err := transactions.NewOracleRespondTx(o.ctx.SenderAccount(), o.ID, *q.ID, resp, config.Client.Oracles.ResponseTTLType, config.Client.Oracles.ResponseTTLValue, o.ctx.TTLNoncer()) + if err != nil { + fmt.Println("Error generating OracleRespondTx", err) + } fmt.Println("respTx", respTx) receipt, err := o.ctx.SignBroadcastWait(respTx, config.Client.WaitBlocks) if err != nil { - fmt.Println("Error sending a response to OracleQuery, reason:", err) + fmt.Println("Error sending a response to OracleQuery", err) } fmt.Println(receipt) } diff --git a/aeternity/oracles_test.go b/aeternity/oracles_test.go index f10b2cd3..2b1c61f7 100644 --- a/aeternity/oracles_test.go +++ b/aeternity/oracles_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) type mockOracleQueryNode struct { diff --git a/api/README.md b/api/README.md index cec7aeaa..cf289022 100644 --- a/api/README.md +++ b/api/README.md @@ -1,26 +1,40 @@ # Node -The node's `swagger.json` cannot be used out of the box. -1. `./simpletextreplacement.sh swagger-stock.json > swagger2.json` replaces `"$ref": "#/definitions/UInt64/32/16"` with `"type": "integer", "format": "uint64/32/16"`, replace `"$ref": "#/definitions/EncodedPubkey/Hash/Value/ByteArray"` with `"type": "string"` -2. `python updatedict.py swagger2.json swagger3.json` adds BigInt to `/definitions/UInt`, makes all implicit `int64`s explicit `uint64`s -3. replace `"$ref": "#/definitions/TxBlockHeight"` with `"$ref": "#/definitions/UInt"` -4. Inconsistency between `OracleResponse/OracleRespond` -5. generate the client (using [go-swagger](https://github.com/go-swagger/go-swagger)) - +The node's `node.json` cannot be used out of the box. +1. `python3 updatedict.py node.json node-temp.json` + - replaces `"$ref": "#/definitions/UInt64/32/16"` with `"type": "integer", "format": "uint64/32/16"` + - replaces `"$ref": "#/definitions/EncodedPubkey/Hash/Value/ByteArray"` with `"type": "string"` + - replaces `#/definitions/TxBlockHeight` with `#/definitions/UInt` + - replaces `OracleResponseTxJSON` with `OracleRespondTxJSON` (https://github.com/aeternity/aeternity/issues/2799) + - adds BigInt to `/definitions/UInt` + - makes all implicit `int64`s explicit `uint64`s + - remove maximum for uint64 because go-swagger converts it to float +2. generate the client (using [go-swagger](https://github.com/go-swagger/go-swagger)) ``` - rm -rf swagguard/node/* && swagger generate client -f api/swagger3.json -A node --with-flatten=minimal --target swagguard/node --tags=external --api-package=operations --client-package=client + rm -rf ../swagguard/node/* && swagger generate client -f node-temp.json -A node --with-flatten=minimal --target ../swagguard/node --tags=external --api-package=operations --client-package=client ``` -6. The node replies with a Generic Transaction but specifies type: "SpendTx" instead of "SpendTxJSON", so the stock generic_tx.go does not pick it up. -TODO: investigate why Python and JS SDKs have no problem with this -`python api/generic_tx_json_fix.py swagguard/node/models/` to bulk edit all `_tx_json.go` files: their `Type()` should return "*Tx" instead of "*TxJSON" -Manually add `generic_tx.go unmarshalGenericTx()`: `case "ChannelCloseMutualTxJSON": add "ChannelCloseMutualTx"` etc for other Tx types +3. The node replies with a Generic Transaction but specifies type: "SpendTx" instead of "SpendTxJSON", so the stock generic_tx.go does not pick it up. + +TODO: investigate why Python SDK have no problem with this - generic_tx_json_fix.py fixes the `*TxJSON` problem partially - you still need to edit generic_tx.go +`python3 generic_tx_json_fix.py ../swagguard/node/models/` to bulk edit all `_tx_json.go` files: their `Type()` should return "*Tx" instead of "*TxJSON" -7. remember to add .String() to Error +4. Manually add `generic_tx.go unmarshalGenericTx()`: `case "ChannelCloseMutualTxJSON": add "ChannelCloseMutualTx"` etc for other Tx types + `generic_tx_json_fix.py` fixes the `*TxJSON` problem partially - you still need to edit generic_tx.go + +5. remember to add .String() to Error (https://github.com/go-swagger/go-swagger/issues/872) # Compiler ``` -rm -rf swagguard/compiler/* && swagger generate client -f api/compiler.json -A compiler --with-flatten=minimal --target swagguard/compiler -``` \ No newline at end of file +rm -rf ../swagguard/compiler/* && swagger generate client -f compiler.json -A compiler --with-flatten=minimal --target ../swagguard/compiler +``` + + +# go-swagger +The last time was used: +``` +$ swagger version +version: v0.27.0 +commit: 43c2774170504d87b104e3e4d68626aac2cd447d +``` diff --git a/api/compiler.json b/api/compiler.json index 4576f141..a8aa6875 100644 --- a/api/compiler.json +++ b/api/compiler.json @@ -1,851 +1,1027 @@ { - "basePath": "/", - "definitions": { - "ACI": { - "example": { - "encoded_aci": "{}", - "interface": "interface" - }, - "properties": { - "encoded_aci": { - "properties": {}, - "type": "object" - }, - "interface": { - "type": "string" - } - }, - "required": [ - "encoded_aci", - "interface" - ], - "type": "object" + "basePath": "/", + "definitions": { + "ACI": { + "example": { + "encoded_aci": "{}", + "external_encoded_aci": "", + "interface": "interface" + }, + "properties": { + "encoded_aci": { + "properties": {}, + "type": "object" }, - "API": { - "description": "Swagger API description", - "type": "object" + "external_encoded_aci": { + "type": "array", + "items": { + "type": "object", + "properties": {} + } }, - "APIVersion": { - "example": { - "api-version": "api-version" - }, - "properties": { - "api-version": { - "description": "API compiler version", - "type": "string" - } - }, - "required": [ - "api-version" - ], - "type": "object" + "interface": { + "type": "string" + } + }, + "required": [ + "encoded_aci", + "interface" + ], + "type": "object" + }, + "API": { + "description": "Swagger API description", + "type": "object" + }, + "APIVersion": { + "example": { + "api-version": "api-version" + }, + "properties": { + "api-version": { + "description": "API compiler version", + "type": "string" + } + }, + "required": [ + "api-version" + ], + "type": "object" + }, + "ByteCode": { + "example": { + "bytecode": {} + }, + "properties": { + "bytecode": { + "$ref": "#/definitions/EncodedByteArray" + } + }, + "required": [ + "bytecode" + ], + "type": "object" + }, + "ByteCodeInput": { + "example": { + "bytecode": {} + }, + "properties": { + "bytecode": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Compiled contract" + } + }, + "required": [ + "bytecode" + ], + "type": "object" + }, + "BytecodeCallResultInput": { + "example": { + "backend": "fate", + "bytecode": {}, + "call-result": "call-result", + "call-value": "call-value", + "function": "function" + }, + "properties": { + "backend": { + "description": "Compiler backend; fate | aevm", + "enum": [ + "fate", + "aevm" + ], + "type": "string" }, - "ByteCode": { - "example": { - "bytecode": {} - }, - "properties": { - "bytecode": { - "$ref": "#/definitions/EncodedByteArray" - } - }, - "required": [ - "bytecode" - ], - "type": "object" + "bytecode": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Compiled contract" }, - "BytecodeCallResultInput": { - "example": { - "backend": "fate", - "bytecode": {}, - "call-result": "call-result", - "call-value": "call-value", - "function": "function" - }, - "properties": { - "backend": { - "description": "Compiler backend; fate | aevm", - "enum": [ - "fate", - "aevm" - ], - "type": "string" - }, - "bytecode": { - "$ref": "#/definitions/EncodedByteArray", - "description": "Compiled contract" - }, - "call-result": { - "description": "Call result type (ok | revert | error)", - "type": "string" - }, - "call-value": { - "description": "Call result value (ABI encoded data or error string)", - "type": "string" - }, - "function": { - "description": "Name of the called function", - "type": "string" - } - }, - "required": [ - "bytecode", - "call-result", - "call-value", - "function" - ], - "type": "object" + "call-result": { + "description": "Call result type (ok | revert | error)", + "type": "string" }, - "Calldata": { - "example": { - "calldata": {} - }, - "properties": { - "calldata": { - "$ref": "#/definitions/EncodedByteArray" - } - }, - "required": [ - "calldata" - ], - "type": "object" + "call-value": { + "description": "Call result value (ABI encoded data or error string)", + "type": "string" }, - "CompileOpts": { - "example": { - "backend": "fate", - "file_system": "{}", - "src_file": "src_file" - }, - "properties": { - "backend": { - "description": "Compiler backend; fate | aevm", - "enum": [ - "fate", - "aevm" - ], - "type": "string" - }, - "file_system": { - "description": "An explicit file system, mapping file names to file content", - "properties": {}, - "type": "object" - }, - "src_file": { - "description": "Name of contract source file - only used in error messages", - "type": "string" - } - }, - "type": "object" + "function": { + "description": "Name of the called function", + "type": "string" + } + }, + "required": [ + "bytecode", + "call-result", + "call-value", + "function" + ], + "type": "object" + }, + "Calldata": { + "example": { + "calldata": {} + }, + "properties": { + "calldata": { + "$ref": "#/definitions/EncodedByteArray" + } + }, + "required": [ + "calldata" + ], + "type": "object" + }, + "CompileOpts": { + "example": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" + }, + "properties": { + "backend": { + "description": "Compiler backend; fate | aevm", + "enum": [ + "fate", + "aevm" + ], + "type": "string" }, - "CompilerError": { - "properties": { - "context": { - "type": "string" - }, - "message": { - "type": "string" - }, - "pos": { - "$ref": "#/definitions/ErrorPos" - }, - "type": { - "type": "string" - } - }, - "required": [ - "message", - "pos", - "type" - ], - "type": "object" + "file_system": { + "description": "An explicit file system, mapping file names to file content", + "properties": {}, + "type": "object" }, - "CompilerErrors": { - "items": { - "$ref": "#/definitions/CompilerError" - }, - "type": "array" - }, - "CompilerVersion": { - "example": { - "version": "version" - }, - "properties": { - "version": { - "description": "Sophia compiler version", - "type": "string" - } - }, - "required": [ - "version" - ], - "type": "object" + "src_file": { + "description": "Name of contract source file - only used in error messages", + "type": "string" + } + }, + "type": "object" + }, + "CompilerError": { + "properties": { + "context": { + "type": "string" }, - "Contract": { - "example": { - "code": "code", - "options": { - "backend": "fate", - "file_system": "{}", - "src_file": "src_file" - } - }, - "properties": { - "code": { - "type": "string" - }, - "options": { - "$ref": "#/definitions/CompileOpts" - } - }, - "required": [ - "code", - "options" - ], - "type": "object" + "message": { + "type": "string" }, - "DecodeCalldataBytecode": { - "example": { - "backend": "fate", - "bytecode": null, - "calldata": {} - }, - "properties": { - "backend": { - "description": "Compiler backend; fate | aevm", - "enum": [ - "fate", - "aevm" - ], - "type": "string" - }, - "bytecode": { - "$ref": "#/definitions/EncodedByteArray", - "description": "Compiled contract" - }, - "calldata": { - "$ref": "#/definitions/EncodedByteArray", - "description": "Calldata to dissect" - } - }, - "required": [ - "bytecode", - "calldata" - ], - "type": "object" + "pos": { + "$ref": "#/definitions/ErrorPos" }, - "DecodeCalldataSource": { - "example": { - "calldata": {}, - "function": "function", - "options": { - "backend": "fate", - "file_system": "{}", - "src_file": "src_file" - }, - "source": "source" - }, - "properties": { - "calldata": { - "$ref": "#/definitions/EncodedByteArray", - "description": "Calldata to dissect" - }, - "function": { - "description": "Name of the function to call", - "type": "string" - }, - "options": { - "$ref": "#/definitions/CompileOpts" - }, - "source": { - "description": "(Possibly partial) Sophia contract code", - "type": "string" - } - }, - "required": [ - "calldata", - "function", - "source" - ], - "type": "object" + "type": { + "type": "string" + } + }, + "required": [ + "message", + "pos", + "type" + ], + "type": "object" + }, + "CompilerErrors": { + "items": { + "$ref": "#/definitions/CompilerError" + }, + "type": "array" + }, + "CompilerVersion": { + "example": { + "version": "version" + }, + "properties": { + "version": { + "description": "Sophia compiler version", + "type": "string" + } + }, + "required": [ + "version" + ], + "type": "object" + }, + "Contract": { + "example": { + "code": "code", + "options": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" + } + }, + "properties": { + "code": { + "type": "string" }, - "DecodedCalldata": { - "example": { - "arguments": [ - "{}", - "{}" - ], - "function": "function" - }, - "properties": { - "arguments": { - "items": { - "properties": {}, - "type": "object" - }, - "type": "array" - }, - "function": { - "type": "string" - } - }, - "required": [ - "arguments", - "function" - ], - "type": "object" + "options": { + "$ref": "#/definitions/CompileOpts" + } + }, + "required": [ + "code", + "options" + ], + "type": "object" + }, + "DecodeCalldataBytecode": { + "example": { + "backend": "fate", + "bytecode": null, + "calldata": {} + }, + "properties": { + "backend": { + "description": "Compiler backend; fate | aevm", + "enum": [ + "fate", + "aevm" + ], + "type": "string" + }, + "bytecode": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Compiled contract" }, - "DecodedCallresult": { - "example": { - "function": "function", - "result": "{}" - }, - "properties": { - "function": { - "type": "string" - }, - "result": { - "properties": {}, - "type": "object" - } - }, - "required": [ - "function", - "result" - ], + "calldata": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Calldata to dissect" + } + }, + "required": [ + "bytecode", + "calldata" + ], + "type": "object" + }, + "DecodeCalldataSource": { + "example": { + "calldata": {}, + "function": "function", + "options": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" + }, + "source": "source" + }, + "properties": { + "calldata": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Calldata to dissect" + }, + "function": { + "description": "Name of the function to call", + "type": "string" + }, + "options": { + "$ref": "#/definitions/CompileOpts" + }, + "source": { + "description": "(Possibly partial) Sophia contract code", + "type": "string" + } + }, + "required": [ + "calldata", + "function", + "source" + ], + "type": "object" + }, + "DecodedCalldata": { + "example": { + "arguments": [ + "{}", + "{}" + ], + "function": "function" + }, + "properties": { + "arguments": { + "items": { + "properties": {}, "type": "object" + }, + "type": "array" + }, + "function": { + "type": "string" + } + }, + "required": [ + "arguments", + "function" + ], + "type": "object" + }, + "DecodedCallresult": { + "example": { + "function": "function", + "result": "{}" + }, + "properties": { + "function": { + "type": "string" + }, + "result": { + "properties": {}, + "type": "object" + } + }, + "required": [ + "function", + "result" + ], + "type": "object" + }, + "EncodedByteArray": { + "description": "Prefixed (cb_) Base64Check encoded byte array", + "type": "string" + }, + "Error": { + "properties": { + "reason": { + "type": "string" + } + }, + "required": [ + "reason" + ], + "type": "object" + }, + "ErrorPos": { + "properties": { + "col": { + "type": "integer" + }, + "file": { + "type": "string" }, - "EncodedByteArray": { - "description": "Prefixed (cb_) Base64Check encoded byte array", + "line": { + "type": "integer" + } + }, + "required": [ + "col", + "line" + ], + "type": "object" + }, + "FateAssembler": { + "example": { + "fate-assembler": "fate-assembler" + }, + "properties": { + "fate-assembler": { + "description": "Fate assembler code", + "type": "string" + } + }, + "required": [ + "fate-assembler" + ], + "type": "object" + }, + "FunctionCallInput": { + "example": { + "arguments": [ + "arguments", + "arguments" + ], + "function": "function", + "options": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" + }, + "source": "source" + }, + "properties": { + "arguments": { + "description": "Array of function call arguments", + "items": { "type": "string" + }, + "type": "array" }, - "Error": { - "properties": { - "reason": { - "type": "string" - } - }, - "required": [ - "reason" - ], - "type": "object" + "function": { + "description": "Name of function to call", + "type": "string" }, - "ErrorPos": { - "properties": { - "col": { - "type": "integer" - }, - "file": { - "type": "string" - }, - "line": { - "type": "integer" - } - }, - "required": [ - "col", - "line" - ], - "type": "object" + "options": { + "$ref": "#/definitions/CompileOpts" }, - "FunctionCallInput": { - "example": { - "arguments": [ - "arguments", - "arguments" - ], - "function": "function", - "options": { - "backend": "fate", - "file_system": "{}", - "src_file": "src_file" - }, - "source": "source" - }, - "properties": { - "arguments": { - "description": "Array of function call arguments", - "items": { - "type": "string" - }, - "type": "array" - }, - "function": { - "description": "Name of function to call", - "type": "string" - }, - "options": { - "$ref": "#/definitions/CompileOpts" - }, - "source": { - "description": "(Possibly partial) Sophia contract code", - "type": "string" - } - }, - "required": [ - "arguments", - "function", - "source" - ], - "type": "object" + "source": { + "description": "(Possibly partial) Sophia contract code", + "type": "string" + } + }, + "required": [ + "arguments", + "function", + "source" + ], + "type": "object" + }, + "SophiaBinaryData": { + "example": { + "data": "data", + "sophia-type": "sophia-type" + }, + "properties": { + "data": { + "type": "string" }, - "SophiaBinaryData": { - "example": { - "data": "data", - "sophia-type": "sophia-type" - }, - "properties": { - "data": { - "type": "string" - }, - "sophia-type": { - "type": "string" - } - }, - "required": [ - "data", - "sophia-type" - ], - "type": "object" + "sophia-type": { + "type": "string" + } + }, + "required": [ + "data", + "sophia-type" + ], + "type": "object" + }, + "SophiaCallResult": {}, + "SophiaCallResultInput": { + "example": { + "call-result": "call-result", + "call-value": "call-value", + "function": "function", + "options": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" }, - "SophiaCallResult": {}, - "SophiaCallResultInput": { - "example": { - "call-result": "call-result", - "call-value": "call-value", - "function": "function", - "options": { - "backend": "fate", - "file_system": "{}", - "src_file": "src_file" - }, - "source": "source" - }, - "properties": { - "call-result": { - "description": "Call result type (ok | revert | error)", - "type": "string" - }, - "call-value": { - "description": "Call result value (ABI encoded data or error string)", - "type": "string" - }, - "function": { - "description": "Name of the called function", - "type": "string" - }, - "options": { - "$ref": "#/definitions/CompileOpts" - }, - "source": { - "description": "(Possibly partial) Sophia contract code/interface", - "type": "string" - } - }, - "required": [ - "call-result", - "call-value", - "function", - "source" - ], - "type": "object" + "source": "source" + }, + "properties": { + "call-result": { + "description": "Call result type (ok | revert | error)", + "type": "string" }, - "SophiaJsonData": { - "example": { - "data": "{}" - }, - "properties": { - "data": { - "properties": {}, - "type": "object" - } - }, - "required": [ - "data" - ], - "type": "object" + "call-value": { + "description": "Call result value (ABI encoded data or error string)", + "type": "string" + }, + "function": { + "description": "Name of the called function", + "type": "string" + }, + "options": { + "$ref": "#/definitions/CompileOpts" + }, + "source": { + "description": "(Possibly partial) Sophia contract code/interface", + "type": "string" } + }, + "required": [ + "call-result", + "call-value", + "function", + "source" + ], + "type": "object" }, - "info": { - "contact": { - "email": "apiteam@aeternity.com" - }, - "description": "This is the [Aeternity](https://www.aeternity.com/) compiler API.", - "termsOfService": "https://www.aeternity.com/terms/", - "title": "Aeternity node", - "version": "4.0.0-rc5" - }, - "paths": { - "/aci": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Generate an Aeternity Contract Interface (ACI) for contract", - "operationId": "GenerateACI", - "parameters": [ - { - "description": "contract code", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Contract" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "ACI for contract", - "schema": { - "$ref": "#/definitions/ACI" - } - }, - "400": { - "description": "Compiler errors", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/api": { - "get": { - "description": "Get the Api description", - "operationId": "Api", - "parameters": [], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "API description", - "schema": { - "$ref": "#/definitions/API" - } - }, - "400": { - "description": "Error", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - }, - "/api-version": { - "get": { - "description": "Get the version of the API", - "operationId": "APIVersion", - "parameters": [], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Sophia compiler version", - "schema": { - "$ref": "#/definitions/APIVersion" - } - }, - "500": { - "description": "Error", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - }, - "/compile": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Compile a sophia contract from source and return byte code", - "operationId": "CompileContract", - "parameters": [ - { - "description": "contract code", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Contract" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Byte code response", - "schema": { - "$ref": "#/definitions/ByteCode" - } - }, - "400": { - "description": "Invalid contract", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/decode-call-result": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Decode the result of contract call", - "operationId": "DecodeCallResult", - "parameters": [ - { - "description": "Binary data in Sophia ABI format", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SophiaCallResultInput" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Json encoded data", - "schema": { - "$ref": "#/definitions/SophiaCallResult" - } - }, - "400": { - "description": "Invalid data", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/decode-call-result/bytecode": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Decode the result of contract call from Bytecode", - "operationId": "DecodeCallResultBytecode", - "parameters": [ - { - "description": "Call result + compiled contract", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/BytecodeCallResultInput" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Json encoded data", - "schema": { - "$ref": "#/definitions/DecodedCallresult" - } - }, - "400": { - "description": "Invalid data", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/decode-calldata/bytecode": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Identify function name and arguments in Calldata for a compiled contract", - "operationId": "DecodeCalldataBytecode", - "parameters": [ - { - "description": "Calldata + compiled contract", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DecodeCalldataBytecode" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Binary encoded calldata", - "schema": { - "$ref": "#/definitions/DecodedCalldata" - } - }, - "400": { - "description": "Invalid contract", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - }, - "/decode-calldata/source": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Identify function name and arguments in Calldata for a (partial) contract", - "operationId": "DecodeCalldataSource", - "parameters": [ - { - "description": "Calldata + contract (stub) code", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/DecodeCalldataSource" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Binary encoded calldata", - "schema": { - "$ref": "#/definitions/DecodedCalldata" - } - }, - "400": { - "description": "Invalid data", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/decode-data": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Decode data as retuned by a contract call. - Legacy decoding", - "operationId": "DecodeData", - "parameters": [ - { - "description": "Binary data in Sophia ABI format", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/SophiaBinaryData" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Json encoded data", - "schema": { - "$ref": "#/definitions/SophiaJsonData" - } - }, - "400": { - "description": "Invalid data", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/encode-calldata": { - "post": { - "consumes": [ - "application/json" - ], - "description": "Encode Sophia function call according to sophia ABI.", - "operationId": "EncodeCalldata", - "parameters": [ - { - "description": "Sophia function call - contract code + function name + arguments", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/FunctionCallInput" - } - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Binary encoded calldata", - "schema": { - "$ref": "#/definitions/Calldata" - } - }, - "400": { - "description": "Invalid contract", - "schema": { - "$ref": "#/definitions/CompilerErrors" - } - } - } - } - }, - "/version": { - "get": { - "description": "Get the version of the underlying Sophia compiler version", - "operationId": "Version", - "parameters": [], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Sophia compiler version", - "schema": { - "$ref": "#/definitions/CompilerVersion" - } - }, - "500": { - "description": "Error", - "schema": { - "$ref": "#/definitions/Error" - } - } - } - } - } - }, - "schemes": [ - "http" - ], - "swagger": "2.0" -} \ No newline at end of file + "SophiaJsonData": { + "example": { + "data": "{}" + }, + "properties": { + "data": { + "properties": {}, + "type": "object" + } + }, + "required": [ + "data" + ], + "type": "object" + }, + "ValidateByteCodeInput": { + "example": { + "bytecode": {}, + "options": { + "backend": "fate", + "file_system": "{}", + "src_file": "src_file" + }, + "source": "source" + }, + "properties": { + "bytecode": { + "$ref": "#/definitions/EncodedByteArray", + "description": "Compiled contract" + }, + "options": { + "$ref": "#/definitions/CompileOpts" + }, + "source": { + "description": "Sophia contract source code", + "type": "string" + } + }, + "required": [ + "bytecode", + "options", + "source" + ], + "type": "object" + } + }, + "info": { + "contact": { + "email": "apiteam@aeternity.com" + }, + "description": "This is the [Aeternity](https://www.aeternity.com/) compiler API.", + "termsOfService": "https://www.aeternity.com/terms/", + "title": "Aeternity node", + "version": "6.0.0" + }, + "paths": { + "/aci": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Generate an Aeternity Contract Interface (ACI) for contract", + "operationId": "GenerateACI", + "parameters": [ + { + "description": "contract code", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Contract" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "ACI for contract", + "schema": { + "$ref": "#/definitions/ACI" + } + }, + "400": { + "description": "Compiler errors", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/api": { + "get": { + "description": "Get the Api description", + "operationId": "Api", + "parameters": [], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "API description", + "schema": { + "$ref": "#/definitions/API" + } + }, + "400": { + "description": "Error", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/api-version": { + "get": { + "description": "Get the version of the API", + "operationId": "APIVersion", + "parameters": [], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Sophia compiler version", + "schema": { + "$ref": "#/definitions/APIVersion" + } + }, + "500": { + "description": "Error", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/compile": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Compile a sophia contract from source and return byte code", + "operationId": "CompileContract", + "parameters": [ + { + "description": "contract code", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/Contract" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Byte code response", + "schema": { + "$ref": "#/definitions/ByteCode" + } + }, + "400": { + "description": "Invalid contract", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/compiler-version": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Extract compiler version from bytecode", + "operationId": "GetCompilerVersion", + "parameters": [ + { + "description": "contract byte array", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ByteCodeInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "The compiler version", + "schema": { + "$ref": "#/definitions/CompilerVersion" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/decode-call-result": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Decode the result of contract call", + "operationId": "DecodeCallResult", + "parameters": [ + { + "description": "Binary data in Sophia ABI format", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SophiaCallResultInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Json encoded data", + "schema": { + "$ref": "#/definitions/SophiaCallResult" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/decode-call-result/bytecode": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Decode the result of contract call from Bytecode", + "operationId": "DecodeCallResultBytecode", + "parameters": [ + { + "description": "Call result + compiled contract", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/BytecodeCallResultInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Json encoded data", + "schema": { + "$ref": "#/definitions/DecodedCallresult" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/decode-calldata/bytecode": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Identify function name and arguments in Calldata for a compiled contract", + "operationId": "DecodeCalldataBytecode", + "parameters": [ + { + "description": "Calldata + compiled contract", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DecodeCalldataBytecode" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Binary encoded calldata", + "schema": { + "$ref": "#/definitions/DecodedCalldata" + } + }, + "400": { + "description": "Invalid contract", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/decode-calldata/source": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Identify function name and arguments in Calldata for a (partial) contract", + "operationId": "DecodeCalldataSource", + "parameters": [ + { + "description": "Calldata + contract (stub) code", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/DecodeCalldataSource" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Binary encoded calldata", + "schema": { + "$ref": "#/definitions/DecodedCalldata" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/decode-data": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Decode data as retuned by a contract call. - Legacy decoding", + "operationId": "DecodeData", + "parameters": [ + { + "description": "Binary data in Sophia ABI format", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/SophiaBinaryData" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Json encoded data", + "schema": { + "$ref": "#/definitions/SophiaJsonData" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/encode-calldata": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Encode Sophia function call according to sophia ABI.", + "operationId": "EncodeCalldata", + "parameters": [ + { + "description": "Sophia function call - contract code + function name + arguments", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/FunctionCallInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Binary encoded calldata", + "schema": { + "$ref": "#/definitions/Calldata" + } + }, + "400": { + "description": "Invalid contract", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/fate-assembler": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Get FATE assembler code from bytecode", + "operationId": "GetFateAssemblerCode", + "parameters": [ + { + "description": "contract byte array", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ByteCodeInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "The FATE assembler", + "schema": { + "$ref": "#/definitions/FateAssembler" + } + }, + "400": { + "description": "Invalid data", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, + "/validate-byte-code": { + "post": { + "consumes": [ + "application/json" + ], + "description": "Verify that an encoded byte array is the result of compiling a given contract", + "operationId": "ValidateByteCode", + "parameters": [ + { + "description": "contract byte array and source code", + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ValidateByteCodeInput" + } + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Validation successful" + }, + "400": { + "description": "Invalid contract", + "schema": { + "$ref": "#/definitions/CompilerErrors" + } + } + } + } + }, + "/version": { + "get": { + "description": "Get the version of the underlying Sophia compiler version", + "operationId": "Version", + "parameters": [], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "Sophia compiler version", + "schema": { + "$ref": "#/definitions/CompilerVersion" + } + }, + "500": { + "description": "Error", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + } + }, + "schemes": [ + "http" + ], + "swagger": "2.0" +} diff --git a/api/swagger.json b/api/node.json similarity index 82% rename from api/swagger.json rename to api/node.json index f4b5f080..16db5dbb 100644 --- a/api/swagger.json +++ b/api/node.json @@ -2,7 +2,7 @@ "swagger": "2.0", "info": { "description": "This is the [Aeternity](https://www.aeternity.com/) node API.", - "version": "5.0.0-rc.4", + "version": "6.0.0", "title": "Aeternity node", "termsOfService": "https://www.aeternity.com/terms/", "contact": { @@ -139,7 +139,7 @@ "type": "object", "properties": { "hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" } } } @@ -172,8 +172,7 @@ "type": "object", "properties": { "height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } } } @@ -281,7 +280,8 @@ "description": "The height", "required": true, "type": "integer", - "format": "uint64" + "minimum": 0, + "maximum": 18446744073709551615 } ], "responses": { @@ -500,8 +500,7 @@ "properties": { "count": { "description": "Count", - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" } } } @@ -609,7 +608,8 @@ "description": "The height", "required": true, "type": "integer", - "format": "uint64" + "minimum": 0, + "maximum": 18446744073709551615 } ], "responses": { @@ -695,7 +695,8 @@ "description": "The height", "required": true, "type": "integer", - "format": "uint64" + "minimum": 0, + "maximum": 18446744073709551615 } ], "responses": { @@ -811,6 +812,47 @@ } } }, + "/dry-run": { + "post": { + "tags": [ + "external", + "dry-run" + ], + "operationId": "ProtectedDryRunTxs", + "description": "Dry-run transactions on top of a given block. Supports all TXs except GAMetaTx, PayingForTx and OffchainTx. The maximum gas limit of all calls is capped. The maximum gas limit per request is a global node setting. Since DryRunCallReq object do not have a mandatory gas field, if not set a default value of 1000000 is being used instead.", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "transactions", + "required": true, + "schema": { + "$ref": "#/definitions/DryRunInput" + } + } + ], + "responses": { + "200": { + "description": "Dry-run result", + "schema": { + "$ref": "#/definitions/DryRunResults" + } + }, + "403": { + "description": "Invalid input", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, "/transactions/{hash}": { "get": { "tags": [ @@ -1016,45 +1058,6 @@ } } }, - "/contracts/{pubkey}/store": { - "get": { - "tags": [ - "external", - "contract" - ], - "operationId": "GetContractStore", - "description": "Get contract store by pubkey", - "produces": [ - "application/json" - ], - "parameters": [ - { - "in": "path", - "name": "pubkey", - "description": "The pubkey of the contract", - "required": true, - "type": "string" - } - ], - "responses": { - "200": { - "description": "Contract Store", - "schema": { - "$ref": "#/definitions/ContractStore" - } - }, - "400": { - "description": "Invalid pubkey", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Contract not found" - } - } - } - }, "/contracts/{pubkey}/poi": { "get": { "tags": [ @@ -1172,13 +1175,15 @@ "required": false, "type": "integer", "minimum": 1, - "maximum": 1000 + "maximum": 1000, + "default": 20 }, { "in": "query", "name": "type", "description": "The type of a query: open, closed or all", "required": false, + "default": "all", "type": "string", "enum": [ "open", @@ -1386,6 +1391,60 @@ } } }, + "/status/chain-ends": { + "get": { + "tags": [ + "external", + "chain" + ], + "operationId": "GetChainEnds", + "description": "Get oldest keyblock hashes counting from genesis including orphans", + "produces": [ + "application/json" + ], + "parameters": [], + "responses": { + "200": { + "description": "Successful operation", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/EncodedHash" + } + } + } + } + } + }, + "/debug/network": { + "get": { + "tags": [ + "internal", + "node_info", + "debug" + ], + "operationId": "GetNetworkStatus", + "description": "Get detailed analytics on peers", + "produces": [ + "application/json" + ], + "parameters": [], + "responses": { + "404": { + "description": "Analytics disabled", + "schema": { + "$ref": "#/definitions/Error" + } + }, + "200": { + "description": "Successful operation", + "schema": { + "$ref": "#/definitions/NetworkStatus" + } + } + } + } + }, "/debug/contracts/create": { "post": { "tags": [ @@ -1677,6 +1736,9 @@ ], "operationId": "PostNamePreclaim", "description": "Get a name_preclaim transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1721,6 +1783,9 @@ ], "operationId": "PostNameClaim", "description": "Get a name_claim transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1765,6 +1830,9 @@ ], "operationId": "PostNameUpdate", "description": "Get a name_update transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1809,6 +1877,9 @@ ], "operationId": "PostNameTransfer", "description": "Get a name_transfer transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1853,6 +1924,9 @@ ], "operationId": "PostNameRevoke", "description": "Get a name_revoke transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1945,6 +2019,9 @@ ], "operationId": "PostChannelCreate", "description": "Get a channel_create transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1989,6 +2066,9 @@ ], "operationId": "PostChannelDeposit", "description": "Get a channel_deposit transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2027,6 +2107,9 @@ ], "operationId": "PostChannelWithdraw", "description": "Get a channel_withdrawal transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2065,6 +2148,9 @@ ], "operationId": "PostChannelSnapshotSolo", "description": "Get a channel_snapshot_solo transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2094,6 +2180,47 @@ } } }, + "/debug/channels/set-delegates": { + "post": { + "tags": [ + "internal", + "channel", + "debug" + ], + "operationId": "PostChannelSetDelegates", + "description": "Get a channel_set_delegates_tx transaction object", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ChannelSetDelegatesTx" + } + } + ], + "responses": { + "200": { + "description": "Successful operation", + "schema": { + "$ref": "#/definitions/UnsignedTx" + } + }, + "400": { + "description": "Invalid transaction", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, "/debug/channels/close/mutual": { "post": { "tags": [ @@ -2103,6 +2230,9 @@ ], "operationId": "PostChannelCloseMutual", "description": "Get a channel_close_mutual transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2141,6 +2271,9 @@ ], "operationId": "PostChannelCloseSolo", "description": "Get a channel_close_solo transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2179,6 +2312,9 @@ ], "operationId": "PostChannelSlash", "description": "Get a channel_slash transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2217,6 +2353,9 @@ ], "operationId": "PostChannelSettle", "description": "Get a channel_settle transaction object", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -2295,7 +2434,6 @@ "description": "Salt", "required": true, "type": "integer", - "format": "uint64", "minimum": 0 } ], @@ -2409,7 +2547,7 @@ "debug" ], "operationId": "DryRunTxs", - "description": "Dry-run transactions on top of a given block. Supports SpendTx, ContractCreateTx and ContractCallTx", + "description": "Dry-run transactions on top of a given block. Supports all TXs except GAMetaTx, PayingForTx and OffchainTx.", "consumes": [ "application/json" ], @@ -2443,6 +2581,54 @@ } } }, + "/debug/transactions/paying-for": { + "post": { + "tags": [ + "internal", + "transaction", + "debug" + ], + "operationId": "PostPayingFor", + "description": "Get a paying-for transaction object", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "description": "transactions", + "required": true, + "schema": { + "$ref": "#/definitions/PayingForTx" + } + } + ], + "responses": { + "200": { + "description": "Successful operation", + "schema": { + "$ref": "#/definitions/UnsignedTx" + } + }, + "400": { + "description": "Invalid transaction", + "schema": { + "$ref": "#/definitions/Error" + } + }, + "404": { + "description": "Payer account not found", + "schema": { + "$ref": "#/definitions/Error" + } + } + } + } + }, "/debug/token-supply/height/{height}": { "get": { "tags": [ @@ -2461,7 +2647,8 @@ "description": "The height", "required": true, "type": "integer", - "format": "uint64" + "minimum": 0, + "maximum": 18446744073709551615 } ], "responses": { @@ -2484,38 +2671,27 @@ "definitions": { "UInt": { "type": "integer", - "minimum": 0, - "x-go-type": { - "import": { - "package": "github.com/aeternity/aepp-sdk-go/v8/utils" - }, - "type": "BigInt" - }, - "format": "uint64" + "minimum": 0 }, "UInt16": { "type": "integer", "minimum": 0, - "maximum": 65535, - "format": "uint64" + "maximum": 65535 }, "UInt32": { "type": "integer", "minimum": 0, - "maximum": 4294967295, - "format": "uint64" + "maximum": 4294967295 }, "UInt64": { "type": "integer", "minimum": 0, - "maximum": 18446744073709551615, - "format": "uint64" + "maximum": 18446744073709551615 }, "TxBlockHeight": { "type": "integer", "minimum": -1, - "maximum": 18446744073709551615, - "format": "uint64" + "maximum": 18446744073709551615 }, "EncodedHash": { "description": "Base58Check encoded tagged hash", @@ -2536,8 +2712,7 @@ "Pow": { "type": "array", "items": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" }, "minItems": 42, "maxItems": 42 @@ -2546,48 +2721,43 @@ "type": "object", "properties": { "hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "prev_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "prev_key_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "state_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "miner": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "beneficiary": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "target": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" }, "pow": { "$ref": "#/definitions/Pow" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "time": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "version": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" }, "info": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -2608,38 +2778,35 @@ "type": "object", "properties": { "hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "pof_hash": { "description": "\"no_fraud\" | api encoded Proof of Fraud hash", - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "prev_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "prev_key_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "state_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "txs_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "signature": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "time": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "version": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" } }, "required": [ @@ -2685,7 +2852,7 @@ "properties": { "id": { "description": "Public key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "balance": { "description": "Balance", @@ -2693,8 +2860,7 @@ }, "nonce": { "description": "Nonce", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "payable": { "description": "Payable", @@ -2709,7 +2875,7 @@ }, "contract_id": { "description": "Id of authorization contract for generalized account", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "auth_fun": { "description": "Name of authorization function for generalized account", @@ -2726,7 +2892,7 @@ "type": "object", "properties": { "tx": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -2737,7 +2903,7 @@ "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "query_format": { "type": "string" @@ -2749,12 +2915,10 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" } }, "required": [ @@ -2770,17 +2934,16 @@ "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "sender_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "sender_nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "oracle_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "query": { "type": "string" @@ -2789,8 +2952,7 @@ "type": "string" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "response_ttl": { "$ref": "#/definitions/TTL" @@ -2829,7 +2991,7 @@ "type": "object", "properties": { "recipient_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -2838,18 +3000,16 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "sender_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "payload": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -2876,22 +3036,19 @@ "$ref": "#/definitions/TTL" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" } }, "required": [ @@ -2913,15 +3070,13 @@ "$ref": "#/definitions/RelativeTTL" }, "oracle_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -2934,7 +3089,7 @@ "type": "object", "properties": { "oracle_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "query": { "type": "string" @@ -2952,16 +3107,14 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "sender_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { "description": "Sender nonce", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -2978,7 +3131,7 @@ "type": "object", "properties": { "query_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "response": { "type": "string" @@ -2990,15 +3143,13 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "oracle_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3020,8 +3171,7 @@ ] }, "value": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3039,8 +3189,7 @@ ] }, "value": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3052,11 +3201,13 @@ "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" + }, + "owner": { + "$ref": "#/definitions/EncodedPubkey" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "pointers": { "type": "array", @@ -3075,21 +3226,19 @@ "type": "object", "properties": { "commitment_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3114,15 +3263,13 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3136,11 +3283,10 @@ "type": "object", "properties": { "name_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "name_ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "pointers": { "type": "array", @@ -3149,22 +3295,19 @@ } }, "client_ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3180,24 +3323,22 @@ "type": "object", "properties": { "name_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "recipient_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3211,21 +3352,19 @@ "type": "object", "properties": { "name_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "account_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3238,7 +3377,7 @@ "type": "object", "properties": { "commitment_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" } }, "required": [ @@ -3249,7 +3388,7 @@ "type": "object", "properties": { "name_id": { - "type": "string" + "$ref": "#/definitions/EncodedValue" } }, "required": [ @@ -3263,7 +3402,7 @@ "type": "string" }, "id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } }, "required": [ @@ -3275,13 +3414,13 @@ "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "initiator_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "responder_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "channel_amount": { "$ref": "#/definitions/UInt" @@ -3295,30 +3434,20 @@ "channel_reserve": { "$ref": "#/definitions/UInt" }, - "delegate_ids": { - "type": "array", - "items": { - "type": "string" - } - }, "state_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "round": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "solo_round": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "lock_period": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "locked_until": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3329,7 +3458,6 @@ "initiator_amount", "responder_amount", "channel_reserve", - "delegate_ids", "state_hash", "round", "solo_round", @@ -3341,47 +3469,35 @@ "type": "object", "properties": { "initiator_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "initiator_amount": { "$ref": "#/definitions/UInt" }, "responder_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "responder_amount": { "$ref": "#/definitions/UInt" }, - "push_amount": { - "$ref": "#/definitions/UInt" - }, "channel_reserve": { "$ref": "#/definitions/UInt" }, "lock_period": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "state_hash": { "description": "Root hash of the channel's internal state tree", - "type": "string" - }, - "delegate_ids": { - "type": "array", - "items": { - "type": "string" - } + "$ref": "#/definitions/EncodedHash" } }, "required": [ @@ -3389,7 +3505,6 @@ "initiator_amount", "responder_id", "responder_amount", - "push_amount", "channel_reserve", "lock_period", "fee", @@ -3400,33 +3515,30 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "state_hash": { "description": "Root hash of the channel's internal state tree after the deposit had been applied to it", - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "round": { "description": "Channel's next round", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3443,33 +3555,30 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "to_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "state_hash": { "description": "Root hash of the channel's internal state tree after the withdraw had been applied to it", - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "round": { "description": "Channel's next round", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3486,18 +3595,17 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "payload": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "round": { "description": "Channel's next round", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "update": { "description": "Update to be applied. Must be a OffChainCallContract", @@ -3505,22 +3613,20 @@ }, "state_hash": { "description": "Channel's next state_hash", - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "offchain_trees": { "description": "The whole set of off-chain state trees", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -3537,10 +3643,10 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "initiator_amount_final": { "$ref": "#/definitions/UInt" @@ -3549,16 +3655,13 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3574,28 +3677,26 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "payload": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "poi": { "description": "Proof of inclusion containing information for closing the channel", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -3610,28 +3711,26 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "payload": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "poi": { "description": "Proof of inclusion containing information for closing the channel", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -3646,10 +3745,10 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "initiator_amount_final": { "$ref": "#/definitions/UInt" @@ -3658,15 +3757,13 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3682,24 +3779,22 @@ "type": "object", "properties": { "channel_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "from_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "payload": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "fee": { "$ref": "#/definitions/UInt" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3709,11 +3804,48 @@ "fee" ] }, + "ChannelSetDelegatesTx": { + "type": "object", + "properties": { + "channel_id": { + "$ref": "#/definitions/EncodedPubkey" + }, + "from_id": { + "$ref": "#/definitions/EncodedPubkey" + }, + "state_hash": { + "$ref": "#/definitions/EncodedHash" + }, + "round": { + "$ref": "#/definitions/UInt64" + }, + "payload": { + "$ref": "#/definitions/EncodedByteArray" + }, + "ttl": { + "$ref": "#/definitions/UInt64" + }, + "fee": { + "$ref": "#/definitions/UInt" + }, + "nonce": { + "$ref": "#/definitions/UInt64" + } + }, + "required": [ + "channel_id", + "from_id", + "state_hash", + "round", + "payload", + "fee" + ] + }, "PeerPubKey": { "type": "object", "properties": { "pubkey": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } }, "required": [ @@ -3724,7 +3856,7 @@ "type": "object", "properties": { "pub_key": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } }, "required": [ @@ -3735,15 +3867,13 @@ "type": "object", "properties": { "genesis_key_block_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "solutions": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "difficulty": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "syncing": { "type": "boolean" @@ -3751,8 +3881,8 @@ "sync_progress": { "type": "number", "format": "float", - "minimum": 0, - "maximum": 100 + "minimum": 0.0, + "maximum": 100.0 }, "listening": { "type": "boolean" @@ -3770,25 +3900,25 @@ "type": "string" }, "peer_count": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" + }, + "peer_connections": { + "$ref": "#/definitions/PeerConnections" }, "pending_transactions_count": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" }, "network_id": { "type": "string" }, "peer_pubkey": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "top_key_block_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "top_block_height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3801,6 +3931,7 @@ "node_version", "node_revision", "peer_count", + "peer_connections", "pending_transactions_count", "network_id", "peer_pubkey", @@ -3812,12 +3943,12 @@ "type": "object", "properties": { "version": { - "type": "integer", - "format": "uint32" + "description": "Protocol version (can include protocol activated by miner signalling)", + "$ref": "#/definitions/UInt32" }, "effective_at_height": { - "type": "integer", - "format": "uint64" + "description": "Height at which protocol becomes active", + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -3825,6 +3956,86 @@ "effective_at_height" ] }, + "PeerConnections": { + "type": "object", + "properties": { + "inbound": { + "description": "Number of inbound peer connections", + "$ref": "#/definitions/UInt32" + }, + "outbound": { + "description": "Number of outbound peer connections", + "$ref": "#/definitions/UInt32" + } + }, + "required": [ + "inbound", + "outbound" + ] + }, + "NetworkStatus": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/PeerDetails" + } + }, + "PeerDetails": { + "type": "object", + "properties": { + "host": { + "description": "Hostname of peer", + "type": "string" + }, + "port": { + "description": "Port of peer", + "$ref": "#/definitions/UInt32" + }, + "first_seen": { + "description": "Unix timestamp of when the peer was first pinged", + "$ref": "#/definitions/UInt32" + }, + "last_seen": { + "description": "Unix timestamp of when the peer was last pinged", + "$ref": "#/definitions/UInt32" + }, + "genesis_hash": { + "description": "The genesis hash the remote node reports", + "$ref": "#/definitions/EncodedHash" + }, + "top_hash": { + "description": "The top hash the remote node reports", + "$ref": "#/definitions/EncodedHash" + }, + "top_difficulty": { + "description": "The total top difficulty the node reports", + "$ref": "#/definitions/UInt64" + }, + "network_id": { + "type": "string" + }, + "node_version": { + "type": "string" + }, + "node_revision": { + "type": "string" + }, + "node_vendor": { + "type": "string" + }, + "node_os": { + "type": "string" + } + }, + "required": [ + "host", + "port", + "first_seen", + "last_seen", + "genesis_hash", + "top_hash", + "top_difficulty" + ] + }, "GenericSignedTx": { "type": "object", "properties": { @@ -3832,20 +4043,20 @@ "$ref": "#/definitions/GenericTx" }, "block_height": { - "$ref": "#/definitions/UInt" + "$ref": "#/definitions/TxBlockHeight" }, "block_hash": { "description": "Value \"none\" means no block in the chain includes the transaction", - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "signatures": { "description": "At least one signature is required unless for Generalized Account Meta transactions", "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/EncodedValue" } } }, @@ -3856,13 +4067,32 @@ "hash" ] }, + "SignedTx": { + "type": "object", + "properties": { + "tx": { + "$ref": "#/definitions/GenericTx" + }, + "signatures": { + "description": "At least one signature is required unless for Generalized Account Meta transactions", + "type": "array", + "minItems": 0, + "items": { + "$ref": "#/definitions/EncodedValue" + } + } + }, + "required": [ + "tx", + "signatures" + ] + }, "GenericTx": { "type": "object", "discriminator": "type", "properties": { "version": { - "type": "integer", - "format": "uint32" + "$ref": "#/definitions/UInt32" }, "type": { "type": "string" @@ -4003,7 +4233,7 @@ } ] }, - "OracleRespondTxJSON": { + "OracleResponseTxJSON": { "allOf": [ { "$ref": "#/definitions/GenericTx" @@ -4103,6 +4333,16 @@ } ] }, + "PayingForTxJSON": { + "allOf": [ + { + "$ref": "#/definitions/GenericTx" + }, + { + "$ref": "#/definitions/PayingForTx" + } + ] + }, "TxInfoObject": { "type": "object", "properties": { @@ -4121,25 +4361,22 @@ "type": "object", "properties": { "caller_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "caller_nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "contract_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "gas_price": { "$ref": "#/definitions/UInt" }, "gas_used": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "log": { "type": "array", @@ -4148,7 +4385,7 @@ } }, "return_value": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "return_type": { "description": "The status of the call 'ok | error | revert'.", @@ -4171,21 +4408,19 @@ "type": "object", "properties": { "caller_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "height": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" }, "gas_used": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "return_value": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "return_type": { "description": "The status of the call 'ok | error'.", @@ -4209,7 +4444,7 @@ "properties": { "address": { "description": "Contract address", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "topics": { "description": "Event topics", @@ -4220,7 +4455,7 @@ }, "data": { "description": "Log event data (as contract byte array).", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4244,18 +4479,16 @@ "type": "object", "properties": { "id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "owner_id": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "vm_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "active": { "type": "boolean" @@ -4263,12 +4496,11 @@ "referrer_ids": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } }, "deposit": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" } }, "required": [ @@ -4281,33 +4513,11 @@ "deposit" ] }, - "ContractStore": { - "type": "object", - "properties": { - "store": { - "type": "array", - "items": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - } - } - }, - "required": [ - "store" - ] - }, "ByteCode": { "type": "object", "properties": { "bytecode": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4318,7 +4528,7 @@ "type": "object", "properties": { "top": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "accounts": { "type": "array", @@ -4333,6 +4543,11 @@ "items": { "$ref": "#/definitions/DryRunInputItem" } + }, + "tx_events": { + "type": "boolean", + "default": false, + "description": "Collect and return on-chain tx events that would result from the call" } }, "required": [ @@ -4343,7 +4558,7 @@ "type": "object", "properties": { "tx": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "call_req": { "$ref": "#/definitions/DryRunCallReq" @@ -4354,10 +4569,10 @@ "type": "object", "properties": { "calldata": { - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "contract": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -4366,15 +4581,13 @@ "$ref": "#/definitions/UInt" }, "caller": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "context": { "$ref": "#/definitions/DryRunCallContext" @@ -4388,8 +4601,11 @@ "DryRunCallContext": { "type": "object", "properties": { + "tx": { + "$ref": "#/definitions/EncodedByteArray" + }, "tx_hash": { - "type": "string" + "$ref": "#/definitions/EncodedHash" }, "stateful": { "description": "This call will have effects on the next call in this dry-run (or not)", @@ -4401,7 +4617,7 @@ "type": "object", "properties": { "pub_key": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -4421,6 +4637,13 @@ "items": { "$ref": "#/definitions/DryRunResult" } + }, + "tx_events": { + "type": "array", + "description": "on-chain tx events", + "items": { + "$ref": "#/definitions/TxEvent" + } } }, "required": [ @@ -4448,6 +4671,9 @@ "result" ] }, + "TxEvent": { + "type": "object" + }, "Peer": { "type": "string", "description": "Aeternity node" @@ -4480,26 +4706,23 @@ "properties": { "owner_id": { "description": "Contract owner pub_key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { "description": "Owner's nonce", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "code": { "description": "Contract's code", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "vm_version": { "description": "Virtual machine's version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "abi_version": { "description": "ABI version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "deposit": { "$ref": "#/definitions/UInt" @@ -4508,8 +4731,7 @@ "$ref": "#/definitions/UInt" }, "gas": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" @@ -4518,12 +4740,11 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "call_data": { "description": "Contract call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4544,42 +4765,38 @@ "properties": { "caller_id": { "description": "Contract caller pub_key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { "description": "Caller's nonce", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "contract_id": { "description": "Contract's pub_key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "abi_version": { "description": "ABI version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "fee": { "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "amount": { "$ref": "#/definitions/UInt" }, "gas": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" }, "call_data": { "description": "Contract call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4598,7 +4815,7 @@ "properties": { "tx": { "description": "Unsigned transaction object", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4610,7 +4827,7 @@ "properties": { "tx_hash": { "description": "Hash of a signed transaction", - "type": "string" + "$ref": "#/definitions/EncodedHash" } }, "required": [ @@ -4627,7 +4844,7 @@ "properties": { "contract_id": { "description": "Address of the contract to be created", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } }, "required": [ @@ -4641,7 +4858,7 @@ "properties": { "poi": { "description": "Proof of inclusion", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4657,7 +4874,7 @@ "micro_blocks": { "type": "array", "items": { - "type": "string" + "$ref": "#/definitions/EncodedPubkey" } } }, @@ -4688,11 +4905,11 @@ "properties": { "from": { "description": "Sender of tokens", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "to": { "description": "Receiver of tokens", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -4716,7 +4933,7 @@ "properties": { "to": { "description": "Withdrawer of tokens", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -4739,7 +4956,7 @@ "properties": { "from": { "description": "Depositor of tokens", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "amount": { "$ref": "#/definitions/UInt" @@ -4762,15 +4979,13 @@ "properties": { "owner": { "description": "Contract owner", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "vm_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "code": { "$ref": "#/definitions/ByteCode" @@ -4780,7 +4995,7 @@ }, "call_data": { "description": "Contract call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4804,29 +5019,27 @@ "properties": { "caller": { "description": "Contract caller", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "contract": { "description": "Contract address", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "abi_version": { - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "amount": { "$ref": "#/definitions/UInt" }, "gas": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" }, "call_data": { "description": "Contract call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" } }, "required": [ @@ -4883,30 +5096,26 @@ "properties": { "owner_id": { "description": "Contract owner pub_key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "nonce": { "description": "Owner's nonce", - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "code": { "description": "Contract's code", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "vm_version": { "description": "Virtual machine's version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "abi_version": { "description": "ABI version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "gas": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" @@ -4915,17 +5124,16 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "call_data": { "description": "Contract call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "auth_fun": { "description": "Contract authorization function hash (hex encoded)", "type": "string", - "pattern": "^(0x|0X)?[a-fA-F0-9]+$'" + "pattern": "^(0x|0X)?[a-fA-F0-9]+$" } }, "required": [ @@ -4945,16 +5153,14 @@ "properties": { "ga_id": { "description": "Account owner pub_key", - "type": "string" + "$ref": "#/definitions/EncodedPubkey" }, "abi_version": { "description": "ABI version", - "type": "integer", - "format": "uint16" + "$ref": "#/definitions/UInt16" }, "gas": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "gas_price": { "$ref": "#/definitions/UInt" @@ -4963,12 +5169,11 @@ "$ref": "#/definitions/UInt" }, "ttl": { - "type": "integer", - "format": "uint64" + "$ref": "#/definitions/UInt64" }, "auth_data": { "description": "Contract authorization function call data", - "type": "string" + "$ref": "#/definitions/EncodedByteArray" }, "tx": { "description": "Enclosed signed transaction", @@ -4984,6 +5189,47 @@ "auth_data", "tx" ] + }, + "PayingForTx": { + "type": "object", + "properties": { + "payer_id": { + "$ref": "#/definitions/EncodedPubkey" + }, + "fee": { + "$ref": "#/definitions/UInt" + }, + "nonce": { + "$ref": "#/definitions/UInt64" + }, + "tx": { + "$ref": "#/definitions/SignedTx" + } + }, + "required": [ + "payer_id", + "fee", + "tx" + ] + }, + "DelegatesList": { + "type": "array", + "items": { + "$ref": "#/definitions/EncodedPubkey" + } + }, + "DelegatesObject": { + "type": "object", + "properties": { + "initiator": { + "description": "Initiator's delegates", + "$ref": "#/definitions/DelegatesList" + }, + "responder": { + "description": "Responder's delegates", + "$ref": "#/definitions/DelegatesList" + } + } } }, "externalDocs": { diff --git a/api/simpletextreplacement.sh b/api/simpletextreplacement.sh deleted file mode 100755 index 17ce2601..00000000 --- a/api/simpletextreplacement.sh +++ /dev/null @@ -1,8 +0,0 @@ -sed -e 's/"$ref": "#\/definitions\/UInt64"/"type":"integer", "format":"uint64"/g' $1 | -sed -e 's/"$ref": "#\/definitions\/UInt32"/"type":"integer", "format":"uint32"/g' | -sed -e 's/"$ref": "#\/definitions\/UInt16"/"type":"integer", "format":"uint16"/g' | - -sed -e 's/"$ref": "#\/definitions\/EncodedPubkey"/"type":"string"/g' | -sed -e 's/"$ref": "#\/definitions\/EncodedHash"/"type":"string"/g' | -sed -e 's/"$ref": "#\/definitions\/EncodedValue"/"type":"string"/g' | -sed -e 's/"$ref": "#\/definitions\/EncodedByteArray"/"type":"string"/g' diff --git a/api/updatedict.py b/api/updatedict.py index 534d2b2d..1e93630c 100644 --- a/api/updatedict.py +++ b/api/updatedict.py @@ -1,64 +1,56 @@ -from pprint import pprint -from dotted.collection import DottedDict import json import argparse -json_objects = [] -json_leaves = [] -def traverse(data, parents): - for key in data: - # If we're in an "example": {"fee": 5} object, don't traverse into it. - if key == "example": - continue - if not isinstance(data[key], dict): - json_leaves.append(".".join(parents + [key])) - continue - - json_objects.append(".".join(parents + [key])) - parents.append(key) - traverse(data[key], parents) - - try: - parents.pop() - except IndexError: - # We have reached the JSON's root. - pass - -def no_implicit_int64(data): - swaggerD = DottedDict(data) - for l in json_objects: - n = swaggerD[l] - if n.get("type") == "integer" and n.get("format") is None: - n.format = "uint64" - print(l, n) - - return swaggerD.to_python() - -def add_uint_bigint(data): - bigint = { - "type": "integer", - "minimum": 0, - "x-go-type": { - "import": { - "package": "github.com/aeternity/aepp-sdk-go/v8/utils" - }, - "type": "BigInt" - } - } - data["definitions"]["UInt"] = bigint - return data - -parser = argparse.ArgumentParser(description="Modify a swagger.json in ways that cannot be done via simple search/replace") +def no_implicit_int64(el, p = []): + if isinstance(el, list): + for i, d in enumerate(el): + no_implicit_int64(d, p + [str(i)]) + if isinstance(el, dict): + if el.get('type') == 'integer' and el.get('format') is None: + if el.get('minimum', 0) >= 0: + el['format'] = 'uint64' + print('added uint64 in', '.'.join(p), el) + el.pop('maximum', None) + for k, v in el.items(): + no_implicit_int64(v, p + [k]) + +replaces = [ + ['"$ref": "#/definitions/UInt64"', '"type":"integer", "format":"uint64"'], + ['"$ref": "#/definitions/UInt32"', '"type":"integer", "format":"uint32"'], + ['"$ref": "#/definitions/UInt16"', '"type":"integer", "format":"uint16"'], + + ['"$ref": "#/definitions/EncodedPubkey"', '"type":"string"'], + ['"$ref": "#/definitions/EncodedHash"', '"type":"string"'], + ['"$ref": "#/definitions/EncodedValue"', '"type":"string"'], + ['"$ref": "#/definitions/EncodedByteArray"', '"type":"string"'], + + ['"#/definitions/TxBlockHeight"', '"#/definitions/UInt"'], + ['OracleResponseTxJSON', 'OracleRespondTxJSON'], +] + +parser = argparse.ArgumentParser(description='Modify a node.json') parser.add_argument('infile', type=open) parser.add_argument('outfile', type=argparse.FileType('w')) args = parser.parse_args() -swagger = json.load(args.infile) -traverse(swagger, []) +api = args.infile.read() + +for replace in replaces: + api = api.replace(*replace) +parsed = json.loads(api) -swagger_n = add_uint_bigint(swagger) -swagger_n = no_implicit_int64(swagger_n) +no_implicit_int64(parsed) +parsed['definitions']['UInt'] = { + 'type': 'integer', + 'minimum': 0, + 'x-go-type': { + 'import': { + 'package': 'github.com/aeternity/aepp-sdk-go/v9/utils' + }, + 'type': 'BigInt' + } +} -json.dump(swagger_n, args.outfile, indent=2) \ No newline at end of file +json.dump(parsed, args.outfile, indent=2) diff --git a/binary/hashing.go b/binary/hashing.go index 45741688..8855da48 100644 --- a/binary/hashing.go +++ b/binary/hashing.go @@ -3,10 +3,11 @@ package binary import ( "crypto/sha256" "encoding/base64" + "errors" "fmt" + rlp "github.com/aeternity/rlp-go" "github.com/btcsuite/btcutil/base58" - rlp "github.com/randomshinichi/rlpae" "golang.org/x/crypto/blake2b" ) @@ -31,9 +32,8 @@ func Encode(prefix HashPrefix, data []byte) string { case Base64c: return fmt.Sprint(prefix, base64.StdEncoding.EncodeToString(in)) default: - panic(fmt.Sprint("Encoding not supported")) + panic("Encoding not supported") } - } // Decode a string encoded with base58/base64 + checksum to a byte array @@ -52,7 +52,7 @@ func Decode(in string) (out []byte, err error) { // 3 (**_) + 5 (Single byte, prefixed with Base58 4 character hash) // then split it into p(refix) and h(ash) if len(in) <= 8 || string(in[2]) != PrefixSeparator { - err = fmt.Errorf("Invalid object encoding") + err = errors.New("invalid object encoding") return } p = HashPrefix(in[0:3]) @@ -65,12 +65,12 @@ func Decode(in string) (out []byte, err error) { raw, _ = base64.StdEncoding.DecodeString(h) } if len(raw) < 5 { - err = fmt.Errorf("Invalid input, %s cannot be decoded", in) + err = fmt.Errorf("invalid input, %s cannot be decoded", in) return nil, err } out = raw[:len(raw)-4] if chk := Encode(p, out); in != chk { - err = fmt.Errorf("Invalid checksum, expected %s got %s", chk, in) + err = fmt.Errorf("invalid checksum, expected %s got %s", chk, in) return nil, err } return out, nil diff --git a/build/docker/entrypoint.sh b/build/docker/entrypoint.sh deleted file mode 100755 index e768e943..00000000 --- a/build/docker/entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -# Use TestNet example config as configuration template -cp docs/examples/epoch_testnet.yaml epoch.yaml - -# Using console with extra arguments because "foreground" does not handle SIGTERM/SIGQUIT -exec ./bin/epoch console -noshell -noinput $@ diff --git a/build/docker/keys/node/peer_key b/build/docker/keys/node/peer_key deleted file mode 100644 index 3e381b2e..00000000 --- a/build/docker/keys/node/peer_key +++ /dev/null @@ -1 +0,0 @@ -Ÿ(.îG QR›·;l,må–h5¾ <\û†W¦5 \ No newline at end of file diff --git a/build/docker/keys/node/peer_key.pub b/build/docker/keys/node/peer_key.pub deleted file mode 100644 index 953de30f..00000000 --- a/build/docker/keys/node/peer_key.pub +++ /dev/null @@ -1 +0,0 @@ -ãŽâäG~@>ïÆn&^FørÆ渄³ôVõJ¼ø \ No newline at end of file diff --git a/build/docker/keys/node/sign_key b/build/docker/keys/node/sign_key deleted file mode 100644 index 9b533088..00000000 Binary files a/build/docker/keys/node/sign_key and /dev/null differ diff --git a/build/docker/keys/node/sign_key.pub b/build/docker/keys/node/sign_key.pub deleted file mode 100644 index a2e717ef..00000000 --- a/build/docker/keys/node/sign_key.pub +++ /dev/null @@ -1,2 +0,0 @@ -«¡hVÌ“Á=/\®ƒÔ{U!ŠÇ­":76 -ÜÉyØ \ No newline at end of file diff --git a/build/docker/sdk.env b/build/docker/sdk.env deleted file mode 100644 index 2c477d9d..00000000 --- a/build/docker/sdk.env +++ /dev/null @@ -1,4 +0,0 @@ -TEST_NODE=node:3013 -TEST_URL=http://node:3013 -TEST_INTERNAL_URL=http://node:3113 - diff --git a/build/docker/wait-for-it.sh b/build/docker/wait-for-it.sh deleted file mode 100755 index bbe40432..00000000 --- a/build/docker/wait-for-it.sh +++ /dev/null @@ -1,177 +0,0 @@ -#!/usr/bin/env bash -# Use this script to test if a given TCP host/port are available - -cmdname=$(basename $0) - -echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } - -usage() -{ - cat << USAGE >&2 -Usage: - $cmdname host:port [-s] [-t timeout] [-- command args] - -h HOST | --host=HOST Host or IP under test - -p PORT | --port=PORT TCP port under test - Alternatively, you specify the host and port as host:port - -s | --strict Only execute subcommand if the test succeeds - -q | --quiet Don't output any status messages - -t TIMEOUT | --timeout=TIMEOUT - Timeout in seconds, zero for no timeout - -- COMMAND ARGS Execute command with args after the test finishes -USAGE - exit 1 -} - -wait_for() -{ - if [[ $TIMEOUT -gt 0 ]]; then - echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" - else - echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" - fi - start_ts=$(date +%s) - while : - do - if [[ $ISBUSY -eq 1 ]]; then - nc -z $HOST $PORT - result=$? - else - (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 - result=$? - fi - if [[ $result -eq 0 ]]; then - end_ts=$(date +%s) - echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" - break - fi - sleep 1 - done - return $result -} - -wait_for_wrapper() -{ - # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 - if [[ $QUIET -eq 1 ]]; then - timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & - else - timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & - fi - PID=$! - trap "kill -INT -$PID" INT - wait $PID - RESULT=$? - if [[ $RESULT -ne 0 ]]; then - echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" - fi - return $RESULT -} - -# process arguments -while [[ $# -gt 0 ]] -do - case "$1" in - *:* ) - hostport=(${1//:/ }) - HOST=${hostport[0]} - PORT=${hostport[1]} - shift 1 - ;; - --child) - CHILD=1 - shift 1 - ;; - -q | --quiet) - QUIET=1 - shift 1 - ;; - -s | --strict) - STRICT=1 - shift 1 - ;; - -h) - HOST="$2" - if [[ $HOST == "" ]]; then break; fi - shift 2 - ;; - --host=*) - HOST="${1#*=}" - shift 1 - ;; - -p) - PORT="$2" - if [[ $PORT == "" ]]; then break; fi - shift 2 - ;; - --port=*) - PORT="${1#*=}" - shift 1 - ;; - -t) - TIMEOUT="$2" - if [[ $TIMEOUT == "" ]]; then break; fi - shift 2 - ;; - --timeout=*) - TIMEOUT="${1#*=}" - shift 1 - ;; - --) - shift - CLI=("$@") - break - ;; - --help) - usage - ;; - *) - echoerr "Unknown argument: $1" - usage - ;; - esac -done - -if [[ "$HOST" == "" || "$PORT" == "" ]]; then - echoerr "Error: you need to provide a host and port to test." - usage -fi - -TIMEOUT=${TIMEOUT:-15} -STRICT=${STRICT:-0} -CHILD=${CHILD:-0} -QUIET=${QUIET:-0} - -# check to see if timeout is from busybox? -# check to see if timeout is from busybox? -TIMEOUT_PATH=$(realpath $(which timeout)) -if [[ $TIMEOUT_PATH =~ "busybox" ]]; then - ISBUSY=1 - BUSYTIMEFLAG="-t" -else - ISBUSY=0 - BUSYTIMEFLAG="" -fi - -if [[ $CHILD -gt 0 ]]; then - wait_for - RESULT=$? - exit $RESULT -else - if [[ $TIMEOUT -gt 0 ]]; then - wait_for_wrapper - RESULT=$? - else - wait_for - RESULT=$? - fi -fi - -if [[ $CLI != "" ]]; then - if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then - echoerr "$cmdname: strict mode, refusing to execute subprocess" - exit $RESULT - fi - exec "${CLI[@]}" -else - exit $RESULT -fi diff --git a/cmd/account.go b/cmd/account.go index 1bf7d1eb..c2aab78f 100644 --- a/cmd/account.go +++ b/cmd/account.go @@ -20,16 +20,15 @@ import ( "runtime" "sync" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" "github.com/spf13/cobra" ) var ( - waitForTx bool spendTxPayload string printPrivateKey bool accountFileName string @@ -61,10 +60,7 @@ func getPassword() (p string, err error) { return password, nil } p, err = AskPassword("Enter the password to unlock the keystore: ") - if err != nil { - return "", err - } - return p, nil + return } func addressFunc(cmd *cobra.Command, args []string) error { @@ -134,6 +130,9 @@ var balanceCmd = &cobra.Command{ func balanceFunc(conn naet.GetAccounter, args []string) (err error) { p, err := getPassword() + if err != nil { + return err + } // load the account account, err := account.LoadFromKeyStoreFile(args[0], p) @@ -161,6 +160,9 @@ var signCmd = &cobra.Command{ func signFunc(cmd *cobra.Command, args []string) (err error) { p, err := getPassword() + if err != nil { + return err + } // load the account account, err := account.LoadFromKeyStoreFile(args[0], p) @@ -210,6 +212,9 @@ func saveFunc(cmd *cobra.Command, args []string) (err error) { } p, err := getPassword() + if err != nil { + return err + } f, err := account.StoreToKeyStoreFile(acc, p, accountFileName) if err != nil { diff --git a/cmd/account_test.go b/cmd/account_test.go index 4a0508b3..e1e7398f 100644 --- a/cmd/account_test.go +++ b/cmd/account_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" ) diff --git a/cmd/chain.go b/cmd/chain.go index 44d31e3a..4ea46dfb 100644 --- a/cmd/chain.go +++ b/cmd/chain.go @@ -18,9 +18,9 @@ import ( "errors" "fmt" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" ) @@ -93,7 +93,7 @@ func playFunc(conn playFuncInterface, args []string) (err error) { // deal with the height parameter if startFromHeight > blockHeight { - err := fmt.Errorf("Height (%d) is greater that the top block (%d)", startFromHeight, blockHeight) + err := fmt.Errorf("height (%d) is greater that the top block (%d)", startFromHeight, blockHeight) return err } @@ -133,8 +133,7 @@ func broadcastFunc(conn naet.PostTransactioner, args []string) (err error) { txSignedBase64 := args[0] if len(txSignedBase64) == 0 || txSignedBase64[0:3] != "tx_" { - err := errors.New("Error, missing or invalid recipient address") - return err + return errors.New("missing or invalid recipient address") } // Transform tx_ string back to an RLP bytearray to calculate its hash @@ -150,8 +149,7 @@ func broadcastFunc(conn naet.PostTransactioner, args []string) (err error) { err = conn.PostTransaction(txSignedBase64, signedEncodedTxHash) if err != nil { - errFinal := fmt.Errorf("Error while broadcasting transaction: %v", err) - return errFinal + return fmt.Errorf("can't broadcast transaction: %v", err) } return nil @@ -171,7 +169,7 @@ var ttlCmd = &cobra.Command{ func ttlFunc(conn naet.GetHeighter, args []string) (err error) { height, err := conn.GetHeight() if err != nil { - errFinal := fmt.Errorf("Error getting height from the node: %v", err) + errFinal := fmt.Errorf("can't get height from the node: %v", err) return errFinal } ttl = height + config.Client.TTL @@ -193,8 +191,7 @@ var networkIDCmd = &cobra.Command{ func networkIDFunc(conn naet.GetStatuser, args []string) (err error) { resp, err := conn.GetStatus() if err != nil { - errFinal := fmt.Errorf("Error getting status information from the node: %v", err) - return errFinal + return fmt.Errorf("can't get status information from the node: %v", err) } fmt.Println(*resp.NetworkID) return nil diff --git a/cmd/chain_test.go b/cmd/chain_test.go index 18b57dc6..674e7a17 100644 --- a/cmd/chain_test.go +++ b/cmd/chain_test.go @@ -6,7 +6,7 @@ import ( "os" "testing" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" ) // Prefixing each test with Example makes go-test check the stdout diff --git a/cmd/contract.go b/cmd/contract.go index ccd26d0f..a313073f 100644 --- a/cmd/contract.go +++ b/cmd/contract.go @@ -5,8 +5,7 @@ import ( "io/ioutil" "os" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" ) @@ -35,7 +34,7 @@ func compileFunc(conn naet.CompileContracter, args []string) (err error) { return err } - bytecode, err := conn.CompileContract(s, config.Compiler.Backend) + bytecode, err := conn.CompileContract(s) fmt.Println(bytecode) return err } @@ -58,7 +57,7 @@ func encodeCalldataFunc(conn naet.EncodeCalldataer, args []string) (err error) { return err } - callData, err := conn.EncodeCalldata(s, args[1], args[2:], config.Compiler.Backend) + callData, err := conn.EncodeCalldata(s, args[1], args[2:]) if err != nil { return err } @@ -91,7 +90,7 @@ func decodeCalldataBytecodeFunc(conn decodeCalldataer, args []string) (err error return fmt.Errorf("%s is not bytecode", args[0]) } - r, err := conn.DecodeCalldataBytecode(args[0], args[1], config.Compiler.Backend) + r, err := conn.DecodeCalldataBytecode(args[0], args[1]) if err != nil { return } @@ -121,7 +120,7 @@ func decodeCalldataSourceFunc(conn decodeCalldataer, args []string) (err error) return fmt.Errorf("%s is not bytecode", args[0]) } - r, err := conn.DecodeCalldataSource(source, args[1], args[2], config.Compiler.Backend) + r, err := conn.DecodeCalldataSource(source, args[1], args[2]) fmt.Println(*r.Function, r.Arguments) return @@ -145,7 +144,7 @@ func generateAciFunc(conn naet.GenerateACIer, args []string) (err error) { return } - aci, err := conn.GenerateACI(source, config.Compiler.Backend) + aci, err := conn.GenerateACI(source) if err != nil { return } @@ -168,4 +167,5 @@ func init() { contractCmd.AddCommand(encodeCalldataCmd) contractCmd.AddCommand(decodeCalldataBytecodeCmd) contractCmd.AddCommand(decodeCalldataSourceCmd) + contractCmd.AddCommand(generateAciCmd) } diff --git a/cmd/contract_test.go b/cmd/contract_test.go index ec03ad80..11633bac 100644 --- a/cmd/contract_test.go +++ b/cmd/contract_test.go @@ -4,7 +4,7 @@ import ( "os" "testing" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" ) func Test_compileFunc(t *testing.T) { diff --git a/cmd/inspect.go b/cmd/inspect.go index 48a705e4..0b9e661d 100644 --- a/cmd/inspect.go +++ b/cmd/inspect.go @@ -21,8 +21,8 @@ import ( "strconv" "strings" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" ) @@ -141,9 +141,13 @@ func printOracleByPubkey(conn naet.GetOracleByPubkeyer, oracleID string) (err er } func inspectFunc(conn nodeGetters, args []string) (err error) { + numberRegexp, err := regexp.Compile(`^\d+$`) + if err != nil { + return + } for _, object := range args { // height - if matched, _ := regexp.MatchString(`^\d+$`, object); matched { + if numberRegexp.MatchString(object) { height, _ := strconv.ParseUint(object, 10, 64) PrintGenerationByHeight(conn, height) continue @@ -166,7 +170,7 @@ func inspectFunc(conn nodeGetters, args []string) (err error) { case binary.PrefixOraclePubkey: printOracleByPubkey(conn, object) default: - return fmt.Errorf("Object %v not yet supported", object) + return fmt.Errorf("object %v not yet supported", object) } } return nil diff --git a/cmd/inspect_test.go b/cmd/inspect_test.go index 7c737b33..28a0b183 100644 --- a/cmd/inspect_test.go +++ b/cmd/inspect_test.go @@ -3,7 +3,7 @@ package cmd import ( "testing" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" ) func Test_printNameEntry(t *testing.T) { diff --git a/cmd/mocks_test.go b/cmd/mocks_test.go index 8bcc9e1e..71a068ee 100644 --- a/cmd/mocks_test.go +++ b/cmd/mocks_test.go @@ -1,8 +1,8 @@ package cmd import ( - compilermodels "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + compilermodels "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" + models "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) type mockGetHeighter struct { @@ -107,13 +107,13 @@ func (m *mockGetNameEntryByNamer) GetNameEntryByName(name string) (nameEntry *mo type mockCompileContracter struct{} -func (m *mockCompileContracter) CompileContract(source string, backend string) (bytecode string, err error) { +func (m *mockCompileContracter) CompileContract(source string) (bytecode string, err error) { return "cb_+QYYRgKg+HOI9x+n5+MOEpnQ/zO+GoibqhQxGO4bgnvASx0vzB75BKX5AUmgOoWULXtHOgf10E7h2cFqXOqxa3kc6pKJYRpEw/nlugeDc2V0uMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC4YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////////////////////////////////jJoEnsSQdsAgNxJqQzA+rc5DsuLDKUV7ETxQp+ItyJgJS3g2dldLhgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA///////////////////////////////////////////uEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA+QKLoOIjHWzfyTkW3kyzqYV79lz0D8JW9KFJiz9+fJgMGZNEhGluaXS4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACg//////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALkBoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA//////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYD//////////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAuQFEYgAAj2IAAMKRgICAUX9J7EkHbAIDcSakMwPq3OQ7LiwylFexE8UKfiLciYCUtxRiAAE5V1CAgFF/4iMdbN/JORbeTLOphXv2XPQPwlb0oUmLP358mAwZk0QUYgAA0VdQgFF/OoWULXtHOgf10E7h2cFqXOqxa3kc6pKJYRpEw/nlugcUYgABG1dQYAEZUQBbYAAZWWAgAZCBUmAgkANgAFmQgVKBUllgIAGQgVJgIJADYAOBUpBZYABRWVJgAFJgAPNbYACAUmAA81tgAFFRkFZbYCABUVGQUIOSUICRUFCAWZCBUllgIAGQgVJgIJADYAAZWWAgAZCBUmAgkANgAFmQgVKBUllgIAGQgVJgIJADYAOBUoFSkFCQVltgIAFRUVlQgJFQUGAAUYFZkIFSkFBgAFJZkFCQVltQUFlQUGIAAMpWhTMuMS4wHchc+w==", nil } type mockEncodeCalldataer struct{} -func (m *mockEncodeCalldataer) EncodeCalldata(source string, function string, args []string, backend string) (bytecode string, err error) { +func (m *mockEncodeCalldataer) EncodeCalldata(source string, function string, args []string) (bytecode string, err error) { return "cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDiIx1s38k5Ft5Ms6mFe/Zc9A/CVvShSYs/fnyYDBmTRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACo7j+li", nil } @@ -121,12 +121,12 @@ type mockdecodeCalldataer struct { decodedCalldata string } -func (m *mockdecodeCalldataer) DecodeCalldataSource(source string, function string, callData string, backend string) (decodedCallData *compilermodels.DecodedCalldata, err error) { +func (m *mockdecodeCalldataer) DecodeCalldataSource(source string, function string, callData string) (decodedCallData *compilermodels.DecodedCalldata, err error) { decodedCallData = &compilermodels.DecodedCalldata{} decodedCallData.UnmarshalBinary([]byte(m.decodedCalldata)) return decodedCallData, nil } -func (m *mockdecodeCalldataer) DecodeCalldataBytecode(bytecode string, calldata string, backend string) (decodedCallData *compilermodels.DecodedCalldata, err error) { +func (m *mockdecodeCalldataer) DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *compilermodels.DecodedCalldata, err error) { decodedCallData = &compilermodels.DecodedCalldata{} decodedCallData.UnmarshalBinary([]byte(m.decodedCalldata)) return decodedCallData, nil @@ -136,7 +136,7 @@ type mockGenerateACIer struct { aci string } -func (m *mockGenerateACIer) GenerateACI(source string, backend string) (aci *compilermodels.ACI, err error) { +func (m *mockGenerateACIer) GenerateACI(source string) (aci *compilermodels.ACI, err error) { aci = &compilermodels.ACI{} err = aci.UnmarshalBinary([]byte(m.aci)) return aci, err diff --git a/cmd/name.go b/cmd/name.go index bb128ac9..8197f8ba 100644 --- a/cmd/name.go +++ b/cmd/name.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" ) diff --git a/cmd/root.go b/cmd/root.go index fbfb4122..73d3f6aa 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -18,8 +18,8 @@ import ( "fmt" "os" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" "github.com/spf13/cobra" "github.com/spf13/viper" ) diff --git a/cmd/terminal.go b/cmd/terminal.go index 7d5a3653..b6a077b0 100644 --- a/cmd/terminal.go +++ b/cmd/terminal.go @@ -8,8 +8,8 @@ import ( "time" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" ) func times(str string, n int) (out string) { @@ -23,12 +23,6 @@ var ( defaultIndentSize = 50 ) -// Left left-pads the string with pad up to len runes -// len may be exceeded if -func left(str string, length int, pad string) string { - return times(pad, length-len(str)) + str -} - // Right right-pads the string with pad up to len runes func right(str string, length int, pad string) string { return str + times(pad, length-len(str)) diff --git a/cmd/terminal_test.go b/cmd/terminal_test.go index d769c65f..87578656 100644 --- a/cmd/terminal_test.go +++ b/cmd/terminal_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) func Test_printIf_BigIntBalancePrinted(t *testing.T) { diff --git a/cmd/test_utils.go b/cmd/test_utils.go index e93f03b5..ff02c0b3 100644 --- a/cmd/test_utils.go +++ b/cmd/test_utils.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - "github.com/aeternity/aepp-sdk-go/v8/config" + "github.com/aeternity/aepp-sdk-go/v9/config" ) func setPrivateNetParams() { diff --git a/cmd/text_functions.go b/cmd/text_functions.go index 0c185002..67fe68c1 100644 --- a/cmd/text_functions.go +++ b/cmd/text_functions.go @@ -7,12 +7,12 @@ import ( "strings" "syscall" - "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) // IsEqStr tells if two strings a and b are equals after trimming spaces and lowercasing func IsEqStr(a, b string) bool { - return strings.ToLower(strings.TrimSpace(a)) == strings.ToLower(strings.TrimSpace(b)) + return strings.EqualFold(strings.TrimSpace(a), strings.TrimSpace(b)) } // IsEmptyStr tells if a string is empty or not @@ -46,7 +46,7 @@ func AskYes(question string, defaultYes bool) (isYes bool) { // AskPassword ask a password func AskPassword(question string) (password string, err error) { fmt.Println(question) - bytePassword, err := terminal.ReadPassword(int(syscall.Stdin)) + bytePassword, err := term.ReadPassword(int(syscall.Stdin)) if err != nil { return } diff --git a/cmd/tx.go b/cmd/tx.go index 11e5d745..75fa74e9 100644 --- a/cmd/tx.go +++ b/cmd/tx.go @@ -5,11 +5,10 @@ import ( "fmt" "math/big" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/transactions" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/spf13/cobra" ) @@ -49,20 +48,23 @@ func txSpendFunc(ttlFunc transactions.TTLer, nonceFunc transactions.Noncer, args sender = args[0] recipient = args[1] amount, err = utils.NewIntFromString(args[2]) + if err != nil { + return + } feeBigInt, _ = utils.NewIntFromString(fee) // Validate arguments if !IsAddress(sender) { - return errors.New("Error, missing or invalid sender address") + return errors.New("missing or invalid sender address") } if !IsAddress(recipient) { - return errors.New("Error, missing or invalid recipient address") + return errors.New("missing or invalid recipient address") } if amount.Cmp(big.NewInt(0)) == -1 { - return errors.New("Error, missing or invalid amount") + return errors.New("missing or invalid amount") } if feeBigInt.Cmp(big.NewInt(0)) == -1 { - return errors.New("Error, missing or invalid fee") + return errors.New("missing or invalid fee") } // If nonce or TTL was specified, no need to query the node @@ -118,11 +120,6 @@ var txContractCreateCmd = &cobra.Command{ }, } -type getHeightAccounter interface { - naet.GetHeighter - naet.GetAccounter -} - func txContractCreateFunc(ttlFunc transactions.TTLer, nonceFunc transactions.Noncer, args []string) (err error) { var ( owner string @@ -133,15 +130,15 @@ func txContractCreateFunc(ttlFunc transactions.TTLer, nonceFunc transactions.Non // Load variables from arguments and validate them owner = args[0] if !IsAddress(owner) { - return errors.New("Error, missing or invalid owner address") + return errors.New("missing or invalid owner address") } contract = args[1] if !IsBytecode(contract) { - return errors.New("Error, missing or invalid contract bytecode") + return errors.New("missing or invalid contract bytecode") } calldata = args[2] if !IsBytecode(calldata) { - return errors.New("Error, missing or invalid init calldata bytecode") + return errors.New("missing or invalid init calldata bytecode") } // If nonce was not specified as an argument, connect to the node to @@ -206,10 +203,10 @@ func txVerifyFunc(cmd *cobra.Command, args []string) (err error) { txSignedBase64 := args[1] if !IsAddress(sender) { - return errors.New("Error, missing or invalid sender address") + return errors.New("missing or invalid sender address") } if !IsTransaction(txSignedBase64) { - return errors.New("Error, missing or invalid base64 encoded transaction") + return errors.New("missing or invalid base64 encoded transaction") } valid, err := transactions.VerifySignedTx(sender, txSignedBase64, config.Node.NetworkID) if err != nil { @@ -239,7 +236,7 @@ var txDumpRawCmd = &cobra.Command{ func txDumpRawFunc(cmd *cobra.Command, args []string) (err error) { tx := args[0] if !IsTransaction(tx) { - return errors.New("Error, missing or invalid base64 encoded transaction") + return errors.New("missing or invalid base64 encoded transaction") } txRaw, err := binary.Decode(tx) if err != nil { @@ -260,6 +257,6 @@ func init() { // tx spend command txSpendCmd.Flags().StringVar(&fee, "fee", config.Client.Fee.String(), fmt.Sprintf("Set the transaction fee (default=%s)", config.Client.Fee.String())) txSpendCmd.Flags().Uint64Var(&ttl, "ttl", 0, fmt.Sprintf("Set the TTL in keyblocks (default=%d)", 0)) - txSpendCmd.Flags().Uint64Var(&nonce, "nonce", 0, fmt.Sprint("Set the sender account nonce, if not the chain will be queried for its value")) - txSpendCmd.Flags().StringVar(&spendTxPayload, "payload", "", fmt.Sprint("Optional text payload for Spend Transactions, which will be turned into a bytearray")) + txSpendCmd.Flags().Uint64Var(&nonce, "nonce", 0, "Set the sender account nonce, if not the chain will be queried for its value") + txSpendCmd.Flags().StringVar(&spendTxPayload, "payload", "", "Optional text payload for Spend Transactions, which will be turned into a bytearray") } diff --git a/cmd/tx_test.go b/cmd/tx_test.go index afdd688a..99a460d9 100644 --- a/cmd/tx_test.go +++ b/cmd/tx_test.go @@ -3,13 +3,13 @@ package cmd import ( "testing" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/transactions" "github.com/spf13/cobra" ) var alice = "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi" -var bob = "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v" +var bob = "ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks" func Test_txSpendFunc(t *testing.T) { type args struct { diff --git a/cmd/validation.go b/cmd/validation.go index 1d3db57e..fec38102 100644 --- a/cmd/validation.go +++ b/cmd/validation.go @@ -1,6 +1,6 @@ package cmd -import "github.com/aeternity/aepp-sdk-go/v8/binary" +import "github.com/aeternity/aepp-sdk-go/v9/binary" // IsAddress does some minor checks to ensure that the string is an ak_ address func IsAddress(a string) bool { diff --git a/config/config.go b/config/config.go index ebce9fed..9a70817c 100644 --- a/config/config.go +++ b/config/config.go @@ -12,17 +12,11 @@ const ( // NetworkIDMainnet is the network ID for aeternity mainnet NetworkIDMainnet = "ae_mainnet" // URLMainnet is the URL to an aeternity Foundation maintained node - URLMainnet = "https://sdk-mainnet.aepps.com" + URLMainnet = "https://mainnet.aeternity.io" // NetworkIDTestnet is the network ID for aeternity testnet NetworkIDTestnet = "ae_uat" // URLTestnet is the URL to an aeternity Foundation maintained node - URLTestnet = "https://sdk-testnet.aepps.com" - // CompilerBackendFATE indicates that the compiler should use the FATE VM - // for contract bytecode execution - CompilerBackendFATE = "fate" - // CompilerBackendAEVM indicates that the compiler should use the AEVM for - // contract bytecode execution - CompilerBackendAEVM = "aevm" + URLTestnet = "https://testnet.aeternity.io" // OracleTTLTypeDelta indicates that the accompanying TTL value (in blocks) // should be interpreted as currentHeight + TTLValue OracleTTLTypeDelta = 0 @@ -45,7 +39,6 @@ type NodeConfig struct { // CompilerConfig configuration for the compiler type CompilerConfig struct { URL string `json:"url" yaml:"url" mapstructure:"url"` - Backend string `json:"backend" yaml:"backend" mapstructure:"backend"` } // AensConfig contains default parameters for AENS @@ -152,16 +145,15 @@ type ProfileConfig struct { // Node holds default settings for NodeConfig var Node = NodeConfig{ - URL: "https://sdk-mainnet.aepps.com", - URLInternal: "https://sdk-mainnet.aepps.com", - URLChannels: "https://sdk-mainnet.aepps.com", + URL: "https://mainnet.aeternity.io", + URLInternal: "https://mainnet.aeternity.io", + URLChannels: "https://mainnet.aeternity.io", NetworkID: "ae_mainnet", } // Compiler holds default settings for CompilerConfig var Compiler = CompilerConfig{ URL: "http://localhost:3080", - Backend: CompilerBackendFATE, } // Client holds default settings for ClientConfig @@ -182,7 +174,7 @@ var Client = ClientConfig{ GasLimit: big.NewInt(1e6), Amount: new(big.Int), Deposit: new(big.Int), - VMVersion: 5, + VMVersion: 7, ABIVersion: 3, }, Oracles: OracleConfig{ diff --git a/docker-compose.yml b/docker-compose.yml index 443615b4..0b125e54 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,5 @@ version: '3' services: - sdk: - build: - context: . - dockerfile: Dockerfile.ci - depends_on: [node] - entrypoint: docker/wait-for-it.sh node:3013 -- - env_file: [./build/docker/sdk.env] - environment: - - WALLET_PRIV=${WALLET_PRIV} - - WALLET_PUB=${WALLET_PUB} - volumes: - - .:/go/src/app - node: image: aeternity/aeternity:${TAG} hostname: node @@ -21,17 +8,12 @@ services: - "3113:3113" environment: AETERNITY_CONFIG: /home/aeternity/aeternity.yaml - command: bin/aeternity console -noinput -aecore expected_mine_rate ${AETERNITY_MINE_RATE:-15000} + command: bin/aeternity console -noinput -aecore volumes: - - ${PWD}/build/docker/aeternity_node_mean16.yaml:/home/aeternity/aeternity.yaml - - ${PWD}/build/docker/accounts.json:/home/aeternity/node/data/aecore/.genesis/accounts_test.json - - ${PWD}/build/docker/keys/node:/home/aeternity/node/keys - - node_db:/home/aeternity/node/data/mnesia + - ${PWD}/docker/aeternity_node_mean16.yaml:/home/aeternity/aeternity.yaml + - ${PWD}/docker/accounts.json:/home/aeternity/node/data/aecore/.genesis/accounts_test.json compiler: image: aeternity/aesophia_http:${COMPILER_TAG} hostname: compiler ports: - "3080:3080" -volumes: - node_db: - node_keys: diff --git a/build/docker/accounts.json b/docker/accounts.json similarity index 69% rename from build/docker/accounts.json rename to docker/accounts.json index 7eac7df1..dd9090e9 100644 --- a/build/docker/accounts.json +++ b/docker/accounts.json @@ -1,4 +1,4 @@ { "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi": 1600000000000000000000000000000000000000, - "ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v": 1600000000000000000000000000000000000000 + "ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks": 1600000000000000000000000000000000000000 } \ No newline at end of file diff --git a/build/docker/aeternity_node_mean16.yaml b/docker/aeternity_node_mean16.yaml similarity index 88% rename from build/docker/aeternity_node_mean16.yaml rename to docker/aeternity_node_mean16.yaml index d58f9763..a1d80118 100644 --- a/build/docker/aeternity_node_mean16.yaml +++ b/docker/aeternity_node_mean16.yaml @@ -18,12 +18,10 @@ keys: dir: ./keys chain: - persist: true + persist: false hard_forks: "1": 0 - "2": 2 - "3": 4 - "4": 6 + "5": 1 mining: autostart: true @@ -37,4 +35,4 @@ mining: edge_bits: 15 # nice: 3 fork_management: - network_id: "ae_docker" \ No newline at end of file + network_id: "ae_docker" diff --git a/go.mod b/go.mod index ed3e08c0..0b3d4aec 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,46 @@ -module github.com/aeternity/aepp-sdk-go/v8 +module github.com/aeternity/aepp-sdk-go/v9 -go 1.12 +go 1.16 require ( - github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d - github.com/go-openapi/errors v0.19.2 - github.com/go-openapi/runtime v0.19.7 - github.com/go-openapi/strfmt v0.19.3 - github.com/go-openapi/swag v0.19.5 - github.com/go-openapi/validate v0.19.4 - github.com/randomshinichi/rlpae v0.0.0-20190813143754-207301e28aeb + github.com/AlecAivazis/survey/v2 v2.2.12 // indirect + github.com/aeternity/rlp-go v0.0.0-20190813143754-207301e28aeb + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect + github.com/btcsuite/btcutil v1.0.2 + github.com/fatih/color v1.12.0 // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/git-chglog/git-chglog v0.14.2 // indirect + github.com/go-openapi/analysis v0.20.1 // indirect + github.com/go-openapi/errors v0.20.0 + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/runtime v0.19.29 + github.com/go-openapi/strfmt v0.20.1 + github.com/go-openapi/swag v0.19.15 + github.com/go-openapi/validate v0.20.2 + github.com/google/go-querystring v1.1.0 // indirect + github.com/google/uuid v1.2.0 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-isatty v0.0.13 // indirect + github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/pelletier/go-toml v1.9.2 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/satori/go.uuid v1.2.0 - github.com/spf13/cobra v0.0.5 - github.com/spf13/viper v1.4.0 - github.com/tyler-smith/go-bip39 v1.0.2 - golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/cobra v1.1.3 + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/viper v1.7.1 + github.com/trivago/tgo v1.0.7 // indirect + github.com/tyler-smith/go-bip39 v1.1.0 + go.mongodb.org/mongo-driver v1.5.3 // indirect + golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a + golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect + golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect + golang.org/x/term v0.0.0-20210503060354-a79de5458b56 + gopkg.in/ini.v1 v1.62.0 // indirect gotest.tools v2.2.0+incompatible ) diff --git a/go.sum b/go.sum index 9953f134..3eabb2b1 100644 --- a/go.sum +++ b/go.sum @@ -1,43 +1,105 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/AlecAivazis/survey/v2 v2.2.9/go.mod h1:9DYvHgXtiXm6nCn+jXnOXLKbH+Yo9u8fAS/SduGdoPk= +github.com/AlecAivazis/survey/v2 v2.2.12 h1:5a07y93zA6SZ09gOa9wLVLznF5zTJMQ+pJ3cZK4IuO8= +github.com/AlecAivazis/survey/v2 v2.2.12/go.mod h1:6d4saEvBsfSHXeN1a5OA5m2+HJ2LuVokllnC77pAIKI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= +github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/aeternity/rlp-go v0.0.0-20190813143754-207301e28aeb h1:uPTdmmEd962RvqwtOKQZcfIF3BdmGT+ZSrw3GbXRy9E= +github.com/aeternity/rlp-go v0.0.0-20190813143754-207301e28aeb/go.mod h1:JI2JhYGhPvUtx436JgrBmYBRxMlZg8gWO7oDs+TqXL4= +github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/andygrunwald/go-jira v1.13.0 h1:vvIImGgX32bHfoiyUwkNo+/YrPnRczNarvhLOncP6dE= +github.com/andygrunwald/go-jira v1.13.0/go.mod h1:jYi4kFDbRPZTJdJOVJO4mpMMIwdB+rcZwSO58DzPd2I= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts= +github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc= +github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/git-chglog/git-chglog v0.14.2 h1:nx84X23vc0eLCYfNX+EmuaqvVUb3mvjKdW9fcC3eJWs= +github.com/git-chglog/git-chglog v0.14.2/go.mod h1:QYJ8Ctd/bMkNX3R+AyZf2x0iF6InIZ6xEOqCOldbAOQ= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= @@ -46,109 +108,300 @@ github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpR github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.19.2/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= github.com/go-openapi/analysis v0.19.4/go.mod h1:3P1osvZa9jKjb8ed2TPng3f0i/UY9snX6gxi44djMjk= -github.com/go-openapi/analysis v0.19.5 h1:8b2ZgKfKIUTVQpTb77MoRDIMEIwvDVw40o3aOXdfYzI= github.com/go-openapi/analysis v0.19.5/go.mod h1:hkEAkxagaIvIP7VTn8ygJNkd4kAYON2rCu0v0ObL0AU= +github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgTAUNE9AEEMdlJQ= +github.com/go-openapi/analysis v0.19.16/go.mod h1:GLInF007N83Ad3m8a/CbQ5TPzdnGT7workfHwuVjNVk= +github.com/go-openapi/analysis v0.20.0/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= +github.com/go-openapi/analysis v0.20.1 h1:zdVbw8yoD4SWZeq+cWdGgquaB0W4VrsJvDJHJND/Ktc= +github.com/go-openapi/analysis v0.20.1/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= -github.com/go-openapi/errors v0.19.2 h1:a2kIyV3w+OS3S97zxUndRVD46+FhGOUBDFY7nmu4CsY= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.3/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= +github.com/go-openapi/errors v0.19.6/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.0 h1:Sxpo9PjEHDzhs3FbnGNonvDgWcMW2U7wGTcDDSFSceM= +github.com/go-openapi/errors v0.20.0/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= -github.com/go-openapi/jsonpointer v0.19.3 h1:gihV7YNZK1iK6Tgwwsxo2rJbD1GTbdm72325Bq8FI3w= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= -github.com/go-openapi/jsonreference v0.19.2 h1:o20suLFB4Ri0tuzpWtyHlh7E7HnkqTNLq6aR6WVNS1w= github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.19.2/go.mod h1:QAskZPMX5V0C2gvfkGZzJlINuP7Hx/4+ix5jWFxsNPs= -github.com/go-openapi/loads v0.19.3 h1:jwIoahqCmaA5OBoc/B+1+Mu2L0Gr8xYQnbeyQEo/7b0= github.com/go-openapi/loads v0.19.3/go.mod h1:YVfqhUCdahYwR3f3iiwQLhicVRvLlU/WO5WPaZvcvSI= +github.com/go-openapi/loads v0.19.5/go.mod h1:dswLCAdonkRufe/gSUC3gN8nTSaB9uaS2es0x5/IbjY= +github.com/go-openapi/loads v0.19.6/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hsKvYBNEGVc= +github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= +github.com/go-openapi/loads v0.20.2 h1:z5p5Xf5wujMxS1y8aP+vxwW5qYT2zdJBbXKmQUG3lcc= +github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= -github.com/go-openapi/runtime v0.19.7 h1:b2zcE9GCjDVtguugU7+S95vkHjwQEjz/lB+8LOuA9Nw= -github.com/go-openapi/runtime v0.19.7/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= +github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= +github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= +github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= +github.com/go-openapi/runtime v0.19.29 h1:5IIvCaIDbxetN674vX9eOxvoZ9mYGQ16fV1Q0VSG+NA= +github.com/go-openapi/runtime v0.19.29/go.mod h1:BvrQtn6iVb2QmiVXRsFAm6ZCAZBpbVKFfN6QWCp582M= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.19.2/go.mod h1:sCxk3jxKgioEJikev4fgkNmwS+3kuYdJtcsZsD5zxMY= -github.com/go-openapi/spec v0.19.3 h1:0XRyw8kguri6Yw4SxhsQA/atC88yqrk0+G4YhI2wabc= github.com/go-openapi/spec v0.19.3/go.mod h1:FpwSN1ksY1eteniUU7X0N/BgJ7a4WvBFVA8Lj9mJglo= +github.com/go-openapi/spec v0.19.6/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/spec v0.19.8/go.mod h1:Hm2Jr4jv8G1ciIAo+frC/Ft+rR2kQDh8JHKHb3gWUSk= +github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= +github.com/go-openapi/spec v0.20.3 h1:uH9RQ6vdyPSs2pSy9fL8QPspDF2AMIMPtmK5coSSjtQ= +github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.19.0/go.mod h1:+uW+93UVvGGq2qGaZxdDeJqSAqBqBdl+ZPMF/cC8nDY= github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= -github.com/go-openapi/strfmt v0.19.3 h1:eRfyY5SkaNJCAwmmMcADjY31ow9+N7MCLW7oRkbsINA= github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= +github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= +github.com/go-openapi/strfmt v0.20.1 h1:1VgxvehFne1mbChGeCmZ5pc0LxUf6yaACVSIYAR91Xc= +github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= +github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= +github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= -github.com/go-openapi/validate v0.19.4 h1:LGjO87VyXY3bIKjlYpXSFuLRG2mTeuYlZyeNwFFWpyM= -github.com/go-openapi/validate v0.19.4/go.mod h1:BkJ0ZmXui7yB0bJXWSXgLPNTmbLVeX/3D1xn/N9mMUM= +github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbNMAuKvKB+IaGx8= +github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= +github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= +github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= +github.com/go-openapi/validate v0.20.2 h1:AhqDegYV3J3iQkMPJSXkvzymHKMTw0BST3RK3hTT4ts= +github.com/go-openapi/validate v0.20.2/go.mod h1:e7OJoKNgd0twXZwIn0A43tHbvIcr/rZIVCbJBpTUoY0= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= +github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= +github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= +github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= +github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= +github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= +github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= +github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= +github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= +github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= +github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= +github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= +github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= +github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= +github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= +github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= +github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqUE= +github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= +github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= +github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA= +github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= +github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/pelletier/go-toml v1.9.2 h1:7NiByeVF4jKSG1lDF3X8LTIkq2/bu+1uYbIm1eS5tzk= +github.com/pelletier/go-toml v1.9.2/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -158,111 +411,302 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/randomshinichi/rlpae v0.0.0-20190813143754-207301e28aeb h1:DOLztFf89YZND4VWtZK2FTKw2HWq+MqYT+xJ2PiYSk0= -github.com/randomshinichi/rlpae v0.0.0-20190813143754-207301e28aeb/go.mod h1:B5w8oWv2VQrCUeAb+hvZ5uFsBynBeyEMuvnKEDFEH1k= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/trivago/tgo v1.0.1/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc= +github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM= +github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY= +github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8= +github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2nyfOP8= +github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= +github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= +github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= +github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= +github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.1.1 h1:Sq1fR+0c58RME5EoqKdjkiQAmPjmfHlZOoRI6fTUOcs= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= +go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= +go.mongodb.org/mongo-driver v1.5.3 h1:wWbFB6zaGHpzguF3f7tW94sVE8sFl3lHx8OZx/4OuFI= +go.mongodb.org/mongo-driver v1.5.3/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/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-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190617133340-57b3e21c3d56/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/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-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190320064053-1272bf9dcd53/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/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-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f h1:25KHgbfyiSm6vwQLbM3zZIe1v9p/3ea4Rz+nnM5K/i4= +golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8= +golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/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-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w= +golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/integration_test/aens_higherlevel_test.go b/integration_test/aens_higherlevel_test.go index b7632709..b254a524 100644 --- a/integration_test/aens_higherlevel_test.go +++ b/integration_test/aens_higherlevel_test.go @@ -3,8 +3,8 @@ package integrationtest import ( "testing" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) func TestRegisterName(t *testing.T) { @@ -12,7 +12,7 @@ func TestRegisterName(t *testing.T) { alice, _ := setupAccounts(t) ctx := aeternity.NewContext(alice, n) - name := "somelongnamefdsafdffsa.chain" + name := randomName(22) nameFee := transactions.CalculateMinNameFee(name) aens := aeternity.NewAENS(ctx) diff --git a/integration_test/aens_test.go b/integration_test/aens_test.go index 8fead0b4..efb5f0ac 100644 --- a/integration_test/aens_test.go +++ b/integration_test/aens_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) func getNameEntry(t *testing.T, node *naet.Node, name string) (responseJSON string) { diff --git a/integration_test/api_test.go b/integration_test/api_test.go index 9470f323..41d9cb60 100644 --- a/integration_test/api_test.go +++ b/integration_test/api_test.go @@ -11,12 +11,12 @@ import ( "gotest.tools/golden" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) /* @@ -56,7 +56,6 @@ type txTypes struct { } var sentTxs txTypes -var useTestNet bool func signBroadcastWaitKeepTrackOfTx(t *testing.T, tx transactions.Transaction, acc *account.Account, node *naet.Node) (height uint64, txHash string, mbHash string) { receipt, err := aeternity.SignBroadcast(tx, acc, node, networkID) @@ -107,14 +106,12 @@ func signBroadcastWaitKeepTrackOfTx(t *testing.T, tx transactions.Transaction, a } func TestMain(m *testing.M) { - flag.BoolVar(&useTestNet, "testnet", false, "Run tests that need an internet connection to testnet") flag.Parse() os.Exit(m.Run()) } func TestAPI(t *testing.T) { privateNet := setupNetwork(t, privatenetURL, false) - testNet := setupNetwork(t, testnetURL, false) ttlnoncer := transactions.NewTTLNoncer(privateNet) alice, bob := setupAccounts(t) @@ -327,17 +324,6 @@ func TestAPI(t *testing.T) { } }) - t.Run("GetKeyBlockByHash", func(t *testing.T) { - if !useTestNet { - t.Skip("-testnet not specified: skipping test") - } - _, err := testNet.GetKeyBlockByHash("kh_2ZPK9GGvXKJ8vfwapBLztd2F8DSr9QdphZRHSdJH8MR298Guao") - // t.Logf("%+v\n", gotKeyBlockByHash) - if err != nil { - t.Errorf("Client.GetKeyBlockByHash() error = %v", err) - return - } - }) t.Run("GetMicroBlockTransactionsByHash", func(t *testing.T) { _, err := privateNet.GetMicroBlockTransactionsByHash(sentTxs.SpendTx.mbHash) // t.Logf("%+v\n", gotMicroBlockTransactionsByHash) diff --git a/integration_test/compiler_test.go b/integration_test/compiler_test.go index a3a2552b..32c0348b 100644 --- a/integration_test/compiler_test.go +++ b/integration_test/compiler_test.go @@ -4,8 +4,7 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/naet" "gotest.tools/golden" ) @@ -23,7 +22,7 @@ func TestCompiler(t *testing.T) { } }) t.Run("CompileContract", func(t *testing.T) { - _, err := c.CompileContract(string(golden.Get(t, simplestorageSource)), config.Compiler.Backend) + _, err := c.CompileContract(string(golden.Get(t, simplestorageSource))) if err != nil { t.Error(err) } @@ -39,27 +38,27 @@ func TestCompiler(t *testing.T) { ae_addres ` - _, err := c.CompileContract(wontcompileSource, config.Compiler.Backend) + _, err := c.CompileContract(wontcompileSource) errtype := reflect.TypeOf(err).String() if errtype != "*operations.CompileContractBadRequest" { t.Error(err) } }) t.Run("DecodeCallResult", func(t *testing.T) { - // taken from contract_test.go running main(42) on identity.aes, GET /transactions/th_.../info - _, err := c.DecodeCallResult("ok", "cb_VNLOFXc=", "main", string(golden.Get(t, identitySource)), config.Compiler.Backend) + // taken from contract_test.go running getArg(5) on identity.aes, GET /transactions/th_.../info + _, err := c.DecodeCallResult("ok", "cb_CpyCcgE=", "getArg", string(golden.Get(t, identitySource))) if err != nil { t.Error(err) } }) t.Run("DecodeCalldataBytecode", func(t *testing.T) { - _, err := c.DecodeCalldataBytecode(string(golden.Get(t, simplestorageBytecode)), string(golden.Get(t, simplestorageCalldata)), config.Compiler.Backend) + _, err := c.DecodeCalldataBytecode(string(golden.Get(t, simplestorageBytecode)), string(golden.Get(t, simplestorageCalldata))) if err != nil { t.Error(err) } }) t.Run("DecodeCalldataSource", func(t *testing.T) { - _, err := c.DecodeCalldataSource(string(golden.Get(t, simplestorageSource)), "init", string(golden.Get(t, simplestorageCalldata)), config.Compiler.Backend) + _, err := c.DecodeCalldataSource(string(golden.Get(t, simplestorageSource)), "init", string(golden.Get(t, simplestorageCalldata))) if err != nil { t.Error(err) } @@ -72,21 +71,21 @@ func TestCompiler(t *testing.T) { } }) t.Run("EncodeCalldata SimpleStorage set(123)", func(t *testing.T) { - encodedCalldata, err := c.EncodeCalldata(string(golden.Get(t, simplestorageSource)), "set", []string{"123"}, config.Compiler.Backend) + encodedCalldata, err := c.EncodeCalldata(string(golden.Get(t, simplestorageSource)), "set", []string{"123"}) if err != nil { t.Error(err) } golden.Assert(t, encodedCalldata, "simplestorage_set123.txt") }) t.Run("EncodeCalldata SimpleStorage init(42)", func(t *testing.T) { - encodedCalldata, err := c.EncodeCalldata(string(golden.Get(t, simplestorageSource)), "init", []string{"42"}, config.Compiler.Backend) + encodedCalldata, err := c.EncodeCalldata(string(golden.Get(t, simplestorageSource)), "init", []string{"42"}) if err != nil { t.Error(err) } golden.Assert(t, encodedCalldata, "simplestorage_init42.txt") }) t.Run("GenerateACI", func(t *testing.T) { - _, err := c.GenerateACI(string(golden.Get(t, simplestorageSource)), config.Compiler.Backend) + _, err := c.GenerateACI(string(golden.Get(t, simplestorageSource))) if err != nil { t.Error(err) } diff --git a/integration_test/contract_higherlevel_test.go b/integration_test/contract_higherlevel_test.go index 0d80e128..a367b71a 100644 --- a/integration_test/contract_higherlevel_test.go +++ b/integration_test/contract_higherlevel_test.go @@ -3,10 +3,10 @@ package integrationtest import ( "testing" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) func TestCreateContract(t *testing.T) { @@ -24,7 +24,7 @@ contract SimpleStorage = function get() : int = state.data stateful function set(value : int) = put(state{data = value})` - ctID, _, err := contract.Deploy(simplestorage, "init", []string{"42"}, config.CompilerBackendFATE) + ctID, _, err := contract.Deploy(simplestorage, "init", []string{"42"}) if err != nil { t.Error(err) } @@ -50,12 +50,12 @@ contract SimpleStorage = function get() : int = state.data stateful function set(value : int) = put(state{data = value})` - ctID, _, err := contract.Deploy(simplestorage, "init", []string{"42"}, config.CompilerBackendFATE) + ctID, _, err := contract.Deploy(simplestorage, "init", []string{"42"}) if err != nil { t.Fatal(err) } - callReceipt, err := contract.Call(ctID, simplestorage, "get", []string{}, config.CompilerBackendFATE) + callReceipt, err := contract.Call(ctID, simplestorage, "get", []string{}) if err != nil { t.Error(err) } @@ -63,7 +63,7 @@ contract SimpleStorage = callInfoChan := make(chan *models.ContractCallObject) errChan := make(chan error) go aeternity.DefaultCallResultListener(n, callReceipt.Hash, callInfoChan, errChan, config.Tuning.ChainPollInterval) - _ = <-callInfoChan + <-callInfoChan err = <-errChan if err != nil { t.Fatal(err) diff --git a/integration_test/contract_test.go b/integration_test/contract_test.go index 77399e23..a0db9eaa 100644 --- a/integration_test/contract_test.go +++ b/integration_test/contract_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/transactions" "gotest.tools/golden" ) diff --git a/integration_test/ga_test.go b/integration_test/ga_test.go index a239a7f2..c590bf06 100644 --- a/integration_test/ga_test.go +++ b/integration_test/ga_test.go @@ -5,14 +5,14 @@ import ( "math/big" "testing" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/models" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" "gotest.tools/golden" ) @@ -39,17 +39,17 @@ func TestGeneralizedAccounts(t *testing.T) { if err != nil { expected.Set(amount) } else { - bS := big.Int(bobState.Balance) + bS := big.Int(*bobState.Balance) expected.Add(&bS, amount) } authorizeSource := string(golden.Get(t, "authorize.aes")) // Read the auth contract from a file, compile and prepare its init() calldata - authBytecode, err := compiler.CompileContract(authorizeSource, config.Compiler.Backend) + authBytecode, err := compiler.CompileContract(authorizeSource) if err != nil { t.Fatal(err) } - authInitCalldata, err := compiler.EncodeCalldata(authorizeSource, "init", []string{alice.Address}, config.Compiler.Backend) + authInitCalldata, err := compiler.EncodeCalldata(authorizeSource, "init", []string{alice.Address}) if err != nil { t.Fatal(err) } @@ -69,15 +69,15 @@ func TestGeneralizedAccounts(t *testing.T) { } // GAAttachTx - // Create a Contract{} struct from the compiled bytecode to get its authfunc hash - auth, err := models.NewContractFromString(authBytecode) + authFuncHash, err := binary.Blake2bHash([]byte("authorize")) if err != nil { t.Fatal(err) } - gaTx, err := transactions.NewGAAttachTx(testAccount.Address, authBytecode, auth.TypeInfo[0].FuncHash, config.Client.Contracts.VMVersion, config.Client.Contracts.ABIVersion, config.Client.Contracts.GasLimit, config.Client.GasPrice, authInitCalldata, ctx.TTLNoncer()) + gaTx, err := transactions.NewGAAttachTx(testAccount.Address, authBytecode, authFuncHash, config.Client.Contracts.VMVersion, config.Client.Contracts.ABIVersion, config.Client.Contracts.GasLimit, config.Client.GasPrice, authInitCalldata, ctx.TTLNoncer()) if err != nil { t.Fatal(err) } + ctx.SigningAccount = testAccount _, err = ctx.SignBroadcastWait(gaTx, config.Client.WaitBlocks) if err != nil { t.Fatal(err) @@ -98,15 +98,17 @@ func TestGeneralizedAccounts(t *testing.T) { // GAMetaTx // spendTx will be wrapped in a SignedTx with 0 signatures before being // included in GAMetaTx. The constructor NewGAMetaTx() does this for you. - // authData is authorize(3) - authData := "cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACBGtXufEG2HuMYcRcNwsGAeqymslunKf692bHnvwI5K6wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU3aKBNm" + authData, err := compiler.EncodeCalldata(authorizeSource, "authorize", []string{"3"}) + if err != nil { + t.Fatal(err) + } metaTxTTLNoncer := func(accountID string, offset uint64) (ttl, height, nonce uint64, err error) { return 0, 0, 0, nil } spendTx, err := transactions.NewSpendTx(testAccount.Address, bob.Address, big.NewInt(5000), []byte{}, metaTxTTLNoncer) - gaMetaTx, err := transactions.NewGAMetaTx(testAccount.Address, authData, config.Client.Contracts.ABIVersion, config.Client.GasPrice, config.Client.GasPrice, spendTx, ctx.TTLNoncer()) + gaMetaTx, err := transactions.NewGAMetaTx(testAccount.Address, authData, config.Client.Contracts.ABIVersion, big.NewInt(50000), config.Client.GasPrice, spendTx, ctx.TTLNoncer()) - gaMetaTxFinal, hash, _, err := transactions.SignHashTx(testAccount, gaMetaTx, config.Node.NetworkID) + gaMetaTxFinal, hash, _, err := transactions.SignHashTx(alice, gaMetaTx, config.Node.NetworkID) if err != nil { t.Fatal(err) } @@ -128,7 +130,7 @@ func TestGeneralizedAccounts(t *testing.T) { } } delay(getBobsAccount) - b := big.Int(bobState.Balance) + b := big.Int(*bobState.Balance) if expected.Cmp(&b) != 0 { t.Fatalf("Bob should have %v, but has %v instead", expected.String(), bobState.Balance.String()) diff --git a/integration_test/noncer_test.go b/integration_test/noncer_test.go new file mode 100644 index 00000000..b7b4dbac --- /dev/null +++ b/integration_test/noncer_test.go @@ -0,0 +1,26 @@ +package integrationtest + +import ( + "testing" + + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" +) + +func TestNoncer(t *testing.T) { + n := setupNetwork(t, privatenetURL, false) + emptyAccount, err := account.New() + if err != nil { + t.Fatal(err) + } + + ctx := aeternity.NewContext(emptyAccount, n) + _, _, accountNonce, err := ctx.TTLNoncer()(emptyAccount.Address, config.Client.TTL) + if err != nil { + t.Fatal(err) + } + if accountNonce != 0 { + t.Fatal("Invalid nonce of new account", accountNonce) + } +} diff --git a/integration_test/oracle_test.go b/integration_test/oracle_test.go index 09ae39ac..488f17f8 100644 --- a/integration_test/oracle_test.go +++ b/integration_test/oracle_test.go @@ -5,11 +5,11 @@ import ( "math/big" "testing" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) func myFunction(query string) (response string, err error) { @@ -20,20 +20,18 @@ func TestOracleHLL(t *testing.T) { node := setupNetwork(t, privatenetURL, false) ctx := aeternity.NewContext(alice, node) oracle := aeternity.NewOracle(myFunction, node, ctx, "", "", config.Tuning.ChainPollInterval) - oracle.Listen() + go oracle.Listen() } func TestOracleWorkflow(t *testing.T) { alice, _ := setupAccounts(t) node := setupNetwork(t, privatenetURL, false) - ctx := aeternity.NewContext(alice, node) - - // Setup temporary test account and fund it testAccount, err := account.New() if err != nil { t.Fatal(err) } fundAccount(t, node, alice, testAccount, big.NewInt(1000000000000000000)) + ctx := aeternity.NewContext(testAccount, node) // Register register, err := transactions.NewOracleRegisterTx(testAccount.Address, "hello", "helloback", config.Client.Oracles.QueryFee, config.OracleTTLTypeDelta, config.Client.Oracles.OracleTTLValue, config.Client.Oracles.ABIVersion, ctx.TTLNoncer()) @@ -80,10 +78,11 @@ func TestOracleWorkflow(t *testing.T) { } // Query - query, err := transactions.NewOracleQueryTx(testAccount.Address, oraclePubKey, "How was your day?", config.Client.Oracles.QueryFee, 0, 100, 0, 100, ctx.TTLNoncer()) + query, err := transactions.NewOracleQueryTx(alice.Address, oraclePubKey, "How was your day?", config.Client.Oracles.QueryFee, 0, 100, 0, 100, ctx.TTLNoncer()) if err != nil { t.Fatal(err) } + ctx.SigningAccount = alice fmt.Printf("Query %+v\n", query) _, err = ctx.SignBroadcastWait(query, config.Client.WaitBlocks) if err != nil { @@ -97,6 +96,7 @@ func TestOracleWorkflow(t *testing.T) { } // Respond + ctx.SigningAccount = testAccount respond, err := transactions.NewOracleRespondTx(testAccount.Address, oraclePubKey, oqID, "My day was fine thank you", config.OracleTTLTypeDelta, config.Client.Oracles.ResponseTTLValue, ctx.TTLNoncer()) if err != nil { t.Fatal(err) diff --git a/integration_test/spend_test.go b/integration_test/spend_test.go index 89f3663b..e8b7dd0b 100644 --- a/integration_test/spend_test.go +++ b/integration_test/spend_test.go @@ -4,10 +4,10 @@ import ( "math/big" "testing" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/transactions" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/transactions" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) // Tests for 2 things: sending an amount that is max uint64, and that the node @@ -26,7 +26,7 @@ func TestSpendTx(t *testing.T) { if err != nil { expected.Set(amount) } else { - bS := big.Int(bobState.Balance) + bS := big.Int(*bobState.Balance) expected.Add(&bS, amount) } @@ -52,7 +52,7 @@ func TestSpendTx(t *testing.T) { } } delay(getBobsAccount) - b := big.Int(bobState.Balance) + b := big.Int(*bobState.Balance) if expected.Cmp(&b) != 0 { t.Fatalf("Bob should have %v, but has %v instead", expected.String(), bobState.Balance.String()) diff --git a/integration_test/testdata/authorize_bytecode.txt b/integration_test/testdata/authorize_bytecode.txt deleted file mode 100644 index 2546b7e2..00000000 --- a/integration_test/testdata/authorize_bytecode.txt +++ /dev/null @@ -1 +0,0 @@ -cb_+QegRgKgOOZuRvAD/pZCyb5ecQ1p6GELFfi4tlz2cnV2M5iDqkL5BVH5AS+gRrV7nxBth7jGHEXDcLBgHqsprJbpyn+vdmx578COSuuJYXV0aG9yaXpluMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC4QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD5AY6g3x9QvmHUCNlWpzjYO1II0nP3bjorZc38IBafRAUZKO+HdG9fc2lnbrkBIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA//////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPkCi6DiIx1s38k5Ft5Ms6mFe/Zc9A/CVvShSYs/fnyYDBmTRIRpbml0uMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5AaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAP//////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGA//////////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALkCIGIAAI9iAADCkYCAgFF/RrV7nxBth7jGHEXDcLBgHqsprJbpyn+vdmx578COSusUYgAA0ldQgIBRf98fUL5h1AjZVqc42DtSCNJz9246K2XN/CAWn0QFGSjvFGIAAVNXUIBRf+IjHWzfyTkW3kyzqYV79lz0D8JW9KFJiz9+fJgMGZNEFGIAAdhXUGABGVEAW2AAGVlgIAGQgVJgIJADYABZkIFSgVJZYCABkIFSYCCQA2ADgVKQWWAAUVlSYABSYADzW2AAgFJgAPNbYAD9kFCQVltgIAFRUZBQWVCAkVBQYABgAGAAYQH0WZCBUmAAYABa8YBRYAAUYgABDVeAUWABFGIAAUZXUGABGVEAW1B/Tm90IGluIEF1dGggY29udGV4dAAAAAAAAAAAAAAAAABZYCABkIFSYCCQA2ATgVKQUGIAAMpWW2AgAVFgAZBQkFCQVltgIAFRgFGQYCABUZFQWVCAgpJQklBQYABgAGAAg1lgIAGQgVJgIJADhYFSWWBAAZCBUmAgkANgABlZYCABkIFSYCCQA2AAWZCBUoFSWWAgAZCBUmAgkANgAFmQgVKBUllgIAGQgVJgIJADYAOBUoFSYCCQA2EBk4FSYABgAFrxkVBQkFZbYCABUVGDklCAkVBQgFmQgVJZYCABkIFSYCCQA2AAGVlgIAGQgVJgIJADYABZkIFSgVJZYCABkIFSYCCQA2ADgVKBUpBQkFaFMy4yLjB5ldjq \ No newline at end of file diff --git a/integration_test/testdata/identity.aes b/integration_test/testdata/identity.aes index 38ae3f22..0c6997ed 100644 --- a/integration_test/testdata/identity.aes +++ b/integration_test/testdata/identity.aes @@ -1,2 +1,2 @@ contract Identity = - entrypoint main(z : int) = z \ No newline at end of file + entrypoint getArg(z : int) = z \ No newline at end of file diff --git a/integration_test/testsetup.go b/integration_test/testsetup.go index b3e26d3e..7d8bd86d 100644 --- a/integration_test/testsetup.go +++ b/integration_test/testsetup.go @@ -2,24 +2,20 @@ package integrationtest import ( "fmt" - "io/ioutil" "math/big" - "os" "testing" "time" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/aeternity" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" - "github.com/aeternity/aepp-sdk-go/v8/transactions" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/aeternity" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" + "github.com/aeternity/aepp-sdk-go/v9/transactions" ) -var sender = "ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi" -var alicePrivateKey = os.Getenv("AETERNITY_ALICE_PRIVATE_KEY") -var bobPrivateKey = os.Getenv("AETERNITY_BOB_PRIVATE_KEY") +var alicePrivateKey = "e6a91d633c77cf5771329d3354b3bcef1bc5e032c43d70b6d35af923ce1eb74dcea7ade470c9f99d9d4e400880a86f1d49bb444b62f11a9ebb64bbcfeb73fef3" +var bobPrivateKey = "7065616e38c1da983bc619188efe19bbddc8c149ddfcd3ed1c294294957a18477b47ed425587f4abd5064fe61d5a0121949a4125e8b700a2d14f0bbbafb8b2c6" var privatenetURL = "http://localhost:3013" -var testnetURL = "http://sdk-testnet.aepps.com" var networkID = "ae_docker" func setupNetwork(t *testing.T, nodeURL string, debug bool) *naet.Node { @@ -43,14 +39,6 @@ func setupAccounts(t *testing.T) (*account.Account, *account.Account) { return alice, bob } -func readFile(t *testing.T, filename string) (r string) { - rb, err := ioutil.ReadFile(filename) - if err != nil { - t.Fatal(err) - } - return string(rb) -} - type delayableCode func() func delay(f delayableCode) { @@ -58,16 +46,6 @@ func delay(f delayableCode) { f() } -func getHeight(node *naet.Node) (h uint64) { - h, err := node.GetHeight() - if err != nil { - fmt.Println("Could not retrieve chain height") - return - } - // fmt.Println("Current Height:", h) - return -} - func fundAccount(t *testing.T, node *naet.Node, source, destination *account.Account, amount *big.Int) { ttlnoncer := transactions.NewTTLNoncer(node) fmt.Println("Funding account", destination.Address) diff --git a/main.go b/main.go index 29767ee8..40a28ce3 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ package main import ( - "github.com/aeternity/aepp-sdk-go/v8/cmd" + "github.com/aeternity/aepp-sdk-go/v9/cmd" ) // Version hold the version of the program diff --git a/models/contract.go b/models/contract.go index da161285..62521155 100644 --- a/models/contract.go +++ b/models/contract.go @@ -1,8 +1,8 @@ package models import ( - "github.com/aeternity/aepp-sdk-go/v8/binary" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + rlp "github.com/aeternity/rlp-go" ) // ContractFunction struct represents the type information for a single function diff --git a/naet/api.go b/naet/api.go index 9088031f..07191adf 100644 --- a/naet/api.go +++ b/naet/api.go @@ -1,11 +1,12 @@ package naet import ( + "errors" "fmt" "reflect" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/client/external" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/client/external" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // getErrorReason parses the external.*BadRequest structs returned by the @@ -89,7 +90,7 @@ func (c *Node) PostTransaction(signedEncodedTx, signedEncodedTxHash string) (err return } if *r.Payload.TxHash != signedEncodedTxHash { - err = fmt.Errorf("Transaction hash mismatch, expected %s got %s", signedEncodedTxHash, *r.Payload.TxHash) + err = fmt.Errorf("transaction hash mismatch, expected %s got %s", signedEncodedTxHash, *r.Payload.TxHash) } return } @@ -134,7 +135,7 @@ func (c *Node) GetHeight() (height uint64, err error) { func (c *Node) GetCurrentKeyBlock() (kb *models.KeyBlock, err error) { r, err := c.External.GetCurrentKeyBlock(nil) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } kb = r.Payload @@ -153,7 +154,7 @@ func (c *Node) GetAccount(accountID string) (account *models.Account, err error) p := external.NewGetAccountByPubkeyParams().WithPubkey(accountID) r, err := c.External.GetAccountByPubkey(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } account = r.Payload @@ -172,7 +173,7 @@ func (c *Node) GetNameEntryByName(name string) (nameEntry *models.NameEntry, err r, err := c.External.GetNameEntryByName(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } @@ -191,7 +192,7 @@ func (c *Node) GetGenerationByHeight(height uint64) (g *models.Generation, err e p := external.NewGetGenerationByHeightParams().WithHeight(height) r, err := c.External.GetGenerationByHeight(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } g = r.Payload @@ -210,7 +211,7 @@ func (c *Node) GetMicroBlockTransactionsByHash(microBlockID string) (txs *models p := external.NewGetMicroBlockTransactionsByHashParams().WithHash(microBlockID) r, err := c.External.GetMicroBlockTransactionsByHash(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } txs = r.Payload @@ -228,7 +229,7 @@ func (c *Node) GetMicroBlockHeaderByHash(microBlockID string) (txs *models.Micro p := external.NewGetMicroBlockHeaderByHashParams().WithHash(microBlockID) r, err := c.External.GetMicroBlockHeaderByHash(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } txs = r.Payload @@ -246,7 +247,7 @@ func (c *Node) GetKeyBlockByHash(keyBlockID string) (txs *models.KeyBlock, err e p := external.NewGetKeyBlockByHashParams().WithHash(keyBlockID) r, err := c.External.GetKeyBlockByHash(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } txs = r.Payload @@ -264,7 +265,7 @@ func (c *Node) GetTransactionByHash(txHash string) (tx *models.GenericSignedTx, p := external.NewGetTransactionByHashParams().WithHash(txHash) r, err := c.External.GetTransactionByHash(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } tx = r.Payload @@ -282,7 +283,7 @@ func (c *Node) GetTransactionInfoByHash(txHash string) (tx *models.TxInfoObject, p := external.NewGetTransactionInfoByHashParams().WithHash(txHash) r, err := c.External.GetTransactionInfoByHash(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } tx = r.Payload @@ -300,7 +301,7 @@ func (c *Node) GetOracleByPubkey(pubkey string) (oracle *models.RegisteredOracle p := external.NewGetOracleByPubkeyParams().WithPubkey(pubkey) r, err := c.External.GetOracleByPubkey(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } oracle = r.Payload @@ -318,7 +319,7 @@ func (c *Node) GetOracleQueriesByPubkey(pubkey string) (oracleQueries *models.Or p := external.NewGetOracleQueriesByPubkeyParams().WithPubkey(pubkey) r, err := c.External.GetOracleQueriesByPubkey(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } oracleQueries = r.Payload @@ -330,7 +331,7 @@ func (c *Node) GetContractByID(ctID string) (contract *models.ContractObject, er p := external.NewGetContractParams().WithPubkey(ctID) r, err := c.External.GetContract(p) if err != nil { - err = fmt.Errorf("Error: %v", getErrorReason(err)) + err = errors.New(getErrorReason(err)) return } contract = r.Payload diff --git a/naet/compiler.go b/naet/compiler.go index 9d388f38..eb673b96 100644 --- a/naet/compiler.go +++ b/naet/compiler.go @@ -1,9 +1,9 @@ package naet import ( - compiler_client "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/client" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/client/operations" - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + compiler_client "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/client" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/client/operations" + models "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) @@ -50,13 +50,12 @@ func (c *Compiler) APIVersion() (version string, err error) { // CompileContracter guarantees that one can run a CompileContract() method on // the mocked/real network connection to the aesophia compiler type CompileContracter interface { - CompileContract(source string, backend string) (bytecode string, err error) + CompileContract(source string) (bytecode string, err error) } // CompileContract abstracts away the swagger specifics of posting to /compile -func (c *Compiler) CompileContract(source string, backend string) (bytecode string, err error) { +func (c *Compiler) CompileContract(source string) (bytecode string, err error) { contract := &models.Contract{Code: &source, Options: &models.CompileOpts{ - Backend: backend, FileSystem: nil, SrcFile: "", }} @@ -65,25 +64,24 @@ func (c *Compiler) CompileContract(source string, backend string) (bytecode stri if err != nil { return "", err } - bytecode = string(result.Payload.Bytecode) + bytecode = string(*result.Payload.Bytecode) return } // DecodeCallResulter guarantees that one can run a DecodeCallResult() method on // the mocked/real network connection to the aesophia compiler type DecodeCallResulter interface { - DecodeCallResult(callResult string, callValue string, function string, source string, backend string) (answer interface{}, err error) + DecodeCallResult(callResult string, callValue string, function string, source string) (answer interface{}, err error) } // DecodeCallResult abstracts away the swagger specifics of posting to // /decode-call-result -func (c *Compiler) DecodeCallResult(callResult string, callValue string, function string, source string, backend string) (answer interface{}, err error) { +func (c *Compiler) DecodeCallResult(callResult string, callValue string, function string, source string) (answer interface{}, err error) { sophiaCallResultInput := &models.SophiaCallResultInput{ CallResult: &callResult, CallValue: &callValue, Function: &function, Options: &models.CompileOpts{ - Backend: backend, FileSystem: nil, SrcFile: "", }, @@ -102,16 +100,17 @@ func (c *Compiler) DecodeCallResult(callResult string, callValue string, functio // DecodeCalldataBytecode() method on the mocked/real network connection to the // aesophia compiler type DecodeCalldataBytecoder interface { - DecodeCalldataBytecode(bytecode string, calldata string, backend string) (decodedCallData *models.DecodedCalldata, err error) + DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *models.DecodedCalldata, err error) } // DecodeCalldataBytecode abstracts away the swagger specifics of posting to // /decode-calldata/bytecode -func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string, backend string) (decodedCallData *models.DecodedCalldata, err error) { +func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *models.DecodedCalldata, err error) { + bytecodeEba := models.EncodedByteArray(bytecode) + calldataEba := models.EncodedByteArray(calldata) decodeCalldataBytecode := &models.DecodeCalldataBytecode{ - Bytecode: models.EncodedByteArray(bytecode), - Calldata: models.EncodedByteArray(calldata), - Backend: backend, + Bytecode: &bytecodeEba, + Calldata: &calldataEba, } params := operations.NewDecodeCalldataBytecodeParams().WithBody(decodeCalldataBytecode) result, err := c.Compiler.Operations.DecodeCalldataBytecode(params) @@ -125,17 +124,17 @@ func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string, back // DecodeCalldataSourcer guarantees that one can run a DecodeCalldataSource() // method on the mocked/real network connection to the aesophia compiler type DecodeCalldataSourcer interface { - DecodeCalldataSource(source string, function string, callData string, backend string) (decodedCallData *models.DecodedCalldata, err error) + DecodeCalldataSource(source string, function string, callData string) (decodedCallData *models.DecodedCalldata, err error) } // DecodeCalldataSource abstracts away the swagger specifics of posting to // /decode-calldata/source -func (c *Compiler) DecodeCalldataSource(source string, function string, callData string, backend string) (decodedCallData *models.DecodedCalldata, err error) { +func (c *Compiler) DecodeCalldataSource(source string, function string, callData string) (decodedCallData *models.DecodedCalldata, err error) { + callDataEba := models.EncodedByteArray(callData) p := &models.DecodeCalldataSource{ - Calldata: models.EncodedByteArray(callData), + Calldata: &callDataEba, Function: &function, Options: &models.CompileOpts{ - Backend: backend, FileSystem: nil, SrcFile: "", }, @@ -174,17 +173,16 @@ func (c *Compiler) DecodeData(data string, sophiaType string) (decodedData *mode // EncodeCalldataer guarantees that one can run a EncodeCalldata() method on the // mocked/real network connection to the aesophia compiler type EncodeCalldataer interface { - EncodeCalldata(source string, function string, args []string, backend string) (callData string, err error) + EncodeCalldata(source string, function string, args []string) (callData string, err error) } // EncodeCalldata abstracts away the swagger specifics of posting to // /encode-calldata -func (c *Compiler) EncodeCalldata(source string, function string, args []string, backend string) (callData string, err error) { +func (c *Compiler) EncodeCalldata(source string, function string, args []string) (callData string, err error) { f := &models.FunctionCallInput{ Arguments: args, Function: &function, Options: &models.CompileOpts{ - Backend: backend, FileSystem: nil, SrcFile: "", }, @@ -196,20 +194,19 @@ func (c *Compiler) EncodeCalldata(source string, function string, args []string, return } - s := string(result.Payload.Calldata) + s := string(*result.Payload.Calldata) return s, err } // GenerateACIer guarantees that one can run a GenerateACI() method on the // mocked/real network connection to the aesophia compiler type GenerateACIer interface { - GenerateACI(source string, backend string) (aci *models.ACI, err error) + GenerateACI(source string) (aci *models.ACI, err error) } // GenerateACI abstracts away the swagger specifics of posting to /aci -func (c *Compiler) GenerateACI(source string, backend string) (aci *models.ACI, err error) { +func (c *Compiler) GenerateACI(source string) (aci *models.ACI, err error) { contract := &models.Contract{Code: &source, Options: &models.CompileOpts{ - Backend: backend, FileSystem: nil, SrcFile: "", }} diff --git a/naet/node.go b/naet/node.go index 9c1a7d54..05ee430b 100644 --- a/naet/node.go +++ b/naet/node.go @@ -3,7 +3,7 @@ package naet import ( "strings" - apiclient "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/client" + apiclient "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/client" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" ) diff --git a/swagguard/compiler/client/compiler_client.go b/swagguard/compiler/client/compiler_client.go index 298c54ca..58e823ba 100644 --- a/swagguard/compiler/client/compiler_client.go +++ b/swagguard/compiler/client/compiler_client.go @@ -6,12 +6,10 @@ package client // Editing this file might prove futile when you re-run the swagger generate command import ( + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/client/operations" "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" - - "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/client/operations" + "github.com/go-openapi/strfmt" ) // Default compiler HTTP client. @@ -56,9 +54,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Compiler { cli := new(Compiler) cli.Transport = transport - cli.Operations = operations.New(transport, formats) - return cli } @@ -103,7 +99,7 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { // Compiler is a client for compiler type Compiler struct { - Operations *operations.Client + Operations operations.ClientService Transport runtime.ClientTransport } @@ -111,7 +107,5 @@ type Compiler struct { // SetTransport changes the transport on the client and all its subresources func (c *Compiler) SetTransport(transport runtime.ClientTransport) { c.Transport = transport - c.Operations.SetTransport(transport) - } diff --git a/swagguard/compiler/client/operations/api_parameters.go b/swagguard/compiler/client/operations/api_parameters.go index cace934a..ebe9ab7e 100644 --- a/swagguard/compiler/client/operations/api_parameters.go +++ b/swagguard/compiler/client/operations/api_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewAPIParams creates a new APIParams object -// with the default values initialized. +// NewAPIParams creates a new APIParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewAPIParams() *APIParams { - return &APIParams{ - timeout: cr.DefaultTimeout, } } // NewAPIParamsWithTimeout creates a new APIParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAPIParamsWithTimeout(timeout time.Duration) *APIParams { - return &APIParams{ - timeout: timeout, } } // NewAPIParamsWithContext creates a new APIParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAPIParamsWithContext(ctx context.Context) *APIParams { - return &APIParams{ - Context: ctx, } } // NewAPIParamsWithHTTPClient creates a new APIParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAPIParamsWithHTTPClient(client *http.Client) *APIParams { - return &APIParams{ HTTPClient: client, } } -/*APIParams contains all the parameters to send to the API endpoint -for the Api operation typically these are written to a http.Request +/* APIParams contains all the parameters to send to the API endpoint + for the Api operation. + + Typically these are written to a http.Request. */ type APIParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type APIParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the Api params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *APIParams) WithDefaults() *APIParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the Api params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *APIParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the Api params func (o *APIParams) WithTimeout(timeout time.Duration) *APIParams { o.SetTimeout(timeout) diff --git a/swagguard/compiler/client/operations/api_responses.go b/swagguard/compiler/client/operations/api_responses.go index adbed70f..a91e4414 100644 --- a/swagguard/compiler/client/operations/api_responses.go +++ b/swagguard/compiler/client/operations/api_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // APIReader is a Reader for the API structure. @@ -24,23 +23,20 @@ type APIReader struct { // ReadResponse reads a server response into the received o. func (o *APIReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewAPIOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewAPIBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewAPIOK() *APIOK { return &APIOK{} } -/*APIOK handles this case with default header values. +/* APIOK describes a response with status code 200, with default header values. API description */ @@ -60,6 +56,9 @@ type APIOK struct { func (o *APIOK) Error() string { return fmt.Sprintf("[GET /api][%d] apiOK %+v", 200, o.Payload) } +func (o *APIOK) GetPayload() models.API { + return o.Payload +} func (o *APIOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -76,7 +75,7 @@ func NewAPIBadRequest() *APIBadRequest { return &APIBadRequest{} } -/*APIBadRequest handles this case with default header values. +/* APIBadRequest describes a response with status code 400, with default header values. Error */ @@ -87,6 +86,9 @@ type APIBadRequest struct { func (o *APIBadRequest) Error() string { return fmt.Sprintf("[GET /api][%d] apiBadRequest %+v", 400, o.Payload) } +func (o *APIBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *APIBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/api_version_parameters.go b/swagguard/compiler/client/operations/api_version_parameters.go index 2c284bb0..b73bb7ec 100644 --- a/swagguard/compiler/client/operations/api_version_parameters.go +++ b/swagguard/compiler/client/operations/api_version_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewAPIVersionParams creates a new APIVersionParams object -// with the default values initialized. +// NewAPIVersionParams creates a new APIVersionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewAPIVersionParams() *APIVersionParams { - return &APIVersionParams{ - timeout: cr.DefaultTimeout, } } // NewAPIVersionParamsWithTimeout creates a new APIVersionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewAPIVersionParamsWithTimeout(timeout time.Duration) *APIVersionParams { - return &APIVersionParams{ - timeout: timeout, } } // NewAPIVersionParamsWithContext creates a new APIVersionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewAPIVersionParamsWithContext(ctx context.Context) *APIVersionParams { - return &APIVersionParams{ - Context: ctx, } } // NewAPIVersionParamsWithHTTPClient creates a new APIVersionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewAPIVersionParamsWithHTTPClient(client *http.Client) *APIVersionParams { - return &APIVersionParams{ HTTPClient: client, } } -/*APIVersionParams contains all the parameters to send to the API endpoint -for the API version operation typically these are written to a http.Request +/* APIVersionParams contains all the parameters to send to the API endpoint + for the API version operation. + + Typically these are written to a http.Request. */ type APIVersionParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type APIVersionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the API version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *APIVersionParams) WithDefaults() *APIVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the API version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *APIVersionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the API version params func (o *APIVersionParams) WithTimeout(timeout time.Duration) *APIVersionParams { o.SetTimeout(timeout) diff --git a/swagguard/compiler/client/operations/api_version_responses.go b/swagguard/compiler/client/operations/api_version_responses.go index 986fed00..f949ea97 100644 --- a/swagguard/compiler/client/operations/api_version_responses.go +++ b/swagguard/compiler/client/operations/api_version_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // APIVersionReader is a Reader for the APIVersion structure. @@ -24,23 +23,20 @@ type APIVersionReader struct { // ReadResponse reads a server response into the received o. func (o *APIVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewAPIVersionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewAPIVersionInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewAPIVersionOK() *APIVersionOK { return &APIVersionOK{} } -/*APIVersionOK handles this case with default header values. +/* APIVersionOK describes a response with status code 200, with default header values. Sophia compiler version */ @@ -60,6 +56,9 @@ type APIVersionOK struct { func (o *APIVersionOK) Error() string { return fmt.Sprintf("[GET /api-version][%d] apiVersionOK %+v", 200, o.Payload) } +func (o *APIVersionOK) GetPayload() *models.APIVersion { + return o.Payload +} func (o *APIVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewAPIVersionInternalServerError() *APIVersionInternalServerError { return &APIVersionInternalServerError{} } -/*APIVersionInternalServerError handles this case with default header values. +/* APIVersionInternalServerError describes a response with status code 500, with default header values. Error */ @@ -89,6 +88,9 @@ type APIVersionInternalServerError struct { func (o *APIVersionInternalServerError) Error() string { return fmt.Sprintf("[GET /api-version][%d] apiVersionInternalServerError %+v", 500, o.Payload) } +func (o *APIVersionInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *APIVersionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/compile_contract_parameters.go b/swagguard/compiler/client/operations/compile_contract_parameters.go index 63064e03..9a293337 100644 --- a/swagguard/compiler/client/operations/compile_contract_parameters.go +++ b/swagguard/compiler/client/operations/compile_contract_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewCompileContractParams creates a new CompileContractParams object -// with the default values initialized. +// NewCompileContractParams creates a new CompileContractParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewCompileContractParams() *CompileContractParams { - var () return &CompileContractParams{ - timeout: cr.DefaultTimeout, } } // NewCompileContractParamsWithTimeout creates a new CompileContractParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewCompileContractParamsWithTimeout(timeout time.Duration) *CompileContractParams { - var () return &CompileContractParams{ - timeout: timeout, } } // NewCompileContractParamsWithContext creates a new CompileContractParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewCompileContractParamsWithContext(ctx context.Context) *CompileContractParams { - var () return &CompileContractParams{ - Context: ctx, } } // NewCompileContractParamsWithHTTPClient creates a new CompileContractParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewCompileContractParamsWithHTTPClient(client *http.Client) *CompileContractParams { - var () return &CompileContractParams{ HTTPClient: client, } } -/*CompileContractParams contains all the parameters to send to the API endpoint -for the compile contract operation typically these are written to a http.Request +/* CompileContractParams contains all the parameters to send to the API endpoint + for the compile contract operation. + + Typically these are written to a http.Request. */ type CompileContractParams struct { - /*Body - contract code + /* Body. + contract code */ Body *models.Contract @@ -74,6 +72,21 @@ type CompileContractParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the compile contract params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompileContractParams) WithDefaults() *CompileContractParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the compile contract params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CompileContractParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the compile contract params func (o *CompileContractParams) WithTimeout(timeout time.Duration) *CompileContractParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *CompileContractParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/compile_contract_responses.go b/swagguard/compiler/client/operations/compile_contract_responses.go index 3e00e47d..7b60264d 100644 --- a/swagguard/compiler/client/operations/compile_contract_responses.go +++ b/swagguard/compiler/client/operations/compile_contract_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // CompileContractReader is a Reader for the CompileContract structure. @@ -24,23 +23,20 @@ type CompileContractReader struct { // ReadResponse reads a server response into the received o. func (o *CompileContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewCompileContractOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewCompileContractBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewCompileContractOK() *CompileContractOK { return &CompileContractOK{} } -/*CompileContractOK handles this case with default header values. +/* CompileContractOK describes a response with status code 200, with default header values. Byte code response */ @@ -60,6 +56,9 @@ type CompileContractOK struct { func (o *CompileContractOK) Error() string { return fmt.Sprintf("[POST /compile][%d] compileContractOK %+v", 200, o.Payload) } +func (o *CompileContractOK) GetPayload() *models.ByteCode { + return o.Payload +} func (o *CompileContractOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewCompileContractBadRequest() *CompileContractBadRequest { return &CompileContractBadRequest{} } -/*CompileContractBadRequest handles this case with default header values. +/* CompileContractBadRequest describes a response with status code 400, with default header values. Invalid contract */ @@ -89,6 +88,9 @@ type CompileContractBadRequest struct { func (o *CompileContractBadRequest) Error() string { return fmt.Sprintf("[POST /compile][%d] compileContractBadRequest %+v", 400, o.Payload) } +func (o *CompileContractBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *CompileContractBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/decode_call_result_bytecode_parameters.go b/swagguard/compiler/client/operations/decode_call_result_bytecode_parameters.go index 4c70dbb5..3d57d339 100644 --- a/swagguard/compiler/client/operations/decode_call_result_bytecode_parameters.go +++ b/swagguard/compiler/client/operations/decode_call_result_bytecode_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewDecodeCallResultBytecodeParams creates a new DecodeCallResultBytecodeParams object -// with the default values initialized. +// NewDecodeCallResultBytecodeParams creates a new DecodeCallResultBytecodeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDecodeCallResultBytecodeParams() *DecodeCallResultBytecodeParams { - var () return &DecodeCallResultBytecodeParams{ - timeout: cr.DefaultTimeout, } } // NewDecodeCallResultBytecodeParamsWithTimeout creates a new DecodeCallResultBytecodeParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDecodeCallResultBytecodeParamsWithTimeout(timeout time.Duration) *DecodeCallResultBytecodeParams { - var () return &DecodeCallResultBytecodeParams{ - timeout: timeout, } } // NewDecodeCallResultBytecodeParamsWithContext creates a new DecodeCallResultBytecodeParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDecodeCallResultBytecodeParamsWithContext(ctx context.Context) *DecodeCallResultBytecodeParams { - var () return &DecodeCallResultBytecodeParams{ - Context: ctx, } } // NewDecodeCallResultBytecodeParamsWithHTTPClient creates a new DecodeCallResultBytecodeParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDecodeCallResultBytecodeParamsWithHTTPClient(client *http.Client) *DecodeCallResultBytecodeParams { - var () return &DecodeCallResultBytecodeParams{ HTTPClient: client, } } -/*DecodeCallResultBytecodeParams contains all the parameters to send to the API endpoint -for the decode call result bytecode operation typically these are written to a http.Request +/* DecodeCallResultBytecodeParams contains all the parameters to send to the API endpoint + for the decode call result bytecode operation. + + Typically these are written to a http.Request. */ type DecodeCallResultBytecodeParams struct { - /*Body - Call result + compiled contract + /* Body. + Call result + compiled contract */ Body *models.BytecodeCallResultInput @@ -74,6 +72,21 @@ type DecodeCallResultBytecodeParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decode call result bytecode params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCallResultBytecodeParams) WithDefaults() *DecodeCallResultBytecodeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decode call result bytecode params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCallResultBytecodeParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decode call result bytecode params func (o *DecodeCallResultBytecodeParams) WithTimeout(timeout time.Duration) *DecodeCallResultBytecodeParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *DecodeCallResultBytecodeParams) WriteToRequest(r runtime.ClientRequest, return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/decode_call_result_bytecode_responses.go b/swagguard/compiler/client/operations/decode_call_result_bytecode_responses.go index 6693145f..d50142e7 100644 --- a/swagguard/compiler/client/operations/decode_call_result_bytecode_responses.go +++ b/swagguard/compiler/client/operations/decode_call_result_bytecode_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // DecodeCallResultBytecodeReader is a Reader for the DecodeCallResultBytecode structure. @@ -24,23 +23,20 @@ type DecodeCallResultBytecodeReader struct { // ReadResponse reads a server response into the received o. func (o *DecodeCallResultBytecodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewDecodeCallResultBytecodeOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewDecodeCallResultBytecodeBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewDecodeCallResultBytecodeOK() *DecodeCallResultBytecodeOK { return &DecodeCallResultBytecodeOK{} } -/*DecodeCallResultBytecodeOK handles this case with default header values. +/* DecodeCallResultBytecodeOK describes a response with status code 200, with default header values. Json encoded data */ @@ -60,6 +56,9 @@ type DecodeCallResultBytecodeOK struct { func (o *DecodeCallResultBytecodeOK) Error() string { return fmt.Sprintf("[POST /decode-call-result/bytecode][%d] decodeCallResultBytecodeOK %+v", 200, o.Payload) } +func (o *DecodeCallResultBytecodeOK) GetPayload() *models.DecodedCallresult { + return o.Payload +} func (o *DecodeCallResultBytecodeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewDecodeCallResultBytecodeBadRequest() *DecodeCallResultBytecodeBadRequest return &DecodeCallResultBytecodeBadRequest{} } -/*DecodeCallResultBytecodeBadRequest handles this case with default header values. +/* DecodeCallResultBytecodeBadRequest describes a response with status code 400, with default header values. Invalid data */ @@ -89,6 +88,9 @@ type DecodeCallResultBytecodeBadRequest struct { func (o *DecodeCallResultBytecodeBadRequest) Error() string { return fmt.Sprintf("[POST /decode-call-result/bytecode][%d] decodeCallResultBytecodeBadRequest %+v", 400, o.Payload) } +func (o *DecodeCallResultBytecodeBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *DecodeCallResultBytecodeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/decode_call_result_parameters.go b/swagguard/compiler/client/operations/decode_call_result_parameters.go index bc6b029b..1f556dda 100644 --- a/swagguard/compiler/client/operations/decode_call_result_parameters.go +++ b/swagguard/compiler/client/operations/decode_call_result_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewDecodeCallResultParams creates a new DecodeCallResultParams object -// with the default values initialized. +// NewDecodeCallResultParams creates a new DecodeCallResultParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDecodeCallResultParams() *DecodeCallResultParams { - var () return &DecodeCallResultParams{ - timeout: cr.DefaultTimeout, } } // NewDecodeCallResultParamsWithTimeout creates a new DecodeCallResultParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDecodeCallResultParamsWithTimeout(timeout time.Duration) *DecodeCallResultParams { - var () return &DecodeCallResultParams{ - timeout: timeout, } } // NewDecodeCallResultParamsWithContext creates a new DecodeCallResultParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDecodeCallResultParamsWithContext(ctx context.Context) *DecodeCallResultParams { - var () return &DecodeCallResultParams{ - Context: ctx, } } // NewDecodeCallResultParamsWithHTTPClient creates a new DecodeCallResultParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDecodeCallResultParamsWithHTTPClient(client *http.Client) *DecodeCallResultParams { - var () return &DecodeCallResultParams{ HTTPClient: client, } } -/*DecodeCallResultParams contains all the parameters to send to the API endpoint -for the decode call result operation typically these are written to a http.Request +/* DecodeCallResultParams contains all the parameters to send to the API endpoint + for the decode call result operation. + + Typically these are written to a http.Request. */ type DecodeCallResultParams struct { - /*Body - Binary data in Sophia ABI format + /* Body. + Binary data in Sophia ABI format */ Body *models.SophiaCallResultInput @@ -74,6 +72,21 @@ type DecodeCallResultParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decode call result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCallResultParams) WithDefaults() *DecodeCallResultParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decode call result params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCallResultParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decode call result params func (o *DecodeCallResultParams) WithTimeout(timeout time.Duration) *DecodeCallResultParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *DecodeCallResultParams) WriteToRequest(r runtime.ClientRequest, reg str return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/decode_call_result_responses.go b/swagguard/compiler/client/operations/decode_call_result_responses.go index 564157ce..ea865231 100644 --- a/swagguard/compiler/client/operations/decode_call_result_responses.go +++ b/swagguard/compiler/client/operations/decode_call_result_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // DecodeCallResultReader is a Reader for the DecodeCallResult structure. @@ -24,23 +23,20 @@ type DecodeCallResultReader struct { // ReadResponse reads a server response into the received o. func (o *DecodeCallResultReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewDecodeCallResultOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewDecodeCallResultBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewDecodeCallResultOK() *DecodeCallResultOK { return &DecodeCallResultOK{} } -/*DecodeCallResultOK handles this case with default header values. +/* DecodeCallResultOK describes a response with status code 200, with default header values. Json encoded data */ @@ -60,6 +56,9 @@ type DecodeCallResultOK struct { func (o *DecodeCallResultOK) Error() string { return fmt.Sprintf("[POST /decode-call-result][%d] decodeCallResultOK %+v", 200, o.Payload) } +func (o *DecodeCallResultOK) GetPayload() models.SophiaCallResult { + return o.Payload +} func (o *DecodeCallResultOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -76,7 +75,7 @@ func NewDecodeCallResultBadRequest() *DecodeCallResultBadRequest { return &DecodeCallResultBadRequest{} } -/*DecodeCallResultBadRequest handles this case with default header values. +/* DecodeCallResultBadRequest describes a response with status code 400, with default header values. Invalid data */ @@ -87,6 +86,9 @@ type DecodeCallResultBadRequest struct { func (o *DecodeCallResultBadRequest) Error() string { return fmt.Sprintf("[POST /decode-call-result][%d] decodeCallResultBadRequest %+v", 400, o.Payload) } +func (o *DecodeCallResultBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *DecodeCallResultBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/decode_calldata_bytecode_parameters.go b/swagguard/compiler/client/operations/decode_calldata_bytecode_parameters.go index bf9d51e9..ffbaf6bc 100644 --- a/swagguard/compiler/client/operations/decode_calldata_bytecode_parameters.go +++ b/swagguard/compiler/client/operations/decode_calldata_bytecode_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewDecodeCalldataBytecodeParams creates a new DecodeCalldataBytecodeParams object -// with the default values initialized. +// NewDecodeCalldataBytecodeParams creates a new DecodeCalldataBytecodeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDecodeCalldataBytecodeParams() *DecodeCalldataBytecodeParams { - var () return &DecodeCalldataBytecodeParams{ - timeout: cr.DefaultTimeout, } } // NewDecodeCalldataBytecodeParamsWithTimeout creates a new DecodeCalldataBytecodeParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDecodeCalldataBytecodeParamsWithTimeout(timeout time.Duration) *DecodeCalldataBytecodeParams { - var () return &DecodeCalldataBytecodeParams{ - timeout: timeout, } } // NewDecodeCalldataBytecodeParamsWithContext creates a new DecodeCalldataBytecodeParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDecodeCalldataBytecodeParamsWithContext(ctx context.Context) *DecodeCalldataBytecodeParams { - var () return &DecodeCalldataBytecodeParams{ - Context: ctx, } } // NewDecodeCalldataBytecodeParamsWithHTTPClient creates a new DecodeCalldataBytecodeParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDecodeCalldataBytecodeParamsWithHTTPClient(client *http.Client) *DecodeCalldataBytecodeParams { - var () return &DecodeCalldataBytecodeParams{ HTTPClient: client, } } -/*DecodeCalldataBytecodeParams contains all the parameters to send to the API endpoint -for the decode calldata bytecode operation typically these are written to a http.Request +/* DecodeCalldataBytecodeParams contains all the parameters to send to the API endpoint + for the decode calldata bytecode operation. + + Typically these are written to a http.Request. */ type DecodeCalldataBytecodeParams struct { - /*Body - Calldata + compiled contract + /* Body. + Calldata + compiled contract */ Body *models.DecodeCalldataBytecode @@ -74,6 +72,21 @@ type DecodeCalldataBytecodeParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decode calldata bytecode params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCalldataBytecodeParams) WithDefaults() *DecodeCalldataBytecodeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decode calldata bytecode params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCalldataBytecodeParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decode calldata bytecode params func (o *DecodeCalldataBytecodeParams) WithTimeout(timeout time.Duration) *DecodeCalldataBytecodeParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *DecodeCalldataBytecodeParams) WriteToRequest(r runtime.ClientRequest, r return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/decode_calldata_bytecode_responses.go b/swagguard/compiler/client/operations/decode_calldata_bytecode_responses.go index e7789549..51752a9b 100644 --- a/swagguard/compiler/client/operations/decode_calldata_bytecode_responses.go +++ b/swagguard/compiler/client/operations/decode_calldata_bytecode_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // DecodeCalldataBytecodeReader is a Reader for the DecodeCalldataBytecode structure. @@ -24,23 +23,20 @@ type DecodeCalldataBytecodeReader struct { // ReadResponse reads a server response into the received o. func (o *DecodeCalldataBytecodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewDecodeCalldataBytecodeOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewDecodeCalldataBytecodeBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewDecodeCalldataBytecodeOK() *DecodeCalldataBytecodeOK { return &DecodeCalldataBytecodeOK{} } -/*DecodeCalldataBytecodeOK handles this case with default header values. +/* DecodeCalldataBytecodeOK describes a response with status code 200, with default header values. Binary encoded calldata */ @@ -60,6 +56,9 @@ type DecodeCalldataBytecodeOK struct { func (o *DecodeCalldataBytecodeOK) Error() string { return fmt.Sprintf("[POST /decode-calldata/bytecode][%d] decodeCalldataBytecodeOK %+v", 200, o.Payload) } +func (o *DecodeCalldataBytecodeOK) GetPayload() *models.DecodedCalldata { + return o.Payload +} func (o *DecodeCalldataBytecodeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewDecodeCalldataBytecodeBadRequest() *DecodeCalldataBytecodeBadRequest { return &DecodeCalldataBytecodeBadRequest{} } -/*DecodeCalldataBytecodeBadRequest handles this case with default header values. +/* DecodeCalldataBytecodeBadRequest describes a response with status code 400, with default header values. Invalid contract */ @@ -89,6 +88,9 @@ type DecodeCalldataBytecodeBadRequest struct { func (o *DecodeCalldataBytecodeBadRequest) Error() string { return fmt.Sprintf("[POST /decode-calldata/bytecode][%d] decodeCalldataBytecodeBadRequest %+v", 400, o.Payload) } +func (o *DecodeCalldataBytecodeBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *DecodeCalldataBytecodeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/decode_calldata_source_parameters.go b/swagguard/compiler/client/operations/decode_calldata_source_parameters.go index aaebdc9e..c4fded4e 100644 --- a/swagguard/compiler/client/operations/decode_calldata_source_parameters.go +++ b/swagguard/compiler/client/operations/decode_calldata_source_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewDecodeCalldataSourceParams creates a new DecodeCalldataSourceParams object -// with the default values initialized. +// NewDecodeCalldataSourceParams creates a new DecodeCalldataSourceParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDecodeCalldataSourceParams() *DecodeCalldataSourceParams { - var () return &DecodeCalldataSourceParams{ - timeout: cr.DefaultTimeout, } } // NewDecodeCalldataSourceParamsWithTimeout creates a new DecodeCalldataSourceParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDecodeCalldataSourceParamsWithTimeout(timeout time.Duration) *DecodeCalldataSourceParams { - var () return &DecodeCalldataSourceParams{ - timeout: timeout, } } // NewDecodeCalldataSourceParamsWithContext creates a new DecodeCalldataSourceParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDecodeCalldataSourceParamsWithContext(ctx context.Context) *DecodeCalldataSourceParams { - var () return &DecodeCalldataSourceParams{ - Context: ctx, } } // NewDecodeCalldataSourceParamsWithHTTPClient creates a new DecodeCalldataSourceParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDecodeCalldataSourceParamsWithHTTPClient(client *http.Client) *DecodeCalldataSourceParams { - var () return &DecodeCalldataSourceParams{ HTTPClient: client, } } -/*DecodeCalldataSourceParams contains all the parameters to send to the API endpoint -for the decode calldata source operation typically these are written to a http.Request +/* DecodeCalldataSourceParams contains all the parameters to send to the API endpoint + for the decode calldata source operation. + + Typically these are written to a http.Request. */ type DecodeCalldataSourceParams struct { - /*Body - Calldata + contract (stub) code + /* Body. + Calldata + contract (stub) code */ Body *models.DecodeCalldataSource @@ -74,6 +72,21 @@ type DecodeCalldataSourceParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decode calldata source params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCalldataSourceParams) WithDefaults() *DecodeCalldataSourceParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decode calldata source params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeCalldataSourceParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decode calldata source params func (o *DecodeCalldataSourceParams) WithTimeout(timeout time.Duration) *DecodeCalldataSourceParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *DecodeCalldataSourceParams) WriteToRequest(r runtime.ClientRequest, reg return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/decode_calldata_source_responses.go b/swagguard/compiler/client/operations/decode_calldata_source_responses.go index aa7d1cb4..3bd9e749 100644 --- a/swagguard/compiler/client/operations/decode_calldata_source_responses.go +++ b/swagguard/compiler/client/operations/decode_calldata_source_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // DecodeCalldataSourceReader is a Reader for the DecodeCalldataSource structure. @@ -24,23 +23,20 @@ type DecodeCalldataSourceReader struct { // ReadResponse reads a server response into the received o. func (o *DecodeCalldataSourceReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewDecodeCalldataSourceOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewDecodeCalldataSourceBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewDecodeCalldataSourceOK() *DecodeCalldataSourceOK { return &DecodeCalldataSourceOK{} } -/*DecodeCalldataSourceOK handles this case with default header values. +/* DecodeCalldataSourceOK describes a response with status code 200, with default header values. Binary encoded calldata */ @@ -60,6 +56,9 @@ type DecodeCalldataSourceOK struct { func (o *DecodeCalldataSourceOK) Error() string { return fmt.Sprintf("[POST /decode-calldata/source][%d] decodeCalldataSourceOK %+v", 200, o.Payload) } +func (o *DecodeCalldataSourceOK) GetPayload() *models.DecodedCalldata { + return o.Payload +} func (o *DecodeCalldataSourceOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewDecodeCalldataSourceBadRequest() *DecodeCalldataSourceBadRequest { return &DecodeCalldataSourceBadRequest{} } -/*DecodeCalldataSourceBadRequest handles this case with default header values. +/* DecodeCalldataSourceBadRequest describes a response with status code 400, with default header values. Invalid data */ @@ -89,6 +88,9 @@ type DecodeCalldataSourceBadRequest struct { func (o *DecodeCalldataSourceBadRequest) Error() string { return fmt.Sprintf("[POST /decode-calldata/source][%d] decodeCalldataSourceBadRequest %+v", 400, o.Payload) } +func (o *DecodeCalldataSourceBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *DecodeCalldataSourceBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/decode_data_parameters.go b/swagguard/compiler/client/operations/decode_data_parameters.go index d5f95726..4efd3daa 100644 --- a/swagguard/compiler/client/operations/decode_data_parameters.go +++ b/swagguard/compiler/client/operations/decode_data_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewDecodeDataParams creates a new DecodeDataParams object -// with the default values initialized. +// NewDecodeDataParams creates a new DecodeDataParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewDecodeDataParams() *DecodeDataParams { - var () return &DecodeDataParams{ - timeout: cr.DefaultTimeout, } } // NewDecodeDataParamsWithTimeout creates a new DecodeDataParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewDecodeDataParamsWithTimeout(timeout time.Duration) *DecodeDataParams { - var () return &DecodeDataParams{ - timeout: timeout, } } // NewDecodeDataParamsWithContext creates a new DecodeDataParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewDecodeDataParamsWithContext(ctx context.Context) *DecodeDataParams { - var () return &DecodeDataParams{ - Context: ctx, } } // NewDecodeDataParamsWithHTTPClient creates a new DecodeDataParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewDecodeDataParamsWithHTTPClient(client *http.Client) *DecodeDataParams { - var () return &DecodeDataParams{ HTTPClient: client, } } -/*DecodeDataParams contains all the parameters to send to the API endpoint -for the decode data operation typically these are written to a http.Request +/* DecodeDataParams contains all the parameters to send to the API endpoint + for the decode data operation. + + Typically these are written to a http.Request. */ type DecodeDataParams struct { - /*Body - Binary data in Sophia ABI format + /* Body. + Binary data in Sophia ABI format */ Body *models.SophiaBinaryData @@ -74,6 +72,21 @@ type DecodeDataParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the decode data params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeDataParams) WithDefaults() *DecodeDataParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the decode data params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DecodeDataParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the decode data params func (o *DecodeDataParams) WithTimeout(timeout time.Duration) *DecodeDataParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *DecodeDataParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Re return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/decode_data_responses.go b/swagguard/compiler/client/operations/decode_data_responses.go index b421052d..33758364 100644 --- a/swagguard/compiler/client/operations/decode_data_responses.go +++ b/swagguard/compiler/client/operations/decode_data_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // DecodeDataReader is a Reader for the DecodeData structure. @@ -24,23 +23,20 @@ type DecodeDataReader struct { // ReadResponse reads a server response into the received o. func (o *DecodeDataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewDecodeDataOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewDecodeDataBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewDecodeDataOK() *DecodeDataOK { return &DecodeDataOK{} } -/*DecodeDataOK handles this case with default header values. +/* DecodeDataOK describes a response with status code 200, with default header values. Json encoded data */ @@ -60,6 +56,9 @@ type DecodeDataOK struct { func (o *DecodeDataOK) Error() string { return fmt.Sprintf("[POST /decode-data][%d] decodeDataOK %+v", 200, o.Payload) } +func (o *DecodeDataOK) GetPayload() *models.SophiaJSONData { + return o.Payload +} func (o *DecodeDataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewDecodeDataBadRequest() *DecodeDataBadRequest { return &DecodeDataBadRequest{} } -/*DecodeDataBadRequest handles this case with default header values. +/* DecodeDataBadRequest describes a response with status code 400, with default header values. Invalid data */ @@ -89,6 +88,9 @@ type DecodeDataBadRequest struct { func (o *DecodeDataBadRequest) Error() string { return fmt.Sprintf("[POST /decode-data][%d] decodeDataBadRequest %+v", 400, o.Payload) } +func (o *DecodeDataBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *DecodeDataBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/encode_calldata_parameters.go b/swagguard/compiler/client/operations/encode_calldata_parameters.go index 41649941..40608f44 100644 --- a/swagguard/compiler/client/operations/encode_calldata_parameters.go +++ b/swagguard/compiler/client/operations/encode_calldata_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewEncodeCalldataParams creates a new EncodeCalldataParams object -// with the default values initialized. +// NewEncodeCalldataParams creates a new EncodeCalldataParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewEncodeCalldataParams() *EncodeCalldataParams { - var () return &EncodeCalldataParams{ - timeout: cr.DefaultTimeout, } } // NewEncodeCalldataParamsWithTimeout creates a new EncodeCalldataParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewEncodeCalldataParamsWithTimeout(timeout time.Duration) *EncodeCalldataParams { - var () return &EncodeCalldataParams{ - timeout: timeout, } } // NewEncodeCalldataParamsWithContext creates a new EncodeCalldataParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewEncodeCalldataParamsWithContext(ctx context.Context) *EncodeCalldataParams { - var () return &EncodeCalldataParams{ - Context: ctx, } } // NewEncodeCalldataParamsWithHTTPClient creates a new EncodeCalldataParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewEncodeCalldataParamsWithHTTPClient(client *http.Client) *EncodeCalldataParams { - var () return &EncodeCalldataParams{ HTTPClient: client, } } -/*EncodeCalldataParams contains all the parameters to send to the API endpoint -for the encode calldata operation typically these are written to a http.Request +/* EncodeCalldataParams contains all the parameters to send to the API endpoint + for the encode calldata operation. + + Typically these are written to a http.Request. */ type EncodeCalldataParams struct { - /*Body - Sophia function call - contract code + function name + arguments + /* Body. + Sophia function call - contract code + function name + arguments */ Body *models.FunctionCallInput @@ -74,6 +72,21 @@ type EncodeCalldataParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the encode calldata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EncodeCalldataParams) WithDefaults() *EncodeCalldataParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the encode calldata params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EncodeCalldataParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the encode calldata params func (o *EncodeCalldataParams) WithTimeout(timeout time.Duration) *EncodeCalldataParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *EncodeCalldataParams) WriteToRequest(r runtime.ClientRequest, reg strfm return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/encode_calldata_responses.go b/swagguard/compiler/client/operations/encode_calldata_responses.go index 2d17e7a7..1365af31 100644 --- a/swagguard/compiler/client/operations/encode_calldata_responses.go +++ b/swagguard/compiler/client/operations/encode_calldata_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // EncodeCalldataReader is a Reader for the EncodeCalldata structure. @@ -24,23 +23,20 @@ type EncodeCalldataReader struct { // ReadResponse reads a server response into the received o. func (o *EncodeCalldataReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewEncodeCalldataOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewEncodeCalldataBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewEncodeCalldataOK() *EncodeCalldataOK { return &EncodeCalldataOK{} } -/*EncodeCalldataOK handles this case with default header values. +/* EncodeCalldataOK describes a response with status code 200, with default header values. Binary encoded calldata */ @@ -60,6 +56,9 @@ type EncodeCalldataOK struct { func (o *EncodeCalldataOK) Error() string { return fmt.Sprintf("[POST /encode-calldata][%d] encodeCalldataOK %+v", 200, o.Payload) } +func (o *EncodeCalldataOK) GetPayload() *models.Calldata { + return o.Payload +} func (o *EncodeCalldataOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewEncodeCalldataBadRequest() *EncodeCalldataBadRequest { return &EncodeCalldataBadRequest{} } -/*EncodeCalldataBadRequest handles this case with default header values. +/* EncodeCalldataBadRequest describes a response with status code 400, with default header values. Invalid contract */ @@ -89,6 +88,9 @@ type EncodeCalldataBadRequest struct { func (o *EncodeCalldataBadRequest) Error() string { return fmt.Sprintf("[POST /encode-calldata][%d] encodeCalldataBadRequest %+v", 400, o.Payload) } +func (o *EncodeCalldataBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *EncodeCalldataBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/generate_a_c_i_parameters.go b/swagguard/compiler/client/operations/generate_a_c_i_parameters.go index a6ac5695..ee9a176b 100644 --- a/swagguard/compiler/client/operations/generate_a_c_i_parameters.go +++ b/swagguard/compiler/client/operations/generate_a_c_i_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) -// NewGenerateACIParams creates a new GenerateACIParams object -// with the default values initialized. +// NewGenerateACIParams creates a new GenerateACIParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGenerateACIParams() *GenerateACIParams { - var () return &GenerateACIParams{ - timeout: cr.DefaultTimeout, } } // NewGenerateACIParamsWithTimeout creates a new GenerateACIParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGenerateACIParamsWithTimeout(timeout time.Duration) *GenerateACIParams { - var () return &GenerateACIParams{ - timeout: timeout, } } // NewGenerateACIParamsWithContext creates a new GenerateACIParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGenerateACIParamsWithContext(ctx context.Context) *GenerateACIParams { - var () return &GenerateACIParams{ - Context: ctx, } } // NewGenerateACIParamsWithHTTPClient creates a new GenerateACIParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGenerateACIParamsWithHTTPClient(client *http.Client) *GenerateACIParams { - var () return &GenerateACIParams{ HTTPClient: client, } } -/*GenerateACIParams contains all the parameters to send to the API endpoint -for the generate a c i operation typically these are written to a http.Request +/* GenerateACIParams contains all the parameters to send to the API endpoint + for the generate a c i operation. + + Typically these are written to a http.Request. */ type GenerateACIParams struct { - /*Body - contract code + /* Body. + contract code */ Body *models.Contract @@ -74,6 +72,21 @@ type GenerateACIParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the generate a c i params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GenerateACIParams) WithDefaults() *GenerateACIParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the generate a c i params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GenerateACIParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the generate a c i params func (o *GenerateACIParams) WithTimeout(timeout time.Duration) *GenerateACIParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *GenerateACIParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/compiler/client/operations/generate_a_c_i_responses.go b/swagguard/compiler/client/operations/generate_a_c_i_responses.go index 329fa407..94d6bed4 100644 --- a/swagguard/compiler/client/operations/generate_a_c_i_responses.go +++ b/swagguard/compiler/client/operations/generate_a_c_i_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // GenerateACIReader is a Reader for the GenerateACI structure. @@ -24,23 +23,20 @@ type GenerateACIReader struct { // ReadResponse reads a server response into the received o. func (o *GenerateACIReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGenerateACIOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGenerateACIBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGenerateACIOK() *GenerateACIOK { return &GenerateACIOK{} } -/*GenerateACIOK handles this case with default header values. +/* GenerateACIOK describes a response with status code 200, with default header values. ACI for contract */ @@ -60,6 +56,9 @@ type GenerateACIOK struct { func (o *GenerateACIOK) Error() string { return fmt.Sprintf("[POST /aci][%d] generateACIOK %+v", 200, o.Payload) } +func (o *GenerateACIOK) GetPayload() *models.ACI { + return o.Payload +} func (o *GenerateACIOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGenerateACIBadRequest() *GenerateACIBadRequest { return &GenerateACIBadRequest{} } -/*GenerateACIBadRequest handles this case with default header values. +/* GenerateACIBadRequest describes a response with status code 400, with default header values. Compiler errors */ @@ -89,6 +88,9 @@ type GenerateACIBadRequest struct { func (o *GenerateACIBadRequest) Error() string { return fmt.Sprintf("[POST /aci][%d] generateACIBadRequest %+v", 400, o.Payload) } +func (o *GenerateACIBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} func (o *GenerateACIBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/client/operations/get_compiler_version_parameters.go b/swagguard/compiler/client/operations/get_compiler_version_parameters.go new file mode 100644 index 00000000..021add19 --- /dev/null +++ b/swagguard/compiler/client/operations/get_compiler_version_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// NewGetCompilerVersionParams creates a new GetCompilerVersionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetCompilerVersionParams() *GetCompilerVersionParams { + return &GetCompilerVersionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetCompilerVersionParamsWithTimeout creates a new GetCompilerVersionParams object +// with the ability to set a timeout on a request. +func NewGetCompilerVersionParamsWithTimeout(timeout time.Duration) *GetCompilerVersionParams { + return &GetCompilerVersionParams{ + timeout: timeout, + } +} + +// NewGetCompilerVersionParamsWithContext creates a new GetCompilerVersionParams object +// with the ability to set a context for a request. +func NewGetCompilerVersionParamsWithContext(ctx context.Context) *GetCompilerVersionParams { + return &GetCompilerVersionParams{ + Context: ctx, + } +} + +// NewGetCompilerVersionParamsWithHTTPClient creates a new GetCompilerVersionParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetCompilerVersionParamsWithHTTPClient(client *http.Client) *GetCompilerVersionParams { + return &GetCompilerVersionParams{ + HTTPClient: client, + } +} + +/* GetCompilerVersionParams contains all the parameters to send to the API endpoint + for the get compiler version operation. + + Typically these are written to a http.Request. +*/ +type GetCompilerVersionParams struct { + + /* Body. + + contract byte array + */ + Body *models.ByteCodeInput + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get compiler version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompilerVersionParams) WithDefaults() *GetCompilerVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get compiler version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCompilerVersionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get compiler version params +func (o *GetCompilerVersionParams) WithTimeout(timeout time.Duration) *GetCompilerVersionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get compiler version params +func (o *GetCompilerVersionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get compiler version params +func (o *GetCompilerVersionParams) WithContext(ctx context.Context) *GetCompilerVersionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get compiler version params +func (o *GetCompilerVersionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get compiler version params +func (o *GetCompilerVersionParams) WithHTTPClient(client *http.Client) *GetCompilerVersionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get compiler version params +func (o *GetCompilerVersionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the get compiler version params +func (o *GetCompilerVersionParams) WithBody(body *models.ByteCodeInput) *GetCompilerVersionParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the get compiler version params +func (o *GetCompilerVersionParams) SetBody(body *models.ByteCodeInput) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *GetCompilerVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/compiler/client/operations/get_compiler_version_responses.go b/swagguard/compiler/client/operations/get_compiler_version_responses.go new file mode 100644 index 00000000..359e5e9e --- /dev/null +++ b/swagguard/compiler/client/operations/get_compiler_version_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// GetCompilerVersionReader is a Reader for the GetCompilerVersion structure. +type GetCompilerVersionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetCompilerVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetCompilerVersionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetCompilerVersionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewGetCompilerVersionOK creates a GetCompilerVersionOK with default headers values +func NewGetCompilerVersionOK() *GetCompilerVersionOK { + return &GetCompilerVersionOK{} +} + +/* GetCompilerVersionOK describes a response with status code 200, with default header values. + +The compiler version +*/ +type GetCompilerVersionOK struct { + Payload *models.CompilerVersion +} + +func (o *GetCompilerVersionOK) Error() string { + return fmt.Sprintf("[POST /compiler-version][%d] getCompilerVersionOK %+v", 200, o.Payload) +} +func (o *GetCompilerVersionOK) GetPayload() *models.CompilerVersion { + return o.Payload +} + +func (o *GetCompilerVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CompilerVersion) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetCompilerVersionBadRequest creates a GetCompilerVersionBadRequest with default headers values +func NewGetCompilerVersionBadRequest() *GetCompilerVersionBadRequest { + return &GetCompilerVersionBadRequest{} +} + +/* GetCompilerVersionBadRequest describes a response with status code 400, with default header values. + +Invalid data +*/ +type GetCompilerVersionBadRequest struct { + Payload *models.Error +} + +func (o *GetCompilerVersionBadRequest) Error() string { + return fmt.Sprintf("[POST /compiler-version][%d] getCompilerVersionBadRequest %+v", 400, o.Payload) +} +func (o *GetCompilerVersionBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *GetCompilerVersionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/swagguard/compiler/client/operations/get_fate_assembler_code_parameters.go b/swagguard/compiler/client/operations/get_fate_assembler_code_parameters.go new file mode 100644 index 00000000..23538f02 --- /dev/null +++ b/swagguard/compiler/client/operations/get_fate_assembler_code_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// NewGetFateAssemblerCodeParams creates a new GetFateAssemblerCodeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetFateAssemblerCodeParams() *GetFateAssemblerCodeParams { + return &GetFateAssemblerCodeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetFateAssemblerCodeParamsWithTimeout creates a new GetFateAssemblerCodeParams object +// with the ability to set a timeout on a request. +func NewGetFateAssemblerCodeParamsWithTimeout(timeout time.Duration) *GetFateAssemblerCodeParams { + return &GetFateAssemblerCodeParams{ + timeout: timeout, + } +} + +// NewGetFateAssemblerCodeParamsWithContext creates a new GetFateAssemblerCodeParams object +// with the ability to set a context for a request. +func NewGetFateAssemblerCodeParamsWithContext(ctx context.Context) *GetFateAssemblerCodeParams { + return &GetFateAssemblerCodeParams{ + Context: ctx, + } +} + +// NewGetFateAssemblerCodeParamsWithHTTPClient creates a new GetFateAssemblerCodeParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetFateAssemblerCodeParamsWithHTTPClient(client *http.Client) *GetFateAssemblerCodeParams { + return &GetFateAssemblerCodeParams{ + HTTPClient: client, + } +} + +/* GetFateAssemblerCodeParams contains all the parameters to send to the API endpoint + for the get fate assembler code operation. + + Typically these are written to a http.Request. +*/ +type GetFateAssemblerCodeParams struct { + + /* Body. + + contract byte array + */ + Body *models.ByteCodeInput + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get fate assembler code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFateAssemblerCodeParams) WithDefaults() *GetFateAssemblerCodeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get fate assembler code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFateAssemblerCodeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) WithTimeout(timeout time.Duration) *GetFateAssemblerCodeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) WithContext(ctx context.Context) *GetFateAssemblerCodeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) WithHTTPClient(client *http.Client) *GetFateAssemblerCodeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) WithBody(body *models.ByteCodeInput) *GetFateAssemblerCodeParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the get fate assembler code params +func (o *GetFateAssemblerCodeParams) SetBody(body *models.ByteCodeInput) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *GetFateAssemblerCodeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/compiler/client/operations/get_fate_assembler_code_responses.go b/swagguard/compiler/client/operations/get_fate_assembler_code_responses.go new file mode 100644 index 00000000..1e298143 --- /dev/null +++ b/swagguard/compiler/client/operations/get_fate_assembler_code_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// GetFateAssemblerCodeReader is a Reader for the GetFateAssemblerCode structure. +type GetFateAssemblerCodeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetFateAssemblerCodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetFateAssemblerCodeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetFateAssemblerCodeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewGetFateAssemblerCodeOK creates a GetFateAssemblerCodeOK with default headers values +func NewGetFateAssemblerCodeOK() *GetFateAssemblerCodeOK { + return &GetFateAssemblerCodeOK{} +} + +/* GetFateAssemblerCodeOK describes a response with status code 200, with default header values. + +The FATE assembler +*/ +type GetFateAssemblerCodeOK struct { + Payload *models.FateAssembler +} + +func (o *GetFateAssemblerCodeOK) Error() string { + return fmt.Sprintf("[POST /fate-assembler][%d] getFateAssemblerCodeOK %+v", 200, o.Payload) +} +func (o *GetFateAssemblerCodeOK) GetPayload() *models.FateAssembler { + return o.Payload +} + +func (o *GetFateAssemblerCodeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FateAssembler) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetFateAssemblerCodeBadRequest creates a GetFateAssemblerCodeBadRequest with default headers values +func NewGetFateAssemblerCodeBadRequest() *GetFateAssemblerCodeBadRequest { + return &GetFateAssemblerCodeBadRequest{} +} + +/* GetFateAssemblerCodeBadRequest describes a response with status code 400, with default header values. + +Invalid data +*/ +type GetFateAssemblerCodeBadRequest struct { + Payload *models.Error +} + +func (o *GetFateAssemblerCodeBadRequest) Error() string { + return fmt.Sprintf("[POST /fate-assembler][%d] getFateAssemblerCodeBadRequest %+v", 400, o.Payload) +} +func (o *GetFateAssemblerCodeBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *GetFateAssemblerCodeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/swagguard/compiler/client/operations/operations_client.go b/swagguard/compiler/client/operations/operations_client.go index d029c549..765e021c 100644 --- a/swagguard/compiler/client/operations/operations_client.go +++ b/swagguard/compiler/client/operations/operations_client.go @@ -6,13 +6,14 @@ package operations // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new operations API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,72 +25,127 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + APIVersion(params *APIVersionParams, opts ...ClientOption) (*APIVersionOK, error) + + API(params *APIParams, opts ...ClientOption) (*APIOK, error) + + CompileContract(params *CompileContractParams, opts ...ClientOption) (*CompileContractOK, error) + + DecodeCallResult(params *DecodeCallResultParams, opts ...ClientOption) (*DecodeCallResultOK, error) + + DecodeCallResultBytecode(params *DecodeCallResultBytecodeParams, opts ...ClientOption) (*DecodeCallResultBytecodeOK, error) + + DecodeCalldataBytecode(params *DecodeCalldataBytecodeParams, opts ...ClientOption) (*DecodeCalldataBytecodeOK, error) + + DecodeCalldataSource(params *DecodeCalldataSourceParams, opts ...ClientOption) (*DecodeCalldataSourceOK, error) + + DecodeData(params *DecodeDataParams, opts ...ClientOption) (*DecodeDataOK, error) + + EncodeCalldata(params *EncodeCalldataParams, opts ...ClientOption) (*EncodeCalldataOK, error) + + GenerateACI(params *GenerateACIParams, opts ...ClientOption) (*GenerateACIOK, error) + + GetCompilerVersion(params *GetCompilerVersionParams, opts ...ClientOption) (*GetCompilerVersionOK, error) + + GetFateAssemblerCode(params *GetFateAssemblerCodeParams, opts ...ClientOption) (*GetFateAssemblerCodeOK, error) + + ValidateByteCode(params *ValidateByteCodeParams, opts ...ClientOption) (*ValidateByteCodeOK, error) + + Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -APIVersion Get the version of the API + APIVersion Get the version of the API */ -func (a *Client) APIVersion(params *APIVersionParams) (*APIVersionOK, error) { +func (a *Client) APIVersion(params *APIVersionParams, opts ...ClientOption) (*APIVersionOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAPIVersionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "APIVersion", Method: "GET", PathPattern: "/api-version", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &APIVersionReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*APIVersionOK), nil - + success, ok := result.(*APIVersionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for APIVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -API Get the Api description + API Get the Api description */ -func (a *Client) API(params *APIParams) (*APIOK, error) { +func (a *Client) API(params *APIParams, opts ...ClientOption) (*APIOK, error) { // TODO: Validate the params before sending if params == nil { params = NewAPIParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "Api", Method: "GET", PathPattern: "/api", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &APIReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*APIOK), nil - + success, ok := result.(*APIOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for Api: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -CompileContract Compile a sophia contract from source and return byte code + CompileContract Compile a sophia contract from source and return byte code */ -func (a *Client) CompileContract(params *CompileContractParams) (*CompileContractOK, error) { +func (a *Client) CompileContract(params *CompileContractParams, opts ...ClientOption) (*CompileContractOK, error) { // TODO: Validate the params before sending if params == nil { params = NewCompileContractParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "CompileContract", Method: "POST", PathPattern: "/compile", @@ -100,24 +156,34 @@ func (a *Client) CompileContract(params *CompileContractParams) (*CompileContrac Reader: &CompileContractReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*CompileContractOK), nil - + success, ok := result.(*CompileContractOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for CompileContract: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -DecodeCallResult Decode the result of contract call + DecodeCallResult Decode the result of contract call */ -func (a *Client) DecodeCallResult(params *DecodeCallResultParams) (*DecodeCallResultOK, error) { +func (a *Client) DecodeCallResult(params *DecodeCallResultParams, opts ...ClientOption) (*DecodeCallResultOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecodeCallResultParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DecodeCallResult", Method: "POST", PathPattern: "/decode-call-result", @@ -128,24 +194,34 @@ func (a *Client) DecodeCallResult(params *DecodeCallResultParams) (*DecodeCallRe Reader: &DecodeCallResultReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*DecodeCallResultOK), nil - + success, ok := result.(*DecodeCallResultOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for DecodeCallResult: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -DecodeCallResultBytecode Decode the result of contract call from Bytecode + DecodeCallResultBytecode Decode the result of contract call from Bytecode */ -func (a *Client) DecodeCallResultBytecode(params *DecodeCallResultBytecodeParams) (*DecodeCallResultBytecodeOK, error) { +func (a *Client) DecodeCallResultBytecode(params *DecodeCallResultBytecodeParams, opts ...ClientOption) (*DecodeCallResultBytecodeOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecodeCallResultBytecodeParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DecodeCallResultBytecode", Method: "POST", PathPattern: "/decode-call-result/bytecode", @@ -156,24 +232,34 @@ func (a *Client) DecodeCallResultBytecode(params *DecodeCallResultBytecodeParams Reader: &DecodeCallResultBytecodeReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*DecodeCallResultBytecodeOK), nil - + success, ok := result.(*DecodeCallResultBytecodeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for DecodeCallResultBytecode: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -DecodeCalldataBytecode Identify function name and arguments in Calldata for a compiled contract + DecodeCalldataBytecode Identify function name and arguments in Calldata for a compiled contract */ -func (a *Client) DecodeCalldataBytecode(params *DecodeCalldataBytecodeParams) (*DecodeCalldataBytecodeOK, error) { +func (a *Client) DecodeCalldataBytecode(params *DecodeCalldataBytecodeParams, opts ...ClientOption) (*DecodeCalldataBytecodeOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecodeCalldataBytecodeParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DecodeCalldataBytecode", Method: "POST", PathPattern: "/decode-calldata/bytecode", @@ -184,24 +270,34 @@ func (a *Client) DecodeCalldataBytecode(params *DecodeCalldataBytecodeParams) (* Reader: &DecodeCalldataBytecodeReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*DecodeCalldataBytecodeOK), nil - + success, ok := result.(*DecodeCalldataBytecodeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for DecodeCalldataBytecode: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -DecodeCalldataSource Identify function name and arguments in Calldata for a (partial) contract + DecodeCalldataSource Identify function name and arguments in Calldata for a (partial) contract */ -func (a *Client) DecodeCalldataSource(params *DecodeCalldataSourceParams) (*DecodeCalldataSourceOK, error) { +func (a *Client) DecodeCalldataSource(params *DecodeCalldataSourceParams, opts ...ClientOption) (*DecodeCalldataSourceOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecodeCalldataSourceParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DecodeCalldataSource", Method: "POST", PathPattern: "/decode-calldata/source", @@ -212,24 +308,34 @@ func (a *Client) DecodeCalldataSource(params *DecodeCalldataSourceParams) (*Deco Reader: &DecodeCalldataSourceReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*DecodeCalldataSourceOK), nil - + success, ok := result.(*DecodeCalldataSourceOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for DecodeCalldataSource: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -DecodeData Decode data as retuned by a contract call. - Legacy decoding + DecodeData Decode data as retuned by a contract call. - Legacy decoding */ -func (a *Client) DecodeData(params *DecodeDataParams) (*DecodeDataOK, error) { +func (a *Client) DecodeData(params *DecodeDataParams, opts ...ClientOption) (*DecodeDataOK, error) { // TODO: Validate the params before sending if params == nil { params = NewDecodeDataParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "DecodeData", Method: "POST", PathPattern: "/decode-data", @@ -240,24 +346,34 @@ func (a *Client) DecodeData(params *DecodeDataParams) (*DecodeDataOK, error) { Reader: &DecodeDataReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*DecodeDataOK), nil - + success, ok := result.(*DecodeDataOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for DecodeData: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -EncodeCalldata Encode Sophia function call according to sophia ABI. + EncodeCalldata Encode Sophia function call according to sophia ABI. */ -func (a *Client) EncodeCalldata(params *EncodeCalldataParams) (*EncodeCalldataOK, error) { +func (a *Client) EncodeCalldata(params *EncodeCalldataParams, opts ...ClientOption) (*EncodeCalldataOK, error) { // TODO: Validate the params before sending if params == nil { params = NewEncodeCalldataParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "EncodeCalldata", Method: "POST", PathPattern: "/encode-calldata", @@ -268,24 +384,34 @@ func (a *Client) EncodeCalldata(params *EncodeCalldataParams) (*EncodeCalldataOK Reader: &EncodeCalldataReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*EncodeCalldataOK), nil - + success, ok := result.(*EncodeCalldataOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for EncodeCalldata: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GenerateACI Generate an Aeternity Contract Interface (ACI) for contract + GenerateACI Generate an Aeternity Contract Interface (ACI) for contract */ -func (a *Client) GenerateACI(params *GenerateACIParams) (*GenerateACIOK, error) { +func (a *Client) GenerateACI(params *GenerateACIParams, opts ...ClientOption) (*GenerateACIOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGenerateACIParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GenerateACI", Method: "POST", PathPattern: "/aci", @@ -296,40 +422,175 @@ func (a *Client) GenerateACI(params *GenerateACIParams) (*GenerateACIOK, error) Reader: &GenerateACIReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GenerateACIOK), nil + success, ok := result.(*GenerateACIOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GenerateACI: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} +/* + GetCompilerVersion Extract compiler version from bytecode +*/ +func (a *Client) GetCompilerVersion(params *GetCompilerVersionParams, opts ...ClientOption) (*GetCompilerVersionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetCompilerVersionParams() + } + op := &runtime.ClientOperation{ + ID: "GetCompilerVersion", + Method: "POST", + PathPattern: "/compiler-version", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetCompilerVersionReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetCompilerVersionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetCompilerVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -Version Get the version of the underlying Sophia compiler version + GetFateAssemblerCode Get FATE assembler code from bytecode */ -func (a *Client) Version(params *VersionParams) (*VersionOK, error) { +func (a *Client) GetFateAssemblerCode(params *GetFateAssemblerCodeParams, opts ...ClientOption) (*GetFateAssemblerCodeOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewVersionParams() + params = NewGetFateAssemblerCodeParams() + } + op := &runtime.ClientOperation{ + ID: "GetFateAssemblerCode", + Method: "POST", + PathPattern: "/fate-assembler", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetFateAssemblerCodeReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetFateAssemblerCodeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetFateAssemblerCode: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ValidateByteCode Verify that an encoded byte array is the result of compiling a given contract +*/ +func (a *Client) ValidateByteCode(params *ValidateByteCodeParams, opts ...ClientOption) (*ValidateByteCodeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewValidateByteCodeParams() + } + op := &runtime.ClientOperation{ + ID: "ValidateByteCode", + Method: "POST", + PathPattern: "/validate-byte-code", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ValidateByteCodeReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) } - result, err := a.transport.Submit(&runtime.ClientOperation{ + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ValidateByteCodeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ValidateByteCode: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Version Get the version of the underlying Sophia compiler version +*/ +func (a *Client) Version(params *VersionParams, opts ...ClientOption) (*VersionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewVersionParams() + } + op := &runtime.ClientOperation{ ID: "Version", Method: "GET", PathPattern: "/version", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &VersionReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*VersionOK), nil - + success, ok := result.(*VersionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for Version: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/swagguard/compiler/client/operations/validate_byte_code_parameters.go b/swagguard/compiler/client/operations/validate_byte_code_parameters.go new file mode 100644 index 00000000..3ea03ae9 --- /dev/null +++ b/swagguard/compiler/client/operations/validate_byte_code_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// NewValidateByteCodeParams creates a new ValidateByteCodeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewValidateByteCodeParams() *ValidateByteCodeParams { + return &ValidateByteCodeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewValidateByteCodeParamsWithTimeout creates a new ValidateByteCodeParams object +// with the ability to set a timeout on a request. +func NewValidateByteCodeParamsWithTimeout(timeout time.Duration) *ValidateByteCodeParams { + return &ValidateByteCodeParams{ + timeout: timeout, + } +} + +// NewValidateByteCodeParamsWithContext creates a new ValidateByteCodeParams object +// with the ability to set a context for a request. +func NewValidateByteCodeParamsWithContext(ctx context.Context) *ValidateByteCodeParams { + return &ValidateByteCodeParams{ + Context: ctx, + } +} + +// NewValidateByteCodeParamsWithHTTPClient creates a new ValidateByteCodeParams object +// with the ability to set a custom HTTPClient for a request. +func NewValidateByteCodeParamsWithHTTPClient(client *http.Client) *ValidateByteCodeParams { + return &ValidateByteCodeParams{ + HTTPClient: client, + } +} + +/* ValidateByteCodeParams contains all the parameters to send to the API endpoint + for the validate byte code operation. + + Typically these are written to a http.Request. +*/ +type ValidateByteCodeParams struct { + + /* Body. + + contract byte array and source code + */ + Body *models.ValidateByteCodeInput + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the validate byte code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ValidateByteCodeParams) WithDefaults() *ValidateByteCodeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the validate byte code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ValidateByteCodeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the validate byte code params +func (o *ValidateByteCodeParams) WithTimeout(timeout time.Duration) *ValidateByteCodeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the validate byte code params +func (o *ValidateByteCodeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the validate byte code params +func (o *ValidateByteCodeParams) WithContext(ctx context.Context) *ValidateByteCodeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the validate byte code params +func (o *ValidateByteCodeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the validate byte code params +func (o *ValidateByteCodeParams) WithHTTPClient(client *http.Client) *ValidateByteCodeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the validate byte code params +func (o *ValidateByteCodeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the validate byte code params +func (o *ValidateByteCodeParams) WithBody(body *models.ValidateByteCodeInput) *ValidateByteCodeParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the validate byte code params +func (o *ValidateByteCodeParams) SetBody(body *models.ValidateByteCodeInput) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ValidateByteCodeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/compiler/client/operations/validate_byte_code_responses.go b/swagguard/compiler/client/operations/validate_byte_code_responses.go new file mode 100644 index 00000000..9c827e79 --- /dev/null +++ b/swagguard/compiler/client/operations/validate_byte_code_responses.go @@ -0,0 +1,92 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package operations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" +) + +// ValidateByteCodeReader is a Reader for the ValidateByteCode structure. +type ValidateByteCodeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ValidateByteCodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewValidateByteCodeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewValidateByteCodeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewValidateByteCodeOK creates a ValidateByteCodeOK with default headers values +func NewValidateByteCodeOK() *ValidateByteCodeOK { + return &ValidateByteCodeOK{} +} + +/* ValidateByteCodeOK describes a response with status code 200, with default header values. + +Validation successful +*/ +type ValidateByteCodeOK struct { +} + +func (o *ValidateByteCodeOK) Error() string { + return fmt.Sprintf("[POST /validate-byte-code][%d] validateByteCodeOK ", 200) +} + +func (o *ValidateByteCodeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewValidateByteCodeBadRequest creates a ValidateByteCodeBadRequest with default headers values +func NewValidateByteCodeBadRequest() *ValidateByteCodeBadRequest { + return &ValidateByteCodeBadRequest{} +} + +/* ValidateByteCodeBadRequest describes a response with status code 400, with default header values. + +Invalid contract +*/ +type ValidateByteCodeBadRequest struct { + Payload models.CompilerErrors +} + +func (o *ValidateByteCodeBadRequest) Error() string { + return fmt.Sprintf("[POST /validate-byte-code][%d] validateByteCodeBadRequest %+v", 400, o.Payload) +} +func (o *ValidateByteCodeBadRequest) GetPayload() models.CompilerErrors { + return o.Payload +} + +func (o *ValidateByteCodeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/swagguard/compiler/client/operations/version_parameters.go b/swagguard/compiler/client/operations/version_parameters.go index 4dd79a54..f8964f83 100644 --- a/swagguard/compiler/client/operations/version_parameters.go +++ b/swagguard/compiler/client/operations/version_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewVersionParams creates a new VersionParams object -// with the default values initialized. +// NewVersionParams creates a new VersionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewVersionParams() *VersionParams { - return &VersionParams{ - timeout: cr.DefaultTimeout, } } // NewVersionParamsWithTimeout creates a new VersionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewVersionParamsWithTimeout(timeout time.Duration) *VersionParams { - return &VersionParams{ - timeout: timeout, } } // NewVersionParamsWithContext creates a new VersionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewVersionParamsWithContext(ctx context.Context) *VersionParams { - return &VersionParams{ - Context: ctx, } } // NewVersionParamsWithHTTPClient creates a new VersionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewVersionParamsWithHTTPClient(client *http.Client) *VersionParams { - return &VersionParams{ HTTPClient: client, } } -/*VersionParams contains all the parameters to send to the API endpoint -for the version operation typically these are written to a http.Request +/* VersionParams contains all the parameters to send to the API endpoint + for the version operation. + + Typically these are written to a http.Request. */ type VersionParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type VersionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionParams) WithDefaults() *VersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *VersionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the version params func (o *VersionParams) WithTimeout(timeout time.Duration) *VersionParams { o.SetTimeout(timeout) diff --git a/swagguard/compiler/client/operations/version_responses.go b/swagguard/compiler/client/operations/version_responses.go index 8bfafbd6..559d7e9f 100644 --- a/swagguard/compiler/client/operations/version_responses.go +++ b/swagguard/compiler/client/operations/version_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) // VersionReader is a Reader for the Version structure. @@ -24,23 +23,20 @@ type VersionReader struct { // ReadResponse reads a server response into the received o. func (o *VersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewVersionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 500: result := NewVersionInternalServerError() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewVersionOK() *VersionOK { return &VersionOK{} } -/*VersionOK handles this case with default header values. +/* VersionOK describes a response with status code 200, with default header values. Sophia compiler version */ @@ -60,6 +56,9 @@ type VersionOK struct { func (o *VersionOK) Error() string { return fmt.Sprintf("[GET /version][%d] versionOK %+v", 200, o.Payload) } +func (o *VersionOK) GetPayload() *models.CompilerVersion { + return o.Payload +} func (o *VersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewVersionInternalServerError() *VersionInternalServerError { return &VersionInternalServerError{} } -/*VersionInternalServerError handles this case with default header values. +/* VersionInternalServerError describes a response with status code 500, with default header values. Error */ @@ -89,6 +88,9 @@ type VersionInternalServerError struct { func (o *VersionInternalServerError) Error() string { return fmt.Sprintf("[GET /version][%d] versionInternalServerError %+v", 500, o.Payload) } +func (o *VersionInternalServerError) GetPayload() *models.Error { + return o.Payload +} func (o *VersionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/compiler/models/a_c_i.go b/swagguard/compiler/models/a_c_i.go index da69a216..613854a2 100644 --- a/swagguard/compiler/models/a_c_i.go +++ b/swagguard/compiler/models/a_c_i.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ACI a c i +// Example: {"encoded_aci":"{}","external_encoded_aci":"","interface":"interface"} +// // swagger:model ACI type ACI struct { @@ -21,6 +24,9 @@ type ACI struct { // Required: true EncodedAci interface{} `json:"encoded_aci"` + // external encoded aci + ExternalEncodedAci []interface{} `json:"external_encoded_aci"` + // interface // Required: true Interface *string `json:"interface"` @@ -46,8 +52,8 @@ func (m *ACI) Validate(formats strfmt.Registry) error { func (m *ACI) validateEncodedAci(formats strfmt.Registry) error { - if err := validate.Required("encoded_aci", "body", m.EncodedAci); err != nil { - return err + if m.EncodedAci == nil { + return errors.Required("encoded_aci", "body", nil) } return nil @@ -62,6 +68,11 @@ func (m *ACI) validateInterface(formats strfmt.Registry) error { return nil } +// ContextValidate validates this a c i based on context it is used +func (m *ACI) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ACI) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/api.go b/swagguard/compiler/models/api.go index 3940a5e6..d1e978b5 100644 --- a/swagguard/compiler/models/api.go +++ b/swagguard/compiler/models/api.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // API Swagger API description +// // swagger:model API type API interface{} diff --git a/swagguard/compiler/models/api_version.go b/swagguard/compiler/models/api_version.go index bff04834..98656a5c 100644 --- a/swagguard/compiler/models/api_version.go +++ b/swagguard/compiler/models/api_version.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // APIVersion API version +// Example: {"api-version":"api-version"} +// // swagger:model APIVersion type APIVersion struct { @@ -45,6 +48,11 @@ func (m *APIVersion) validateAPIVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this API version based on context it is used +func (m *APIVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *APIVersion) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/byte_code.go b/swagguard/compiler/models/byte_code.go index cb37b5f1..2517d53e 100644 --- a/swagguard/compiler/models/byte_code.go +++ b/swagguard/compiler/models/byte_code.go @@ -6,19 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // ByteCode byte code +// Example: {"bytecode":{}} +// // swagger:model ByteCode type ByteCode struct { // bytecode // Required: true - Bytecode EncodedByteArray `json:"bytecode"` + Bytecode *EncodedByteArray `json:"bytecode"` } // Validate validates this byte code @@ -37,13 +41,51 @@ func (m *ByteCode) Validate(formats strfmt.Registry) error { func (m *ByteCode) validateBytecode(formats strfmt.Registry) error { - if err := m.Bytecode.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bytecode") - } + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { return err } + if m.Bytecode != nil { + if err := m.Bytecode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +// ContextValidate validate this byte code based on the context it is used +func (m *ByteCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBytecode(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ByteCode) contextValidateBytecode(ctx context.Context, formats strfmt.Registry) error { + + if m.Bytecode != nil { + if err := m.Bytecode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + return nil } diff --git a/swagguard/compiler/models/byte_code_input.go b/swagguard/compiler/models/byte_code_input.go new file mode 100644 index 00000000..5dee3d51 --- /dev/null +++ b/swagguard/compiler/models/byte_code_input.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ByteCodeInput byte code input +// Example: {"bytecode":{}} +// +// swagger:model ByteCodeInput +type ByteCodeInput struct { + + // Compiled contract + // Required: true + Bytecode *EncodedByteArray `json:"bytecode"` +} + +// Validate validates this byte code input +func (m *ByteCodeInput) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBytecode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ByteCodeInput) validateBytecode(formats strfmt.Registry) error { + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if m.Bytecode != nil { + if err := m.Bytecode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +// ContextValidate validate this byte code input based on the context it is used +func (m *ByteCodeInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBytecode(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ByteCodeInput) contextValidateBytecode(ctx context.Context, formats strfmt.Registry) error { + + if m.Bytecode != nil { + if err := m.Bytecode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ByteCodeInput) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ByteCodeInput) UnmarshalBinary(b []byte) error { + var res ByteCodeInput + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/compiler/models/bytecode_call_result_input.go b/swagguard/compiler/models/bytecode_call_result_input.go index 9cd7229c..95b0436b 100644 --- a/swagguard/compiler/models/bytecode_call_result_input.go +++ b/swagguard/compiler/models/bytecode_call_result_input.go @@ -6,16 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // BytecodeCallResultInput bytecode call result input +// Example: {"backend":"fate","bytecode":{},"call-result":"call-result","call-value":"call-value","function":"function"} +// // swagger:model BytecodeCallResultInput type BytecodeCallResultInput struct { @@ -25,7 +27,7 @@ type BytecodeCallResultInput struct { // Compiled contract // Required: true - Bytecode EncodedByteArray `json:"bytecode"` + Bytecode *EncodedByteArray `json:"bytecode"` // Call result type (ok | revert | error) // Required: true @@ -93,14 +95,13 @@ const ( // prop value enum func (m *BytecodeCallResultInput) validateBackendEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, bytecodeCallResultInputTypeBackendPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, bytecodeCallResultInputTypeBackendPropEnum, true); err != nil { return err } return nil } func (m *BytecodeCallResultInput) validateBackend(formats strfmt.Registry) error { - if swag.IsZero(m.Backend) { // not required return nil } @@ -115,13 +116,23 @@ func (m *BytecodeCallResultInput) validateBackend(formats strfmt.Registry) error func (m *BytecodeCallResultInput) validateBytecode(formats strfmt.Registry) error { - if err := m.Bytecode.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bytecode") - } + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { return err } + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if m.Bytecode != nil { + if err := m.Bytecode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + return nil } @@ -152,6 +163,34 @@ func (m *BytecodeCallResultInput) validateFunction(formats strfmt.Registry) erro return nil } +// ContextValidate validate this bytecode call result input based on the context it is used +func (m *BytecodeCallResultInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBytecode(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *BytecodeCallResultInput) contextValidateBytecode(ctx context.Context, formats strfmt.Registry) error { + + if m.Bytecode != nil { + if err := m.Bytecode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *BytecodeCallResultInput) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/calldata.go b/swagguard/compiler/models/calldata.go index b5880d95..70114bb6 100644 --- a/swagguard/compiler/models/calldata.go +++ b/swagguard/compiler/models/calldata.go @@ -6,19 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // Calldata calldata +// Example: {"calldata":{}} +// // swagger:model Calldata type Calldata struct { // calldata // Required: true - Calldata EncodedByteArray `json:"calldata"` + Calldata *EncodedByteArray `json:"calldata"` } // Validate validates this calldata @@ -37,13 +41,51 @@ func (m *Calldata) Validate(formats strfmt.Registry) error { func (m *Calldata) validateCalldata(formats strfmt.Registry) error { - if err := m.Calldata.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("calldata") - } + if err := validate.Required("calldata", "body", m.Calldata); err != nil { + return err + } + + if err := validate.Required("calldata", "body", m.Calldata); err != nil { return err } + if m.Calldata != nil { + if err := m.Calldata.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + + return nil +} + +// ContextValidate validate this calldata based on the context it is used +func (m *Calldata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCalldata(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Calldata) contextValidateCalldata(ctx context.Context, formats strfmt.Registry) error { + + if m.Calldata != nil { + if err := m.Calldata.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + return nil } diff --git a/swagguard/compiler/models/compile_opts.go b/swagguard/compiler/models/compile_opts.go index 4aeec14c..c036a054 100644 --- a/swagguard/compiler/models/compile_opts.go +++ b/swagguard/compiler/models/compile_opts.go @@ -6,16 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CompileOpts compile opts +// Example: {"backend":"fate","file_system":"{}","src_file":"src_file"} +// // swagger:model CompileOpts type CompileOpts struct { @@ -67,14 +69,13 @@ const ( // prop value enum func (m *CompileOpts) validateBackendEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, compileOptsTypeBackendPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, compileOptsTypeBackendPropEnum, true); err != nil { return err } return nil } func (m *CompileOpts) validateBackend(formats strfmt.Registry) error { - if swag.IsZero(m.Backend) { // not required return nil } @@ -87,6 +88,11 @@ func (m *CompileOpts) validateBackend(formats strfmt.Registry) error { return nil } +// ContextValidate validates this compile opts based on context it is used +func (m *CompileOpts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CompileOpts) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/compiler_error.go b/swagguard/compiler/models/compiler_error.go index bd70dca2..4ee16c36 100644 --- a/swagguard/compiler/models/compiler_error.go +++ b/swagguard/compiler/models/compiler_error.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CompilerError compiler error +// // swagger:model CompilerError type CompilerError struct { @@ -93,6 +94,34 @@ func (m *CompilerError) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this compiler error based on the context it is used +func (m *CompilerError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePos(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CompilerError) contextValidatePos(ctx context.Context, formats strfmt.Registry) error { + + if m.Pos != nil { + if err := m.Pos.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pos") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *CompilerError) MarshalBinary() ([]byte, error) { if m == nil { @@ -111,6 +140,7 @@ func (m *CompilerError) UnmarshalBinary(b []byte) error { return nil } +// TODO: This is not auto generated, it should be avoided func (m *CompilerError) String() string { return fmt.Sprintf("%s, %s, %s", *m.Type, *m.Message, m.Context) } diff --git a/swagguard/compiler/models/compiler_errors.go b/swagguard/compiler/models/compiler_errors.go index 17374832..c511f9f1 100644 --- a/swagguard/compiler/models/compiler_errors.go +++ b/swagguard/compiler/models/compiler_errors.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // CompilerErrors compiler errors +// // swagger:model CompilerErrors type CompilerErrors []*CompilerError @@ -43,3 +44,26 @@ func (m CompilerErrors) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validate this compiler errors based on the context it is used +func (m CompilerErrors) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/compiler/models/compiler_version.go b/swagguard/compiler/models/compiler_version.go index 3a21db9c..265fff7f 100644 --- a/swagguard/compiler/models/compiler_version.go +++ b/swagguard/compiler/models/compiler_version.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CompilerVersion compiler version +// Example: {"version":"version"} +// // swagger:model CompilerVersion type CompilerVersion struct { @@ -45,6 +48,11 @@ func (m *CompilerVersion) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this compiler version based on context it is used +func (m *CompilerVersion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CompilerVersion) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/contract.go b/swagguard/compiler/models/contract.go index f4686e91..2fc7c077 100644 --- a/swagguard/compiler/models/contract.go +++ b/swagguard/compiler/models/contract.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Contract contract +// Example: {"code":"code","options":{"backend":"fate","file_system":"{}","src_file":"src_file"}} +// // swagger:model Contract type Contract struct { @@ -71,6 +74,34 @@ func (m *Contract) validateOptions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contract based on the context it is used +func (m *Contract) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Contract) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Contract) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/decode_calldata_bytecode.go b/swagguard/compiler/models/decode_calldata_bytecode.go index f2fb050d..ef55797e 100644 --- a/swagguard/compiler/models/decode_calldata_bytecode.go +++ b/swagguard/compiler/models/decode_calldata_bytecode.go @@ -6,16 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DecodeCalldataBytecode decode calldata bytecode +// Example: {"backend":"fate","bytecode":null,"calldata":{}} +// // swagger:model DecodeCalldataBytecode type DecodeCalldataBytecode struct { @@ -25,11 +27,11 @@ type DecodeCalldataBytecode struct { // Compiled contract // Required: true - Bytecode EncodedByteArray `json:"bytecode"` + Bytecode *EncodedByteArray `json:"bytecode"` // Calldata to dissect // Required: true - Calldata EncodedByteArray `json:"calldata"` + Calldata *EncodedByteArray `json:"calldata"` } // Validate validates this decode calldata bytecode @@ -77,14 +79,13 @@ const ( // prop value enum func (m *DecodeCalldataBytecode) validateBackendEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, decodeCalldataBytecodeTypeBackendPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, decodeCalldataBytecodeTypeBackendPropEnum, true); err != nil { return err } return nil } func (m *DecodeCalldataBytecode) validateBackend(formats strfmt.Registry) error { - if swag.IsZero(m.Backend) { // not required return nil } @@ -99,25 +100,91 @@ func (m *DecodeCalldataBytecode) validateBackend(formats strfmt.Registry) error func (m *DecodeCalldataBytecode) validateBytecode(formats strfmt.Registry) error { - if err := m.Bytecode.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("bytecode") - } + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { return err } + if m.Bytecode != nil { + if err := m.Bytecode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + return nil } func (m *DecodeCalldataBytecode) validateCalldata(formats strfmt.Registry) error { - if err := m.Calldata.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("calldata") - } + if err := validate.Required("calldata", "body", m.Calldata); err != nil { + return err + } + + if err := validate.Required("calldata", "body", m.Calldata); err != nil { return err } + if m.Calldata != nil { + if err := m.Calldata.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + + return nil +} + +// ContextValidate validate this decode calldata bytecode based on the context it is used +func (m *DecodeCalldataBytecode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBytecode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCalldata(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DecodeCalldataBytecode) contextValidateBytecode(ctx context.Context, formats strfmt.Registry) error { + + if m.Bytecode != nil { + if err := m.Bytecode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +func (m *DecodeCalldataBytecode) contextValidateCalldata(ctx context.Context, formats strfmt.Registry) error { + + if m.Calldata != nil { + if err := m.Calldata.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + return nil } diff --git a/swagguard/compiler/models/decode_calldata_source.go b/swagguard/compiler/models/decode_calldata_source.go index 7f8c178f..33393639 100644 --- a/swagguard/compiler/models/decode_calldata_source.go +++ b/swagguard/compiler/models/decode_calldata_source.go @@ -6,20 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DecodeCalldataSource decode calldata source +// Example: {"calldata":{},"function":"function","options":{"backend":"fate","file_system":"{}","src_file":"src_file"},"source":"source"} +// // swagger:model DecodeCalldataSource type DecodeCalldataSource struct { // Calldata to dissect // Required: true - Calldata EncodedByteArray `json:"calldata"` + Calldata *EncodedByteArray `json:"calldata"` // Name of the function to call // Required: true @@ -61,13 +64,23 @@ func (m *DecodeCalldataSource) Validate(formats strfmt.Registry) error { func (m *DecodeCalldataSource) validateCalldata(formats strfmt.Registry) error { - if err := m.Calldata.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("calldata") - } + if err := validate.Required("calldata", "body", m.Calldata); err != nil { + return err + } + + if err := validate.Required("calldata", "body", m.Calldata); err != nil { return err } + if m.Calldata != nil { + if err := m.Calldata.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + return nil } @@ -81,7 +94,6 @@ func (m *DecodeCalldataSource) validateFunction(formats strfmt.Registry) error { } func (m *DecodeCalldataSource) validateOptions(formats strfmt.Registry) error { - if swag.IsZero(m.Options) { // not required return nil } @@ -107,6 +119,52 @@ func (m *DecodeCalldataSource) validateSource(formats strfmt.Registry) error { return nil } +// ContextValidate validate this decode calldata source based on the context it is used +func (m *DecodeCalldataSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCalldata(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DecodeCalldataSource) contextValidateCalldata(ctx context.Context, formats strfmt.Registry) error { + + if m.Calldata != nil { + if err := m.Calldata.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("calldata") + } + return err + } + } + + return nil +} + +func (m *DecodeCalldataSource) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DecodeCalldataSource) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/decoded_calldata.go b/swagguard/compiler/models/decoded_calldata.go index bef4307b..c085d83b 100644 --- a/swagguard/compiler/models/decoded_calldata.go +++ b/swagguard/compiler/models/decoded_calldata.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DecodedCalldata decoded calldata +// Example: {"arguments":["{}","{}"],"function":"function"} +// // swagger:model DecodedCalldata type DecodedCalldata struct { @@ -62,6 +65,11 @@ func (m *DecodedCalldata) validateFunction(formats strfmt.Registry) error { return nil } +// ContextValidate validates this decoded calldata based on context it is used +func (m *DecodedCalldata) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DecodedCalldata) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/decoded_callresult.go b/swagguard/compiler/models/decoded_callresult.go index 6bcc0cce..dfbb01b9 100644 --- a/swagguard/compiler/models/decoded_callresult.go +++ b/swagguard/compiler/models/decoded_callresult.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DecodedCallresult decoded callresult +// Example: {"function":"function","result":"{}"} +// // swagger:model DecodedCallresult type DecodedCallresult struct { @@ -55,13 +58,18 @@ func (m *DecodedCallresult) validateFunction(formats strfmt.Registry) error { func (m *DecodedCallresult) validateResult(formats strfmt.Registry) error { - if err := validate.Required("result", "body", m.Result); err != nil { - return err + if m.Result == nil { + return errors.Required("result", "body", nil) } return nil } +// ContextValidate validates this decoded callresult based on context it is used +func (m *DecodedCallresult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DecodedCallresult) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/encoded_byte_array.go b/swagguard/compiler/models/encoded_byte_array.go index 271cbd3a..6193d0ed 100644 --- a/swagguard/compiler/models/encoded_byte_array.go +++ b/swagguard/compiler/models/encoded_byte_array.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // EncodedByteArray Prefixed (cb_) Base64Check encoded byte array +// // swagger:model EncodedByteArray type EncodedByteArray string @@ -17,3 +20,8 @@ type EncodedByteArray string func (m EncodedByteArray) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this encoded byte array based on context it is used +func (m EncodedByteArray) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/compiler/models/error.go b/swagguard/compiler/models/error.go index c2b8a818..1eb29c93 100644 --- a/swagguard/compiler/models/error.go +++ b/swagguard/compiler/models/error.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Error error +// // swagger:model Error type Error struct { @@ -45,6 +47,11 @@ func (m *Error) validateReason(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { @@ -63,6 +70,7 @@ func (m *Error) UnmarshalBinary(b []byte) error { return nil } +// TODO: This is not auto generated, it should be avoided func (m *Error) String() string { return *m.Reason } diff --git a/swagguard/compiler/models/error_pos.go b/swagguard/compiler/models/error_pos.go index 3ca12449..56e7ec9c 100644 --- a/swagguard/compiler/models/error_pos.go +++ b/swagguard/compiler/models/error_pos.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ErrorPos error pos +// // swagger:model ErrorPos type ErrorPos struct { @@ -67,6 +68,11 @@ func (m *ErrorPos) validateLine(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error pos based on context it is used +func (m *ErrorPos) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ErrorPos) MarshalBinary() ([]byte, error) { if m == nil { @@ -85,6 +91,7 @@ func (m *ErrorPos) UnmarshalBinary(b []byte) error { return nil } +// TODO: This is not auto generated, it should be avoided func (m *ErrorPos) String() string { return fmt.Sprintf("%s:line %v, col %v", m.File, *m.Line, *m.Col) } diff --git a/swagguard/compiler/models/fate_assembler.go b/swagguard/compiler/models/fate_assembler.go new file mode 100644 index 00000000..a59d9d03 --- /dev/null +++ b/swagguard/compiler/models/fate_assembler.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// FateAssembler fate assembler +// Example: {"fate-assembler":"fate-assembler"} +// +// swagger:model FateAssembler +type FateAssembler struct { + + // Fate assembler code + // Required: true + FateAssembler *string `json:"fate-assembler"` +} + +// Validate validates this fate assembler +func (m *FateAssembler) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFateAssembler(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FateAssembler) validateFateAssembler(formats strfmt.Registry) error { + + if err := validate.Required("fate-assembler", "body", m.FateAssembler); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this fate assembler based on context it is used +func (m *FateAssembler) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FateAssembler) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FateAssembler) UnmarshalBinary(b []byte) error { + var res FateAssembler + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/compiler/models/function_call_input.go b/swagguard/compiler/models/function_call_input.go index 5c84a8b8..e4b28194 100644 --- a/swagguard/compiler/models/function_call_input.go +++ b/swagguard/compiler/models/function_call_input.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // FunctionCallInput function call input +// Example: {"arguments":["arguments","arguments"],"function":"function","options":{"backend":"fate","file_system":"{}","src_file":"src_file"},"source":"source"} +// // swagger:model FunctionCallInput type FunctionCallInput struct { @@ -78,7 +81,6 @@ func (m *FunctionCallInput) validateFunction(formats strfmt.Registry) error { } func (m *FunctionCallInput) validateOptions(formats strfmt.Registry) error { - if swag.IsZero(m.Options) { // not required return nil } @@ -104,6 +106,34 @@ func (m *FunctionCallInput) validateSource(formats strfmt.Registry) error { return nil } +// ContextValidate validate this function call input based on the context it is used +func (m *FunctionCallInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FunctionCallInput) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *FunctionCallInput) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/sophia_binary_data.go b/swagguard/compiler/models/sophia_binary_data.go index 1273451f..90158a38 100644 --- a/swagguard/compiler/models/sophia_binary_data.go +++ b/swagguard/compiler/models/sophia_binary_data.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SophiaBinaryData sophia binary data +// Example: {"data":"data","sophia-type":"sophia-type"} +// // swagger:model SophiaBinaryData type SophiaBinaryData struct { @@ -62,6 +65,11 @@ func (m *SophiaBinaryData) validateSophiaType(formats strfmt.Registry) error { return nil } +// ContextValidate validates this sophia binary data based on context it is used +func (m *SophiaBinaryData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SophiaBinaryData) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/sophia_call_result.go b/swagguard/compiler/models/sophia_call_result.go index 3c9f2bd4..d36416f4 100644 --- a/swagguard/compiler/models/sophia_call_result.go +++ b/swagguard/compiler/models/sophia_call_result.go @@ -6,5 +6,6 @@ package models // Editing this file might prove futile when you re-run the swagger generate command // SophiaCallResult sophia call result +// // swagger:model SophiaCallResult type SophiaCallResult interface{} diff --git a/swagguard/compiler/models/sophia_call_result_input.go b/swagguard/compiler/models/sophia_call_result_input.go index a6025780..8e9ca948 100644 --- a/swagguard/compiler/models/sophia_call_result_input.go +++ b/swagguard/compiler/models/sophia_call_result_input.go @@ -6,14 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SophiaCallResultInput sophia call result input +// Example: {"call-result":"call-result","call-value":"call-value","function":"function","options":{"backend":"fate","file_system":"{}","src_file":"src_file"},"source":"source"} +// // swagger:model SophiaCallResultInput type SophiaCallResultInput struct { @@ -95,7 +98,6 @@ func (m *SophiaCallResultInput) validateFunction(formats strfmt.Registry) error } func (m *SophiaCallResultInput) validateOptions(formats strfmt.Registry) error { - if swag.IsZero(m.Options) { // not required return nil } @@ -121,6 +123,34 @@ func (m *SophiaCallResultInput) validateSource(formats strfmt.Registry) error { return nil } +// ContextValidate validate this sophia call result input based on the context it is used +func (m *SophiaCallResultInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SophiaCallResultInput) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SophiaCallResultInput) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/sophia_json_data.go b/swagguard/compiler/models/sophia_json_data.go index 1b33290d..f8f5b8da 100644 --- a/swagguard/compiler/models/sophia_json_data.go +++ b/swagguard/compiler/models/sophia_json_data.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - "github.com/go-openapi/validate" ) // SophiaJSONData sophia Json data +// Example: {"data":"{}"} +// // swagger:model SophiaJsonData type SophiaJSONData struct { @@ -38,13 +40,18 @@ func (m *SophiaJSONData) Validate(formats strfmt.Registry) error { func (m *SophiaJSONData) validateData(formats strfmt.Registry) error { - if err := validate.Required("data", "body", m.Data); err != nil { - return err + if m.Data == nil { + return errors.Required("data", "body", nil) } return nil } +// ContextValidate validates this sophia Json data based on context it is used +func (m *SophiaJSONData) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *SophiaJSONData) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/compiler/models/validate_byte_code_input.go b/swagguard/compiler/models/validate_byte_code_input.go new file mode 100644 index 00000000..88977535 --- /dev/null +++ b/swagguard/compiler/models/validate_byte_code_input.go @@ -0,0 +1,169 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ValidateByteCodeInput validate byte code input +// Example: {"bytecode":{},"options":{"backend":"fate","file_system":"{}","src_file":"src_file"},"source":"source"} +// +// swagger:model ValidateByteCodeInput +type ValidateByteCodeInput struct { + + // Compiled contract + // Required: true + Bytecode *EncodedByteArray `json:"bytecode"` + + // options + // Required: true + Options *CompileOpts `json:"options"` + + // Sophia contract source code + // Required: true + Source *string `json:"source"` +} + +// Validate validates this validate byte code input +func (m *ValidateByteCodeInput) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBytecode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOptions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ValidateByteCodeInput) validateBytecode(formats strfmt.Registry) error { + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if err := validate.Required("bytecode", "body", m.Bytecode); err != nil { + return err + } + + if m.Bytecode != nil { + if err := m.Bytecode.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +func (m *ValidateByteCodeInput) validateOptions(formats strfmt.Registry) error { + + if err := validate.Required("options", "body", m.Options); err != nil { + return err + } + + if m.Options != nil { + if err := m.Options.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + +func (m *ValidateByteCodeInput) validateSource(formats strfmt.Registry) error { + + if err := validate.Required("source", "body", m.Source); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this validate byte code input based on the context it is used +func (m *ValidateByteCodeInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBytecode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ValidateByteCodeInput) contextValidateBytecode(ctx context.Context, formats strfmt.Registry) error { + + if m.Bytecode != nil { + if err := m.Bytecode.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bytecode") + } + return err + } + } + + return nil +} + +func (m *ValidateByteCodeInput) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.Options != nil { + if err := m.Options.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ValidateByteCodeInput) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ValidateByteCodeInput) UnmarshalBinary(b []byte) error { + var res ValidateByteCodeInput + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/compiler_error_test.go b/swagguard/compiler_error_test.go index 3f25965c..74a43419 100644 --- a/swagguard/compiler_error_test.go +++ b/swagguard/compiler_error_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/client/operations" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/compiler/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/client/operations" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/compiler/models" ) func TestCompilerErrorModelDereferencing(t *testing.T) { @@ -14,7 +14,7 @@ func TestCompilerErrorModelDereferencing(t *testing.T) { internalServerErr := operations.APIVersionInternalServerError{} err := models.Error{Reason: &reason} internalServerErr.Payload = &err - printedError := fmt.Sprintf("BadRequest %s", internalServerErr) + printedError := fmt.Sprintf("BadRequest %v", internalServerErr) if !strings.Contains(printedError, reason) { t.Errorf("Expected to find %s when printing out the models.Error: got %s instead", reason, printedError) } @@ -27,13 +27,16 @@ func TestCompilerCompilationErrorsModelDereferencing(t *testing.T) { err2.UnmarshalBinary([]byte(`{"message":"Also I don't like your face","pos":{"col":0,"line":0},"type":"wrong_programmer_error"}`)) compileContractErr := operations.CompileContractBadRequest{ - Payload: []*models.CompilerError{err1, err2}, + Payload: models.CompilerErrors{err1, err2}, } - printedError := fmt.Sprintf("%s", compileContractErr) - lookForError1 := "Unbound variable ae_addres" - lookForError2 := "Also I don't like your face" + printedError := compileContractErr.Error() - if !(strings.Contains(printedError, lookForError1) && strings.Contains(printedError, lookForError2)) { - t.Errorf("Expected []*models.CompilerError to include the messages %s and %s; got %s instead", lookForError1, lookForError2, printedError) + for _, message := range []string{ + "Unbound variable ae_addres", + "Also I don't like your face", + } { + if !strings.Contains(printedError, message) { + t.Errorf("Expected error to include %s; got %s instead", message, printedError) + } } } diff --git a/swagguard/node/client/external/external_client.go b/swagguard/node/client/external/external_client.go index 7d24cde5..a35ad219 100644 --- a/swagguard/node/client/external/external_client.go +++ b/swagguard/node/client/external/external_client.go @@ -6,13 +6,14 @@ package external // Editing this file might prove futile when you re-run the swagger generate command import ( - "github.com/go-openapi/runtime" + "fmt" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" ) // New creates a new external API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { return &Client{transport: transport, formats: formats} } @@ -24,884 +25,1267 @@ type Client struct { formats strfmt.Registry } +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetAccountByPubkey(params *GetAccountByPubkeyParams, opts ...ClientOption) (*GetAccountByPubkeyOK, error) + + GetAccountByPubkeyAndHash(params *GetAccountByPubkeyAndHashParams, opts ...ClientOption) (*GetAccountByPubkeyAndHashOK, error) + + GetAccountByPubkeyAndHeight(params *GetAccountByPubkeyAndHeightParams, opts ...ClientOption) (*GetAccountByPubkeyAndHeightOK, error) + + GetChainEnds(params *GetChainEndsParams, opts ...ClientOption) (*GetChainEndsOK, error) + + GetChannelByPubkey(params *GetChannelByPubkeyParams, opts ...ClientOption) (*GetChannelByPubkeyOK, error) + + GetContract(params *GetContractParams, opts ...ClientOption) (*GetContractOK, error) + + GetContractCode(params *GetContractCodeParams, opts ...ClientOption) (*GetContractCodeOK, error) + + GetContractPoI(params *GetContractPoIParams, opts ...ClientOption) (*GetContractPoIOK, error) + + GetCurrentGeneration(params *GetCurrentGenerationParams, opts ...ClientOption) (*GetCurrentGenerationOK, error) + + GetCurrentKeyBlock(params *GetCurrentKeyBlockParams, opts ...ClientOption) (*GetCurrentKeyBlockOK, error) + + GetCurrentKeyBlockHash(params *GetCurrentKeyBlockHashParams, opts ...ClientOption) (*GetCurrentKeyBlockHashOK, error) + + GetCurrentKeyBlockHeight(params *GetCurrentKeyBlockHeightParams, opts ...ClientOption) (*GetCurrentKeyBlockHeightOK, error) + + GetGenerationByHash(params *GetGenerationByHashParams, opts ...ClientOption) (*GetGenerationByHashOK, error) + + GetGenerationByHeight(params *GetGenerationByHeightParams, opts ...ClientOption) (*GetGenerationByHeightOK, error) + + GetKeyBlockByHash(params *GetKeyBlockByHashParams, opts ...ClientOption) (*GetKeyBlockByHashOK, error) + + GetKeyBlockByHeight(params *GetKeyBlockByHeightParams, opts ...ClientOption) (*GetKeyBlockByHeightOK, error) + + GetMicroBlockHeaderByHash(params *GetMicroBlockHeaderByHashParams, opts ...ClientOption) (*GetMicroBlockHeaderByHashOK, error) + + GetMicroBlockTransactionByHashAndIndex(params *GetMicroBlockTransactionByHashAndIndexParams, opts ...ClientOption) (*GetMicroBlockTransactionByHashAndIndexOK, error) + + GetMicroBlockTransactionsByHash(params *GetMicroBlockTransactionsByHashParams, opts ...ClientOption) (*GetMicroBlockTransactionsByHashOK, error) + + GetMicroBlockTransactionsCountByHash(params *GetMicroBlockTransactionsCountByHashParams, opts ...ClientOption) (*GetMicroBlockTransactionsCountByHashOK, error) + + GetNameEntryByName(params *GetNameEntryByNameParams, opts ...ClientOption) (*GetNameEntryByNameOK, error) + + GetOracleByPubkey(params *GetOracleByPubkeyParams, opts ...ClientOption) (*GetOracleByPubkeyOK, error) + + GetOracleQueriesByPubkey(params *GetOracleQueriesByPubkeyParams, opts ...ClientOption) (*GetOracleQueriesByPubkeyOK, error) + + GetOracleQueryByPubkeyAndQueryID(params *GetOracleQueryByPubkeyAndQueryIDParams, opts ...ClientOption) (*GetOracleQueryByPubkeyAndQueryIDOK, error) + + GetPeerPubkey(params *GetPeerPubkeyParams, opts ...ClientOption) (*GetPeerPubkeyOK, error) + + GetPendingAccountTransactionsByPubkey(params *GetPendingAccountTransactionsByPubkeyParams, opts ...ClientOption) (*GetPendingAccountTransactionsByPubkeyOK, error) + + GetPendingKeyBlock(params *GetPendingKeyBlockParams, opts ...ClientOption) (*GetPendingKeyBlockOK, error) + + GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) + + GetTopBlock(params *GetTopBlockParams, opts ...ClientOption) (*GetTopBlockOK, error) + + GetTransactionByHash(params *GetTransactionByHashParams, opts ...ClientOption) (*GetTransactionByHashOK, error) + + GetTransactionInfoByHash(params *GetTransactionInfoByHashParams, opts ...ClientOption) (*GetTransactionInfoByHashOK, error) + + PostTransaction(params *PostTransactionParams, opts ...ClientOption) (*PostTransactionOK, error) + + ProtectedDryRunTxs(params *ProtectedDryRunTxsParams, opts ...ClientOption) (*ProtectedDryRunTxsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + /* -GetAccountByPubkey Get an account by public key + GetAccountByPubkey Get an account by public key */ -func (a *Client) GetAccountByPubkey(params *GetAccountByPubkeyParams) (*GetAccountByPubkeyOK, error) { +func (a *Client) GetAccountByPubkey(params *GetAccountByPubkeyParams, opts ...ClientOption) (*GetAccountByPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountByPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAccountByPubkey", Method: "GET", PathPattern: "/accounts/{pubkey}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetAccountByPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetAccountByPubkeyOK), nil - + success, ok := result.(*GetAccountByPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetAccountByPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetAccountByPubkeyAndHash Get an account by public key after the block indicated by hash + GetAccountByPubkeyAndHash Get an account by public key after the block indicated by hash */ -func (a *Client) GetAccountByPubkeyAndHash(params *GetAccountByPubkeyAndHashParams) (*GetAccountByPubkeyAndHashOK, error) { +func (a *Client) GetAccountByPubkeyAndHash(params *GetAccountByPubkeyAndHashParams, opts ...ClientOption) (*GetAccountByPubkeyAndHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountByPubkeyAndHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAccountByPubkeyAndHash", Method: "GET", PathPattern: "/accounts/{pubkey}/hash/{hash}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetAccountByPubkeyAndHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetAccountByPubkeyAndHashOK), nil - + success, ok := result.(*GetAccountByPubkeyAndHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetAccountByPubkeyAndHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetAccountByPubkeyAndHeight Get an account by public key after the opening key block of the generation at height + GetAccountByPubkeyAndHeight Get an account by public key after the opening key block of the generation at height */ -func (a *Client) GetAccountByPubkeyAndHeight(params *GetAccountByPubkeyAndHeightParams) (*GetAccountByPubkeyAndHeightOK, error) { +func (a *Client) GetAccountByPubkeyAndHeight(params *GetAccountByPubkeyAndHeightParams, opts ...ClientOption) (*GetAccountByPubkeyAndHeightOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetAccountByPubkeyAndHeightParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetAccountByPubkeyAndHeight", Method: "GET", PathPattern: "/accounts/{pubkey}/height/{height}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetAccountByPubkeyAndHeightReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetAccountByPubkeyAndHeightOK), nil + success, ok := result.(*GetAccountByPubkeyAndHeightOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetAccountByPubkeyAndHeight: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} +/* + GetChainEnds Get oldest keyblock hashes counting from genesis including orphans +*/ +func (a *Client) GetChainEnds(params *GetChainEndsParams, opts ...ClientOption) (*GetChainEndsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetChainEndsParams() + } + op := &runtime.ClientOperation{ + ID: "GetChainEnds", + Method: "GET", + PathPattern: "/status/chain-ends", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetChainEndsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetChainEndsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetChainEnds: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetChannelByPubkey Get channel by public key + GetChannelByPubkey Get channel by public key */ -func (a *Client) GetChannelByPubkey(params *GetChannelByPubkeyParams) (*GetChannelByPubkeyOK, error) { +func (a *Client) GetChannelByPubkey(params *GetChannelByPubkeyParams, opts ...ClientOption) (*GetChannelByPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetChannelByPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetChannelByPubkey", Method: "GET", PathPattern: "/channels/{pubkey}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetChannelByPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetChannelByPubkeyOK), nil - + success, ok := result.(*GetChannelByPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetChannelByPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetContract Get a contract by pubkey + GetContract Get a contract by pubkey */ -func (a *Client) GetContract(params *GetContractParams) (*GetContractOK, error) { +func (a *Client) GetContract(params *GetContractParams, opts ...ClientOption) (*GetContractOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContractParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetContract", Method: "GET", PathPattern: "/contracts/{pubkey}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetContractReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetContractOK), nil - + success, ok := result.(*GetContractOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetContract: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetContractCode Get contract code by pubkey + GetContractCode Get contract code by pubkey */ -func (a *Client) GetContractCode(params *GetContractCodeParams) (*GetContractCodeOK, error) { +func (a *Client) GetContractCode(params *GetContractCodeParams, opts ...ClientOption) (*GetContractCodeOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContractCodeParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetContractCode", Method: "GET", PathPattern: "/contracts/{pubkey}/code", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetContractCodeReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetContractCodeOK), nil - + success, ok := result.(*GetContractCodeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetContractCode: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetContractPoI Get a proof of inclusion for a contract + GetContractPoI Get a proof of inclusion for a contract */ -func (a *Client) GetContractPoI(params *GetContractPoIParams) (*GetContractPoIOK, error) { +func (a *Client) GetContractPoI(params *GetContractPoIParams, opts ...ClientOption) (*GetContractPoIOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetContractPoIParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetContractPoI", Method: "GET", PathPattern: "/contracts/{pubkey}/poi", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetContractPoIReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) - if err != nil { - return nil, err } - return result.(*GetContractPoIOK), nil - -} - -/* -GetContractStore Get contract store by pubkey -*/ -func (a *Client) GetContractStore(params *GetContractStoreParams) (*GetContractStoreOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetContractStoreParams() + for _, opt := range opts { + opt(op) } - result, err := a.transport.Submit(&runtime.ClientOperation{ - ID: "GetContractStore", - Method: "GET", - PathPattern: "/contracts/{pubkey}/store", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetContractStoreReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - }) + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetContractStoreOK), nil - + success, ok := result.(*GetContractPoIOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetContractPoI: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetCurrentGeneration Get the current generation + GetCurrentGeneration Get the current generation */ -func (a *Client) GetCurrentGeneration(params *GetCurrentGenerationParams) (*GetCurrentGenerationOK, error) { +func (a *Client) GetCurrentGeneration(params *GetCurrentGenerationParams, opts ...ClientOption) (*GetCurrentGenerationOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCurrentGenerationParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetCurrentGeneration", Method: "GET", PathPattern: "/generations/current", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetCurrentGenerationReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetCurrentGenerationOK), nil - + success, ok := result.(*GetCurrentGenerationOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetCurrentGeneration: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetCurrentKeyBlock Get the current key block + GetCurrentKeyBlock Get the current key block */ -func (a *Client) GetCurrentKeyBlock(params *GetCurrentKeyBlockParams) (*GetCurrentKeyBlockOK, error) { +func (a *Client) GetCurrentKeyBlock(params *GetCurrentKeyBlockParams, opts ...ClientOption) (*GetCurrentKeyBlockOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCurrentKeyBlockParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetCurrentKeyBlock", Method: "GET", PathPattern: "/key-blocks/current", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetCurrentKeyBlockReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetCurrentKeyBlockOK), nil - + success, ok := result.(*GetCurrentKeyBlockOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetCurrentKeyBlock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetCurrentKeyBlockHash Get the hash of the current key block + GetCurrentKeyBlockHash Get the hash of the current key block */ -func (a *Client) GetCurrentKeyBlockHash(params *GetCurrentKeyBlockHashParams) (*GetCurrentKeyBlockHashOK, error) { +func (a *Client) GetCurrentKeyBlockHash(params *GetCurrentKeyBlockHashParams, opts ...ClientOption) (*GetCurrentKeyBlockHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCurrentKeyBlockHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetCurrentKeyBlockHash", Method: "GET", PathPattern: "/key-blocks/current/hash", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetCurrentKeyBlockHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetCurrentKeyBlockHashOK), nil - + success, ok := result.(*GetCurrentKeyBlockHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetCurrentKeyBlockHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetCurrentKeyBlockHeight Get the height of the current key block + GetCurrentKeyBlockHeight Get the height of the current key block */ -func (a *Client) GetCurrentKeyBlockHeight(params *GetCurrentKeyBlockHeightParams) (*GetCurrentKeyBlockHeightOK, error) { +func (a *Client) GetCurrentKeyBlockHeight(params *GetCurrentKeyBlockHeightParams, opts ...ClientOption) (*GetCurrentKeyBlockHeightOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetCurrentKeyBlockHeightParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetCurrentKeyBlockHeight", Method: "GET", PathPattern: "/key-blocks/current/height", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetCurrentKeyBlockHeightReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetCurrentKeyBlockHeightOK), nil - + success, ok := result.(*GetCurrentKeyBlockHeightOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetCurrentKeyBlockHeight: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetGenerationByHash Get a generation by hash + GetGenerationByHash Get a generation by hash */ -func (a *Client) GetGenerationByHash(params *GetGenerationByHashParams) (*GetGenerationByHashOK, error) { +func (a *Client) GetGenerationByHash(params *GetGenerationByHashParams, opts ...ClientOption) (*GetGenerationByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGenerationByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetGenerationByHash", Method: "GET", PathPattern: "/generations/hash/{hash}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetGenerationByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetGenerationByHashOK), nil - + success, ok := result.(*GetGenerationByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetGenerationByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetGenerationByHeight Get a generation by height + GetGenerationByHeight Get a generation by height */ -func (a *Client) GetGenerationByHeight(params *GetGenerationByHeightParams) (*GetGenerationByHeightOK, error) { +func (a *Client) GetGenerationByHeight(params *GetGenerationByHeightParams, opts ...ClientOption) (*GetGenerationByHeightOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetGenerationByHeightParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetGenerationByHeight", Method: "GET", PathPattern: "/generations/height/{height}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetGenerationByHeightReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetGenerationByHeightOK), nil - + success, ok := result.(*GetGenerationByHeightOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetGenerationByHeight: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetKeyBlockByHash Get a key block by hash + GetKeyBlockByHash Get a key block by hash */ -func (a *Client) GetKeyBlockByHash(params *GetKeyBlockByHashParams) (*GetKeyBlockByHashOK, error) { +func (a *Client) GetKeyBlockByHash(params *GetKeyBlockByHashParams, opts ...ClientOption) (*GetKeyBlockByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetKeyBlockByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetKeyBlockByHash", Method: "GET", PathPattern: "/key-blocks/hash/{hash}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetKeyBlockByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetKeyBlockByHashOK), nil - + success, ok := result.(*GetKeyBlockByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetKeyBlockByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetKeyBlockByHeight Get a key block by height + GetKeyBlockByHeight Get a key block by height */ -func (a *Client) GetKeyBlockByHeight(params *GetKeyBlockByHeightParams) (*GetKeyBlockByHeightOK, error) { +func (a *Client) GetKeyBlockByHeight(params *GetKeyBlockByHeightParams, opts ...ClientOption) (*GetKeyBlockByHeightOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetKeyBlockByHeightParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetKeyBlockByHeight", Method: "GET", PathPattern: "/key-blocks/height/{height}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetKeyBlockByHeightReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetKeyBlockByHeightOK), nil - + success, ok := result.(*GetKeyBlockByHeightOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetKeyBlockByHeight: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetMicroBlockHeaderByHash Get a micro block header by hash + GetMicroBlockHeaderByHash Get a micro block header by hash */ -func (a *Client) GetMicroBlockHeaderByHash(params *GetMicroBlockHeaderByHashParams) (*GetMicroBlockHeaderByHashOK, error) { +func (a *Client) GetMicroBlockHeaderByHash(params *GetMicroBlockHeaderByHashParams, opts ...ClientOption) (*GetMicroBlockHeaderByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMicroBlockHeaderByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetMicroBlockHeaderByHash", Method: "GET", PathPattern: "/micro-blocks/hash/{hash}/header", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetMicroBlockHeaderByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetMicroBlockHeaderByHashOK), nil - + success, ok := result.(*GetMicroBlockHeaderByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetMicroBlockHeaderByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetMicroBlockTransactionByHashAndIndex Get a micro block transaction by hash and index + GetMicroBlockTransactionByHashAndIndex Get a micro block transaction by hash and index */ -func (a *Client) GetMicroBlockTransactionByHashAndIndex(params *GetMicroBlockTransactionByHashAndIndexParams) (*GetMicroBlockTransactionByHashAndIndexOK, error) { +func (a *Client) GetMicroBlockTransactionByHashAndIndex(params *GetMicroBlockTransactionByHashAndIndexParams, opts ...ClientOption) (*GetMicroBlockTransactionByHashAndIndexOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMicroBlockTransactionByHashAndIndexParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetMicroBlockTransactionByHashAndIndex", Method: "GET", PathPattern: "/micro-blocks/hash/{hash}/transactions/index/{index}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetMicroBlockTransactionByHashAndIndexReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetMicroBlockTransactionByHashAndIndexOK), nil - + success, ok := result.(*GetMicroBlockTransactionByHashAndIndexOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetMicroBlockTransactionByHashAndIndex: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetMicroBlockTransactionsByHash Get micro block transactions by hash + GetMicroBlockTransactionsByHash Get micro block transactions by hash */ -func (a *Client) GetMicroBlockTransactionsByHash(params *GetMicroBlockTransactionsByHashParams) (*GetMicroBlockTransactionsByHashOK, error) { +func (a *Client) GetMicroBlockTransactionsByHash(params *GetMicroBlockTransactionsByHashParams, opts ...ClientOption) (*GetMicroBlockTransactionsByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMicroBlockTransactionsByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetMicroBlockTransactionsByHash", Method: "GET", PathPattern: "/micro-blocks/hash/{hash}/transactions", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetMicroBlockTransactionsByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetMicroBlockTransactionsByHashOK), nil - + success, ok := result.(*GetMicroBlockTransactionsByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetMicroBlockTransactionsByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetMicroBlockTransactionsCountByHash Get micro block transaction count by hash + GetMicroBlockTransactionsCountByHash Get micro block transaction count by hash */ -func (a *Client) GetMicroBlockTransactionsCountByHash(params *GetMicroBlockTransactionsCountByHashParams) (*GetMicroBlockTransactionsCountByHashOK, error) { +func (a *Client) GetMicroBlockTransactionsCountByHash(params *GetMicroBlockTransactionsCountByHashParams, opts ...ClientOption) (*GetMicroBlockTransactionsCountByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetMicroBlockTransactionsCountByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetMicroBlockTransactionsCountByHash", Method: "GET", PathPattern: "/micro-blocks/hash/{hash}/transactions/count", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetMicroBlockTransactionsCountByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetMicroBlockTransactionsCountByHashOK), nil - + success, ok := result.(*GetMicroBlockTransactionsCountByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetMicroBlockTransactionsCountByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetNameEntryByName Get name entry from naming system + GetNameEntryByName Get name entry from naming system */ -func (a *Client) GetNameEntryByName(params *GetNameEntryByNameParams) (*GetNameEntryByNameOK, error) { +func (a *Client) GetNameEntryByName(params *GetNameEntryByNameParams, opts ...ClientOption) (*GetNameEntryByNameOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetNameEntryByNameParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetNameEntryByName", Method: "GET", PathPattern: "/names/{name}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetNameEntryByNameReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetNameEntryByNameOK), nil - + success, ok := result.(*GetNameEntryByNameOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetNameEntryByName: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetOracleByPubkey Get an oracle by public key + GetOracleByPubkey Get an oracle by public key */ -func (a *Client) GetOracleByPubkey(params *GetOracleByPubkeyParams) (*GetOracleByPubkeyOK, error) { +func (a *Client) GetOracleByPubkey(params *GetOracleByPubkeyParams, opts ...ClientOption) (*GetOracleByPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetOracleByPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetOracleByPubkey", Method: "GET", PathPattern: "/oracles/{pubkey}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetOracleByPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetOracleByPubkeyOK), nil - + success, ok := result.(*GetOracleByPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetOracleByPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetOracleQueriesByPubkey Get oracle queries by public key + GetOracleQueriesByPubkey Get oracle queries by public key */ -func (a *Client) GetOracleQueriesByPubkey(params *GetOracleQueriesByPubkeyParams) (*GetOracleQueriesByPubkeyOK, error) { +func (a *Client) GetOracleQueriesByPubkey(params *GetOracleQueriesByPubkeyParams, opts ...ClientOption) (*GetOracleQueriesByPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetOracleQueriesByPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetOracleQueriesByPubkey", Method: "GET", PathPattern: "/oracles/{pubkey}/queries", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetOracleQueriesByPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetOracleQueriesByPubkeyOK), nil - + success, ok := result.(*GetOracleQueriesByPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetOracleQueriesByPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetOracleQueryByPubkeyAndQueryID Get an oracle query by public key and query ID + GetOracleQueryByPubkeyAndQueryID Get an oracle query by public key and query ID */ -func (a *Client) GetOracleQueryByPubkeyAndQueryID(params *GetOracleQueryByPubkeyAndQueryIDParams) (*GetOracleQueryByPubkeyAndQueryIDOK, error) { +func (a *Client) GetOracleQueryByPubkeyAndQueryID(params *GetOracleQueryByPubkeyAndQueryIDParams, opts ...ClientOption) (*GetOracleQueryByPubkeyAndQueryIDOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetOracleQueryByPubkeyAndQueryIDParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetOracleQueryByPubkeyAndQueryId", Method: "GET", PathPattern: "/oracles/{pubkey}/queries/{query-id}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetOracleQueryByPubkeyAndQueryIDReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetOracleQueryByPubkeyAndQueryIDOK), nil - + success, ok := result.(*GetOracleQueryByPubkeyAndQueryIDOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetOracleQueryByPubkeyAndQueryId: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetPeerPubkey Get peer public key + GetPeerPubkey Get peer public key */ -func (a *Client) GetPeerPubkey(params *GetPeerPubkeyParams) (*GetPeerPubkeyOK, error) { +func (a *Client) GetPeerPubkey(params *GetPeerPubkeyParams, opts ...ClientOption) (*GetPeerPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPeerPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetPeerPubkey", Method: "GET", PathPattern: "/peers/pubkey", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetPeerPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetPeerPubkeyOK), nil - + success, ok := result.(*GetPeerPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetPeerPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetPendingAccountTransactionsByPubkey Get pending account transactions by public key + GetPendingAccountTransactionsByPubkey Get pending account transactions by public key */ -func (a *Client) GetPendingAccountTransactionsByPubkey(params *GetPendingAccountTransactionsByPubkeyParams) (*GetPendingAccountTransactionsByPubkeyOK, error) { +func (a *Client) GetPendingAccountTransactionsByPubkey(params *GetPendingAccountTransactionsByPubkeyParams, opts ...ClientOption) (*GetPendingAccountTransactionsByPubkeyOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPendingAccountTransactionsByPubkeyParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetPendingAccountTransactionsByPubkey", Method: "GET", PathPattern: "/accounts/{pubkey}/transactions/pending", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetPendingAccountTransactionsByPubkeyReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetPendingAccountTransactionsByPubkeyOK), nil - + success, ok := result.(*GetPendingAccountTransactionsByPubkeyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetPendingAccountTransactionsByPubkey: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetPendingKeyBlock Get the pending key block + GetPendingKeyBlock Get the pending key block */ -func (a *Client) GetPendingKeyBlock(params *GetPendingKeyBlockParams) (*GetPendingKeyBlockOK, error) { +func (a *Client) GetPendingKeyBlock(params *GetPendingKeyBlockParams, opts ...ClientOption) (*GetPendingKeyBlockOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetPendingKeyBlockParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetPendingKeyBlock", Method: "GET", PathPattern: "/key-blocks/pending", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetPendingKeyBlockReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetPendingKeyBlockOK), nil - + success, ok := result.(*GetPendingKeyBlockOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetPendingKeyBlock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetStatus Get the status of a node + GetStatus Get the status of a node */ -func (a *Client) GetStatus(params *GetStatusParams) (*GetStatusOK, error) { +func (a *Client) GetStatus(params *GetStatusParams, opts ...ClientOption) (*GetStatusOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetStatusParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetStatus", Method: "GET", PathPattern: "/status", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetStatusReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetStatusOK), nil - + success, ok := result.(*GetStatusOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetStatus: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetTopBlock Get the top block (either key or micro block) + GetTopBlock Get the top block (either key or micro block) */ -func (a *Client) GetTopBlock(params *GetTopBlockParams) (*GetTopBlockOK, error) { +func (a *Client) GetTopBlock(params *GetTopBlockParams, opts ...ClientOption) (*GetTopBlockOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTopBlockParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetTopBlock", Method: "GET", PathPattern: "/blocks/top", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetTopBlockReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetTopBlockOK), nil - + success, ok := result.(*GetTopBlockOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetTopBlock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetTransactionByHash Get a transaction by hash + GetTransactionByHash Get a transaction by hash */ -func (a *Client) GetTransactionByHash(params *GetTransactionByHashParams) (*GetTransactionByHashOK, error) { +func (a *Client) GetTransactionByHash(params *GetTransactionByHashParams, opts ...ClientOption) (*GetTransactionByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransactionByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetTransactionByHash", Method: "GET", PathPattern: "/transactions/{hash}", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetTransactionByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetTransactionByHashOK), nil - + success, ok := result.(*GetTransactionByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetTransactionByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -GetTransactionInfoByHash get transaction info by hash API + GetTransactionInfoByHash get transaction info by hash API */ -func (a *Client) GetTransactionInfoByHash(params *GetTransactionInfoByHashParams) (*GetTransactionInfoByHashOK, error) { +func (a *Client) GetTransactionInfoByHash(params *GetTransactionInfoByHashParams, opts ...ClientOption) (*GetTransactionInfoByHashOK, error) { // TODO: Validate the params before sending if params == nil { params = NewGetTransactionInfoByHashParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "GetTransactionInfoByHash", Method: "GET", PathPattern: "/transactions/{hash}/info", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{""}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, Reader: &GetTransactionInfoByHashReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*GetTransactionInfoByHashOK), nil - + success, ok := result.(*GetTransactionInfoByHashOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetTransactionInfoByHash: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } /* -PostTransaction Post a new transaction + PostTransaction Post a new transaction */ -func (a *Client) PostTransaction(params *PostTransactionParams) (*PostTransactionOK, error) { +func (a *Client) PostTransaction(params *PostTransactionParams, opts ...ClientOption) (*PostTransactionOK, error) { // TODO: Validate the params before sending if params == nil { params = NewPostTransactionParams() } - - result, err := a.transport.Submit(&runtime.ClientOperation{ + op := &runtime.ClientOperation{ ID: "PostTransaction", Method: "POST", PathPattern: "/transactions", @@ -912,12 +1296,61 @@ func (a *Client) PostTransaction(params *PostTransactionParams) (*PostTransactio Reader: &PostTransactionReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, - }) + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) if err != nil { return nil, err } - return result.(*PostTransactionOK), nil + success, ok := result.(*PostTransactionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for PostTransaction: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ProtectedDryRunTxs Dry-run transactions on top of a given block. Supports all TXs except GAMetaTx, PayingForTx and OffchainTx. The maximum gas limit of all calls is capped. The maximum gas limit per request is a global node setting. Since DryRunCallReq object do not have a mandatory gas field, if not set a default value of 1000000 is being used instead. +*/ +func (a *Client) ProtectedDryRunTxs(params *ProtectedDryRunTxsParams, opts ...ClientOption) (*ProtectedDryRunTxsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewProtectedDryRunTxsParams() + } + op := &runtime.ClientOperation{ + ID: "ProtectedDryRunTxs", + Method: "POST", + PathPattern: "/dry-run", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ProtectedDryRunTxsReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ProtectedDryRunTxsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ProtectedDryRunTxs: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) } // SetTransport changes the transport on the client diff --git a/swagguard/node/client/external/get_account_by_pubkey_and_hash_parameters.go b/swagguard/node/client/external/get_account_by_pubkey_and_hash_parameters.go index 5dbd4847..695c73b8 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_and_hash_parameters.go +++ b/swagguard/node/client/external/get_account_by_pubkey_and_hash_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetAccountByPubkeyAndHashParams creates a new GetAccountByPubkeyAndHashParams object -// with the default values initialized. +// NewGetAccountByPubkeyAndHashParams creates a new GetAccountByPubkeyAndHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountByPubkeyAndHashParams() *GetAccountByPubkeyAndHashParams { - var () return &GetAccountByPubkeyAndHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountByPubkeyAndHashParamsWithTimeout creates a new GetAccountByPubkeyAndHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountByPubkeyAndHashParamsWithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHashParams { - var () return &GetAccountByPubkeyAndHashParams{ - timeout: timeout, } } // NewGetAccountByPubkeyAndHashParamsWithContext creates a new GetAccountByPubkeyAndHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountByPubkeyAndHashParamsWithContext(ctx context.Context) *GetAccountByPubkeyAndHashParams { - var () return &GetAccountByPubkeyAndHashParams{ - Context: ctx, } } // NewGetAccountByPubkeyAndHashParamsWithHTTPClient creates a new GetAccountByPubkeyAndHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountByPubkeyAndHashParamsWithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHashParams { - var () return &GetAccountByPubkeyAndHashParams{ HTTPClient: client, } } -/*GetAccountByPubkeyAndHashParams contains all the parameters to send to the API endpoint -for the get account by pubkey and hash operation typically these are written to a http.Request +/* GetAccountByPubkeyAndHashParams contains all the parameters to send to the API endpoint + for the get account by pubkey and hash operation. + + Typically these are written to a http.Request. */ type GetAccountByPubkeyAndHashParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string - /*Pubkey - The public key of the account + /* Pubkey. + + The public key of the account */ Pubkey string @@ -77,6 +76,21 @@ type GetAccountByPubkeyAndHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get account by pubkey and hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyAndHashParams) WithDefaults() *GetAccountByPubkeyAndHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get account by pubkey and hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyAndHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get account by pubkey and hash params func (o *GetAccountByPubkeyAndHashParams) WithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_account_by_pubkey_and_hash_responses.go b/swagguard/node/client/external/get_account_by_pubkey_and_hash_responses.go index 19237cb5..893de381 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_and_hash_responses.go +++ b/swagguard/node/client/external/get_account_by_pubkey_and_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetAccountByPubkeyAndHashReader is a Reader for the GetAccountByPubkeyAndHash structure. @@ -24,30 +23,26 @@ type GetAccountByPubkeyAndHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetAccountByPubkeyAndHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetAccountByPubkeyAndHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetAccountByPubkeyAndHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetAccountByPubkeyAndHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetAccountByPubkeyAndHashOK() *GetAccountByPubkeyAndHashOK { return &GetAccountByPubkeyAndHashOK{} } -/*GetAccountByPubkeyAndHashOK handles this case with default header values. +/* GetAccountByPubkeyAndHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetAccountByPubkeyAndHashOK struct { func (o *GetAccountByPubkeyAndHashOK) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashOK %+v", 200, o.Payload) } +func (o *GetAccountByPubkeyAndHashOK) GetPayload() *models.Account { + return o.Payload +} func (o *GetAccountByPubkeyAndHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetAccountByPubkeyAndHashBadRequest() *GetAccountByPubkeyAndHashBadReque return &GetAccountByPubkeyAndHashBadRequest{} } -/*GetAccountByPubkeyAndHashBadRequest handles this case with default header values. +/* GetAccountByPubkeyAndHashBadRequest describes a response with status code 400, with default header values. Invalid public key or invalid hash */ @@ -96,6 +94,9 @@ type GetAccountByPubkeyAndHashBadRequest struct { func (o *GetAccountByPubkeyAndHashBadRequest) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashBadRequest %+v", 400, o.Payload) } +func (o *GetAccountByPubkeyAndHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyAndHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetAccountByPubkeyAndHashNotFound() *GetAccountByPubkeyAndHashNotFound { return &GetAccountByPubkeyAndHashNotFound{} } -/*GetAccountByPubkeyAndHashNotFound handles this case with default header values. +/* GetAccountByPubkeyAndHashNotFound describes a response with status code 404, with default header values. Account not found or hash not available */ @@ -125,6 +126,9 @@ type GetAccountByPubkeyAndHashNotFound struct { func (o *GetAccountByPubkeyAndHashNotFound) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashNotFound %+v", 404, o.Payload) } +func (o *GetAccountByPubkeyAndHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyAndHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_account_by_pubkey_and_height_parameters.go b/swagguard/node/client/external/get_account_by_pubkey_and_height_parameters.go index 2e45ab06..7fdae730 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_and_height_parameters.go +++ b/swagguard/node/client/external/get_account_by_pubkey_and_height_parameters.go @@ -13,63 +13,64 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetAccountByPubkeyAndHeightParams creates a new GetAccountByPubkeyAndHeightParams object -// with the default values initialized. +// NewGetAccountByPubkeyAndHeightParams creates a new GetAccountByPubkeyAndHeightParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountByPubkeyAndHeightParams() *GetAccountByPubkeyAndHeightParams { - var () return &GetAccountByPubkeyAndHeightParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountByPubkeyAndHeightParamsWithTimeout creates a new GetAccountByPubkeyAndHeightParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountByPubkeyAndHeightParamsWithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHeightParams { - var () return &GetAccountByPubkeyAndHeightParams{ - timeout: timeout, } } // NewGetAccountByPubkeyAndHeightParamsWithContext creates a new GetAccountByPubkeyAndHeightParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountByPubkeyAndHeightParamsWithContext(ctx context.Context) *GetAccountByPubkeyAndHeightParams { - var () return &GetAccountByPubkeyAndHeightParams{ - Context: ctx, } } // NewGetAccountByPubkeyAndHeightParamsWithHTTPClient creates a new GetAccountByPubkeyAndHeightParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountByPubkeyAndHeightParamsWithHTTPClient(client *http.Client) *GetAccountByPubkeyAndHeightParams { - var () return &GetAccountByPubkeyAndHeightParams{ HTTPClient: client, } } -/*GetAccountByPubkeyAndHeightParams contains all the parameters to send to the API endpoint -for the get account by pubkey and height operation typically these are written to a http.Request +/* GetAccountByPubkeyAndHeightParams contains all the parameters to send to the API endpoint + for the get account by pubkey and height operation. + + Typically these are written to a http.Request. */ type GetAccountByPubkeyAndHeightParams struct { - /*Height - The height + /* Height. + + The height + Format: uint64 */ Height uint64 - /*Pubkey - The public key of the account + /* Pubkey. + + The public key of the account */ Pubkey string @@ -78,6 +79,21 @@ type GetAccountByPubkeyAndHeightParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get account by pubkey and height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyAndHeightParams) WithDefaults() *GetAccountByPubkeyAndHeightParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get account by pubkey and height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyAndHeightParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get account by pubkey and height params func (o *GetAccountByPubkeyAndHeightParams) WithTimeout(timeout time.Duration) *GetAccountByPubkeyAndHeightParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_account_by_pubkey_and_height_responses.go b/swagguard/node/client/external/get_account_by_pubkey_and_height_responses.go index da6830ee..5d30bc58 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_and_height_responses.go +++ b/swagguard/node/client/external/get_account_by_pubkey_and_height_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetAccountByPubkeyAndHeightReader is a Reader for the GetAccountByPubkeyAndHeight structure. @@ -24,30 +23,26 @@ type GetAccountByPubkeyAndHeightReader struct { // ReadResponse reads a server response into the received o. func (o *GetAccountByPubkeyAndHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetAccountByPubkeyAndHeightOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetAccountByPubkeyAndHeightBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetAccountByPubkeyAndHeightNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetAccountByPubkeyAndHeightOK() *GetAccountByPubkeyAndHeightOK { return &GetAccountByPubkeyAndHeightOK{} } -/*GetAccountByPubkeyAndHeightOK handles this case with default header values. +/* GetAccountByPubkeyAndHeightOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetAccountByPubkeyAndHeightOK struct { func (o *GetAccountByPubkeyAndHeightOK) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightOK %+v", 200, o.Payload) } +func (o *GetAccountByPubkeyAndHeightOK) GetPayload() *models.Account { + return o.Payload +} func (o *GetAccountByPubkeyAndHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetAccountByPubkeyAndHeightBadRequest() *GetAccountByPubkeyAndHeightBadR return &GetAccountByPubkeyAndHeightBadRequest{} } -/*GetAccountByPubkeyAndHeightBadRequest handles this case with default header values. +/* GetAccountByPubkeyAndHeightBadRequest describes a response with status code 400, with default header values. Invalid public key or invalid height */ @@ -96,6 +94,9 @@ type GetAccountByPubkeyAndHeightBadRequest struct { func (o *GetAccountByPubkeyAndHeightBadRequest) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightBadRequest %+v", 400, o.Payload) } +func (o *GetAccountByPubkeyAndHeightBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyAndHeightBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetAccountByPubkeyAndHeightNotFound() *GetAccountByPubkeyAndHeightNotFou return &GetAccountByPubkeyAndHeightNotFound{} } -/*GetAccountByPubkeyAndHeightNotFound handles this case with default header values. +/* GetAccountByPubkeyAndHeightNotFound describes a response with status code 404, with default header values. Account not found or height not available */ @@ -125,6 +126,9 @@ type GetAccountByPubkeyAndHeightNotFound struct { func (o *GetAccountByPubkeyAndHeightNotFound) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/height/{height}][%d] getAccountByPubkeyAndHeightNotFound %+v", 404, o.Payload) } +func (o *GetAccountByPubkeyAndHeightNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyAndHeightNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_account_by_pubkey_parameters.go b/swagguard/node/client/external/get_account_by_pubkey_parameters.go index 492deb39..556e85be 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_parameters.go +++ b/swagguard/node/client/external/get_account_by_pubkey_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetAccountByPubkeyParams creates a new GetAccountByPubkeyParams object -// with the default values initialized. +// NewGetAccountByPubkeyParams creates a new GetAccountByPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetAccountByPubkeyParams() *GetAccountByPubkeyParams { - var () return &GetAccountByPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetAccountByPubkeyParamsWithTimeout creates a new GetAccountByPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetAccountByPubkeyParamsWithTimeout(timeout time.Duration) *GetAccountByPubkeyParams { - var () return &GetAccountByPubkeyParams{ - timeout: timeout, } } // NewGetAccountByPubkeyParamsWithContext creates a new GetAccountByPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetAccountByPubkeyParamsWithContext(ctx context.Context) *GetAccountByPubkeyParams { - var () return &GetAccountByPubkeyParams{ - Context: ctx, } } // NewGetAccountByPubkeyParamsWithHTTPClient creates a new GetAccountByPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetAccountByPubkeyParamsWithHTTPClient(client *http.Client) *GetAccountByPubkeyParams { - var () return &GetAccountByPubkeyParams{ HTTPClient: client, } } -/*GetAccountByPubkeyParams contains all the parameters to send to the API endpoint -for the get account by pubkey operation typically these are written to a http.Request +/* GetAccountByPubkeyParams contains all the parameters to send to the API endpoint + for the get account by pubkey operation. + + Typically these are written to a http.Request. */ type GetAccountByPubkeyParams struct { - /*Pubkey - The public key of the account + /* Pubkey. + The public key of the account */ Pubkey string @@ -72,6 +70,21 @@ type GetAccountByPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get account by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyParams) WithDefaults() *GetAccountByPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get account by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAccountByPubkeyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get account by pubkey params func (o *GetAccountByPubkeyParams) WithTimeout(timeout time.Duration) *GetAccountByPubkeyParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_account_by_pubkey_responses.go b/swagguard/node/client/external/get_account_by_pubkey_responses.go index a100a99f..d5bdea81 100644 --- a/swagguard/node/client/external/get_account_by_pubkey_responses.go +++ b/swagguard/node/client/external/get_account_by_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetAccountByPubkeyReader is a Reader for the GetAccountByPubkey structure. @@ -24,30 +23,26 @@ type GetAccountByPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetAccountByPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetAccountByPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetAccountByPubkeyBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetAccountByPubkeyNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetAccountByPubkeyOK() *GetAccountByPubkeyOK { return &GetAccountByPubkeyOK{} } -/*GetAccountByPubkeyOK handles this case with default header values. +/* GetAccountByPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetAccountByPubkeyOK struct { func (o *GetAccountByPubkeyOK) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}][%d] getAccountByPubkeyOK %+v", 200, o.Payload) } +func (o *GetAccountByPubkeyOK) GetPayload() *models.Account { + return o.Payload +} func (o *GetAccountByPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetAccountByPubkeyBadRequest() *GetAccountByPubkeyBadRequest { return &GetAccountByPubkeyBadRequest{} } -/*GetAccountByPubkeyBadRequest handles this case with default header values. +/* GetAccountByPubkeyBadRequest describes a response with status code 400, with default header values. Invalid public key */ @@ -96,6 +94,9 @@ type GetAccountByPubkeyBadRequest struct { func (o *GetAccountByPubkeyBadRequest) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}][%d] getAccountByPubkeyBadRequest %+v", 400, o.Payload) } +func (o *GetAccountByPubkeyBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetAccountByPubkeyNotFound() *GetAccountByPubkeyNotFound { return &GetAccountByPubkeyNotFound{} } -/*GetAccountByPubkeyNotFound handles this case with default header values. +/* GetAccountByPubkeyNotFound describes a response with status code 404, with default header values. Account not found */ @@ -125,6 +126,9 @@ type GetAccountByPubkeyNotFound struct { func (o *GetAccountByPubkeyNotFound) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}][%d] getAccountByPubkeyNotFound %+v", 404, o.Payload) } +func (o *GetAccountByPubkeyNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetAccountByPubkeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_chain_ends_parameters.go b/swagguard/node/client/external/get_chain_ends_parameters.go new file mode 100644 index 00000000..8d6b276a --- /dev/null +++ b/swagguard/node/client/external/get_chain_ends_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetChainEndsParams creates a new GetChainEndsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetChainEndsParams() *GetChainEndsParams { + return &GetChainEndsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetChainEndsParamsWithTimeout creates a new GetChainEndsParams object +// with the ability to set a timeout on a request. +func NewGetChainEndsParamsWithTimeout(timeout time.Duration) *GetChainEndsParams { + return &GetChainEndsParams{ + timeout: timeout, + } +} + +// NewGetChainEndsParamsWithContext creates a new GetChainEndsParams object +// with the ability to set a context for a request. +func NewGetChainEndsParamsWithContext(ctx context.Context) *GetChainEndsParams { + return &GetChainEndsParams{ + Context: ctx, + } +} + +// NewGetChainEndsParamsWithHTTPClient creates a new GetChainEndsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetChainEndsParamsWithHTTPClient(client *http.Client) *GetChainEndsParams { + return &GetChainEndsParams{ + HTTPClient: client, + } +} + +/* GetChainEndsParams contains all the parameters to send to the API endpoint + for the get chain ends operation. + + Typically these are written to a http.Request. +*/ +type GetChainEndsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get chain ends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChainEndsParams) WithDefaults() *GetChainEndsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get chain ends params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChainEndsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get chain ends params +func (o *GetChainEndsParams) WithTimeout(timeout time.Duration) *GetChainEndsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get chain ends params +func (o *GetChainEndsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get chain ends params +func (o *GetChainEndsParams) WithContext(ctx context.Context) *GetChainEndsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get chain ends params +func (o *GetChainEndsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get chain ends params +func (o *GetChainEndsParams) WithHTTPClient(client *http.Client) *GetChainEndsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get chain ends params +func (o *GetChainEndsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetChainEndsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/node/client/external/get_chain_ends_responses.go b/swagguard/node/client/external/get_chain_ends_responses.go new file mode 100644 index 00000000..8686f437 --- /dev/null +++ b/swagguard/node/client/external/get_chain_ends_responses.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// GetChainEndsReader is a Reader for the GetChainEnds structure. +type GetChainEndsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetChainEndsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetChainEndsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewGetChainEndsOK creates a GetChainEndsOK with default headers values +func NewGetChainEndsOK() *GetChainEndsOK { + return &GetChainEndsOK{} +} + +/* GetChainEndsOK describes a response with status code 200, with default header values. + +Successful operation +*/ +type GetChainEndsOK struct { + Payload []string +} + +func (o *GetChainEndsOK) Error() string { + return fmt.Sprintf("[GET /status/chain-ends][%d] getChainEndsOK %+v", 200, o.Payload) +} +func (o *GetChainEndsOK) GetPayload() []string { + return o.Payload +} + +func (o *GetChainEndsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/swagguard/node/client/external/get_channel_by_pubkey_parameters.go b/swagguard/node/client/external/get_channel_by_pubkey_parameters.go index ea37c118..9557494a 100644 --- a/swagguard/node/client/external/get_channel_by_pubkey_parameters.go +++ b/swagguard/node/client/external/get_channel_by_pubkey_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetChannelByPubkeyParams creates a new GetChannelByPubkeyParams object -// with the default values initialized. +// NewGetChannelByPubkeyParams creates a new GetChannelByPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetChannelByPubkeyParams() *GetChannelByPubkeyParams { - var () return &GetChannelByPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetChannelByPubkeyParamsWithTimeout creates a new GetChannelByPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetChannelByPubkeyParamsWithTimeout(timeout time.Duration) *GetChannelByPubkeyParams { - var () return &GetChannelByPubkeyParams{ - timeout: timeout, } } // NewGetChannelByPubkeyParamsWithContext creates a new GetChannelByPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetChannelByPubkeyParamsWithContext(ctx context.Context) *GetChannelByPubkeyParams { - var () return &GetChannelByPubkeyParams{ - Context: ctx, } } // NewGetChannelByPubkeyParamsWithHTTPClient creates a new GetChannelByPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetChannelByPubkeyParamsWithHTTPClient(client *http.Client) *GetChannelByPubkeyParams { - var () return &GetChannelByPubkeyParams{ HTTPClient: client, } } -/*GetChannelByPubkeyParams contains all the parameters to send to the API endpoint -for the get channel by pubkey operation typically these are written to a http.Request +/* GetChannelByPubkeyParams contains all the parameters to send to the API endpoint + for the get channel by pubkey operation. + + Typically these are written to a http.Request. */ type GetChannelByPubkeyParams struct { - /*Pubkey - The pubkey of the channel + /* Pubkey. + The pubkey of the channel */ Pubkey string @@ -72,6 +70,21 @@ type GetChannelByPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get channel by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChannelByPubkeyParams) WithDefaults() *GetChannelByPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get channel by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetChannelByPubkeyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get channel by pubkey params func (o *GetChannelByPubkeyParams) WithTimeout(timeout time.Duration) *GetChannelByPubkeyParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_channel_by_pubkey_responses.go b/swagguard/node/client/external/get_channel_by_pubkey_responses.go index f632fb57..dc1216b3 100644 --- a/swagguard/node/client/external/get_channel_by_pubkey_responses.go +++ b/swagguard/node/client/external/get_channel_by_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetChannelByPubkeyReader is a Reader for the GetChannelByPubkey structure. @@ -24,30 +23,26 @@ type GetChannelByPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetChannelByPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetChannelByPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetChannelByPubkeyBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetChannelByPubkeyNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetChannelByPubkeyOK() *GetChannelByPubkeyOK { return &GetChannelByPubkeyOK{} } -/*GetChannelByPubkeyOK handles this case with default header values. +/* GetChannelByPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetChannelByPubkeyOK struct { func (o *GetChannelByPubkeyOK) Error() string { return fmt.Sprintf("[GET /channels/{pubkey}][%d] getChannelByPubkeyOK %+v", 200, o.Payload) } +func (o *GetChannelByPubkeyOK) GetPayload() *models.Channel { + return o.Payload +} func (o *GetChannelByPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetChannelByPubkeyBadRequest() *GetChannelByPubkeyBadRequest { return &GetChannelByPubkeyBadRequest{} } -/*GetChannelByPubkeyBadRequest handles this case with default header values. +/* GetChannelByPubkeyBadRequest describes a response with status code 400, with default header values. Invalid public key */ @@ -96,6 +94,9 @@ type GetChannelByPubkeyBadRequest struct { func (o *GetChannelByPubkeyBadRequest) Error() string { return fmt.Sprintf("[GET /channels/{pubkey}][%d] getChannelByPubkeyBadRequest %+v", 400, o.Payload) } +func (o *GetChannelByPubkeyBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetChannelByPubkeyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetChannelByPubkeyNotFound() *GetChannelByPubkeyNotFound { return &GetChannelByPubkeyNotFound{} } -/*GetChannelByPubkeyNotFound handles this case with default header values. +/* GetChannelByPubkeyNotFound describes a response with status code 404, with default header values. Channel not found */ @@ -125,6 +126,9 @@ type GetChannelByPubkeyNotFound struct { func (o *GetChannelByPubkeyNotFound) Error() string { return fmt.Sprintf("[GET /channels/{pubkey}][%d] getChannelByPubkeyNotFound %+v", 404, o.Payload) } +func (o *GetChannelByPubkeyNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetChannelByPubkeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_contract_code_parameters.go b/swagguard/node/client/external/get_contract_code_parameters.go index 2d3d22ba..2e7b67bd 100644 --- a/swagguard/node/client/external/get_contract_code_parameters.go +++ b/swagguard/node/client/external/get_contract_code_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetContractCodeParams creates a new GetContractCodeParams object -// with the default values initialized. +// NewGetContractCodeParams creates a new GetContractCodeParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContractCodeParams() *GetContractCodeParams { - var () return &GetContractCodeParams{ - timeout: cr.DefaultTimeout, } } // NewGetContractCodeParamsWithTimeout creates a new GetContractCodeParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContractCodeParamsWithTimeout(timeout time.Duration) *GetContractCodeParams { - var () return &GetContractCodeParams{ - timeout: timeout, } } // NewGetContractCodeParamsWithContext creates a new GetContractCodeParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContractCodeParamsWithContext(ctx context.Context) *GetContractCodeParams { - var () return &GetContractCodeParams{ - Context: ctx, } } // NewGetContractCodeParamsWithHTTPClient creates a new GetContractCodeParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContractCodeParamsWithHTTPClient(client *http.Client) *GetContractCodeParams { - var () return &GetContractCodeParams{ HTTPClient: client, } } -/*GetContractCodeParams contains all the parameters to send to the API endpoint -for the get contract code operation typically these are written to a http.Request +/* GetContractCodeParams contains all the parameters to send to the API endpoint + for the get contract code operation. + + Typically these are written to a http.Request. */ type GetContractCodeParams struct { - /*Pubkey - The pubkey of the contract + /* Pubkey. + The pubkey of the contract */ Pubkey string @@ -72,6 +70,21 @@ type GetContractCodeParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contract code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractCodeParams) WithDefaults() *GetContractCodeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contract code params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractCodeParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contract code params func (o *GetContractCodeParams) WithTimeout(timeout time.Duration) *GetContractCodeParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_contract_code_responses.go b/swagguard/node/client/external/get_contract_code_responses.go index 4d503c0a..fe5b85f2 100644 --- a/swagguard/node/client/external/get_contract_code_responses.go +++ b/swagguard/node/client/external/get_contract_code_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetContractCodeReader is a Reader for the GetContractCode structure. @@ -24,30 +23,26 @@ type GetContractCodeReader struct { // ReadResponse reads a server response into the received o. func (o *GetContractCodeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetContractCodeOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetContractCodeBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetContractCodeNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetContractCodeOK() *GetContractCodeOK { return &GetContractCodeOK{} } -/*GetContractCodeOK handles this case with default header values. +/* GetContractCodeOK describes a response with status code 200, with default header values. Contract code */ @@ -67,6 +62,9 @@ type GetContractCodeOK struct { func (o *GetContractCodeOK) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/code][%d] getContractCodeOK %+v", 200, o.Payload) } +func (o *GetContractCodeOK) GetPayload() *models.ByteCode { + return o.Payload +} func (o *GetContractCodeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetContractCodeBadRequest() *GetContractCodeBadRequest { return &GetContractCodeBadRequest{} } -/*GetContractCodeBadRequest handles this case with default header values. +/* GetContractCodeBadRequest describes a response with status code 400, with default header values. Invalid pubkey */ @@ -96,6 +94,9 @@ type GetContractCodeBadRequest struct { func (o *GetContractCodeBadRequest) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/code][%d] getContractCodeBadRequest %+v", 400, o.Payload) } +func (o *GetContractCodeBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetContractCodeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetContractCodeNotFound() *GetContractCodeNotFound { return &GetContractCodeNotFound{} } -/*GetContractCodeNotFound handles this case with default header values. +/* GetContractCodeNotFound describes a response with status code 404, with default header values. Contract not found */ @@ -125,6 +126,9 @@ type GetContractCodeNotFound struct { func (o *GetContractCodeNotFound) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/code][%d] getContractCodeNotFound %+v", 404, o.Payload) } +func (o *GetContractCodeNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetContractCodeNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_contract_parameters.go b/swagguard/node/client/external/get_contract_parameters.go index a472f3a6..b16f68eb 100644 --- a/swagguard/node/client/external/get_contract_parameters.go +++ b/swagguard/node/client/external/get_contract_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetContractParams creates a new GetContractParams object -// with the default values initialized. +// NewGetContractParams creates a new GetContractParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContractParams() *GetContractParams { - var () return &GetContractParams{ - timeout: cr.DefaultTimeout, } } // NewGetContractParamsWithTimeout creates a new GetContractParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContractParamsWithTimeout(timeout time.Duration) *GetContractParams { - var () return &GetContractParams{ - timeout: timeout, } } // NewGetContractParamsWithContext creates a new GetContractParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContractParamsWithContext(ctx context.Context) *GetContractParams { - var () return &GetContractParams{ - Context: ctx, } } // NewGetContractParamsWithHTTPClient creates a new GetContractParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContractParamsWithHTTPClient(client *http.Client) *GetContractParams { - var () return &GetContractParams{ HTTPClient: client, } } -/*GetContractParams contains all the parameters to send to the API endpoint -for the get contract operation typically these are written to a http.Request +/* GetContractParams contains all the parameters to send to the API endpoint + for the get contract operation. + + Typically these are written to a http.Request. */ type GetContractParams struct { - /*Pubkey - The pubkey of the contract + /* Pubkey. + The pubkey of the contract */ Pubkey string @@ -72,6 +70,21 @@ type GetContractParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contract params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractParams) WithDefaults() *GetContractParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contract params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contract params func (o *GetContractParams) WithTimeout(timeout time.Duration) *GetContractParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_contract_po_i_parameters.go b/swagguard/node/client/external/get_contract_po_i_parameters.go index f04f545b..7ad9e71f 100644 --- a/swagguard/node/client/external/get_contract_po_i_parameters.go +++ b/swagguard/node/client/external/get_contract_po_i_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetContractPoIParams creates a new GetContractPoIParams object -// with the default values initialized. +// NewGetContractPoIParams creates a new GetContractPoIParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetContractPoIParams() *GetContractPoIParams { - var () return &GetContractPoIParams{ - timeout: cr.DefaultTimeout, } } // NewGetContractPoIParamsWithTimeout creates a new GetContractPoIParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetContractPoIParamsWithTimeout(timeout time.Duration) *GetContractPoIParams { - var () return &GetContractPoIParams{ - timeout: timeout, } } // NewGetContractPoIParamsWithContext creates a new GetContractPoIParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetContractPoIParamsWithContext(ctx context.Context) *GetContractPoIParams { - var () return &GetContractPoIParams{ - Context: ctx, } } // NewGetContractPoIParamsWithHTTPClient creates a new GetContractPoIParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetContractPoIParamsWithHTTPClient(client *http.Client) *GetContractPoIParams { - var () return &GetContractPoIParams{ HTTPClient: client, } } -/*GetContractPoIParams contains all the parameters to send to the API endpoint -for the get contract po i operation typically these are written to a http.Request +/* GetContractPoIParams contains all the parameters to send to the API endpoint + for the get contract po i operation. + + Typically these are written to a http.Request. */ type GetContractPoIParams struct { - /*Pubkey - Contract pubkey to get proof for + /* Pubkey. + Contract pubkey to get proof for */ Pubkey string @@ -72,6 +70,21 @@ type GetContractPoIParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get contract po i params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractPoIParams) WithDefaults() *GetContractPoIParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get contract po i params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetContractPoIParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get contract po i params func (o *GetContractPoIParams) WithTimeout(timeout time.Duration) *GetContractPoIParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_contract_po_i_responses.go b/swagguard/node/client/external/get_contract_po_i_responses.go index f7377c55..8b588d13 100644 --- a/swagguard/node/client/external/get_contract_po_i_responses.go +++ b/swagguard/node/client/external/get_contract_po_i_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetContractPoIReader is a Reader for the GetContractPoI structure. @@ -24,30 +23,26 @@ type GetContractPoIReader struct { // ReadResponse reads a server response into the received o. func (o *GetContractPoIReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetContractPoIOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetContractPoIBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetContractPoINotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetContractPoIOK() *GetContractPoIOK { return &GetContractPoIOK{} } -/*GetContractPoIOK handles this case with default header values. +/* GetContractPoIOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetContractPoIOK struct { func (o *GetContractPoIOK) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/poi][%d] getContractPoIOK %+v", 200, o.Payload) } +func (o *GetContractPoIOK) GetPayload() *models.PoI { + return o.Payload +} func (o *GetContractPoIOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetContractPoIBadRequest() *GetContractPoIBadRequest { return &GetContractPoIBadRequest{} } -/*GetContractPoIBadRequest handles this case with default header values. +/* GetContractPoIBadRequest describes a response with status code 400, with default header values. Invalid contract key */ @@ -96,6 +94,9 @@ type GetContractPoIBadRequest struct { func (o *GetContractPoIBadRequest) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/poi][%d] getContractPoIBadRequest %+v", 400, o.Payload) } +func (o *GetContractPoIBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetContractPoIBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetContractPoINotFound() *GetContractPoINotFound { return &GetContractPoINotFound{} } -/*GetContractPoINotFound handles this case with default header values. +/* GetContractPoINotFound describes a response with status code 404, with default header values. Contract not found */ @@ -125,6 +126,9 @@ type GetContractPoINotFound struct { func (o *GetContractPoINotFound) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}/poi][%d] getContractPoINotFound %+v", 404, o.Payload) } +func (o *GetContractPoINotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetContractPoINotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_contract_responses.go b/swagguard/node/client/external/get_contract_responses.go index 8b6c487f..89c9f5a6 100644 --- a/swagguard/node/client/external/get_contract_responses.go +++ b/swagguard/node/client/external/get_contract_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetContractReader is a Reader for the GetContract structure. @@ -24,30 +23,26 @@ type GetContractReader struct { // ReadResponse reads a server response into the received o. func (o *GetContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetContractOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetContractBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetContractNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetContractOK() *GetContractOK { return &GetContractOK{} } -/*GetContractOK handles this case with default header values. +/* GetContractOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetContractOK struct { func (o *GetContractOK) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}][%d] getContractOK %+v", 200, o.Payload) } +func (o *GetContractOK) GetPayload() *models.ContractObject { + return o.Payload +} func (o *GetContractOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetContractBadRequest() *GetContractBadRequest { return &GetContractBadRequest{} } -/*GetContractBadRequest handles this case with default header values. +/* GetContractBadRequest describes a response with status code 400, with default header values. Invalid pubkey */ @@ -96,6 +94,9 @@ type GetContractBadRequest struct { func (o *GetContractBadRequest) Error() string { return fmt.Sprintf("[GET /contracts/{pubkey}][%d] getContractBadRequest %+v", 400, o.Payload) } +func (o *GetContractBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetContractBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetContractNotFound() *GetContractNotFound { return &GetContractNotFound{} } -/*GetContractNotFound handles this case with default header values. +/* GetContractNotFound describes a response with status code 404, with default header values. Contract not found */ diff --git a/swagguard/node/client/external/get_contract_store_parameters.go b/swagguard/node/client/external/get_contract_store_parameters.go deleted file mode 100644 index 5da6dad7..00000000 --- a/swagguard/node/client/external/get_contract_store_parameters.go +++ /dev/null @@ -1,136 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package external - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" -) - -// NewGetContractStoreParams creates a new GetContractStoreParams object -// with the default values initialized. -func NewGetContractStoreParams() *GetContractStoreParams { - var () - return &GetContractStoreParams{ - - timeout: cr.DefaultTimeout, - } -} - -// NewGetContractStoreParamsWithTimeout creates a new GetContractStoreParams object -// with the default values initialized, and the ability to set a timeout on a request -func NewGetContractStoreParamsWithTimeout(timeout time.Duration) *GetContractStoreParams { - var () - return &GetContractStoreParams{ - - timeout: timeout, - } -} - -// NewGetContractStoreParamsWithContext creates a new GetContractStoreParams object -// with the default values initialized, and the ability to set a context for a request -func NewGetContractStoreParamsWithContext(ctx context.Context) *GetContractStoreParams { - var () - return &GetContractStoreParams{ - - Context: ctx, - } -} - -// NewGetContractStoreParamsWithHTTPClient creates a new GetContractStoreParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request -func NewGetContractStoreParamsWithHTTPClient(client *http.Client) *GetContractStoreParams { - var () - return &GetContractStoreParams{ - HTTPClient: client, - } -} - -/*GetContractStoreParams contains all the parameters to send to the API endpoint -for the get contract store operation typically these are written to a http.Request -*/ -type GetContractStoreParams struct { - - /*Pubkey - The pubkey of the contract - - */ - Pubkey string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithTimeout adds the timeout to the get contract store params -func (o *GetContractStoreParams) WithTimeout(timeout time.Duration) *GetContractStoreParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get contract store params -func (o *GetContractStoreParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get contract store params -func (o *GetContractStoreParams) WithContext(ctx context.Context) *GetContractStoreParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get contract store params -func (o *GetContractStoreParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get contract store params -func (o *GetContractStoreParams) WithHTTPClient(client *http.Client) *GetContractStoreParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get contract store params -func (o *GetContractStoreParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithPubkey adds the pubkey to the get contract store params -func (o *GetContractStoreParams) WithPubkey(pubkey string) *GetContractStoreParams { - o.SetPubkey(pubkey) - return o -} - -// SetPubkey adds the pubkey to the get contract store params -func (o *GetContractStoreParams) SetPubkey(pubkey string) { - o.Pubkey = pubkey -} - -// WriteToRequest writes these params to a swagger request -func (o *GetContractStoreParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param pubkey - if err := r.SetPathParam("pubkey", o.Pubkey); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/swagguard/node/client/external/get_contract_store_responses.go b/swagguard/node/client/external/get_contract_store_responses.go deleted file mode 100644 index 2c200f5e..00000000 --- a/swagguard/node/client/external/get_contract_store_responses.go +++ /dev/null @@ -1,131 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package external - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" -) - -// GetContractStoreReader is a Reader for the GetContractStore structure. -type GetContractStoreReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetContractStoreReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - - case 200: - result := NewGetContractStoreOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - - case 400: - result := NewGetContractStoreBadRequest() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - - case 404: - result := NewGetContractStoreNotFound() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return nil, result - - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) - } -} - -// NewGetContractStoreOK creates a GetContractStoreOK with default headers values -func NewGetContractStoreOK() *GetContractStoreOK { - return &GetContractStoreOK{} -} - -/*GetContractStoreOK handles this case with default header values. - -Contract Store -*/ -type GetContractStoreOK struct { - Payload *models.ContractStore -} - -func (o *GetContractStoreOK) Error() string { - return fmt.Sprintf("[GET /contracts/{pubkey}/store][%d] getContractStoreOK %+v", 200, o.Payload) -} - -func (o *GetContractStoreOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.ContractStore) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetContractStoreBadRequest creates a GetContractStoreBadRequest with default headers values -func NewGetContractStoreBadRequest() *GetContractStoreBadRequest { - return &GetContractStoreBadRequest{} -} - -/*GetContractStoreBadRequest handles this case with default header values. - -Invalid pubkey -*/ -type GetContractStoreBadRequest struct { - Payload *models.Error -} - -func (o *GetContractStoreBadRequest) Error() string { - return fmt.Sprintf("[GET /contracts/{pubkey}/store][%d] getContractStoreBadRequest %+v", 400, o.Payload) -} - -func (o *GetContractStoreBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.Error) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetContractStoreNotFound creates a GetContractStoreNotFound with default headers values -func NewGetContractStoreNotFound() *GetContractStoreNotFound { - return &GetContractStoreNotFound{} -} - -/*GetContractStoreNotFound handles this case with default header values. - -Contract not found -*/ -type GetContractStoreNotFound struct { -} - -func (o *GetContractStoreNotFound) Error() string { - return fmt.Sprintf("[GET /contracts/{pubkey}/store][%d] getContractStoreNotFound ", 404) -} - -func (o *GetContractStoreNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - return nil -} diff --git a/swagguard/node/client/external/get_current_generation_parameters.go b/swagguard/node/client/external/get_current_generation_parameters.go index b074dc5b..c4082bde 100644 --- a/swagguard/node/client/external/get_current_generation_parameters.go +++ b/swagguard/node/client/external/get_current_generation_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetCurrentGenerationParams creates a new GetCurrentGenerationParams object -// with the default values initialized. +// NewGetCurrentGenerationParams creates a new GetCurrentGenerationParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCurrentGenerationParams() *GetCurrentGenerationParams { - return &GetCurrentGenerationParams{ - timeout: cr.DefaultTimeout, } } // NewGetCurrentGenerationParamsWithTimeout creates a new GetCurrentGenerationParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCurrentGenerationParamsWithTimeout(timeout time.Duration) *GetCurrentGenerationParams { - return &GetCurrentGenerationParams{ - timeout: timeout, } } // NewGetCurrentGenerationParamsWithContext creates a new GetCurrentGenerationParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCurrentGenerationParamsWithContext(ctx context.Context) *GetCurrentGenerationParams { - return &GetCurrentGenerationParams{ - Context: ctx, } } // NewGetCurrentGenerationParamsWithHTTPClient creates a new GetCurrentGenerationParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCurrentGenerationParamsWithHTTPClient(client *http.Client) *GetCurrentGenerationParams { - return &GetCurrentGenerationParams{ HTTPClient: client, } } -/*GetCurrentGenerationParams contains all the parameters to send to the API endpoint -for the get current generation operation typically these are written to a http.Request +/* GetCurrentGenerationParams contains all the parameters to send to the API endpoint + for the get current generation operation. + + Typically these are written to a http.Request. */ type GetCurrentGenerationParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetCurrentGenerationParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get current generation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentGenerationParams) WithDefaults() *GetCurrentGenerationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get current generation params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentGenerationParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get current generation params func (o *GetCurrentGenerationParams) WithTimeout(timeout time.Duration) *GetCurrentGenerationParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_current_generation_responses.go b/swagguard/node/client/external/get_current_generation_responses.go index 92f967ef..ba885bd3 100644 --- a/swagguard/node/client/external/get_current_generation_responses.go +++ b/swagguard/node/client/external/get_current_generation_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetCurrentGenerationReader is a Reader for the GetCurrentGeneration structure. @@ -24,23 +23,20 @@ type GetCurrentGenerationReader struct { // ReadResponse reads a server response into the received o. func (o *GetCurrentGenerationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetCurrentGenerationOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetCurrentGenerationNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGetCurrentGenerationOK() *GetCurrentGenerationOK { return &GetCurrentGenerationOK{} } -/*GetCurrentGenerationOK handles this case with default header values. +/* GetCurrentGenerationOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type GetCurrentGenerationOK struct { func (o *GetCurrentGenerationOK) Error() string { return fmt.Sprintf("[GET /generations/current][%d] getCurrentGenerationOK %+v", 200, o.Payload) } +func (o *GetCurrentGenerationOK) GetPayload() *models.Generation { + return o.Payload +} func (o *GetCurrentGenerationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGetCurrentGenerationNotFound() *GetCurrentGenerationNotFound { return &GetCurrentGenerationNotFound{} } -/*GetCurrentGenerationNotFound handles this case with default header values. +/* GetCurrentGenerationNotFound describes a response with status code 404, with default header values. Generation not found */ @@ -89,6 +88,9 @@ type GetCurrentGenerationNotFound struct { func (o *GetCurrentGenerationNotFound) Error() string { return fmt.Sprintf("[GET /generations/current][%d] getCurrentGenerationNotFound %+v", 404, o.Payload) } +func (o *GetCurrentGenerationNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetCurrentGenerationNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_current_key_block_hash_parameters.go b/swagguard/node/client/external/get_current_key_block_hash_parameters.go index 233002bc..c175f15b 100644 --- a/swagguard/node/client/external/get_current_key_block_hash_parameters.go +++ b/swagguard/node/client/external/get_current_key_block_hash_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetCurrentKeyBlockHashParams creates a new GetCurrentKeyBlockHashParams object -// with the default values initialized. +// NewGetCurrentKeyBlockHashParams creates a new GetCurrentKeyBlockHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCurrentKeyBlockHashParams() *GetCurrentKeyBlockHashParams { - return &GetCurrentKeyBlockHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetCurrentKeyBlockHashParamsWithTimeout creates a new GetCurrentKeyBlockHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCurrentKeyBlockHashParamsWithTimeout(timeout time.Duration) *GetCurrentKeyBlockHashParams { - return &GetCurrentKeyBlockHashParams{ - timeout: timeout, } } // NewGetCurrentKeyBlockHashParamsWithContext creates a new GetCurrentKeyBlockHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCurrentKeyBlockHashParamsWithContext(ctx context.Context) *GetCurrentKeyBlockHashParams { - return &GetCurrentKeyBlockHashParams{ - Context: ctx, } } // NewGetCurrentKeyBlockHashParamsWithHTTPClient creates a new GetCurrentKeyBlockHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCurrentKeyBlockHashParamsWithHTTPClient(client *http.Client) *GetCurrentKeyBlockHashParams { - return &GetCurrentKeyBlockHashParams{ HTTPClient: client, } } -/*GetCurrentKeyBlockHashParams contains all the parameters to send to the API endpoint -for the get current key block hash operation typically these are written to a http.Request +/* GetCurrentKeyBlockHashParams contains all the parameters to send to the API endpoint + for the get current key block hash operation. + + Typically these are written to a http.Request. */ type GetCurrentKeyBlockHashParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetCurrentKeyBlockHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get current key block hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockHashParams) WithDefaults() *GetCurrentKeyBlockHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get current key block hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get current key block hash params func (o *GetCurrentKeyBlockHashParams) WithTimeout(timeout time.Duration) *GetCurrentKeyBlockHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_current_key_block_hash_responses.go b/swagguard/node/client/external/get_current_key_block_hash_responses.go index 918c9409..fc169c20 100644 --- a/swagguard/node/client/external/get_current_key_block_hash_responses.go +++ b/swagguard/node/client/external/get_current_key_block_hash_responses.go @@ -6,15 +6,15 @@ package external // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetCurrentKeyBlockHashReader is a Reader for the GetCurrentKeyBlockHash structure. @@ -25,23 +25,20 @@ type GetCurrentKeyBlockHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetCurrentKeyBlockHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetCurrentKeyBlockHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetCurrentKeyBlockHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -50,7 +47,7 @@ func NewGetCurrentKeyBlockHashOK() *GetCurrentKeyBlockHashOK { return &GetCurrentKeyBlockHashOK{} } -/*GetCurrentKeyBlockHashOK handles this case with default header values. +/* GetCurrentKeyBlockHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -61,6 +58,9 @@ type GetCurrentKeyBlockHashOK struct { func (o *GetCurrentKeyBlockHashOK) Error() string { return fmt.Sprintf("[GET /key-blocks/current/hash][%d] getCurrentKeyBlockHashOK %+v", 200, o.Payload) } +func (o *GetCurrentKeyBlockHashOK) GetPayload() *GetCurrentKeyBlockHashOKBody { + return o.Payload +} func (o *GetCurrentKeyBlockHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -79,7 +79,7 @@ func NewGetCurrentKeyBlockHashNotFound() *GetCurrentKeyBlockHashNotFound { return &GetCurrentKeyBlockHashNotFound{} } -/*GetCurrentKeyBlockHashNotFound handles this case with default header values. +/* GetCurrentKeyBlockHashNotFound describes a response with status code 404, with default header values. Block not found */ @@ -90,6 +90,9 @@ type GetCurrentKeyBlockHashNotFound struct { func (o *GetCurrentKeyBlockHashNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/current/hash][%d] getCurrentKeyBlockHashNotFound %+v", 404, o.Payload) } +func (o *GetCurrentKeyBlockHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetCurrentKeyBlockHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -117,6 +120,11 @@ func (o *GetCurrentKeyBlockHashOKBody) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this get current key block hash o k body based on context it is used +func (o *GetCurrentKeyBlockHashOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetCurrentKeyBlockHashOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/swagguard/node/client/external/get_current_key_block_height_parameters.go b/swagguard/node/client/external/get_current_key_block_height_parameters.go index ccf465df..902092f2 100644 --- a/swagguard/node/client/external/get_current_key_block_height_parameters.go +++ b/swagguard/node/client/external/get_current_key_block_height_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetCurrentKeyBlockHeightParams creates a new GetCurrentKeyBlockHeightParams object -// with the default values initialized. +// NewGetCurrentKeyBlockHeightParams creates a new GetCurrentKeyBlockHeightParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCurrentKeyBlockHeightParams() *GetCurrentKeyBlockHeightParams { - return &GetCurrentKeyBlockHeightParams{ - timeout: cr.DefaultTimeout, } } // NewGetCurrentKeyBlockHeightParamsWithTimeout creates a new GetCurrentKeyBlockHeightParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCurrentKeyBlockHeightParamsWithTimeout(timeout time.Duration) *GetCurrentKeyBlockHeightParams { - return &GetCurrentKeyBlockHeightParams{ - timeout: timeout, } } // NewGetCurrentKeyBlockHeightParamsWithContext creates a new GetCurrentKeyBlockHeightParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCurrentKeyBlockHeightParamsWithContext(ctx context.Context) *GetCurrentKeyBlockHeightParams { - return &GetCurrentKeyBlockHeightParams{ - Context: ctx, } } // NewGetCurrentKeyBlockHeightParamsWithHTTPClient creates a new GetCurrentKeyBlockHeightParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCurrentKeyBlockHeightParamsWithHTTPClient(client *http.Client) *GetCurrentKeyBlockHeightParams { - return &GetCurrentKeyBlockHeightParams{ HTTPClient: client, } } -/*GetCurrentKeyBlockHeightParams contains all the parameters to send to the API endpoint -for the get current key block height operation typically these are written to a http.Request +/* GetCurrentKeyBlockHeightParams contains all the parameters to send to the API endpoint + for the get current key block height operation. + + Typically these are written to a http.Request. */ type GetCurrentKeyBlockHeightParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetCurrentKeyBlockHeightParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get current key block height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockHeightParams) WithDefaults() *GetCurrentKeyBlockHeightParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get current key block height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockHeightParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get current key block height params func (o *GetCurrentKeyBlockHeightParams) WithTimeout(timeout time.Duration) *GetCurrentKeyBlockHeightParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_current_key_block_height_responses.go b/swagguard/node/client/external/get_current_key_block_height_responses.go index 8ddc4c26..ec35d416 100644 --- a/swagguard/node/client/external/get_current_key_block_height_responses.go +++ b/swagguard/node/client/external/get_current_key_block_height_responses.go @@ -6,15 +6,15 @@ package external // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetCurrentKeyBlockHeightReader is a Reader for the GetCurrentKeyBlockHeight structure. @@ -25,23 +25,20 @@ type GetCurrentKeyBlockHeightReader struct { // ReadResponse reads a server response into the received o. func (o *GetCurrentKeyBlockHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetCurrentKeyBlockHeightOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetCurrentKeyBlockHeightNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -50,7 +47,7 @@ func NewGetCurrentKeyBlockHeightOK() *GetCurrentKeyBlockHeightOK { return &GetCurrentKeyBlockHeightOK{} } -/*GetCurrentKeyBlockHeightOK handles this case with default header values. +/* GetCurrentKeyBlockHeightOK describes a response with status code 200, with default header values. Successful operation */ @@ -61,6 +58,9 @@ type GetCurrentKeyBlockHeightOK struct { func (o *GetCurrentKeyBlockHeightOK) Error() string { return fmt.Sprintf("[GET /key-blocks/current/height][%d] getCurrentKeyBlockHeightOK %+v", 200, o.Payload) } +func (o *GetCurrentKeyBlockHeightOK) GetPayload() *GetCurrentKeyBlockHeightOKBody { + return o.Payload +} func (o *GetCurrentKeyBlockHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -79,7 +79,7 @@ func NewGetCurrentKeyBlockHeightNotFound() *GetCurrentKeyBlockHeightNotFound { return &GetCurrentKeyBlockHeightNotFound{} } -/*GetCurrentKeyBlockHeightNotFound handles this case with default header values. +/* GetCurrentKeyBlockHeightNotFound describes a response with status code 404, with default header values. Block not found */ @@ -90,6 +90,9 @@ type GetCurrentKeyBlockHeightNotFound struct { func (o *GetCurrentKeyBlockHeightNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/current/height][%d] getCurrentKeyBlockHeightNotFound %+v", 404, o.Payload) } +func (o *GetCurrentKeyBlockHeightNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetCurrentKeyBlockHeightNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -117,6 +120,11 @@ func (o *GetCurrentKeyBlockHeightOKBody) Validate(formats strfmt.Registry) error return nil } +// ContextValidate validates this get current key block height o k body based on context it is used +func (o *GetCurrentKeyBlockHeightOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetCurrentKeyBlockHeightOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/swagguard/node/client/external/get_current_key_block_parameters.go b/swagguard/node/client/external/get_current_key_block_parameters.go index b7fa29e0..13e7207f 100644 --- a/swagguard/node/client/external/get_current_key_block_parameters.go +++ b/swagguard/node/client/external/get_current_key_block_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetCurrentKeyBlockParams creates a new GetCurrentKeyBlockParams object -// with the default values initialized. +// NewGetCurrentKeyBlockParams creates a new GetCurrentKeyBlockParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetCurrentKeyBlockParams() *GetCurrentKeyBlockParams { - return &GetCurrentKeyBlockParams{ - timeout: cr.DefaultTimeout, } } // NewGetCurrentKeyBlockParamsWithTimeout creates a new GetCurrentKeyBlockParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetCurrentKeyBlockParamsWithTimeout(timeout time.Duration) *GetCurrentKeyBlockParams { - return &GetCurrentKeyBlockParams{ - timeout: timeout, } } // NewGetCurrentKeyBlockParamsWithContext creates a new GetCurrentKeyBlockParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetCurrentKeyBlockParamsWithContext(ctx context.Context) *GetCurrentKeyBlockParams { - return &GetCurrentKeyBlockParams{ - Context: ctx, } } // NewGetCurrentKeyBlockParamsWithHTTPClient creates a new GetCurrentKeyBlockParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetCurrentKeyBlockParamsWithHTTPClient(client *http.Client) *GetCurrentKeyBlockParams { - return &GetCurrentKeyBlockParams{ HTTPClient: client, } } -/*GetCurrentKeyBlockParams contains all the parameters to send to the API endpoint -for the get current key block operation typically these are written to a http.Request +/* GetCurrentKeyBlockParams contains all the parameters to send to the API endpoint + for the get current key block operation. + + Typically these are written to a http.Request. */ type GetCurrentKeyBlockParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetCurrentKeyBlockParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get current key block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockParams) WithDefaults() *GetCurrentKeyBlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get current key block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetCurrentKeyBlockParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get current key block params func (o *GetCurrentKeyBlockParams) WithTimeout(timeout time.Duration) *GetCurrentKeyBlockParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_current_key_block_responses.go b/swagguard/node/client/external/get_current_key_block_responses.go index 98ce6af4..b4bb2f4b 100644 --- a/swagguard/node/client/external/get_current_key_block_responses.go +++ b/swagguard/node/client/external/get_current_key_block_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetCurrentKeyBlockReader is a Reader for the GetCurrentKeyBlock structure. @@ -24,23 +23,20 @@ type GetCurrentKeyBlockReader struct { // ReadResponse reads a server response into the received o. func (o *GetCurrentKeyBlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetCurrentKeyBlockOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetCurrentKeyBlockNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGetCurrentKeyBlockOK() *GetCurrentKeyBlockOK { return &GetCurrentKeyBlockOK{} } -/*GetCurrentKeyBlockOK handles this case with default header values. +/* GetCurrentKeyBlockOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type GetCurrentKeyBlockOK struct { func (o *GetCurrentKeyBlockOK) Error() string { return fmt.Sprintf("[GET /key-blocks/current][%d] getCurrentKeyBlockOK %+v", 200, o.Payload) } +func (o *GetCurrentKeyBlockOK) GetPayload() *models.KeyBlock { + return o.Payload +} func (o *GetCurrentKeyBlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGetCurrentKeyBlockNotFound() *GetCurrentKeyBlockNotFound { return &GetCurrentKeyBlockNotFound{} } -/*GetCurrentKeyBlockNotFound handles this case with default header values. +/* GetCurrentKeyBlockNotFound describes a response with status code 404, with default header values. Block not found */ @@ -89,6 +88,9 @@ type GetCurrentKeyBlockNotFound struct { func (o *GetCurrentKeyBlockNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/current][%d] getCurrentKeyBlockNotFound %+v", 404, o.Payload) } +func (o *GetCurrentKeyBlockNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetCurrentKeyBlockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_generation_by_hash_parameters.go b/swagguard/node/client/external/get_generation_by_hash_parameters.go index 9e533402..01c096fc 100644 --- a/swagguard/node/client/external/get_generation_by_hash_parameters.go +++ b/swagguard/node/client/external/get_generation_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetGenerationByHashParams creates a new GetGenerationByHashParams object -// with the default values initialized. +// NewGetGenerationByHashParams creates a new GetGenerationByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetGenerationByHashParams() *GetGenerationByHashParams { - var () return &GetGenerationByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetGenerationByHashParamsWithTimeout creates a new GetGenerationByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGenerationByHashParamsWithTimeout(timeout time.Duration) *GetGenerationByHashParams { - var () return &GetGenerationByHashParams{ - timeout: timeout, } } // NewGetGenerationByHashParamsWithContext creates a new GetGenerationByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGenerationByHashParamsWithContext(ctx context.Context) *GetGenerationByHashParams { - var () return &GetGenerationByHashParams{ - Context: ctx, } } // NewGetGenerationByHashParamsWithHTTPClient creates a new GetGenerationByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGenerationByHashParamsWithHTTPClient(client *http.Client) *GetGenerationByHashParams { - var () return &GetGenerationByHashParams{ HTTPClient: client, } } -/*GetGenerationByHashParams contains all the parameters to send to the API endpoint -for the get generation by hash operation typically these are written to a http.Request +/* GetGenerationByHashParams contains all the parameters to send to the API endpoint + for the get generation by hash operation. + + Typically these are written to a http.Request. */ type GetGenerationByHashParams struct { - /*Hash - The hash of the generation + /* Hash. + The hash of the generation */ Hash string @@ -72,6 +70,21 @@ type GetGenerationByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get generation by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGenerationByHashParams) WithDefaults() *GetGenerationByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get generation by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGenerationByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get generation by hash params func (o *GetGenerationByHashParams) WithTimeout(timeout time.Duration) *GetGenerationByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_generation_by_hash_responses.go b/swagguard/node/client/external/get_generation_by_hash_responses.go index 78028a53..30ff3f61 100644 --- a/swagguard/node/client/external/get_generation_by_hash_responses.go +++ b/swagguard/node/client/external/get_generation_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetGenerationByHashReader is a Reader for the GetGenerationByHash structure. @@ -24,30 +23,26 @@ type GetGenerationByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetGenerationByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetGenerationByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetGenerationByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetGenerationByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetGenerationByHashOK() *GetGenerationByHashOK { return &GetGenerationByHashOK{} } -/*GetGenerationByHashOK handles this case with default header values. +/* GetGenerationByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetGenerationByHashOK struct { func (o *GetGenerationByHashOK) Error() string { return fmt.Sprintf("[GET /generations/hash/{hash}][%d] getGenerationByHashOK %+v", 200, o.Payload) } +func (o *GetGenerationByHashOK) GetPayload() *models.Generation { + return o.Payload +} func (o *GetGenerationByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetGenerationByHashBadRequest() *GetGenerationByHashBadRequest { return &GetGenerationByHashBadRequest{} } -/*GetGenerationByHashBadRequest handles this case with default header values. +/* GetGenerationByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetGenerationByHashBadRequest struct { func (o *GetGenerationByHashBadRequest) Error() string { return fmt.Sprintf("[GET /generations/hash/{hash}][%d] getGenerationByHashBadRequest %+v", 400, o.Payload) } +func (o *GetGenerationByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetGenerationByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetGenerationByHashNotFound() *GetGenerationByHashNotFound { return &GetGenerationByHashNotFound{} } -/*GetGenerationByHashNotFound handles this case with default header values. +/* GetGenerationByHashNotFound describes a response with status code 404, with default header values. Generation not found */ @@ -125,6 +126,9 @@ type GetGenerationByHashNotFound struct { func (o *GetGenerationByHashNotFound) Error() string { return fmt.Sprintf("[GET /generations/hash/{hash}][%d] getGenerationByHashNotFound %+v", 404, o.Payload) } +func (o *GetGenerationByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetGenerationByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_generation_by_height_parameters.go b/swagguard/node/client/external/get_generation_by_height_parameters.go index 8be8c4ed..9736ffe4 100644 --- a/swagguard/node/client/external/get_generation_by_height_parameters.go +++ b/swagguard/node/client/external/get_generation_by_height_parameters.go @@ -13,58 +13,58 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetGenerationByHeightParams creates a new GetGenerationByHeightParams object -// with the default values initialized. +// NewGetGenerationByHeightParams creates a new GetGenerationByHeightParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetGenerationByHeightParams() *GetGenerationByHeightParams { - var () return &GetGenerationByHeightParams{ - timeout: cr.DefaultTimeout, } } // NewGetGenerationByHeightParamsWithTimeout creates a new GetGenerationByHeightParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetGenerationByHeightParamsWithTimeout(timeout time.Duration) *GetGenerationByHeightParams { - var () return &GetGenerationByHeightParams{ - timeout: timeout, } } // NewGetGenerationByHeightParamsWithContext creates a new GetGenerationByHeightParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetGenerationByHeightParamsWithContext(ctx context.Context) *GetGenerationByHeightParams { - var () return &GetGenerationByHeightParams{ - Context: ctx, } } // NewGetGenerationByHeightParamsWithHTTPClient creates a new GetGenerationByHeightParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetGenerationByHeightParamsWithHTTPClient(client *http.Client) *GetGenerationByHeightParams { - var () return &GetGenerationByHeightParams{ HTTPClient: client, } } -/*GetGenerationByHeightParams contains all the parameters to send to the API endpoint -for the get generation by height operation typically these are written to a http.Request +/* GetGenerationByHeightParams contains all the parameters to send to the API endpoint + for the get generation by height operation. + + Typically these are written to a http.Request. */ type GetGenerationByHeightParams struct { - /*Height - The height + /* Height. + + The height + Format: uint64 */ Height uint64 @@ -73,6 +73,21 @@ type GetGenerationByHeightParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get generation by height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGenerationByHeightParams) WithDefaults() *GetGenerationByHeightParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get generation by height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetGenerationByHeightParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get generation by height params func (o *GetGenerationByHeightParams) WithTimeout(timeout time.Duration) *GetGenerationByHeightParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_generation_by_height_responses.go b/swagguard/node/client/external/get_generation_by_height_responses.go index 8285d718..c4ba401f 100644 --- a/swagguard/node/client/external/get_generation_by_height_responses.go +++ b/swagguard/node/client/external/get_generation_by_height_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetGenerationByHeightReader is a Reader for the GetGenerationByHeight structure. @@ -24,23 +23,20 @@ type GetGenerationByHeightReader struct { // ReadResponse reads a server response into the received o. func (o *GetGenerationByHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetGenerationByHeightOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetGenerationByHeightNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGetGenerationByHeightOK() *GetGenerationByHeightOK { return &GetGenerationByHeightOK{} } -/*GetGenerationByHeightOK handles this case with default header values. +/* GetGenerationByHeightOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type GetGenerationByHeightOK struct { func (o *GetGenerationByHeightOK) Error() string { return fmt.Sprintf("[GET /generations/height/{height}][%d] getGenerationByHeightOK %+v", 200, o.Payload) } +func (o *GetGenerationByHeightOK) GetPayload() *models.Generation { + return o.Payload +} func (o *GetGenerationByHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGetGenerationByHeightNotFound() *GetGenerationByHeightNotFound { return &GetGenerationByHeightNotFound{} } -/*GetGenerationByHeightNotFound handles this case with default header values. +/* GetGenerationByHeightNotFound describes a response with status code 404, with default header values. Generation not found */ @@ -89,6 +88,9 @@ type GetGenerationByHeightNotFound struct { func (o *GetGenerationByHeightNotFound) Error() string { return fmt.Sprintf("[GET /generations/height/{height}][%d] getGenerationByHeightNotFound %+v", 404, o.Payload) } +func (o *GetGenerationByHeightNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetGenerationByHeightNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_key_block_by_hash_parameters.go b/swagguard/node/client/external/get_key_block_by_hash_parameters.go index 8e3826bf..8f1a8abb 100644 --- a/swagguard/node/client/external/get_key_block_by_hash_parameters.go +++ b/swagguard/node/client/external/get_key_block_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetKeyBlockByHashParams creates a new GetKeyBlockByHashParams object -// with the default values initialized. +// NewGetKeyBlockByHashParams creates a new GetKeyBlockByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetKeyBlockByHashParams() *GetKeyBlockByHashParams { - var () return &GetKeyBlockByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetKeyBlockByHashParamsWithTimeout creates a new GetKeyBlockByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetKeyBlockByHashParamsWithTimeout(timeout time.Duration) *GetKeyBlockByHashParams { - var () return &GetKeyBlockByHashParams{ - timeout: timeout, } } // NewGetKeyBlockByHashParamsWithContext creates a new GetKeyBlockByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetKeyBlockByHashParamsWithContext(ctx context.Context) *GetKeyBlockByHashParams { - var () return &GetKeyBlockByHashParams{ - Context: ctx, } } // NewGetKeyBlockByHashParamsWithHTTPClient creates a new GetKeyBlockByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetKeyBlockByHashParamsWithHTTPClient(client *http.Client) *GetKeyBlockByHashParams { - var () return &GetKeyBlockByHashParams{ HTTPClient: client, } } -/*GetKeyBlockByHashParams contains all the parameters to send to the API endpoint -for the get key block by hash operation typically these are written to a http.Request +/* GetKeyBlockByHashParams contains all the parameters to send to the API endpoint + for the get key block by hash operation. + + Typically these are written to a http.Request. */ type GetKeyBlockByHashParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string @@ -72,6 +70,21 @@ type GetKeyBlockByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get key block by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetKeyBlockByHashParams) WithDefaults() *GetKeyBlockByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get key block by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetKeyBlockByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get key block by hash params func (o *GetKeyBlockByHashParams) WithTimeout(timeout time.Duration) *GetKeyBlockByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_key_block_by_hash_responses.go b/swagguard/node/client/external/get_key_block_by_hash_responses.go index fd36e957..1070e4a0 100644 --- a/swagguard/node/client/external/get_key_block_by_hash_responses.go +++ b/swagguard/node/client/external/get_key_block_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetKeyBlockByHashReader is a Reader for the GetKeyBlockByHash structure. @@ -24,30 +23,26 @@ type GetKeyBlockByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetKeyBlockByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetKeyBlockByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetKeyBlockByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetKeyBlockByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetKeyBlockByHashOK() *GetKeyBlockByHashOK { return &GetKeyBlockByHashOK{} } -/*GetKeyBlockByHashOK handles this case with default header values. +/* GetKeyBlockByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetKeyBlockByHashOK struct { func (o *GetKeyBlockByHashOK) Error() string { return fmt.Sprintf("[GET /key-blocks/hash/{hash}][%d] getKeyBlockByHashOK %+v", 200, o.Payload) } +func (o *GetKeyBlockByHashOK) GetPayload() *models.KeyBlock { + return o.Payload +} func (o *GetKeyBlockByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetKeyBlockByHashBadRequest() *GetKeyBlockByHashBadRequest { return &GetKeyBlockByHashBadRequest{} } -/*GetKeyBlockByHashBadRequest handles this case with default header values. +/* GetKeyBlockByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetKeyBlockByHashBadRequest struct { func (o *GetKeyBlockByHashBadRequest) Error() string { return fmt.Sprintf("[GET /key-blocks/hash/{hash}][%d] getKeyBlockByHashBadRequest %+v", 400, o.Payload) } +func (o *GetKeyBlockByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetKeyBlockByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetKeyBlockByHashNotFound() *GetKeyBlockByHashNotFound { return &GetKeyBlockByHashNotFound{} } -/*GetKeyBlockByHashNotFound handles this case with default header values. +/* GetKeyBlockByHashNotFound describes a response with status code 404, with default header values. Block not found */ @@ -125,6 +126,9 @@ type GetKeyBlockByHashNotFound struct { func (o *GetKeyBlockByHashNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/hash/{hash}][%d] getKeyBlockByHashNotFound %+v", 404, o.Payload) } +func (o *GetKeyBlockByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetKeyBlockByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_key_block_by_height_parameters.go b/swagguard/node/client/external/get_key_block_by_height_parameters.go index 9e0d8614..4f51e8d0 100644 --- a/swagguard/node/client/external/get_key_block_by_height_parameters.go +++ b/swagguard/node/client/external/get_key_block_by_height_parameters.go @@ -13,58 +13,58 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetKeyBlockByHeightParams creates a new GetKeyBlockByHeightParams object -// with the default values initialized. +// NewGetKeyBlockByHeightParams creates a new GetKeyBlockByHeightParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetKeyBlockByHeightParams() *GetKeyBlockByHeightParams { - var () return &GetKeyBlockByHeightParams{ - timeout: cr.DefaultTimeout, } } // NewGetKeyBlockByHeightParamsWithTimeout creates a new GetKeyBlockByHeightParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetKeyBlockByHeightParamsWithTimeout(timeout time.Duration) *GetKeyBlockByHeightParams { - var () return &GetKeyBlockByHeightParams{ - timeout: timeout, } } // NewGetKeyBlockByHeightParamsWithContext creates a new GetKeyBlockByHeightParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetKeyBlockByHeightParamsWithContext(ctx context.Context) *GetKeyBlockByHeightParams { - var () return &GetKeyBlockByHeightParams{ - Context: ctx, } } // NewGetKeyBlockByHeightParamsWithHTTPClient creates a new GetKeyBlockByHeightParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetKeyBlockByHeightParamsWithHTTPClient(client *http.Client) *GetKeyBlockByHeightParams { - var () return &GetKeyBlockByHeightParams{ HTTPClient: client, } } -/*GetKeyBlockByHeightParams contains all the parameters to send to the API endpoint -for the get key block by height operation typically these are written to a http.Request +/* GetKeyBlockByHeightParams contains all the parameters to send to the API endpoint + for the get key block by height operation. + + Typically these are written to a http.Request. */ type GetKeyBlockByHeightParams struct { - /*Height - The height + /* Height. + + The height + Format: uint64 */ Height uint64 @@ -73,6 +73,21 @@ type GetKeyBlockByHeightParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get key block by height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetKeyBlockByHeightParams) WithDefaults() *GetKeyBlockByHeightParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get key block by height params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetKeyBlockByHeightParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get key block by height params func (o *GetKeyBlockByHeightParams) WithTimeout(timeout time.Duration) *GetKeyBlockByHeightParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_key_block_by_height_responses.go b/swagguard/node/client/external/get_key_block_by_height_responses.go index 77e0f1a6..fc1f375e 100644 --- a/swagguard/node/client/external/get_key_block_by_height_responses.go +++ b/swagguard/node/client/external/get_key_block_by_height_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetKeyBlockByHeightReader is a Reader for the GetKeyBlockByHeight structure. @@ -24,23 +23,20 @@ type GetKeyBlockByHeightReader struct { // ReadResponse reads a server response into the received o. func (o *GetKeyBlockByHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetKeyBlockByHeightOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetKeyBlockByHeightNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGetKeyBlockByHeightOK() *GetKeyBlockByHeightOK { return &GetKeyBlockByHeightOK{} } -/*GetKeyBlockByHeightOK handles this case with default header values. +/* GetKeyBlockByHeightOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type GetKeyBlockByHeightOK struct { func (o *GetKeyBlockByHeightOK) Error() string { return fmt.Sprintf("[GET /key-blocks/height/{height}][%d] getKeyBlockByHeightOK %+v", 200, o.Payload) } +func (o *GetKeyBlockByHeightOK) GetPayload() *models.KeyBlock { + return o.Payload +} func (o *GetKeyBlockByHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGetKeyBlockByHeightNotFound() *GetKeyBlockByHeightNotFound { return &GetKeyBlockByHeightNotFound{} } -/*GetKeyBlockByHeightNotFound handles this case with default header values. +/* GetKeyBlockByHeightNotFound describes a response with status code 404, with default header values. Block not found */ @@ -89,6 +88,9 @@ type GetKeyBlockByHeightNotFound struct { func (o *GetKeyBlockByHeightNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/height/{height}][%d] getKeyBlockByHeightNotFound %+v", 404, o.Payload) } +func (o *GetKeyBlockByHeightNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetKeyBlockByHeightNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_micro_block_header_by_hash_parameters.go b/swagguard/node/client/external/get_micro_block_header_by_hash_parameters.go index 9fed70e2..33b0042a 100644 --- a/swagguard/node/client/external/get_micro_block_header_by_hash_parameters.go +++ b/swagguard/node/client/external/get_micro_block_header_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetMicroBlockHeaderByHashParams creates a new GetMicroBlockHeaderByHashParams object -// with the default values initialized. +// NewGetMicroBlockHeaderByHashParams creates a new GetMicroBlockHeaderByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetMicroBlockHeaderByHashParams() *GetMicroBlockHeaderByHashParams { - var () return &GetMicroBlockHeaderByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetMicroBlockHeaderByHashParamsWithTimeout creates a new GetMicroBlockHeaderByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMicroBlockHeaderByHashParamsWithTimeout(timeout time.Duration) *GetMicroBlockHeaderByHashParams { - var () return &GetMicroBlockHeaderByHashParams{ - timeout: timeout, } } // NewGetMicroBlockHeaderByHashParamsWithContext creates a new GetMicroBlockHeaderByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMicroBlockHeaderByHashParamsWithContext(ctx context.Context) *GetMicroBlockHeaderByHashParams { - var () return &GetMicroBlockHeaderByHashParams{ - Context: ctx, } } // NewGetMicroBlockHeaderByHashParamsWithHTTPClient creates a new GetMicroBlockHeaderByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMicroBlockHeaderByHashParamsWithHTTPClient(client *http.Client) *GetMicroBlockHeaderByHashParams { - var () return &GetMicroBlockHeaderByHashParams{ HTTPClient: client, } } -/*GetMicroBlockHeaderByHashParams contains all the parameters to send to the API endpoint -for the get micro block header by hash operation typically these are written to a http.Request +/* GetMicroBlockHeaderByHashParams contains all the parameters to send to the API endpoint + for the get micro block header by hash operation. + + Typically these are written to a http.Request. */ type GetMicroBlockHeaderByHashParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string @@ -72,6 +70,21 @@ type GetMicroBlockHeaderByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get micro block header by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockHeaderByHashParams) WithDefaults() *GetMicroBlockHeaderByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get micro block header by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockHeaderByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get micro block header by hash params func (o *GetMicroBlockHeaderByHashParams) WithTimeout(timeout time.Duration) *GetMicroBlockHeaderByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_micro_block_header_by_hash_responses.go b/swagguard/node/client/external/get_micro_block_header_by_hash_responses.go index bbea9b72..c3497400 100644 --- a/swagguard/node/client/external/get_micro_block_header_by_hash_responses.go +++ b/swagguard/node/client/external/get_micro_block_header_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetMicroBlockHeaderByHashReader is a Reader for the GetMicroBlockHeaderByHash structure. @@ -24,30 +23,26 @@ type GetMicroBlockHeaderByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetMicroBlockHeaderByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetMicroBlockHeaderByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetMicroBlockHeaderByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetMicroBlockHeaderByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetMicroBlockHeaderByHashOK() *GetMicroBlockHeaderByHashOK { return &GetMicroBlockHeaderByHashOK{} } -/*GetMicroBlockHeaderByHashOK handles this case with default header values. +/* GetMicroBlockHeaderByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetMicroBlockHeaderByHashOK struct { func (o *GetMicroBlockHeaderByHashOK) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/header][%d] getMicroBlockHeaderByHashOK %+v", 200, o.Payload) } +func (o *GetMicroBlockHeaderByHashOK) GetPayload() *models.MicroBlockHeader { + return o.Payload +} func (o *GetMicroBlockHeaderByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetMicroBlockHeaderByHashBadRequest() *GetMicroBlockHeaderByHashBadReque return &GetMicroBlockHeaderByHashBadRequest{} } -/*GetMicroBlockHeaderByHashBadRequest handles this case with default header values. +/* GetMicroBlockHeaderByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetMicroBlockHeaderByHashBadRequest struct { func (o *GetMicroBlockHeaderByHashBadRequest) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/header][%d] getMicroBlockHeaderByHashBadRequest %+v", 400, o.Payload) } +func (o *GetMicroBlockHeaderByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockHeaderByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetMicroBlockHeaderByHashNotFound() *GetMicroBlockHeaderByHashNotFound { return &GetMicroBlockHeaderByHashNotFound{} } -/*GetMicroBlockHeaderByHashNotFound handles this case with default header values. +/* GetMicroBlockHeaderByHashNotFound describes a response with status code 404, with default header values. Block not found */ @@ -125,6 +126,9 @@ type GetMicroBlockHeaderByHashNotFound struct { func (o *GetMicroBlockHeaderByHashNotFound) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/header][%d] getMicroBlockHeaderByHashNotFound %+v", 404, o.Payload) } +func (o *GetMicroBlockHeaderByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockHeaderByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_parameters.go b/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_parameters.go index 28ef5d3b..c10ac5cf 100644 --- a/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_parameters.go +++ b/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_parameters.go @@ -13,71 +13,87 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetMicroBlockTransactionByHashAndIndexParams creates a new GetMicroBlockTransactionByHashAndIndexParams object -// with the default values initialized. +// NewGetMicroBlockTransactionByHashAndIndexParams creates a new GetMicroBlockTransactionByHashAndIndexParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetMicroBlockTransactionByHashAndIndexParams() *GetMicroBlockTransactionByHashAndIndexParams { - var () return &GetMicroBlockTransactionByHashAndIndexParams{ - timeout: cr.DefaultTimeout, } } // NewGetMicroBlockTransactionByHashAndIndexParamsWithTimeout creates a new GetMicroBlockTransactionByHashAndIndexParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMicroBlockTransactionByHashAndIndexParamsWithTimeout(timeout time.Duration) *GetMicroBlockTransactionByHashAndIndexParams { - var () return &GetMicroBlockTransactionByHashAndIndexParams{ - timeout: timeout, } } // NewGetMicroBlockTransactionByHashAndIndexParamsWithContext creates a new GetMicroBlockTransactionByHashAndIndexParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMicroBlockTransactionByHashAndIndexParamsWithContext(ctx context.Context) *GetMicroBlockTransactionByHashAndIndexParams { - var () return &GetMicroBlockTransactionByHashAndIndexParams{ - Context: ctx, } } // NewGetMicroBlockTransactionByHashAndIndexParamsWithHTTPClient creates a new GetMicroBlockTransactionByHashAndIndexParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMicroBlockTransactionByHashAndIndexParamsWithHTTPClient(client *http.Client) *GetMicroBlockTransactionByHashAndIndexParams { - var () return &GetMicroBlockTransactionByHashAndIndexParams{ HTTPClient: client, } } -/*GetMicroBlockTransactionByHashAndIndexParams contains all the parameters to send to the API endpoint -for the get micro block transaction by hash and index operation typically these are written to a http.Request +/* GetMicroBlockTransactionByHashAndIndexParams contains all the parameters to send to the API endpoint + for the get micro block transaction by hash and index operation. + + Typically these are written to a http.Request. */ type GetMicroBlockTransactionByHashAndIndexParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string - /*Index - The index of the transaction in a block + /* Index. + + The index of the transaction in a block + + Format: uint64 */ - Index int64 + Index uint64 timeout time.Duration Context context.Context HTTPClient *http.Client } +// WithDefaults hydrates default values in the get micro block transaction by hash and index params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionByHashAndIndexParams) WithDefaults() *GetMicroBlockTransactionByHashAndIndexParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get micro block transaction by hash and index params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionByHashAndIndexParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get micro block transaction by hash and index params func (o *GetMicroBlockTransactionByHashAndIndexParams) WithTimeout(timeout time.Duration) *GetMicroBlockTransactionByHashAndIndexParams { o.SetTimeout(timeout) @@ -123,13 +139,13 @@ func (o *GetMicroBlockTransactionByHashAndIndexParams) SetHash(hash string) { } // WithIndex adds the index to the get micro block transaction by hash and index params -func (o *GetMicroBlockTransactionByHashAndIndexParams) WithIndex(index int64) *GetMicroBlockTransactionByHashAndIndexParams { +func (o *GetMicroBlockTransactionByHashAndIndexParams) WithIndex(index uint64) *GetMicroBlockTransactionByHashAndIndexParams { o.SetIndex(index) return o } // SetIndex adds the index to the get micro block transaction by hash and index params -func (o *GetMicroBlockTransactionByHashAndIndexParams) SetIndex(index int64) { +func (o *GetMicroBlockTransactionByHashAndIndexParams) SetIndex(index uint64) { o.Index = index } @@ -147,7 +163,7 @@ func (o *GetMicroBlockTransactionByHashAndIndexParams) WriteToRequest(r runtime. } // path param index - if err := r.SetPathParam("index", swag.FormatInt64(o.Index)); err != nil { + if err := r.SetPathParam("index", swag.FormatUint64(o.Index)); err != nil { return err } diff --git a/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_responses.go b/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_responses.go index 60619eb9..be450218 100644 --- a/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_responses.go +++ b/swagguard/node/client/external/get_micro_block_transaction_by_hash_and_index_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetMicroBlockTransactionByHashAndIndexReader is a Reader for the GetMicroBlockTransactionByHashAndIndex structure. @@ -24,30 +23,26 @@ type GetMicroBlockTransactionByHashAndIndexReader struct { // ReadResponse reads a server response into the received o. func (o *GetMicroBlockTransactionByHashAndIndexReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetMicroBlockTransactionByHashAndIndexOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetMicroBlockTransactionByHashAndIndexBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetMicroBlockTransactionByHashAndIndexNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetMicroBlockTransactionByHashAndIndexOK() *GetMicroBlockTransactionByHa return &GetMicroBlockTransactionByHashAndIndexOK{} } -/*GetMicroBlockTransactionByHashAndIndexOK handles this case with default header values. +/* GetMicroBlockTransactionByHashAndIndexOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetMicroBlockTransactionByHashAndIndexOK struct { func (o *GetMicroBlockTransactionByHashAndIndexOK) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/index/{index}][%d] getMicroBlockTransactionByHashAndIndexOK %+v", 200, o.Payload) } +func (o *GetMicroBlockTransactionByHashAndIndexOK) GetPayload() *models.GenericSignedTx { + return o.Payload +} func (o *GetMicroBlockTransactionByHashAndIndexOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetMicroBlockTransactionByHashAndIndexBadRequest() *GetMicroBlockTransac return &GetMicroBlockTransactionByHashAndIndexBadRequest{} } -/*GetMicroBlockTransactionByHashAndIndexBadRequest handles this case with default header values. +/* GetMicroBlockTransactionByHashAndIndexBadRequest describes a response with status code 400, with default header values. Invalid hash or index */ @@ -96,6 +94,9 @@ type GetMicroBlockTransactionByHashAndIndexBadRequest struct { func (o *GetMicroBlockTransactionByHashAndIndexBadRequest) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/index/{index}][%d] getMicroBlockTransactionByHashAndIndexBadRequest %+v", 400, o.Payload) } +func (o *GetMicroBlockTransactionByHashAndIndexBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionByHashAndIndexBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetMicroBlockTransactionByHashAndIndexNotFound() *GetMicroBlockTransacti return &GetMicroBlockTransactionByHashAndIndexNotFound{} } -/*GetMicroBlockTransactionByHashAndIndexNotFound handles this case with default header values. +/* GetMicroBlockTransactionByHashAndIndexNotFound describes a response with status code 404, with default header values. Block not found */ @@ -125,6 +126,9 @@ type GetMicroBlockTransactionByHashAndIndexNotFound struct { func (o *GetMicroBlockTransactionByHashAndIndexNotFound) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/index/{index}][%d] getMicroBlockTransactionByHashAndIndexNotFound %+v", 404, o.Payload) } +func (o *GetMicroBlockTransactionByHashAndIndexNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionByHashAndIndexNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_micro_block_transactions_by_hash_parameters.go b/swagguard/node/client/external/get_micro_block_transactions_by_hash_parameters.go index 12b637e7..0a02b690 100644 --- a/swagguard/node/client/external/get_micro_block_transactions_by_hash_parameters.go +++ b/swagguard/node/client/external/get_micro_block_transactions_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetMicroBlockTransactionsByHashParams creates a new GetMicroBlockTransactionsByHashParams object -// with the default values initialized. +// NewGetMicroBlockTransactionsByHashParams creates a new GetMicroBlockTransactionsByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetMicroBlockTransactionsByHashParams() *GetMicroBlockTransactionsByHashParams { - var () return &GetMicroBlockTransactionsByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetMicroBlockTransactionsByHashParamsWithTimeout creates a new GetMicroBlockTransactionsByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMicroBlockTransactionsByHashParamsWithTimeout(timeout time.Duration) *GetMicroBlockTransactionsByHashParams { - var () return &GetMicroBlockTransactionsByHashParams{ - timeout: timeout, } } // NewGetMicroBlockTransactionsByHashParamsWithContext creates a new GetMicroBlockTransactionsByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMicroBlockTransactionsByHashParamsWithContext(ctx context.Context) *GetMicroBlockTransactionsByHashParams { - var () return &GetMicroBlockTransactionsByHashParams{ - Context: ctx, } } // NewGetMicroBlockTransactionsByHashParamsWithHTTPClient creates a new GetMicroBlockTransactionsByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMicroBlockTransactionsByHashParamsWithHTTPClient(client *http.Client) *GetMicroBlockTransactionsByHashParams { - var () return &GetMicroBlockTransactionsByHashParams{ HTTPClient: client, } } -/*GetMicroBlockTransactionsByHashParams contains all the parameters to send to the API endpoint -for the get micro block transactions by hash operation typically these are written to a http.Request +/* GetMicroBlockTransactionsByHashParams contains all the parameters to send to the API endpoint + for the get micro block transactions by hash operation. + + Typically these are written to a http.Request. */ type GetMicroBlockTransactionsByHashParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string @@ -72,6 +70,21 @@ type GetMicroBlockTransactionsByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get micro block transactions by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionsByHashParams) WithDefaults() *GetMicroBlockTransactionsByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get micro block transactions by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionsByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get micro block transactions by hash params func (o *GetMicroBlockTransactionsByHashParams) WithTimeout(timeout time.Duration) *GetMicroBlockTransactionsByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_micro_block_transactions_by_hash_responses.go b/swagguard/node/client/external/get_micro_block_transactions_by_hash_responses.go index 871214a1..e5cd831c 100644 --- a/swagguard/node/client/external/get_micro_block_transactions_by_hash_responses.go +++ b/swagguard/node/client/external/get_micro_block_transactions_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetMicroBlockTransactionsByHashReader is a Reader for the GetMicroBlockTransactionsByHash structure. @@ -24,30 +23,26 @@ type GetMicroBlockTransactionsByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetMicroBlockTransactionsByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetMicroBlockTransactionsByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetMicroBlockTransactionsByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetMicroBlockTransactionsByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetMicroBlockTransactionsByHashOK() *GetMicroBlockTransactionsByHashOK { return &GetMicroBlockTransactionsByHashOK{} } -/*GetMicroBlockTransactionsByHashOK handles this case with default header values. +/* GetMicroBlockTransactionsByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetMicroBlockTransactionsByHashOK struct { func (o *GetMicroBlockTransactionsByHashOK) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions][%d] getMicroBlockTransactionsByHashOK %+v", 200, o.Payload) } +func (o *GetMicroBlockTransactionsByHashOK) GetPayload() *models.GenericTxs { + return o.Payload +} func (o *GetMicroBlockTransactionsByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetMicroBlockTransactionsByHashBadRequest() *GetMicroBlockTransactionsBy return &GetMicroBlockTransactionsByHashBadRequest{} } -/*GetMicroBlockTransactionsByHashBadRequest handles this case with default header values. +/* GetMicroBlockTransactionsByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetMicroBlockTransactionsByHashBadRequest struct { func (o *GetMicroBlockTransactionsByHashBadRequest) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions][%d] getMicroBlockTransactionsByHashBadRequest %+v", 400, o.Payload) } +func (o *GetMicroBlockTransactionsByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionsByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetMicroBlockTransactionsByHashNotFound() *GetMicroBlockTransactionsByHa return &GetMicroBlockTransactionsByHashNotFound{} } -/*GetMicroBlockTransactionsByHashNotFound handles this case with default header values. +/* GetMicroBlockTransactionsByHashNotFound describes a response with status code 404, with default header values. Block not found */ @@ -125,6 +126,9 @@ type GetMicroBlockTransactionsByHashNotFound struct { func (o *GetMicroBlockTransactionsByHashNotFound) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions][%d] getMicroBlockTransactionsByHashNotFound %+v", 404, o.Payload) } +func (o *GetMicroBlockTransactionsByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionsByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_parameters.go b/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_parameters.go index 6df5c6f9..787f1c6c 100644 --- a/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_parameters.go +++ b/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetMicroBlockTransactionsCountByHashParams creates a new GetMicroBlockTransactionsCountByHashParams object -// with the default values initialized. +// NewGetMicroBlockTransactionsCountByHashParams creates a new GetMicroBlockTransactionsCountByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetMicroBlockTransactionsCountByHashParams() *GetMicroBlockTransactionsCountByHashParams { - var () return &GetMicroBlockTransactionsCountByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetMicroBlockTransactionsCountByHashParamsWithTimeout creates a new GetMicroBlockTransactionsCountByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetMicroBlockTransactionsCountByHashParamsWithTimeout(timeout time.Duration) *GetMicroBlockTransactionsCountByHashParams { - var () return &GetMicroBlockTransactionsCountByHashParams{ - timeout: timeout, } } // NewGetMicroBlockTransactionsCountByHashParamsWithContext creates a new GetMicroBlockTransactionsCountByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetMicroBlockTransactionsCountByHashParamsWithContext(ctx context.Context) *GetMicroBlockTransactionsCountByHashParams { - var () return &GetMicroBlockTransactionsCountByHashParams{ - Context: ctx, } } // NewGetMicroBlockTransactionsCountByHashParamsWithHTTPClient creates a new GetMicroBlockTransactionsCountByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetMicroBlockTransactionsCountByHashParamsWithHTTPClient(client *http.Client) *GetMicroBlockTransactionsCountByHashParams { - var () return &GetMicroBlockTransactionsCountByHashParams{ HTTPClient: client, } } -/*GetMicroBlockTransactionsCountByHashParams contains all the parameters to send to the API endpoint -for the get micro block transactions count by hash operation typically these are written to a http.Request +/* GetMicroBlockTransactionsCountByHashParams contains all the parameters to send to the API endpoint + for the get micro block transactions count by hash operation. + + Typically these are written to a http.Request. */ type GetMicroBlockTransactionsCountByHashParams struct { - /*Hash - The hash of the block + /* Hash. + The hash of the block */ Hash string @@ -72,6 +70,21 @@ type GetMicroBlockTransactionsCountByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get micro block transactions count by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionsCountByHashParams) WithDefaults() *GetMicroBlockTransactionsCountByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get micro block transactions count by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetMicroBlockTransactionsCountByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get micro block transactions count by hash params func (o *GetMicroBlockTransactionsCountByHashParams) WithTimeout(timeout time.Duration) *GetMicroBlockTransactionsCountByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_responses.go b/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_responses.go index dda86c01..a6857e93 100644 --- a/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_responses.go +++ b/swagguard/node/client/external/get_micro_block_transactions_count_by_hash_responses.go @@ -6,15 +6,15 @@ package external // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "fmt" "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetMicroBlockTransactionsCountByHashReader is a Reader for the GetMicroBlockTransactionsCountByHash structure. @@ -25,30 +25,26 @@ type GetMicroBlockTransactionsCountByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetMicroBlockTransactionsCountByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetMicroBlockTransactionsCountByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetMicroBlockTransactionsCountByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetMicroBlockTransactionsCountByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -57,7 +53,7 @@ func NewGetMicroBlockTransactionsCountByHashOK() *GetMicroBlockTransactionsCount return &GetMicroBlockTransactionsCountByHashOK{} } -/*GetMicroBlockTransactionsCountByHashOK handles this case with default header values. +/* GetMicroBlockTransactionsCountByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -68,6 +64,9 @@ type GetMicroBlockTransactionsCountByHashOK struct { func (o *GetMicroBlockTransactionsCountByHashOK) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/count][%d] getMicroBlockTransactionsCountByHashOK %+v", 200, o.Payload) } +func (o *GetMicroBlockTransactionsCountByHashOK) GetPayload() *GetMicroBlockTransactionsCountByHashOKBody { + return o.Payload +} func (o *GetMicroBlockTransactionsCountByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -86,7 +85,7 @@ func NewGetMicroBlockTransactionsCountByHashBadRequest() *GetMicroBlockTransacti return &GetMicroBlockTransactionsCountByHashBadRequest{} } -/*GetMicroBlockTransactionsCountByHashBadRequest handles this case with default header values. +/* GetMicroBlockTransactionsCountByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -97,6 +96,9 @@ type GetMicroBlockTransactionsCountByHashBadRequest struct { func (o *GetMicroBlockTransactionsCountByHashBadRequest) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/count][%d] getMicroBlockTransactionsCountByHashBadRequest %+v", 400, o.Payload) } +func (o *GetMicroBlockTransactionsCountByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionsCountByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -115,7 +117,7 @@ func NewGetMicroBlockTransactionsCountByHashNotFound() *GetMicroBlockTransaction return &GetMicroBlockTransactionsCountByHashNotFound{} } -/*GetMicroBlockTransactionsCountByHashNotFound handles this case with default header values. +/* GetMicroBlockTransactionsCountByHashNotFound describes a response with status code 404, with default header values. Block not found */ @@ -126,6 +128,9 @@ type GetMicroBlockTransactionsCountByHashNotFound struct { func (o *GetMicroBlockTransactionsCountByHashNotFound) Error() string { return fmt.Sprintf("[GET /micro-blocks/hash/{hash}/transactions/count][%d] getMicroBlockTransactionsCountByHashNotFound %+v", 404, o.Payload) } +func (o *GetMicroBlockTransactionsCountByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetMicroBlockTransactionsCountByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -153,6 +158,11 @@ func (o *GetMicroBlockTransactionsCountByHashOKBody) Validate(formats strfmt.Reg return nil } +// ContextValidate validates this get micro block transactions count by hash o k body based on context it is used +func (o *GetMicroBlockTransactionsCountByHashOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (o *GetMicroBlockTransactionsCountByHashOKBody) MarshalBinary() ([]byte, error) { if o == nil { diff --git a/swagguard/node/client/external/get_name_entry_by_name_parameters.go b/swagguard/node/client/external/get_name_entry_by_name_parameters.go index 51e87bdc..7d0b6de6 100644 --- a/swagguard/node/client/external/get_name_entry_by_name_parameters.go +++ b/swagguard/node/client/external/get_name_entry_by_name_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetNameEntryByNameParams creates a new GetNameEntryByNameParams object -// with the default values initialized. +// NewGetNameEntryByNameParams creates a new GetNameEntryByNameParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetNameEntryByNameParams() *GetNameEntryByNameParams { - var () return &GetNameEntryByNameParams{ - timeout: cr.DefaultTimeout, } } // NewGetNameEntryByNameParamsWithTimeout creates a new GetNameEntryByNameParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetNameEntryByNameParamsWithTimeout(timeout time.Duration) *GetNameEntryByNameParams { - var () return &GetNameEntryByNameParams{ - timeout: timeout, } } // NewGetNameEntryByNameParamsWithContext creates a new GetNameEntryByNameParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetNameEntryByNameParamsWithContext(ctx context.Context) *GetNameEntryByNameParams { - var () return &GetNameEntryByNameParams{ - Context: ctx, } } // NewGetNameEntryByNameParamsWithHTTPClient creates a new GetNameEntryByNameParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetNameEntryByNameParamsWithHTTPClient(client *http.Client) *GetNameEntryByNameParams { - var () return &GetNameEntryByNameParams{ HTTPClient: client, } } -/*GetNameEntryByNameParams contains all the parameters to send to the API endpoint -for the get name entry by name operation typically these are written to a http.Request +/* GetNameEntryByNameParams contains all the parameters to send to the API endpoint + for the get name entry by name operation. + + Typically these are written to a http.Request. */ type GetNameEntryByNameParams struct { - /*Name - The name key of the name entry + /* Name. + The name key of the name entry */ Name string @@ -72,6 +70,21 @@ type GetNameEntryByNameParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get name entry by name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNameEntryByNameParams) WithDefaults() *GetNameEntryByNameParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get name entry by name params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetNameEntryByNameParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get name entry by name params func (o *GetNameEntryByNameParams) WithTimeout(timeout time.Duration) *GetNameEntryByNameParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_name_entry_by_name_responses.go b/swagguard/node/client/external/get_name_entry_by_name_responses.go index 2ab347f7..46099b1b 100644 --- a/swagguard/node/client/external/get_name_entry_by_name_responses.go +++ b/swagguard/node/client/external/get_name_entry_by_name_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetNameEntryByNameReader is a Reader for the GetNameEntryByName structure. @@ -24,30 +23,26 @@ type GetNameEntryByNameReader struct { // ReadResponse reads a server response into the received o. func (o *GetNameEntryByNameReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetNameEntryByNameOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetNameEntryByNameBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetNameEntryByNameNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetNameEntryByNameOK() *GetNameEntryByNameOK { return &GetNameEntryByNameOK{} } -/*GetNameEntryByNameOK handles this case with default header values. +/* GetNameEntryByNameOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetNameEntryByNameOK struct { func (o *GetNameEntryByNameOK) Error() string { return fmt.Sprintf("[GET /names/{name}][%d] getNameEntryByNameOK %+v", 200, o.Payload) } +func (o *GetNameEntryByNameOK) GetPayload() *models.NameEntry { + return o.Payload +} func (o *GetNameEntryByNameOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetNameEntryByNameBadRequest() *GetNameEntryByNameBadRequest { return &GetNameEntryByNameBadRequest{} } -/*GetNameEntryByNameBadRequest handles this case with default header values. +/* GetNameEntryByNameBadRequest describes a response with status code 400, with default header values. Invalid name */ @@ -96,6 +94,9 @@ type GetNameEntryByNameBadRequest struct { func (o *GetNameEntryByNameBadRequest) Error() string { return fmt.Sprintf("[GET /names/{name}][%d] getNameEntryByNameBadRequest %+v", 400, o.Payload) } +func (o *GetNameEntryByNameBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetNameEntryByNameBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetNameEntryByNameNotFound() *GetNameEntryByNameNotFound { return &GetNameEntryByNameNotFound{} } -/*GetNameEntryByNameNotFound handles this case with default header values. +/* GetNameEntryByNameNotFound describes a response with status code 404, with default header values. Name not found */ @@ -125,6 +126,9 @@ type GetNameEntryByNameNotFound struct { func (o *GetNameEntryByNameNotFound) Error() string { return fmt.Sprintf("[GET /names/{name}][%d] getNameEntryByNameNotFound %+v", 404, o.Payload) } +func (o *GetNameEntryByNameNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetNameEntryByNameNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_oracle_by_pubkey_parameters.go b/swagguard/node/client/external/get_oracle_by_pubkey_parameters.go index 3479c809..4319f934 100644 --- a/swagguard/node/client/external/get_oracle_by_pubkey_parameters.go +++ b/swagguard/node/client/external/get_oracle_by_pubkey_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetOracleByPubkeyParams creates a new GetOracleByPubkeyParams object -// with the default values initialized. +// NewGetOracleByPubkeyParams creates a new GetOracleByPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetOracleByPubkeyParams() *GetOracleByPubkeyParams { - var () return &GetOracleByPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetOracleByPubkeyParamsWithTimeout creates a new GetOracleByPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetOracleByPubkeyParamsWithTimeout(timeout time.Duration) *GetOracleByPubkeyParams { - var () return &GetOracleByPubkeyParams{ - timeout: timeout, } } // NewGetOracleByPubkeyParamsWithContext creates a new GetOracleByPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetOracleByPubkeyParamsWithContext(ctx context.Context) *GetOracleByPubkeyParams { - var () return &GetOracleByPubkeyParams{ - Context: ctx, } } // NewGetOracleByPubkeyParamsWithHTTPClient creates a new GetOracleByPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetOracleByPubkeyParamsWithHTTPClient(client *http.Client) *GetOracleByPubkeyParams { - var () return &GetOracleByPubkeyParams{ HTTPClient: client, } } -/*GetOracleByPubkeyParams contains all the parameters to send to the API endpoint -for the get oracle by pubkey operation typically these are written to a http.Request +/* GetOracleByPubkeyParams contains all the parameters to send to the API endpoint + for the get oracle by pubkey operation. + + Typically these are written to a http.Request. */ type GetOracleByPubkeyParams struct { - /*Pubkey - The public key of the oracle + /* Pubkey. + The public key of the oracle */ Pubkey string @@ -72,6 +70,21 @@ type GetOracleByPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get oracle by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleByPubkeyParams) WithDefaults() *GetOracleByPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get oracle by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleByPubkeyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get oracle by pubkey params func (o *GetOracleByPubkeyParams) WithTimeout(timeout time.Duration) *GetOracleByPubkeyParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_oracle_by_pubkey_responses.go b/swagguard/node/client/external/get_oracle_by_pubkey_responses.go index 0f5f6f96..de097b3b 100644 --- a/swagguard/node/client/external/get_oracle_by_pubkey_responses.go +++ b/swagguard/node/client/external/get_oracle_by_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetOracleByPubkeyReader is a Reader for the GetOracleByPubkey structure. @@ -24,30 +23,26 @@ type GetOracleByPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetOracleByPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetOracleByPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetOracleByPubkeyBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetOracleByPubkeyNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetOracleByPubkeyOK() *GetOracleByPubkeyOK { return &GetOracleByPubkeyOK{} } -/*GetOracleByPubkeyOK handles this case with default header values. +/* GetOracleByPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetOracleByPubkeyOK struct { func (o *GetOracleByPubkeyOK) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}][%d] getOracleByPubkeyOK %+v", 200, o.Payload) } +func (o *GetOracleByPubkeyOK) GetPayload() *models.RegisteredOracle { + return o.Payload +} func (o *GetOracleByPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetOracleByPubkeyBadRequest() *GetOracleByPubkeyBadRequest { return &GetOracleByPubkeyBadRequest{} } -/*GetOracleByPubkeyBadRequest handles this case with default header values. +/* GetOracleByPubkeyBadRequest describes a response with status code 400, with default header values. Invalid public key */ @@ -96,6 +94,9 @@ type GetOracleByPubkeyBadRequest struct { func (o *GetOracleByPubkeyBadRequest) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}][%d] getOracleByPubkeyBadRequest %+v", 400, o.Payload) } +func (o *GetOracleByPubkeyBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleByPubkeyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetOracleByPubkeyNotFound() *GetOracleByPubkeyNotFound { return &GetOracleByPubkeyNotFound{} } -/*GetOracleByPubkeyNotFound handles this case with default header values. +/* GetOracleByPubkeyNotFound describes a response with status code 404, with default header values. Oracle not found */ @@ -125,6 +126,9 @@ type GetOracleByPubkeyNotFound struct { func (o *GetOracleByPubkeyNotFound) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}][%d] getOracleByPubkeyNotFound %+v", 404, o.Payload) } +func (o *GetOracleByPubkeyNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleByPubkeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_oracle_queries_by_pubkey_parameters.go b/swagguard/node/client/external/get_oracle_queries_by_pubkey_parameters.go index a753442b..766aa785 100644 --- a/swagguard/node/client/external/get_oracle_queries_by_pubkey_parameters.go +++ b/swagguard/node/client/external/get_oracle_queries_by_pubkey_parameters.go @@ -13,73 +13,79 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) -// NewGetOracleQueriesByPubkeyParams creates a new GetOracleQueriesByPubkeyParams object -// with the default values initialized. +// NewGetOracleQueriesByPubkeyParams creates a new GetOracleQueriesByPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetOracleQueriesByPubkeyParams() *GetOracleQueriesByPubkeyParams { - var () return &GetOracleQueriesByPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetOracleQueriesByPubkeyParamsWithTimeout creates a new GetOracleQueriesByPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetOracleQueriesByPubkeyParamsWithTimeout(timeout time.Duration) *GetOracleQueriesByPubkeyParams { - var () return &GetOracleQueriesByPubkeyParams{ - timeout: timeout, } } // NewGetOracleQueriesByPubkeyParamsWithContext creates a new GetOracleQueriesByPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetOracleQueriesByPubkeyParamsWithContext(ctx context.Context) *GetOracleQueriesByPubkeyParams { - var () return &GetOracleQueriesByPubkeyParams{ - Context: ctx, } } // NewGetOracleQueriesByPubkeyParamsWithHTTPClient creates a new GetOracleQueriesByPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetOracleQueriesByPubkeyParamsWithHTTPClient(client *http.Client) *GetOracleQueriesByPubkeyParams { - var () return &GetOracleQueriesByPubkeyParams{ HTTPClient: client, } } -/*GetOracleQueriesByPubkeyParams contains all the parameters to send to the API endpoint -for the get oracle queries by pubkey operation typically these are written to a http.Request +/* GetOracleQueriesByPubkeyParams contains all the parameters to send to the API endpoint + for the get oracle queries by pubkey operation. + + Typically these are written to a http.Request. */ type GetOracleQueriesByPubkeyParams struct { - /*From - Last query id in previous page + /* From. + Last query id in previous page */ From *string - /*Limit - Max number of oracle queries + /* Limit. + + Max number of oracle queries + + Format: uint64 + Default: 20 */ - Limit *int64 - /*Pubkey - The public key of the oracle + Limit *uint64 + /* Pubkey. + + The public key of the oracle */ Pubkey string - /*Type - The type of a query: open, closed or all + /* Type. + + The type of a query: open, closed or all + + Default: "all" */ Type *string @@ -88,6 +94,35 @@ type GetOracleQueriesByPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get oracle queries by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleQueriesByPubkeyParams) WithDefaults() *GetOracleQueriesByPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get oracle queries by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleQueriesByPubkeyParams) SetDefaults() { + var ( + limitDefault = uint64(20) + + typeVarDefault = string("all") + ) + + val := GetOracleQueriesByPubkeyParams{ + Limit: &limitDefault, + Type: &typeVarDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + // WithTimeout adds the timeout to the get oracle queries by pubkey params func (o *GetOracleQueriesByPubkeyParams) WithTimeout(timeout time.Duration) *GetOracleQueriesByPubkeyParams { o.SetTimeout(timeout) @@ -133,13 +168,13 @@ func (o *GetOracleQueriesByPubkeyParams) SetFrom(from *string) { } // WithLimit adds the limit to the get oracle queries by pubkey params -func (o *GetOracleQueriesByPubkeyParams) WithLimit(limit *int64) *GetOracleQueriesByPubkeyParams { +func (o *GetOracleQueriesByPubkeyParams) WithLimit(limit *uint64) *GetOracleQueriesByPubkeyParams { o.SetLimit(limit) return o } // SetLimit adds the limit to the get oracle queries by pubkey params -func (o *GetOracleQueriesByPubkeyParams) SetLimit(limit *int64) { +func (o *GetOracleQueriesByPubkeyParams) SetLimit(limit *uint64) { o.Limit = limit } @@ -177,32 +212,34 @@ func (o *GetOracleQueriesByPubkeyParams) WriteToRequest(r runtime.ClientRequest, // query param from var qrFrom string + if o.From != nil { qrFrom = *o.From } qFrom := qrFrom if qFrom != "" { + if err := r.SetQueryParam("from", qFrom); err != nil { return err } } - } if o.Limit != nil { // query param limit - var qrLimit int64 + var qrLimit uint64 + if o.Limit != nil { qrLimit = *o.Limit } - qLimit := swag.FormatInt64(qrLimit) + qLimit := swag.FormatUint64(qrLimit) if qLimit != "" { + if err := r.SetQueryParam("limit", qLimit); err != nil { return err } } - } // path param pubkey @@ -214,16 +251,17 @@ func (o *GetOracleQueriesByPubkeyParams) WriteToRequest(r runtime.ClientRequest, // query param type var qrType string + if o.Type != nil { qrType = *o.Type } qType := qrType if qType != "" { + if err := r.SetQueryParam("type", qType); err != nil { return err } } - } if len(res) > 0 { diff --git a/swagguard/node/client/external/get_oracle_queries_by_pubkey_responses.go b/swagguard/node/client/external/get_oracle_queries_by_pubkey_responses.go index 84d4c841..38f2133c 100644 --- a/swagguard/node/client/external/get_oracle_queries_by_pubkey_responses.go +++ b/swagguard/node/client/external/get_oracle_queries_by_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetOracleQueriesByPubkeyReader is a Reader for the GetOracleQueriesByPubkey structure. @@ -24,30 +23,26 @@ type GetOracleQueriesByPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetOracleQueriesByPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetOracleQueriesByPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetOracleQueriesByPubkeyBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetOracleQueriesByPubkeyNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetOracleQueriesByPubkeyOK() *GetOracleQueriesByPubkeyOK { return &GetOracleQueriesByPubkeyOK{} } -/*GetOracleQueriesByPubkeyOK handles this case with default header values. +/* GetOracleQueriesByPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetOracleQueriesByPubkeyOK struct { func (o *GetOracleQueriesByPubkeyOK) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries][%d] getOracleQueriesByPubkeyOK %+v", 200, o.Payload) } +func (o *GetOracleQueriesByPubkeyOK) GetPayload() *models.OracleQueries { + return o.Payload +} func (o *GetOracleQueriesByPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetOracleQueriesByPubkeyBadRequest() *GetOracleQueriesByPubkeyBadRequest return &GetOracleQueriesByPubkeyBadRequest{} } -/*GetOracleQueriesByPubkeyBadRequest handles this case with default header values. +/* GetOracleQueriesByPubkeyBadRequest describes a response with status code 400, with default header values. Invalid public key */ @@ -96,6 +94,9 @@ type GetOracleQueriesByPubkeyBadRequest struct { func (o *GetOracleQueriesByPubkeyBadRequest) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries][%d] getOracleQueriesByPubkeyBadRequest %+v", 400, o.Payload) } +func (o *GetOracleQueriesByPubkeyBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleQueriesByPubkeyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetOracleQueriesByPubkeyNotFound() *GetOracleQueriesByPubkeyNotFound { return &GetOracleQueriesByPubkeyNotFound{} } -/*GetOracleQueriesByPubkeyNotFound handles this case with default header values. +/* GetOracleQueriesByPubkeyNotFound describes a response with status code 404, with default header values. Oracle not found */ @@ -125,6 +126,9 @@ type GetOracleQueriesByPubkeyNotFound struct { func (o *GetOracleQueriesByPubkeyNotFound) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries][%d] getOracleQueriesByPubkeyNotFound %+v", 404, o.Payload) } +func (o *GetOracleQueriesByPubkeyNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleQueriesByPubkeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_parameters.go b/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_parameters.go index 46f099b6..4192d96e 100644 --- a/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_parameters.go +++ b/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_parameters.go @@ -13,62 +13,61 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetOracleQueryByPubkeyAndQueryIDParams creates a new GetOracleQueryByPubkeyAndQueryIDParams object -// with the default values initialized. +// NewGetOracleQueryByPubkeyAndQueryIDParams creates a new GetOracleQueryByPubkeyAndQueryIDParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetOracleQueryByPubkeyAndQueryIDParams() *GetOracleQueryByPubkeyAndQueryIDParams { - var () return &GetOracleQueryByPubkeyAndQueryIDParams{ - timeout: cr.DefaultTimeout, } } // NewGetOracleQueryByPubkeyAndQueryIDParamsWithTimeout creates a new GetOracleQueryByPubkeyAndQueryIDParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetOracleQueryByPubkeyAndQueryIDParamsWithTimeout(timeout time.Duration) *GetOracleQueryByPubkeyAndQueryIDParams { - var () return &GetOracleQueryByPubkeyAndQueryIDParams{ - timeout: timeout, } } // NewGetOracleQueryByPubkeyAndQueryIDParamsWithContext creates a new GetOracleQueryByPubkeyAndQueryIDParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetOracleQueryByPubkeyAndQueryIDParamsWithContext(ctx context.Context) *GetOracleQueryByPubkeyAndQueryIDParams { - var () return &GetOracleQueryByPubkeyAndQueryIDParams{ - Context: ctx, } } // NewGetOracleQueryByPubkeyAndQueryIDParamsWithHTTPClient creates a new GetOracleQueryByPubkeyAndQueryIDParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetOracleQueryByPubkeyAndQueryIDParamsWithHTTPClient(client *http.Client) *GetOracleQueryByPubkeyAndQueryIDParams { - var () return &GetOracleQueryByPubkeyAndQueryIDParams{ HTTPClient: client, } } -/*GetOracleQueryByPubkeyAndQueryIDParams contains all the parameters to send to the API endpoint -for the get oracle query by pubkey and query Id operation typically these are written to a http.Request +/* GetOracleQueryByPubkeyAndQueryIDParams contains all the parameters to send to the API endpoint + for the get oracle query by pubkey and query Id operation. + + Typically these are written to a http.Request. */ type GetOracleQueryByPubkeyAndQueryIDParams struct { - /*Pubkey - The public key of the oracle + /* Pubkey. + The public key of the oracle */ Pubkey string - /*QueryID - The ID of the query + /* QueryID. + + The ID of the query */ QueryID string @@ -77,6 +76,21 @@ type GetOracleQueryByPubkeyAndQueryIDParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get oracle query by pubkey and query Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleQueryByPubkeyAndQueryIDParams) WithDefaults() *GetOracleQueryByPubkeyAndQueryIDParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get oracle query by pubkey and query Id params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOracleQueryByPubkeyAndQueryIDParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get oracle query by pubkey and query Id params func (o *GetOracleQueryByPubkeyAndQueryIDParams) WithTimeout(timeout time.Duration) *GetOracleQueryByPubkeyAndQueryIDParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_responses.go b/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_responses.go index 6d948442..c3754fcf 100644 --- a/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_responses.go +++ b/swagguard/node/client/external/get_oracle_query_by_pubkey_and_query_id_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetOracleQueryByPubkeyAndQueryIDReader is a Reader for the GetOracleQueryByPubkeyAndQueryID structure. @@ -24,30 +23,26 @@ type GetOracleQueryByPubkeyAndQueryIDReader struct { // ReadResponse reads a server response into the received o. func (o *GetOracleQueryByPubkeyAndQueryIDReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetOracleQueryByPubkeyAndQueryIDOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetOracleQueryByPubkeyAndQueryIDBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetOracleQueryByPubkeyAndQueryIDNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetOracleQueryByPubkeyAndQueryIDOK() *GetOracleQueryByPubkeyAndQueryIDOK return &GetOracleQueryByPubkeyAndQueryIDOK{} } -/*GetOracleQueryByPubkeyAndQueryIDOK handles this case with default header values. +/* GetOracleQueryByPubkeyAndQueryIDOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetOracleQueryByPubkeyAndQueryIDOK struct { func (o *GetOracleQueryByPubkeyAndQueryIDOK) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries/{query-id}][%d] getOracleQueryByPubkeyAndQueryIdOK %+v", 200, o.Payload) } +func (o *GetOracleQueryByPubkeyAndQueryIDOK) GetPayload() *models.OracleQuery { + return o.Payload +} func (o *GetOracleQueryByPubkeyAndQueryIDOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetOracleQueryByPubkeyAndQueryIDBadRequest() *GetOracleQueryByPubkeyAndQ return &GetOracleQueryByPubkeyAndQueryIDBadRequest{} } -/*GetOracleQueryByPubkeyAndQueryIDBadRequest handles this case with default header values. +/* GetOracleQueryByPubkeyAndQueryIDBadRequest describes a response with status code 400, with default header values. Invalid public key or query ID */ @@ -96,6 +94,9 @@ type GetOracleQueryByPubkeyAndQueryIDBadRequest struct { func (o *GetOracleQueryByPubkeyAndQueryIDBadRequest) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries/{query-id}][%d] getOracleQueryByPubkeyAndQueryIdBadRequest %+v", 400, o.Payload) } +func (o *GetOracleQueryByPubkeyAndQueryIDBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleQueryByPubkeyAndQueryIDBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetOracleQueryByPubkeyAndQueryIDNotFound() *GetOracleQueryByPubkeyAndQue return &GetOracleQueryByPubkeyAndQueryIDNotFound{} } -/*GetOracleQueryByPubkeyAndQueryIDNotFound handles this case with default header values. +/* GetOracleQueryByPubkeyAndQueryIDNotFound describes a response with status code 404, with default header values. Oracle query not found */ @@ -125,6 +126,9 @@ type GetOracleQueryByPubkeyAndQueryIDNotFound struct { func (o *GetOracleQueryByPubkeyAndQueryIDNotFound) Error() string { return fmt.Sprintf("[GET /oracles/{pubkey}/queries/{query-id}][%d] getOracleQueryByPubkeyAndQueryIdNotFound %+v", 404, o.Payload) } +func (o *GetOracleQueryByPubkeyAndQueryIDNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetOracleQueryByPubkeyAndQueryIDNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_peer_pubkey_parameters.go b/swagguard/node/client/external/get_peer_pubkey_parameters.go index 12706a04..28d34445 100644 --- a/swagguard/node/client/external/get_peer_pubkey_parameters.go +++ b/swagguard/node/client/external/get_peer_pubkey_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetPeerPubkeyParams creates a new GetPeerPubkeyParams object -// with the default values initialized. +// NewGetPeerPubkeyParams creates a new GetPeerPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetPeerPubkeyParams() *GetPeerPubkeyParams { - return &GetPeerPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetPeerPubkeyParamsWithTimeout creates a new GetPeerPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPeerPubkeyParamsWithTimeout(timeout time.Duration) *GetPeerPubkeyParams { - return &GetPeerPubkeyParams{ - timeout: timeout, } } // NewGetPeerPubkeyParamsWithContext creates a new GetPeerPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPeerPubkeyParamsWithContext(ctx context.Context) *GetPeerPubkeyParams { - return &GetPeerPubkeyParams{ - Context: ctx, } } // NewGetPeerPubkeyParamsWithHTTPClient creates a new GetPeerPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPeerPubkeyParamsWithHTTPClient(client *http.Client) *GetPeerPubkeyParams { - return &GetPeerPubkeyParams{ HTTPClient: client, } } -/*GetPeerPubkeyParams contains all the parameters to send to the API endpoint -for the get peer pubkey operation typically these are written to a http.Request +/* GetPeerPubkeyParams contains all the parameters to send to the API endpoint + for the get peer pubkey operation. + + Typically these are written to a http.Request. */ type GetPeerPubkeyParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetPeerPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get peer pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeerPubkeyParams) WithDefaults() *GetPeerPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get peer pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPeerPubkeyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get peer pubkey params func (o *GetPeerPubkeyParams) WithTimeout(timeout time.Duration) *GetPeerPubkeyParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_peer_pubkey_responses.go b/swagguard/node/client/external/get_peer_pubkey_responses.go index 7c13cd0b..95d73dde 100644 --- a/swagguard/node/client/external/get_peer_pubkey_responses.go +++ b/swagguard/node/client/external/get_peer_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetPeerPubkeyReader is a Reader for the GetPeerPubkey structure. @@ -24,16 +23,14 @@ type GetPeerPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetPeerPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetPeerPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -42,7 +39,7 @@ func NewGetPeerPubkeyOK() *GetPeerPubkeyOK { return &GetPeerPubkeyOK{} } -/*GetPeerPubkeyOK handles this case with default header values. +/* GetPeerPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -53,6 +50,9 @@ type GetPeerPubkeyOK struct { func (o *GetPeerPubkeyOK) Error() string { return fmt.Sprintf("[GET /peers/pubkey][%d] getPeerPubkeyOK %+v", 200, o.Payload) } +func (o *GetPeerPubkeyOK) GetPayload() *models.PeerPubKey { + return o.Payload +} func (o *GetPeerPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_parameters.go b/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_parameters.go index c2a1e647..48168e93 100644 --- a/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_parameters.go +++ b/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetPendingAccountTransactionsByPubkeyParams creates a new GetPendingAccountTransactionsByPubkeyParams object -// with the default values initialized. +// NewGetPendingAccountTransactionsByPubkeyParams creates a new GetPendingAccountTransactionsByPubkeyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetPendingAccountTransactionsByPubkeyParams() *GetPendingAccountTransactionsByPubkeyParams { - var () return &GetPendingAccountTransactionsByPubkeyParams{ - timeout: cr.DefaultTimeout, } } // NewGetPendingAccountTransactionsByPubkeyParamsWithTimeout creates a new GetPendingAccountTransactionsByPubkeyParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPendingAccountTransactionsByPubkeyParamsWithTimeout(timeout time.Duration) *GetPendingAccountTransactionsByPubkeyParams { - var () return &GetPendingAccountTransactionsByPubkeyParams{ - timeout: timeout, } } // NewGetPendingAccountTransactionsByPubkeyParamsWithContext creates a new GetPendingAccountTransactionsByPubkeyParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPendingAccountTransactionsByPubkeyParamsWithContext(ctx context.Context) *GetPendingAccountTransactionsByPubkeyParams { - var () return &GetPendingAccountTransactionsByPubkeyParams{ - Context: ctx, } } // NewGetPendingAccountTransactionsByPubkeyParamsWithHTTPClient creates a new GetPendingAccountTransactionsByPubkeyParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPendingAccountTransactionsByPubkeyParamsWithHTTPClient(client *http.Client) *GetPendingAccountTransactionsByPubkeyParams { - var () return &GetPendingAccountTransactionsByPubkeyParams{ HTTPClient: client, } } -/*GetPendingAccountTransactionsByPubkeyParams contains all the parameters to send to the API endpoint -for the get pending account transactions by pubkey operation typically these are written to a http.Request +/* GetPendingAccountTransactionsByPubkeyParams contains all the parameters to send to the API endpoint + for the get pending account transactions by pubkey operation. + + Typically these are written to a http.Request. */ type GetPendingAccountTransactionsByPubkeyParams struct { - /*Pubkey - The public key of the account + /* Pubkey. + The public key of the account */ Pubkey string @@ -72,6 +70,21 @@ type GetPendingAccountTransactionsByPubkeyParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get pending account transactions by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPendingAccountTransactionsByPubkeyParams) WithDefaults() *GetPendingAccountTransactionsByPubkeyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get pending account transactions by pubkey params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPendingAccountTransactionsByPubkeyParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get pending account transactions by pubkey params func (o *GetPendingAccountTransactionsByPubkeyParams) WithTimeout(timeout time.Duration) *GetPendingAccountTransactionsByPubkeyParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_responses.go b/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_responses.go index 3e9f26b4..0bb11883 100644 --- a/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_responses.go +++ b/swagguard/node/client/external/get_pending_account_transactions_by_pubkey_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetPendingAccountTransactionsByPubkeyReader is a Reader for the GetPendingAccountTransactionsByPubkey structure. @@ -24,30 +23,26 @@ type GetPendingAccountTransactionsByPubkeyReader struct { // ReadResponse reads a server response into the received o. func (o *GetPendingAccountTransactionsByPubkeyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetPendingAccountTransactionsByPubkeyOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetPendingAccountTransactionsByPubkeyBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetPendingAccountTransactionsByPubkeyNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetPendingAccountTransactionsByPubkeyOK() *GetPendingAccountTransactions return &GetPendingAccountTransactionsByPubkeyOK{} } -/*GetPendingAccountTransactionsByPubkeyOK handles this case with default header values. +/* GetPendingAccountTransactionsByPubkeyOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetPendingAccountTransactionsByPubkeyOK struct { func (o *GetPendingAccountTransactionsByPubkeyOK) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/transactions/pending][%d] getPendingAccountTransactionsByPubkeyOK %+v", 200, o.Payload) } +func (o *GetPendingAccountTransactionsByPubkeyOK) GetPayload() *models.GenericTxs { + return o.Payload +} func (o *GetPendingAccountTransactionsByPubkeyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetPendingAccountTransactionsByPubkeyBadRequest() *GetPendingAccountTran return &GetPendingAccountTransactionsByPubkeyBadRequest{} } -/*GetPendingAccountTransactionsByPubkeyBadRequest handles this case with default header values. +/* GetPendingAccountTransactionsByPubkeyBadRequest describes a response with status code 400, with default header values. Invalid public key */ @@ -96,6 +94,9 @@ type GetPendingAccountTransactionsByPubkeyBadRequest struct { func (o *GetPendingAccountTransactionsByPubkeyBadRequest) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/transactions/pending][%d] getPendingAccountTransactionsByPubkeyBadRequest %+v", 400, o.Payload) } +func (o *GetPendingAccountTransactionsByPubkeyBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetPendingAccountTransactionsByPubkeyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetPendingAccountTransactionsByPubkeyNotFound() *GetPendingAccountTransa return &GetPendingAccountTransactionsByPubkeyNotFound{} } -/*GetPendingAccountTransactionsByPubkeyNotFound handles this case with default header values. +/* GetPendingAccountTransactionsByPubkeyNotFound describes a response with status code 404, with default header values. Account not found */ @@ -125,6 +126,9 @@ type GetPendingAccountTransactionsByPubkeyNotFound struct { func (o *GetPendingAccountTransactionsByPubkeyNotFound) Error() string { return fmt.Sprintf("[GET /accounts/{pubkey}/transactions/pending][%d] getPendingAccountTransactionsByPubkeyNotFound %+v", 404, o.Payload) } +func (o *GetPendingAccountTransactionsByPubkeyNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetPendingAccountTransactionsByPubkeyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_pending_key_block_parameters.go b/swagguard/node/client/external/get_pending_key_block_parameters.go index d87a50db..f8fc40cd 100644 --- a/swagguard/node/client/external/get_pending_key_block_parameters.go +++ b/swagguard/node/client/external/get_pending_key_block_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetPendingKeyBlockParams creates a new GetPendingKeyBlockParams object -// with the default values initialized. +// NewGetPendingKeyBlockParams creates a new GetPendingKeyBlockParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetPendingKeyBlockParams() *GetPendingKeyBlockParams { - return &GetPendingKeyBlockParams{ - timeout: cr.DefaultTimeout, } } // NewGetPendingKeyBlockParamsWithTimeout creates a new GetPendingKeyBlockParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetPendingKeyBlockParamsWithTimeout(timeout time.Duration) *GetPendingKeyBlockParams { - return &GetPendingKeyBlockParams{ - timeout: timeout, } } // NewGetPendingKeyBlockParamsWithContext creates a new GetPendingKeyBlockParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetPendingKeyBlockParamsWithContext(ctx context.Context) *GetPendingKeyBlockParams { - return &GetPendingKeyBlockParams{ - Context: ctx, } } // NewGetPendingKeyBlockParamsWithHTTPClient creates a new GetPendingKeyBlockParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetPendingKeyBlockParamsWithHTTPClient(client *http.Client) *GetPendingKeyBlockParams { - return &GetPendingKeyBlockParams{ HTTPClient: client, } } -/*GetPendingKeyBlockParams contains all the parameters to send to the API endpoint -for the get pending key block operation typically these are written to a http.Request +/* GetPendingKeyBlockParams contains all the parameters to send to the API endpoint + for the get pending key block operation. + + Typically these are written to a http.Request. */ type GetPendingKeyBlockParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetPendingKeyBlockParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get pending key block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPendingKeyBlockParams) WithDefaults() *GetPendingKeyBlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get pending key block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetPendingKeyBlockParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get pending key block params func (o *GetPendingKeyBlockParams) WithTimeout(timeout time.Duration) *GetPendingKeyBlockParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_pending_key_block_responses.go b/swagguard/node/client/external/get_pending_key_block_responses.go index d9dcced9..69be87c2 100644 --- a/swagguard/node/client/external/get_pending_key_block_responses.go +++ b/swagguard/node/client/external/get_pending_key_block_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetPendingKeyBlockReader is a Reader for the GetPendingKeyBlock structure. @@ -24,30 +23,26 @@ type GetPendingKeyBlockReader struct { // ReadResponse reads a server response into the received o. func (o *GetPendingKeyBlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetPendingKeyBlockOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetPendingKeyBlockBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetPendingKeyBlockNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetPendingKeyBlockOK() *GetPendingKeyBlockOK { return &GetPendingKeyBlockOK{} } -/*GetPendingKeyBlockOK handles this case with default header values. +/* GetPendingKeyBlockOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetPendingKeyBlockOK struct { func (o *GetPendingKeyBlockOK) Error() string { return fmt.Sprintf("[GET /key-blocks/pending][%d] getPendingKeyBlockOK %+v", 200, o.Payload) } +func (o *GetPendingKeyBlockOK) GetPayload() *models.KeyBlock { + return o.Payload +} func (o *GetPendingKeyBlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetPendingKeyBlockBadRequest() *GetPendingKeyBlockBadRequest { return &GetPendingKeyBlockBadRequest{} } -/*GetPendingKeyBlockBadRequest handles this case with default header values. +/* GetPendingKeyBlockBadRequest describes a response with status code 400, with default header values. Beneficiary not configured */ @@ -96,6 +94,9 @@ type GetPendingKeyBlockBadRequest struct { func (o *GetPendingKeyBlockBadRequest) Error() string { return fmt.Sprintf("[GET /key-blocks/pending][%d] getPendingKeyBlockBadRequest %+v", 400, o.Payload) } +func (o *GetPendingKeyBlockBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetPendingKeyBlockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetPendingKeyBlockNotFound() *GetPendingKeyBlockNotFound { return &GetPendingKeyBlockNotFound{} } -/*GetPendingKeyBlockNotFound handles this case with default header values. +/* GetPendingKeyBlockNotFound describes a response with status code 404, with default header values. Block not found */ @@ -125,6 +126,9 @@ type GetPendingKeyBlockNotFound struct { func (o *GetPendingKeyBlockNotFound) Error() string { return fmt.Sprintf("[GET /key-blocks/pending][%d] getPendingKeyBlockNotFound %+v", 404, o.Payload) } +func (o *GetPendingKeyBlockNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetPendingKeyBlockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_status_parameters.go b/swagguard/node/client/external/get_status_parameters.go index bb2cc892..9911fe39 100644 --- a/swagguard/node/client/external/get_status_parameters.go +++ b/swagguard/node/client/external/get_status_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetStatusParams creates a new GetStatusParams object -// with the default values initialized. +// NewGetStatusParams creates a new GetStatusParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetStatusParams() *GetStatusParams { - return &GetStatusParams{ - timeout: cr.DefaultTimeout, } } // NewGetStatusParamsWithTimeout creates a new GetStatusParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetStatusParamsWithTimeout(timeout time.Duration) *GetStatusParams { - return &GetStatusParams{ - timeout: timeout, } } // NewGetStatusParamsWithContext creates a new GetStatusParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetStatusParamsWithContext(ctx context.Context) *GetStatusParams { - return &GetStatusParams{ - Context: ctx, } } // NewGetStatusParamsWithHTTPClient creates a new GetStatusParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetStatusParamsWithHTTPClient(client *http.Client) *GetStatusParams { - return &GetStatusParams{ HTTPClient: client, } } -/*GetStatusParams contains all the parameters to send to the API endpoint -for the get status operation typically these are written to a http.Request +/* GetStatusParams contains all the parameters to send to the API endpoint + for the get status operation. + + Typically these are written to a http.Request. */ type GetStatusParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetStatusParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get status params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatusParams) WithDefaults() *GetStatusParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get status params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetStatusParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get status params func (o *GetStatusParams) WithTimeout(timeout time.Duration) *GetStatusParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_status_responses.go b/swagguard/node/client/external/get_status_responses.go index e137938d..7e484199 100644 --- a/swagguard/node/client/external/get_status_responses.go +++ b/swagguard/node/client/external/get_status_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetStatusReader is a Reader for the GetStatus structure. @@ -24,16 +23,14 @@ type GetStatusReader struct { // ReadResponse reads a server response into the received o. func (o *GetStatusReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetStatusOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -42,7 +39,7 @@ func NewGetStatusOK() *GetStatusOK { return &GetStatusOK{} } -/*GetStatusOK handles this case with default header values. +/* GetStatusOK describes a response with status code 200, with default header values. Successful operation */ @@ -53,6 +50,9 @@ type GetStatusOK struct { func (o *GetStatusOK) Error() string { return fmt.Sprintf("[GET /status][%d] getStatusOK %+v", 200, o.Payload) } +func (o *GetStatusOK) GetPayload() *models.Status { + return o.Payload +} func (o *GetStatusOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_top_block_parameters.go b/swagguard/node/client/external/get_top_block_parameters.go index 627fac21..c135ee38 100644 --- a/swagguard/node/client/external/get_top_block_parameters.go +++ b/swagguard/node/client/external/get_top_block_parameters.go @@ -13,51 +13,49 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetTopBlockParams creates a new GetTopBlockParams object -// with the default values initialized. +// NewGetTopBlockParams creates a new GetTopBlockParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetTopBlockParams() *GetTopBlockParams { - return &GetTopBlockParams{ - timeout: cr.DefaultTimeout, } } // NewGetTopBlockParamsWithTimeout creates a new GetTopBlockParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTopBlockParamsWithTimeout(timeout time.Duration) *GetTopBlockParams { - return &GetTopBlockParams{ - timeout: timeout, } } // NewGetTopBlockParamsWithContext creates a new GetTopBlockParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTopBlockParamsWithContext(ctx context.Context) *GetTopBlockParams { - return &GetTopBlockParams{ - Context: ctx, } } // NewGetTopBlockParamsWithHTTPClient creates a new GetTopBlockParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTopBlockParamsWithHTTPClient(client *http.Client) *GetTopBlockParams { - return &GetTopBlockParams{ HTTPClient: client, } } -/*GetTopBlockParams contains all the parameters to send to the API endpoint -for the get top block operation typically these are written to a http.Request +/* GetTopBlockParams contains all the parameters to send to the API endpoint + for the get top block operation. + + Typically these are written to a http.Request. */ type GetTopBlockParams struct { timeout time.Duration @@ -65,6 +63,21 @@ type GetTopBlockParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get top block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTopBlockParams) WithDefaults() *GetTopBlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get top block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTopBlockParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get top block params func (o *GetTopBlockParams) WithTimeout(timeout time.Duration) *GetTopBlockParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_top_block_responses.go b/swagguard/node/client/external/get_top_block_responses.go index 261863a1..f0f0b169 100644 --- a/swagguard/node/client/external/get_top_block_responses.go +++ b/swagguard/node/client/external/get_top_block_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetTopBlockReader is a Reader for the GetTopBlock structure. @@ -24,23 +23,20 @@ type GetTopBlockReader struct { // ReadResponse reads a server response into the received o. func (o *GetTopBlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetTopBlockOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 404: result := NewGetTopBlockNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewGetTopBlockOK() *GetTopBlockOK { return &GetTopBlockOK{} } -/*GetTopBlockOK handles this case with default header values. +/* GetTopBlockOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type GetTopBlockOK struct { func (o *GetTopBlockOK) Error() string { return fmt.Sprintf("[GET /blocks/top][%d] getTopBlockOK %+v", 200, o.Payload) } +func (o *GetTopBlockOK) GetPayload() *models.KeyBlockOrMicroBlockHeader { + return o.Payload +} func (o *GetTopBlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewGetTopBlockNotFound() *GetTopBlockNotFound { return &GetTopBlockNotFound{} } -/*GetTopBlockNotFound handles this case with default header values. +/* GetTopBlockNotFound describes a response with status code 404, with default header values. Block not found */ @@ -89,6 +88,9 @@ type GetTopBlockNotFound struct { func (o *GetTopBlockNotFound) Error() string { return fmt.Sprintf("[GET /blocks/top][%d] getTopBlockNotFound %+v", 404, o.Payload) } +func (o *GetTopBlockNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetTopBlockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_transaction_by_hash_parameters.go b/swagguard/node/client/external/get_transaction_by_hash_parameters.go index 92fb8c62..0eab7763 100644 --- a/swagguard/node/client/external/get_transaction_by_hash_parameters.go +++ b/swagguard/node/client/external/get_transaction_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetTransactionByHashParams creates a new GetTransactionByHashParams object -// with the default values initialized. +// NewGetTransactionByHashParams creates a new GetTransactionByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetTransactionByHashParams() *GetTransactionByHashParams { - var () return &GetTransactionByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransactionByHashParamsWithTimeout creates a new GetTransactionByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransactionByHashParamsWithTimeout(timeout time.Duration) *GetTransactionByHashParams { - var () return &GetTransactionByHashParams{ - timeout: timeout, } } // NewGetTransactionByHashParamsWithContext creates a new GetTransactionByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransactionByHashParamsWithContext(ctx context.Context) *GetTransactionByHashParams { - var () return &GetTransactionByHashParams{ - Context: ctx, } } // NewGetTransactionByHashParamsWithHTTPClient creates a new GetTransactionByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransactionByHashParamsWithHTTPClient(client *http.Client) *GetTransactionByHashParams { - var () return &GetTransactionByHashParams{ HTTPClient: client, } } -/*GetTransactionByHashParams contains all the parameters to send to the API endpoint -for the get transaction by hash operation typically these are written to a http.Request +/* GetTransactionByHashParams contains all the parameters to send to the API endpoint + for the get transaction by hash operation. + + Typically these are written to a http.Request. */ type GetTransactionByHashParams struct { - /*Hash - The hash of the transaction + /* Hash. + The hash of the transaction */ Hash string @@ -72,6 +70,21 @@ type GetTransactionByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transaction by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionByHashParams) WithDefaults() *GetTransactionByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transaction by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transaction by hash params func (o *GetTransactionByHashParams) WithTimeout(timeout time.Duration) *GetTransactionByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_transaction_by_hash_responses.go b/swagguard/node/client/external/get_transaction_by_hash_responses.go index 9e993d3e..e04870b6 100644 --- a/swagguard/node/client/external/get_transaction_by_hash_responses.go +++ b/swagguard/node/client/external/get_transaction_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetTransactionByHashReader is a Reader for the GetTransactionByHash structure. @@ -24,30 +23,26 @@ type GetTransactionByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetTransactionByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetTransactionByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetTransactionByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetTransactionByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetTransactionByHashOK() *GetTransactionByHashOK { return &GetTransactionByHashOK{} } -/*GetTransactionByHashOK handles this case with default header values. +/* GetTransactionByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetTransactionByHashOK struct { func (o *GetTransactionByHashOK) Error() string { return fmt.Sprintf("[GET /transactions/{hash}][%d] getTransactionByHashOK %+v", 200, o.Payload) } +func (o *GetTransactionByHashOK) GetPayload() *models.GenericSignedTx { + return o.Payload +} func (o *GetTransactionByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetTransactionByHashBadRequest() *GetTransactionByHashBadRequest { return &GetTransactionByHashBadRequest{} } -/*GetTransactionByHashBadRequest handles this case with default header values. +/* GetTransactionByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetTransactionByHashBadRequest struct { func (o *GetTransactionByHashBadRequest) Error() string { return fmt.Sprintf("[GET /transactions/{hash}][%d] getTransactionByHashBadRequest %+v", 400, o.Payload) } +func (o *GetTransactionByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetTransactionByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetTransactionByHashNotFound() *GetTransactionByHashNotFound { return &GetTransactionByHashNotFound{} } -/*GetTransactionByHashNotFound handles this case with default header values. +/* GetTransactionByHashNotFound describes a response with status code 404, with default header values. Transaction not found */ @@ -125,6 +126,9 @@ type GetTransactionByHashNotFound struct { func (o *GetTransactionByHashNotFound) Error() string { return fmt.Sprintf("[GET /transactions/{hash}][%d] getTransactionByHashNotFound %+v", 404, o.Payload) } +func (o *GetTransactionByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetTransactionByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/get_transaction_info_by_hash_parameters.go b/swagguard/node/client/external/get_transaction_info_by_hash_parameters.go index 5be9f484..e335f319 100644 --- a/swagguard/node/client/external/get_transaction_info_by_hash_parameters.go +++ b/swagguard/node/client/external/get_transaction_info_by_hash_parameters.go @@ -13,57 +13,55 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" - - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/strfmt" ) -// NewGetTransactionInfoByHashParams creates a new GetTransactionInfoByHashParams object -// with the default values initialized. +// NewGetTransactionInfoByHashParams creates a new GetTransactionInfoByHashParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewGetTransactionInfoByHashParams() *GetTransactionInfoByHashParams { - var () return &GetTransactionInfoByHashParams{ - timeout: cr.DefaultTimeout, } } // NewGetTransactionInfoByHashParamsWithTimeout creates a new GetTransactionInfoByHashParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewGetTransactionInfoByHashParamsWithTimeout(timeout time.Duration) *GetTransactionInfoByHashParams { - var () return &GetTransactionInfoByHashParams{ - timeout: timeout, } } // NewGetTransactionInfoByHashParamsWithContext creates a new GetTransactionInfoByHashParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewGetTransactionInfoByHashParamsWithContext(ctx context.Context) *GetTransactionInfoByHashParams { - var () return &GetTransactionInfoByHashParams{ - Context: ctx, } } // NewGetTransactionInfoByHashParamsWithHTTPClient creates a new GetTransactionInfoByHashParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewGetTransactionInfoByHashParamsWithHTTPClient(client *http.Client) *GetTransactionInfoByHashParams { - var () return &GetTransactionInfoByHashParams{ HTTPClient: client, } } -/*GetTransactionInfoByHashParams contains all the parameters to send to the API endpoint -for the get transaction info by hash operation typically these are written to a http.Request +/* GetTransactionInfoByHashParams contains all the parameters to send to the API endpoint + for the get transaction info by hash operation. + + Typically these are written to a http.Request. */ type GetTransactionInfoByHashParams struct { - /*Hash - The hash of the transaction + /* Hash. + The hash of the transaction */ Hash string @@ -72,6 +70,21 @@ type GetTransactionInfoByHashParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the get transaction info by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionInfoByHashParams) WithDefaults() *GetTransactionInfoByHashParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get transaction info by hash params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetTransactionInfoByHashParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the get transaction info by hash params func (o *GetTransactionInfoByHashParams) WithTimeout(timeout time.Duration) *GetTransactionInfoByHashParams { o.SetTimeout(timeout) diff --git a/swagguard/node/client/external/get_transaction_info_by_hash_responses.go b/swagguard/node/client/external/get_transaction_info_by_hash_responses.go index 87724b39..51bb5ad3 100644 --- a/swagguard/node/client/external/get_transaction_info_by_hash_responses.go +++ b/swagguard/node/client/external/get_transaction_info_by_hash_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // GetTransactionInfoByHashReader is a Reader for the GetTransactionInfoByHash structure. @@ -24,30 +23,26 @@ type GetTransactionInfoByHashReader struct { // ReadResponse reads a server response into the received o. func (o *GetTransactionInfoByHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewGetTransactionInfoByHashOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewGetTransactionInfoByHashBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - case 404: result := NewGetTransactionInfoByHashNotFound() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -56,7 +51,7 @@ func NewGetTransactionInfoByHashOK() *GetTransactionInfoByHashOK { return &GetTransactionInfoByHashOK{} } -/*GetTransactionInfoByHashOK handles this case with default header values. +/* GetTransactionInfoByHashOK describes a response with status code 200, with default header values. Successful operation */ @@ -67,6 +62,9 @@ type GetTransactionInfoByHashOK struct { func (o *GetTransactionInfoByHashOK) Error() string { return fmt.Sprintf("[GET /transactions/{hash}/info][%d] getTransactionInfoByHashOK %+v", 200, o.Payload) } +func (o *GetTransactionInfoByHashOK) GetPayload() *models.TxInfoObject { + return o.Payload +} func (o *GetTransactionInfoByHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -85,7 +83,7 @@ func NewGetTransactionInfoByHashBadRequest() *GetTransactionInfoByHashBadRequest return &GetTransactionInfoByHashBadRequest{} } -/*GetTransactionInfoByHashBadRequest handles this case with default header values. +/* GetTransactionInfoByHashBadRequest describes a response with status code 400, with default header values. Invalid hash */ @@ -96,6 +94,9 @@ type GetTransactionInfoByHashBadRequest struct { func (o *GetTransactionInfoByHashBadRequest) Error() string { return fmt.Sprintf("[GET /transactions/{hash}/info][%d] getTransactionInfoByHashBadRequest %+v", 400, o.Payload) } +func (o *GetTransactionInfoByHashBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *GetTransactionInfoByHashBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -114,7 +115,7 @@ func NewGetTransactionInfoByHashNotFound() *GetTransactionInfoByHashNotFound { return &GetTransactionInfoByHashNotFound{} } -/*GetTransactionInfoByHashNotFound handles this case with default header values. +/* GetTransactionInfoByHashNotFound describes a response with status code 404, with default header values. Transaction not found */ @@ -125,6 +126,9 @@ type GetTransactionInfoByHashNotFound struct { func (o *GetTransactionInfoByHashNotFound) Error() string { return fmt.Sprintf("[GET /transactions/{hash}/info][%d] getTransactionInfoByHashNotFound %+v", 404, o.Payload) } +func (o *GetTransactionInfoByHashNotFound) GetPayload() *models.Error { + return o.Payload +} func (o *GetTransactionInfoByHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/post_transaction_parameters.go b/swagguard/node/client/external/post_transaction_parameters.go index 57e8b920..b246e04f 100644 --- a/swagguard/node/client/external/post_transaction_parameters.go +++ b/swagguard/node/client/external/post_transaction_parameters.go @@ -13,59 +13,57 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) -// NewPostTransactionParams creates a new PostTransactionParams object -// with the default values initialized. +// NewPostTransactionParams creates a new PostTransactionParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. func NewPostTransactionParams() *PostTransactionParams { - var () return &PostTransactionParams{ - timeout: cr.DefaultTimeout, } } // NewPostTransactionParamsWithTimeout creates a new PostTransactionParams object -// with the default values initialized, and the ability to set a timeout on a request +// with the ability to set a timeout on a request. func NewPostTransactionParamsWithTimeout(timeout time.Duration) *PostTransactionParams { - var () return &PostTransactionParams{ - timeout: timeout, } } // NewPostTransactionParamsWithContext creates a new PostTransactionParams object -// with the default values initialized, and the ability to set a context for a request +// with the ability to set a context for a request. func NewPostTransactionParamsWithContext(ctx context.Context) *PostTransactionParams { - var () return &PostTransactionParams{ - Context: ctx, } } // NewPostTransactionParamsWithHTTPClient creates a new PostTransactionParams object -// with the default values initialized, and the ability to set a custom HTTPClient for a request +// with the ability to set a custom HTTPClient for a request. func NewPostTransactionParamsWithHTTPClient(client *http.Client) *PostTransactionParams { - var () return &PostTransactionParams{ HTTPClient: client, } } -/*PostTransactionParams contains all the parameters to send to the API endpoint -for the post transaction operation typically these are written to a http.Request +/* PostTransactionParams contains all the parameters to send to the API endpoint + for the post transaction operation. + + Typically these are written to a http.Request. */ type PostTransactionParams struct { - /*Body - The new transaction + /* Body. + The new transaction */ Body *models.Tx @@ -74,6 +72,21 @@ type PostTransactionParams struct { HTTPClient *http.Client } +// WithDefaults hydrates default values in the post transaction params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTransactionParams) WithDefaults() *PostTransactionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the post transaction params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PostTransactionParams) SetDefaults() { + // no default values defined for this parameter +} + // WithTimeout adds the timeout to the post transaction params func (o *PostTransactionParams) WithTimeout(timeout time.Duration) *PostTransactionParams { o.SetTimeout(timeout) @@ -125,7 +138,6 @@ func (o *PostTransactionParams) WriteToRequest(r runtime.ClientRequest, reg strf return err } var res []error - if o.Body != nil { if err := r.SetBodyParam(o.Body); err != nil { return err diff --git a/swagguard/node/client/external/post_transaction_responses.go b/swagguard/node/client/external/post_transaction_responses.go index 4f49b420..7d73530d 100644 --- a/swagguard/node/client/external/post_transaction_responses.go +++ b/swagguard/node/client/external/post_transaction_responses.go @@ -10,10 +10,9 @@ import ( "io" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // PostTransactionReader is a Reader for the PostTransaction structure. @@ -24,23 +23,20 @@ type PostTransactionReader struct { // ReadResponse reads a server response into the received o. func (o *PostTransactionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { switch response.Code() { - case 200: result := NewPostTransactionOK() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return result, nil - case 400: result := NewPostTransactionBadRequest() if err := result.readResponse(response, consumer, o.formats); err != nil { return nil, err } return nil, result - default: - return nil, runtime.NewAPIError("unknown error", response, response.Code()) + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) } } @@ -49,7 +45,7 @@ func NewPostTransactionOK() *PostTransactionOK { return &PostTransactionOK{} } -/*PostTransactionOK handles this case with default header values. +/* PostTransactionOK describes a response with status code 200, with default header values. Successful operation */ @@ -60,6 +56,9 @@ type PostTransactionOK struct { func (o *PostTransactionOK) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionOK %+v", 200, o.Payload) } +func (o *PostTransactionOK) GetPayload() *models.PostTxResponse { + return o.Payload +} func (o *PostTransactionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -78,7 +77,7 @@ func NewPostTransactionBadRequest() *PostTransactionBadRequest { return &PostTransactionBadRequest{} } -/*PostTransactionBadRequest handles this case with default header values. +/* PostTransactionBadRequest describes a response with status code 400, with default header values. Invalid transaction */ @@ -89,6 +88,9 @@ type PostTransactionBadRequest struct { func (o *PostTransactionBadRequest) Error() string { return fmt.Sprintf("[POST /transactions][%d] postTransactionBadRequest %+v", 400, o.Payload) } +func (o *PostTransactionBadRequest) GetPayload() *models.Error { + return o.Payload +} func (o *PostTransactionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/swagguard/node/client/external/protected_dry_run_txs_parameters.go b/swagguard/node/client/external/protected_dry_run_txs_parameters.go new file mode 100644 index 00000000..c2409c9d --- /dev/null +++ b/swagguard/node/client/external/protected_dry_run_txs_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" +) + +// NewProtectedDryRunTxsParams creates a new ProtectedDryRunTxsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewProtectedDryRunTxsParams() *ProtectedDryRunTxsParams { + return &ProtectedDryRunTxsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewProtectedDryRunTxsParamsWithTimeout creates a new ProtectedDryRunTxsParams object +// with the ability to set a timeout on a request. +func NewProtectedDryRunTxsParamsWithTimeout(timeout time.Duration) *ProtectedDryRunTxsParams { + return &ProtectedDryRunTxsParams{ + timeout: timeout, + } +} + +// NewProtectedDryRunTxsParamsWithContext creates a new ProtectedDryRunTxsParams object +// with the ability to set a context for a request. +func NewProtectedDryRunTxsParamsWithContext(ctx context.Context) *ProtectedDryRunTxsParams { + return &ProtectedDryRunTxsParams{ + Context: ctx, + } +} + +// NewProtectedDryRunTxsParamsWithHTTPClient creates a new ProtectedDryRunTxsParams object +// with the ability to set a custom HTTPClient for a request. +func NewProtectedDryRunTxsParamsWithHTTPClient(client *http.Client) *ProtectedDryRunTxsParams { + return &ProtectedDryRunTxsParams{ + HTTPClient: client, + } +} + +/* ProtectedDryRunTxsParams contains all the parameters to send to the API endpoint + for the protected dry run txs operation. + + Typically these are written to a http.Request. +*/ +type ProtectedDryRunTxsParams struct { + + /* Body. + + transactions + */ + Body *models.DryRunInput + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the protected dry run txs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProtectedDryRunTxsParams) WithDefaults() *ProtectedDryRunTxsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the protected dry run txs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ProtectedDryRunTxsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) WithTimeout(timeout time.Duration) *ProtectedDryRunTxsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) WithContext(ctx context.Context) *ProtectedDryRunTxsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) WithHTTPClient(client *http.Client) *ProtectedDryRunTxsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) WithBody(body *models.DryRunInput) *ProtectedDryRunTxsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the protected dry run txs params +func (o *ProtectedDryRunTxsParams) SetBody(body *models.DryRunInput) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ProtectedDryRunTxsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/node/client/external/protected_dry_run_txs_responses.go b/swagguard/node/client/external/protected_dry_run_txs_responses.go new file mode 100644 index 00000000..13725838 --- /dev/null +++ b/swagguard/node/client/external/protected_dry_run_txs_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package external + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" +) + +// ProtectedDryRunTxsReader is a Reader for the ProtectedDryRunTxs structure. +type ProtectedDryRunTxsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ProtectedDryRunTxsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewProtectedDryRunTxsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 403: + result := NewProtectedDryRunTxsForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewProtectedDryRunTxsOK creates a ProtectedDryRunTxsOK with default headers values +func NewProtectedDryRunTxsOK() *ProtectedDryRunTxsOK { + return &ProtectedDryRunTxsOK{} +} + +/* ProtectedDryRunTxsOK describes a response with status code 200, with default header values. + +Dry-run result +*/ +type ProtectedDryRunTxsOK struct { + Payload *models.DryRunResults +} + +func (o *ProtectedDryRunTxsOK) Error() string { + return fmt.Sprintf("[POST /dry-run][%d] protectedDryRunTxsOK %+v", 200, o.Payload) +} +func (o *ProtectedDryRunTxsOK) GetPayload() *models.DryRunResults { + return o.Payload +} + +func (o *ProtectedDryRunTxsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DryRunResults) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewProtectedDryRunTxsForbidden creates a ProtectedDryRunTxsForbidden with default headers values +func NewProtectedDryRunTxsForbidden() *ProtectedDryRunTxsForbidden { + return &ProtectedDryRunTxsForbidden{} +} + +/* ProtectedDryRunTxsForbidden describes a response with status code 403, with default header values. + +Invalid input +*/ +type ProtectedDryRunTxsForbidden struct { + Payload *models.Error +} + +func (o *ProtectedDryRunTxsForbidden) Error() string { + return fmt.Sprintf("[POST /dry-run][%d] protectedDryRunTxsForbidden %+v", 403, o.Payload) +} +func (o *ProtectedDryRunTxsForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *ProtectedDryRunTxsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Error) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/swagguard/node/client/node_client.go b/swagguard/node/client/node_client.go index 98685c63..89f2d976 100644 --- a/swagguard/node/client/node_client.go +++ b/swagguard/node/client/node_client.go @@ -8,10 +8,9 @@ package client import ( "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" - strfmt "github.com/go-openapi/strfmt" - - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/client/external" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/client/external" ) // Default node HTTP client. @@ -56,9 +55,7 @@ func New(transport runtime.ClientTransport, formats strfmt.Registry) *Node { cli := new(Node) cli.Transport = transport - cli.External = external.New(transport, formats) - return cli } @@ -103,7 +100,7 @@ func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { // Node is a client for node type Node struct { - External *external.Client + External external.ClientService Transport runtime.ClientTransport } @@ -111,7 +108,5 @@ type Node struct { // SetTransport changes the transport on the client and all its subresources func (c *Node) SetTransport(transport runtime.ClientTransport) { c.Transport = transport - c.External.SetTransport(transport) - } diff --git a/swagguard/node/models/account.go b/swagguard/node/models/account.go index 185fca40..ca773d56 100644 --- a/swagguard/node/models/account.go +++ b/swagguard/node/models/account.go @@ -6,18 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // Account account +// // swagger:model Account type Account struct { @@ -26,7 +26,7 @@ type Account struct { // Balance // Required: true - Balance utils.BigInt `json:"balance"` + Balance *utils.BigInt `json:"balance"` // Id of authorization contract for generalized account ContractID string `json:"contract_id,omitempty"` @@ -75,13 +75,23 @@ func (m *Account) Validate(formats strfmt.Registry) error { func (m *Account) validateBalance(formats strfmt.Registry) error { - if err := m.Balance.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("balance") - } + if err := validate.Required("balance", "body", m.Balance); err != nil { return err } + if err := validate.Required("balance", "body", m.Balance); err != nil { + return err + } + + if m.Balance != nil { + if err := m.Balance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("balance") + } + return err + } + } + return nil } @@ -117,14 +127,13 @@ const ( // prop value enum func (m *Account) validateKindEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, accountTypeKindPropEnum); err != nil { + if err := validate.EnumCase(path, location, value, accountTypeKindPropEnum, true); err != nil { return err } return nil } func (m *Account) validateKind(formats strfmt.Registry) error { - if swag.IsZero(m.Kind) { // not required return nil } @@ -146,6 +155,34 @@ func (m *Account) validateNonce(formats strfmt.Registry) error { return nil } +// ContextValidate validate this account based on the context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBalance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) contextValidateBalance(ctx context.Context, formats strfmt.Registry) error { + + if m.Balance != nil { + if err := m.Balance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("balance") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Account) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/byte_code.go b/swagguard/node/models/byte_code.go index cccd3db3..3dc1b825 100644 --- a/swagguard/node/models/byte_code.go +++ b/swagguard/node/models/byte_code.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ByteCode byte code +// // swagger:model ByteCode type ByteCode struct { @@ -45,6 +47,11 @@ func (m *ByteCode) validateBytecode(formats strfmt.Registry) error { return nil } +// ContextValidate validates this byte code based on context it is used +func (m *ByteCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ByteCode) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel.go b/swagguard/node/models/channel.go index 7c0e842a..3ca69442 100644 --- a/swagguard/node/models/channel.go +++ b/swagguard/node/models/channel.go @@ -6,30 +6,27 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // Channel channel +// // swagger:model Channel type Channel struct { // channel amount // Required: true - ChannelAmount utils.BigInt `json:"channel_amount"` + ChannelAmount *utils.BigInt `json:"channel_amount"` // channel reserve // Required: true - ChannelReserve utils.BigInt `json:"channel_reserve"` - - // delegate ids - // Required: true - DelegateIds []string `json:"delegate_ids"` + ChannelReserve *utils.BigInt `json:"channel_reserve"` // id // Required: true @@ -37,7 +34,7 @@ type Channel struct { // initiator amount // Required: true - InitiatorAmount utils.BigInt `json:"initiator_amount"` + InitiatorAmount *utils.BigInt `json:"initiator_amount"` // initiator id // Required: true @@ -53,7 +50,7 @@ type Channel struct { // responder amount // Required: true - ResponderAmount utils.BigInt `json:"responder_amount"` + ResponderAmount *utils.BigInt `json:"responder_amount"` // responder id // Required: true @@ -84,10 +81,6 @@ func (m *Channel) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateDelegateIds(formats); err != nil { - res = append(res, err) - } - if err := m.validateID(formats); err != nil { res = append(res, err) } @@ -136,34 +129,45 @@ func (m *Channel) Validate(formats strfmt.Registry) error { func (m *Channel) validateChannelAmount(formats strfmt.Registry) error { - if err := m.ChannelAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("channel_amount") - } + if err := validate.Required("channel_amount", "body", m.ChannelAmount); err != nil { return err } - return nil -} - -func (m *Channel) validateChannelReserve(formats strfmt.Registry) error { + if err := validate.Required("channel_amount", "body", m.ChannelAmount); err != nil { + return err + } - if err := m.ChannelReserve.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("channel_reserve") + if m.ChannelAmount != nil { + if err := m.ChannelAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_amount") + } + return err } - return err } return nil } -func (m *Channel) validateDelegateIds(formats strfmt.Registry) error { +func (m *Channel) validateChannelReserve(formats strfmt.Registry) error { + + if err := validate.Required("channel_reserve", "body", m.ChannelReserve); err != nil { + return err + } - if err := validate.Required("delegate_ids", "body", m.DelegateIds); err != nil { + if err := validate.Required("channel_reserve", "body", m.ChannelReserve); err != nil { return err } + if m.ChannelReserve != nil { + if err := m.ChannelReserve.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_reserve") + } + return err + } + } + return nil } @@ -178,13 +182,23 @@ func (m *Channel) validateID(formats strfmt.Registry) error { func (m *Channel) validateInitiatorAmount(formats strfmt.Registry) error { - if err := m.InitiatorAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("initiator_amount") - } + if err := validate.Required("initiator_amount", "body", m.InitiatorAmount); err != nil { + return err + } + + if err := validate.Required("initiator_amount", "body", m.InitiatorAmount); err != nil { return err } + if m.InitiatorAmount != nil { + if err := m.InitiatorAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount") + } + return err + } + } + return nil } @@ -217,13 +231,23 @@ func (m *Channel) validateLockedUntil(formats strfmt.Registry) error { func (m *Channel) validateResponderAmount(formats strfmt.Registry) error { - if err := m.ResponderAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("responder_amount") - } + if err := validate.Required("responder_amount", "body", m.ResponderAmount); err != nil { + return err + } + + if err := validate.Required("responder_amount", "body", m.ResponderAmount); err != nil { return err } + if m.ResponderAmount != nil { + if err := m.ResponderAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount") + } + return err + } + } + return nil } @@ -263,6 +287,88 @@ func (m *Channel) validateStateHash(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel based on the context it is used +func (m *Channel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateChannelAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateChannelReserve(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInitiatorAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponderAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Channel) contextValidateChannelAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.ChannelAmount != nil { + if err := m.ChannelAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_amount") + } + return err + } + } + + return nil +} + +func (m *Channel) contextValidateChannelReserve(ctx context.Context, formats strfmt.Registry) error { + + if m.ChannelReserve != nil { + if err := m.ChannelReserve.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_reserve") + } + return err + } + } + + return nil +} + +func (m *Channel) contextValidateInitiatorAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.InitiatorAmount != nil { + if err := m.InitiatorAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount") + } + return err + } + } + + return nil +} + +func (m *Channel) contextValidateResponderAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponderAmount != nil { + if err := m.ResponderAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Channel) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_close_mutual_tx.go b/swagguard/node/models/channel_close_mutual_tx.go index 1d2e8d35..45e675f5 100644 --- a/swagguard/node/models/channel_close_mutual_tx.go +++ b/swagguard/node/models/channel_close_mutual_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelCloseMutualTx channel close mutual tx +// // swagger:model ChannelCloseMutualTx type ChannelCloseMutualTx struct { @@ -33,7 +34,7 @@ type ChannelCloseMutualTx struct { // initiator amount final // Required: true - InitiatorAmountFinal utils.BigInt `json:"initiator_amount_final"` + InitiatorAmountFinal *utils.BigInt `json:"initiator_amount_final"` // nonce // Required: true @@ -41,7 +42,7 @@ type ChannelCloseMutualTx struct { // responder amount final // Required: true - ResponderAmountFinal utils.BigInt `json:"responder_amount_final"` + ResponderAmountFinal *utils.BigInt `json:"responder_amount_final"` // ttl TTL uint64 `json:"ttl,omitempty"` @@ -110,13 +111,23 @@ func (m *ChannelCloseMutualTx) validateFromID(formats strfmt.Registry) error { func (m *ChannelCloseMutualTx) validateInitiatorAmountFinal(formats strfmt.Registry) error { - if err := m.InitiatorAmountFinal.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("initiator_amount_final") - } + if err := validate.Required("initiator_amount_final", "body", m.InitiatorAmountFinal); err != nil { + return err + } + + if err := validate.Required("initiator_amount_final", "body", m.InitiatorAmountFinal); err != nil { return err } + if m.InitiatorAmountFinal != nil { + if err := m.InitiatorAmountFinal.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount_final") + } + return err + } + } + return nil } @@ -131,13 +142,69 @@ func (m *ChannelCloseMutualTx) validateNonce(formats strfmt.Registry) error { func (m *ChannelCloseMutualTx) validateResponderAmountFinal(formats strfmt.Registry) error { - if err := m.ResponderAmountFinal.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("responder_amount_final") - } + if err := validate.Required("responder_amount_final", "body", m.ResponderAmountFinal); err != nil { + return err + } + + if err := validate.Required("responder_amount_final", "body", m.ResponderAmountFinal); err != nil { return err } + if m.ResponderAmountFinal != nil { + if err := m.ResponderAmountFinal.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount_final") + } + return err + } + } + + return nil +} + +// ContextValidate validate this channel close mutual tx based on the context it is used +func (m *ChannelCloseMutualTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInitiatorAmountFinal(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponderAmountFinal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelCloseMutualTx) contextValidateInitiatorAmountFinal(ctx context.Context, formats strfmt.Registry) error { + + if m.InitiatorAmountFinal != nil { + if err := m.InitiatorAmountFinal.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount_final") + } + return err + } + } + + return nil +} + +func (m *ChannelCloseMutualTx) contextValidateResponderAmountFinal(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponderAmountFinal != nil { + if err := m.ResponderAmountFinal.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount_final") + } + return err + } + } + return nil } diff --git a/swagguard/node/models/channel_close_mutual_tx_json.go b/swagguard/node/models/channel_close_mutual_tx_json.go index f74db661..bcd6f600 100644 --- a/swagguard/node/models/channel_close_mutual_tx_json.go +++ b/swagguard/node/models/channel_close_mutual_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelCloseMutualTxJSON channel close mutual tx JSON +// // swagger:model ChannelCloseMutualTxJSON type ChannelCloseMutualTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelCloseMutualTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelCloseMutualTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelCloseMutualTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelCloseMutualTx = data.ChannelCloseMutualTx @@ -97,8 +96,7 @@ func (m ChannelCloseMutualTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelCloseMutualTx: m.ChannelCloseMutualTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelCloseMutualTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelCloseMutualTxJSON) validateVersion(formats strfmt.Registry) erro return nil } +// ContextValidate validate this channel close mutual tx JSON based on the context it is used +func (m *ChannelCloseMutualTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelCloseMutualTx + if err := m.ChannelCloseMutualTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelCloseMutualTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_close_solo_tx.go b/swagguard/node/models/channel_close_solo_tx.go index 5284949c..99e69bb6 100644 --- a/swagguard/node/models/channel_close_solo_tx.go +++ b/swagguard/node/models/channel_close_solo_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelCloseSoloTx channel close solo tx +// // swagger:model ChannelCloseSoloTx type ChannelCloseSoloTx struct { @@ -25,7 +26,7 @@ type ChannelCloseSoloTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -87,13 +88,23 @@ func (m *ChannelCloseSoloTx) validateChannelID(formats strfmt.Registry) error { func (m *ChannelCloseSoloTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -124,6 +135,34 @@ func (m *ChannelCloseSoloTx) validatePoi(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel close solo tx based on the context it is used +func (m *ChannelCloseSoloTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelCloseSoloTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelCloseSoloTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_close_solo_tx_json.go b/swagguard/node/models/channel_close_solo_tx_json.go index 761055a8..8c18fb51 100644 --- a/swagguard/node/models/channel_close_solo_tx_json.go +++ b/swagguard/node/models/channel_close_solo_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelCloseSoloTxJSON channel close solo tx JSON +// // swagger:model ChannelCloseSoloTxJSON type ChannelCloseSoloTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelCloseSoloTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelCloseSoloTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelCloseSoloTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelCloseSoloTx = data.ChannelCloseSoloTx @@ -97,8 +96,7 @@ func (m ChannelCloseSoloTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelCloseSoloTx: m.ChannelCloseSoloTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelCloseSoloTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelCloseSoloTxJSON) validateVersion(formats strfmt.Registry) error return nil } +// ContextValidate validate this channel close solo tx JSON based on the context it is used +func (m *ChannelCloseSoloTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelCloseSoloTx + if err := m.ChannelCloseSoloTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelCloseSoloTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_create_tx.go b/swagguard/node/models/channel_create_tx.go index 669e5577..55bfa42a 100644 --- a/swagguard/node/models/channel_create_tx.go +++ b/swagguard/node/models/channel_create_tx.go @@ -6,33 +6,31 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelCreateTx channel create tx +// // swagger:model ChannelCreateTx type ChannelCreateTx struct { // channel reserve // Required: true - ChannelReserve utils.BigInt `json:"channel_reserve"` - - // delegate ids - DelegateIds []string `json:"delegate_ids"` + ChannelReserve *utils.BigInt `json:"channel_reserve"` // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // initiator amount // Required: true - InitiatorAmount utils.BigInt `json:"initiator_amount"` + InitiatorAmount *utils.BigInt `json:"initiator_amount"` // initiator id // Required: true @@ -45,13 +43,9 @@ type ChannelCreateTx struct { // nonce Nonce uint64 `json:"nonce,omitempty"` - // push amount - // Required: true - PushAmount utils.BigInt `json:"push_amount"` - // responder amount // Required: true - ResponderAmount utils.BigInt `json:"responder_amount"` + ResponderAmount *utils.BigInt `json:"responder_amount"` // responder id // Required: true @@ -89,10 +83,6 @@ func (m *ChannelCreateTx) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validatePushAmount(formats); err != nil { - res = append(res, err) - } - if err := m.validateResponderAmount(formats); err != nil { res = append(res, err) } @@ -113,37 +103,67 @@ func (m *ChannelCreateTx) Validate(formats strfmt.Registry) error { func (m *ChannelCreateTx) validateChannelReserve(formats strfmt.Registry) error { - if err := m.ChannelReserve.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("channel_reserve") - } + if err := validate.Required("channel_reserve", "body", m.ChannelReserve); err != nil { + return err + } + + if err := validate.Required("channel_reserve", "body", m.ChannelReserve); err != nil { return err } + if m.ChannelReserve != nil { + if err := m.ChannelReserve.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_reserve") + } + return err + } + } + return nil } func (m *ChannelCreateTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } func (m *ChannelCreateTx) validateInitiatorAmount(formats strfmt.Registry) error { - if err := m.InitiatorAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("initiator_amount") - } + if err := validate.Required("initiator_amount", "body", m.InitiatorAmount); err != nil { return err } + if err := validate.Required("initiator_amount", "body", m.InitiatorAmount); err != nil { + return err + } + + if m.InitiatorAmount != nil { + if err := m.InitiatorAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount") + } + return err + } + } + return nil } @@ -165,25 +185,23 @@ func (m *ChannelCreateTx) validateLockPeriod(formats strfmt.Registry) error { return nil } -func (m *ChannelCreateTx) validatePushAmount(formats strfmt.Registry) error { +func (m *ChannelCreateTx) validateResponderAmount(formats strfmt.Registry) error { - if err := m.PushAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("push_amount") - } + if err := validate.Required("responder_amount", "body", m.ResponderAmount); err != nil { return err } - return nil -} - -func (m *ChannelCreateTx) validateResponderAmount(formats strfmt.Registry) error { + if err := validate.Required("responder_amount", "body", m.ResponderAmount); err != nil { + return err + } - if err := m.ResponderAmount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("responder_amount") + if m.ResponderAmount != nil { + if err := m.ResponderAmount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount") + } + return err } - return err } return nil @@ -207,6 +225,88 @@ func (m *ChannelCreateTx) validateStateHash(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel create tx based on the context it is used +func (m *ChannelCreateTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateChannelReserve(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInitiatorAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponderAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelCreateTx) contextValidateChannelReserve(ctx context.Context, formats strfmt.Registry) error { + + if m.ChannelReserve != nil { + if err := m.ChannelReserve.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("channel_reserve") + } + return err + } + } + + return nil +} + +func (m *ChannelCreateTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ChannelCreateTx) contextValidateInitiatorAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.InitiatorAmount != nil { + if err := m.InitiatorAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount") + } + return err + } + } + + return nil +} + +func (m *ChannelCreateTx) contextValidateResponderAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponderAmount != nil { + if err := m.ResponderAmount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelCreateTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_create_tx_json.go b/swagguard/node/models/channel_create_tx_json.go index 0b9a47f9..828e53c8 100644 --- a/swagguard/node/models/channel_create_tx_json.go +++ b/swagguard/node/models/channel_create_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelCreateTxJSON channel create tx JSON +// // swagger:model ChannelCreateTxJSON type ChannelCreateTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelCreateTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelCreateTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelCreateTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelCreateTx = data.ChannelCreateTx @@ -97,8 +96,7 @@ func (m ChannelCreateTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelCreateTx: m.ChannelCreateTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelCreateTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelCreateTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel create tx JSON based on the context it is used +func (m *ChannelCreateTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelCreateTx + if err := m.ChannelCreateTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelCreateTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_deposit_tx.go b/swagguard/node/models/channel_deposit_tx.go index d7714eb6..97d042f0 100644 --- a/swagguard/node/models/channel_deposit_tx.go +++ b/swagguard/node/models/channel_deposit_tx.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelDepositTx channel deposit tx +// // swagger:model ChannelDepositTx type ChannelDepositTx struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // channel id // Required: true @@ -29,7 +30,7 @@ type ChannelDepositTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -91,13 +92,23 @@ func (m *ChannelDepositTx) Validate(formats strfmt.Registry) error { func (m *ChannelDepositTx) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -112,13 +123,23 @@ func (m *ChannelDepositTx) validateChannelID(formats strfmt.Registry) error { func (m *ChannelDepositTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -158,6 +179,52 @@ func (m *ChannelDepositTx) validateStateHash(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel deposit tx based on the context it is used +func (m *ChannelDepositTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelDepositTx) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *ChannelDepositTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelDepositTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_deposit_tx_json.go b/swagguard/node/models/channel_deposit_tx_json.go index b10152ce..bfb7a58f 100644 --- a/swagguard/node/models/channel_deposit_tx_json.go +++ b/swagguard/node/models/channel_deposit_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelDepositTxJSON channel deposit tx JSON +// // swagger:model ChannelDepositTxJSON type ChannelDepositTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelDepositTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelDepositTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelDepositTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelDepositTx = data.ChannelDepositTx @@ -97,8 +96,7 @@ func (m ChannelDepositTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelDepositTx: m.ChannelDepositTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelDepositTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelDepositTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel deposit tx JSON based on the context it is used +func (m *ChannelDepositTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelDepositTx + if err := m.ChannelDepositTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelDepositTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_force_progress_tx.go b/swagguard/node/models/channel_force_progress_tx.go index 08b5a795..6db08cd6 100644 --- a/swagguard/node/models/channel_force_progress_tx.go +++ b/swagguard/node/models/channel_force_progress_tx.go @@ -7,20 +7,20 @@ package models import ( "bytes" + "context" "encoding/json" "io" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelForceProgressTx channel force progress tx +// // swagger:model ChannelForceProgressTx type ChannelForceProgressTx struct { @@ -30,7 +30,7 @@ type ChannelForceProgressTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -75,7 +75,7 @@ func (m *ChannelForceProgressTx) UnmarshalJSON(raw []byte) error { var data struct { ChannelID *string `json:"channel_id"` - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` FromID *string `json:"from_id"` @@ -150,7 +150,7 @@ func (m ChannelForceProgressTx) MarshalJSON() ([]byte, error) { b1, err = json.Marshal(struct { ChannelID *string `json:"channel_id"` - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` FromID *string `json:"from_id"` @@ -184,8 +184,7 @@ func (m ChannelForceProgressTx) MarshalJSON() ([]byte, error) { StateHash: m.StateHash, TTL: m.TTL, - }, - ) + }) if err != nil { return nil, err } @@ -194,8 +193,7 @@ func (m ChannelForceProgressTx) MarshalJSON() ([]byte, error) { }{ Update: m.updateField, - }, - ) + }) if err != nil { return nil, err } @@ -252,13 +250,23 @@ func (m *ChannelForceProgressTx) validateChannelID(formats strfmt.Registry) erro func (m *ChannelForceProgressTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -300,6 +308,10 @@ func (m *ChannelForceProgressTx) validateStateHash(formats strfmt.Registry) erro func (m *ChannelForceProgressTx) validateUpdate(formats strfmt.Registry) error { + if err := validate.Required("update", "body", m.Update()); err != nil { + return err + } + if err := m.Update().Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("update") @@ -310,6 +322,50 @@ func (m *ChannelForceProgressTx) validateUpdate(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel force progress tx based on the context it is used +func (m *ChannelForceProgressTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelForceProgressTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ChannelForceProgressTx) contextValidateUpdate(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Update().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("update") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelForceProgressTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_force_progress_tx_json.go b/swagguard/node/models/channel_force_progress_tx_json.go index 2fcc2fea..1508b372 100644 --- a/swagguard/node/models/channel_force_progress_tx_json.go +++ b/swagguard/node/models/channel_force_progress_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelForceProgressTxJSON channel force progress tx JSON +// // swagger:model ChannelForceProgressTxJSON type ChannelForceProgressTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelForceProgressTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelForceProgressTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelForceProgressTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelForceProgressTx = data.ChannelForceProgressTx @@ -97,8 +96,7 @@ func (m ChannelForceProgressTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelForceProgressTx: m.ChannelForceProgressTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelForceProgressTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelForceProgressTxJSON) validateVersion(formats strfmt.Registry) er return nil } +// ContextValidate validate this channel force progress tx JSON based on the context it is used +func (m *ChannelForceProgressTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelForceProgressTx + if err := m.ChannelForceProgressTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelForceProgressTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_set_delegates_tx.go b/swagguard/node/models/channel_set_delegates_tx.go new file mode 100644 index 00000000..0e04d931 --- /dev/null +++ b/swagguard/node/models/channel_set_delegates_tx.go @@ -0,0 +1,199 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/aeternity/aepp-sdk-go/v9/utils" + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ChannelSetDelegatesTx channel set delegates tx +// +// swagger:model ChannelSetDelegatesTx +type ChannelSetDelegatesTx struct { + + // channel id + // Required: true + ChannelID *string `json:"channel_id"` + + // fee + // Required: true + Fee *utils.BigInt `json:"fee"` + + // from id + // Required: true + FromID *string `json:"from_id"` + + // nonce + Nonce uint64 `json:"nonce,omitempty"` + + // payload + // Required: true + Payload *string `json:"payload"` + + // round + // Required: true + Round *uint64 `json:"round"` + + // state hash + // Required: true + StateHash *string `json:"state_hash"` + + // ttl + TTL uint64 `json:"ttl,omitempty"` +} + +// Validate validates this channel set delegates tx +func (m *ChannelSetDelegatesTx) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateChannelID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFee(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFromID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePayload(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRound(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStateHash(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelSetDelegatesTx) validateChannelID(formats strfmt.Registry) error { + + if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { + return err + } + + return nil +} + +func (m *ChannelSetDelegatesTx) validateFee(formats strfmt.Registry) error { + + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ChannelSetDelegatesTx) validateFromID(formats strfmt.Registry) error { + + if err := validate.Required("from_id", "body", m.FromID); err != nil { + return err + } + + return nil +} + +func (m *ChannelSetDelegatesTx) validatePayload(formats strfmt.Registry) error { + + if err := validate.Required("payload", "body", m.Payload); err != nil { + return err + } + + return nil +} + +func (m *ChannelSetDelegatesTx) validateRound(formats strfmt.Registry) error { + + if err := validate.Required("round", "body", m.Round); err != nil { + return err + } + + return nil +} + +func (m *ChannelSetDelegatesTx) validateStateHash(formats strfmt.Registry) error { + + if err := validate.Required("state_hash", "body", m.StateHash); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this channel set delegates tx based on the context it is used +func (m *ChannelSetDelegatesTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelSetDelegatesTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ChannelSetDelegatesTx) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ChannelSetDelegatesTx) UnmarshalBinary(b []byte) error { + var res ChannelSetDelegatesTx + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/channel_settle_tx.go b/swagguard/node/models/channel_settle_tx.go index aabbb93c..4d0df79a 100644 --- a/swagguard/node/models/channel_settle_tx.go +++ b/swagguard/node/models/channel_settle_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelSettleTx channel settle tx +// // swagger:model ChannelSettleTx type ChannelSettleTx struct { @@ -25,7 +26,7 @@ type ChannelSettleTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -33,7 +34,7 @@ type ChannelSettleTx struct { // initiator amount final // Required: true - InitiatorAmountFinal utils.BigInt `json:"initiator_amount_final"` + InitiatorAmountFinal *utils.BigInt `json:"initiator_amount_final"` // nonce // Required: true @@ -41,7 +42,7 @@ type ChannelSettleTx struct { // responder amount final // Required: true - ResponderAmountFinal utils.BigInt `json:"responder_amount_final"` + ResponderAmountFinal *utils.BigInt `json:"responder_amount_final"` // ttl TTL uint64 `json:"ttl,omitempty"` @@ -92,13 +93,23 @@ func (m *ChannelSettleTx) validateChannelID(formats strfmt.Registry) error { func (m *ChannelSettleTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -113,13 +124,23 @@ func (m *ChannelSettleTx) validateFromID(formats strfmt.Registry) error { func (m *ChannelSettleTx) validateInitiatorAmountFinal(formats strfmt.Registry) error { - if err := m.InitiatorAmountFinal.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("initiator_amount_final") - } + if err := validate.Required("initiator_amount_final", "body", m.InitiatorAmountFinal); err != nil { + return err + } + + if err := validate.Required("initiator_amount_final", "body", m.InitiatorAmountFinal); err != nil { return err } + if m.InitiatorAmountFinal != nil { + if err := m.InitiatorAmountFinal.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount_final") + } + return err + } + } + return nil } @@ -134,13 +155,87 @@ func (m *ChannelSettleTx) validateNonce(formats strfmt.Registry) error { func (m *ChannelSettleTx) validateResponderAmountFinal(formats strfmt.Registry) error { - if err := m.ResponderAmountFinal.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("responder_amount_final") - } + if err := validate.Required("responder_amount_final", "body", m.ResponderAmountFinal); err != nil { + return err + } + + if err := validate.Required("responder_amount_final", "body", m.ResponderAmountFinal); err != nil { return err } + if m.ResponderAmountFinal != nil { + if err := m.ResponderAmountFinal.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount_final") + } + return err + } + } + + return nil +} + +// ContextValidate validate this channel settle tx based on the context it is used +func (m *ChannelSettleTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInitiatorAmountFinal(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponderAmountFinal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelSettleTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ChannelSettleTx) contextValidateInitiatorAmountFinal(ctx context.Context, formats strfmt.Registry) error { + + if m.InitiatorAmountFinal != nil { + if err := m.InitiatorAmountFinal.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator_amount_final") + } + return err + } + } + + return nil +} + +func (m *ChannelSettleTx) contextValidateResponderAmountFinal(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponderAmountFinal != nil { + if err := m.ResponderAmountFinal.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder_amount_final") + } + return err + } + } + return nil } diff --git a/swagguard/node/models/channel_settle_tx_json.go b/swagguard/node/models/channel_settle_tx_json.go index c5d60410..65c82d08 100644 --- a/swagguard/node/models/channel_settle_tx_json.go +++ b/swagguard/node/models/channel_settle_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelSettleTxJSON channel settle tx JSON +// // swagger:model ChannelSettleTxJSON type ChannelSettleTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelSettleTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelSettleTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelSettleTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelSettleTx = data.ChannelSettleTx @@ -97,8 +96,7 @@ func (m ChannelSettleTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelSettleTx: m.ChannelSettleTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelSettleTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelSettleTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel settle tx JSON based on the context it is used +func (m *ChannelSettleTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelSettleTx + if err := m.ChannelSettleTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelSettleTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_sla_s_h_tx.go b/swagguard/node/models/channel_slash_tx.go similarity index 54% rename from swagguard/node/models/channel_sla_s_h_tx.go rename to swagguard/node/models/channel_slash_tx.go index 119e17b1..9de470bd 100644 --- a/swagguard/node/models/channel_sla_s_h_tx.go +++ b/swagguard/node/models/channel_slash_tx.go @@ -6,18 +6,19 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) -// ChannelSLASHTx channel slash tx +// ChannelSlashTx channel slash tx +// // swagger:model ChannelSlashTx -type ChannelSLASHTx struct { +type ChannelSlashTx struct { // channel id // Required: true @@ -25,7 +26,7 @@ type ChannelSLASHTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -47,7 +48,7 @@ type ChannelSLASHTx struct { } // Validate validates this channel slash tx -func (m *ChannelSLASHTx) Validate(formats strfmt.Registry) error { +func (m *ChannelSlashTx) Validate(formats strfmt.Registry) error { var res []error if err := m.validateChannelID(formats); err != nil { @@ -76,7 +77,7 @@ func (m *ChannelSLASHTx) Validate(formats strfmt.Registry) error { return nil } -func (m *ChannelSLASHTx) validateChannelID(formats strfmt.Registry) error { +func (m *ChannelSlashTx) validateChannelID(formats strfmt.Registry) error { if err := validate.Required("channel_id", "body", m.ChannelID); err != nil { return err @@ -85,19 +86,29 @@ func (m *ChannelSLASHTx) validateChannelID(formats strfmt.Registry) error { return nil } -func (m *ChannelSLASHTx) validateFee(formats strfmt.Registry) error { +func (m *ChannelSlashTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } -func (m *ChannelSLASHTx) validateFromID(formats strfmt.Registry) error { +func (m *ChannelSlashTx) validateFromID(formats strfmt.Registry) error { if err := validate.Required("from_id", "body", m.FromID); err != nil { return err @@ -106,7 +117,7 @@ func (m *ChannelSLASHTx) validateFromID(formats strfmt.Registry) error { return nil } -func (m *ChannelSLASHTx) validatePayload(formats strfmt.Registry) error { +func (m *ChannelSlashTx) validatePayload(formats strfmt.Registry) error { if err := validate.Required("payload", "body", m.Payload); err != nil { return err @@ -115,7 +126,7 @@ func (m *ChannelSLASHTx) validatePayload(formats strfmt.Registry) error { return nil } -func (m *ChannelSLASHTx) validatePoi(formats strfmt.Registry) error { +func (m *ChannelSlashTx) validatePoi(formats strfmt.Registry) error { if err := validate.Required("poi", "body", m.Poi); err != nil { return err @@ -124,8 +135,36 @@ func (m *ChannelSLASHTx) validatePoi(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel slash tx based on the context it is used +func (m *ChannelSlashTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelSlashTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation -func (m *ChannelSLASHTx) MarshalBinary() ([]byte, error) { +func (m *ChannelSlashTx) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -133,8 +172,8 @@ func (m *ChannelSLASHTx) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *ChannelSLASHTx) UnmarshalBinary(b []byte) error { - var res ChannelSLASHTx +func (m *ChannelSlashTx) UnmarshalBinary(b []byte) error { + var res ChannelSlashTx if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/swagguard/node/models/channel_sla_s_h_tx_json.go b/swagguard/node/models/channel_slash_tx_json.go similarity index 62% rename from swagguard/node/models/channel_sla_s_h_tx_json.go rename to swagguard/node/models/channel_slash_tx_json.go index 88317a51..68261519 100644 --- a/swagguard/node/models/channel_sla_s_h_tx_json.go +++ b/swagguard/node/models/channel_slash_tx_json.go @@ -7,47 +7,47 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) -// ChannelSLASHTxJSON channel slash tx JSON +// ChannelSlashTxJSON channel slash tx JSON +// // swagger:model ChannelSlashTxJSON -type ChannelSLASHTxJSON struct { +type ChannelSlashTxJSON struct { versionField *uint32 - ChannelSLASHTx + ChannelSlashTx } // Type gets the type of this subtype -func (m *ChannelSLASHTxJSON) Type() string { +func (m *ChannelSlashTxJSON) Type() string { return "ChannelSlashTx" } // SetType sets the type of this subtype -func (m *ChannelSLASHTxJSON) SetType(val string) { - +func (m *ChannelSlashTxJSON) SetType(val string) { } // Version gets the version of this subtype -func (m *ChannelSLASHTxJSON) Version() *uint32 { +func (m *ChannelSlashTxJSON) Version() *uint32 { return m.versionField } // SetVersion sets the version of this subtype -func (m *ChannelSLASHTxJSON) SetVersion(val *uint32) { +func (m *ChannelSlashTxJSON) SetVersion(val *uint32) { m.versionField = val } // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure -func (m *ChannelSLASHTxJSON) UnmarshalJSON(raw []byte) error { +func (m *ChannelSlashTxJSON) UnmarshalJSON(raw []byte) error { var data struct { - ChannelSLASHTx + ChannelSlashTx } buf := bytes.NewBuffer(raw) dec := json.NewDecoder(buf) @@ -72,16 +72,15 @@ func (m *ChannelSLASHTxJSON) UnmarshalJSON(raw []byte) error { return err } - var result ChannelSLASHTxJSON + var result ChannelSlashTxJSON if base.Type != result.Type() { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version - result.ChannelSLASHTx = data.ChannelSLASHTx + result.ChannelSlashTx = data.ChannelSlashTx *m = result @@ -89,16 +88,15 @@ func (m *ChannelSLASHTxJSON) UnmarshalJSON(raw []byte) error { } // MarshalJSON marshals this object with a polymorphic type to a JSON structure -func (m ChannelSLASHTxJSON) MarshalJSON() ([]byte, error) { +func (m ChannelSlashTxJSON) MarshalJSON() ([]byte, error) { var b1, b2, b3 []byte var err error b1, err = json.Marshal(struct { - ChannelSLASHTx + ChannelSlashTx }{ - ChannelSLASHTx: m.ChannelSLASHTx, - }, - ) + ChannelSlashTx: m.ChannelSlashTx, + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelSLASHTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -121,15 +118,15 @@ func (m ChannelSLASHTxJSON) MarshalJSON() ([]byte, error) { } // Validate validates this channel slash tx JSON -func (m *ChannelSLASHTxJSON) Validate(formats strfmt.Registry) error { +func (m *ChannelSlashTxJSON) Validate(formats strfmt.Registry) error { var res []error if err := m.validateVersion(formats); err != nil { res = append(res, err) } - // validation for a type composition with ChannelSLASHTx - if err := m.ChannelSLASHTx.Validate(formats); err != nil { + // validation for a type composition with ChannelSlashTx + if err := m.ChannelSlashTx.Validate(formats); err != nil { res = append(res, err) } @@ -139,7 +136,7 @@ func (m *ChannelSLASHTxJSON) Validate(formats strfmt.Registry) error { return nil } -func (m *ChannelSLASHTxJSON) validateVersion(formats strfmt.Registry) error { +func (m *ChannelSlashTxJSON) validateVersion(formats strfmt.Registry) error { if err := validate.Required("version", "body", m.Version()); err != nil { return err @@ -148,8 +145,23 @@ func (m *ChannelSLASHTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel slash tx JSON based on the context it is used +func (m *ChannelSlashTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelSlashTx + if err := m.ChannelSlashTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation -func (m *ChannelSLASHTxJSON) MarshalBinary() ([]byte, error) { +func (m *ChannelSlashTxJSON) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -157,8 +169,8 @@ func (m *ChannelSLASHTxJSON) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *ChannelSLASHTxJSON) UnmarshalBinary(b []byte) error { - var res ChannelSLASHTxJSON +func (m *ChannelSlashTxJSON) UnmarshalBinary(b []byte) error { + var res ChannelSlashTxJSON if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/swagguard/node/models/channel_snapshot_solo_tx.go b/swagguard/node/models/channel_snapshot_solo_tx.go index fb470f3e..7dcce24b 100644 --- a/swagguard/node/models/channel_snapshot_solo_tx.go +++ b/swagguard/node/models/channel_snapshot_solo_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelSnapshotSoloTx channel snapshot solo tx +// // swagger:model ChannelSnapshotSoloTx type ChannelSnapshotSoloTx struct { @@ -25,7 +26,7 @@ type ChannelSnapshotSoloTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // from id // Required: true @@ -79,13 +80,23 @@ func (m *ChannelSnapshotSoloTx) validateChannelID(formats strfmt.Registry) error func (m *ChannelSnapshotSoloTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -107,6 +118,34 @@ func (m *ChannelSnapshotSoloTx) validatePayload(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel snapshot solo tx based on the context it is used +func (m *ChannelSnapshotSoloTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelSnapshotSoloTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelSnapshotSoloTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_snapshot_solo_tx_json.go b/swagguard/node/models/channel_snapshot_solo_tx_json.go index 41a36b49..6e2aee57 100644 --- a/swagguard/node/models/channel_snapshot_solo_tx_json.go +++ b/swagguard/node/models/channel_snapshot_solo_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelSnapshotSoloTxJSON channel snapshot solo tx JSON +// // swagger:model ChannelSnapshotSoloTxJSON type ChannelSnapshotSoloTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelSnapshotSoloTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelSnapshotSoloTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelSnapshotSoloTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelSnapshotSoloTx = data.ChannelSnapshotSoloTx @@ -97,8 +96,7 @@ func (m ChannelSnapshotSoloTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelSnapshotSoloTx: m.ChannelSnapshotSoloTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelSnapshotSoloTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelSnapshotSoloTxJSON) validateVersion(formats strfmt.Registry) err return nil } +// ContextValidate validate this channel snapshot solo tx JSON based on the context it is used +func (m *ChannelSnapshotSoloTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelSnapshotSoloTx + if err := m.ChannelSnapshotSoloTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelSnapshotSoloTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_withdraw_tx.go b/swagguard/node/models/channel_withdraw_tx.go index d6eb50e3..4df3b3cc 100644 --- a/swagguard/node/models/channel_withdraw_tx.go +++ b/swagguard/node/models/channel_withdraw_tx.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ChannelWithdrawTx channel withdraw tx +// // swagger:model ChannelWithdrawTx type ChannelWithdrawTx struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // channel id // Required: true @@ -29,7 +30,7 @@ type ChannelWithdrawTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce // Required: true @@ -91,13 +92,23 @@ func (m *ChannelWithdrawTx) Validate(formats strfmt.Registry) error { func (m *ChannelWithdrawTx) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -112,13 +123,23 @@ func (m *ChannelWithdrawTx) validateChannelID(formats strfmt.Registry) error { func (m *ChannelWithdrawTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -158,6 +179,52 @@ func (m *ChannelWithdrawTx) validateToID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this channel withdraw tx based on the context it is used +func (m *ChannelWithdrawTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ChannelWithdrawTx) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *ChannelWithdrawTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ChannelWithdrawTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/channel_withdrawal_tx_json.go b/swagguard/node/models/channel_withdrawal_tx_json.go index 955607ef..1a6813df 100644 --- a/swagguard/node/models/channel_withdrawal_tx_json.go +++ b/swagguard/node/models/channel_withdrawal_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ChannelWithdrawalTxJSON channel withdrawal tx JSON +// // swagger:model ChannelWithdrawalTxJSON type ChannelWithdrawalTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ChannelWithdrawalTxJSON) Type() string { // SetType sets the type of this subtype func (m *ChannelWithdrawalTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ChannelWithdrawalTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ChannelWithdrawTx = data.ChannelWithdrawTx @@ -97,8 +96,7 @@ func (m ChannelWithdrawalTxJSON) MarshalJSON() ([]byte, error) { }{ ChannelWithdrawTx: m.ChannelWithdrawTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ChannelWithdrawalTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ChannelWithdrawalTxJSON) validateVersion(formats strfmt.Registry) error return nil } +// ContextValidate validate this channel withdrawal tx JSON based on the context it is used +func (m *ChannelWithdrawalTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ChannelWithdrawTx + if err := m.ChannelWithdrawTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ChannelWithdrawalTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/commitment_id.go b/swagguard/node/models/commitment_id.go index a9fe66fb..c856fa75 100644 --- a/swagguard/node/models/commitment_id.go +++ b/swagguard/node/models/commitment_id.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CommitmentID commitment Id +// // swagger:model CommitmentId type CommitmentID struct { @@ -45,6 +47,11 @@ func (m *CommitmentID) validateCommitmentID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this commitment Id based on context it is used +func (m *CommitmentID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *CommitmentID) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_call_object.go b/swagguard/node/models/contract_call_object.go index 1b7654c5..72fa538c 100644 --- a/swagguard/node/models/contract_call_object.go +++ b/swagguard/node/models/contract_call_object.go @@ -6,18 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ContractCallObject contract call object +// // swagger:model ContractCallObject type ContractCallObject struct { @@ -35,7 +35,7 @@ type ContractCallObject struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // gas used // Required: true @@ -133,13 +133,23 @@ func (m *ContractCallObject) validateContractID(formats strfmt.Registry) error { func (m *ContractCallObject) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } @@ -204,6 +214,56 @@ func (m *ContractCallObject) validateReturnValue(formats strfmt.Registry) error return nil } +// ContextValidate validate this contract call object based on the context it is used +func (m *ContractCallObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLog(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ContractCallObject) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + +func (m *ContractCallObject) contextValidateLog(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Log); i++ { + + if m.Log[i] != nil { + if err := m.Log[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("log" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *ContractCallObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_call_tx.go b/swagguard/node/models/contract_call_tx.go index 514b31f8..b2ecefc6 100644 --- a/swagguard/node/models/contract_call_tx.go +++ b/swagguard/node/models/contract_call_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ContractCallTx contract call tx +// // swagger:model ContractCallTx type ContractCallTx struct { @@ -25,7 +26,7 @@ type ContractCallTx struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -41,7 +42,7 @@ type ContractCallTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // gas // Required: true @@ -49,7 +50,7 @@ type ContractCallTx struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // Caller's nonce Nonce uint64 `json:"nonce,omitempty"` @@ -111,13 +112,23 @@ func (m *ContractCallTx) validateAbiVersion(formats strfmt.Registry) error { func (m *ContractCallTx) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -150,13 +161,23 @@ func (m *ContractCallTx) validateContractID(formats strfmt.Registry) error { func (m *ContractCallTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -171,13 +192,87 @@ func (m *ContractCallTx) validateGas(formats strfmt.Registry) error { func (m *ContractCallTx) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + +// ContextValidate validate this contract call tx based on the context it is used +func (m *ContractCallTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ContractCallTx) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *ContractCallTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ContractCallTx) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } diff --git a/swagguard/node/models/contract_call_tx_json.go b/swagguard/node/models/contract_call_tx_json.go index 9d7e5948..706123f9 100644 --- a/swagguard/node/models/contract_call_tx_json.go +++ b/swagguard/node/models/contract_call_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ContractCallTxJSON contract call tx JSON +// // swagger:model ContractCallTxJSON type ContractCallTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ContractCallTxJSON) Type() string { // SetType sets the type of this subtype func (m *ContractCallTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ContractCallTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ContractCallTx = data.ContractCallTx @@ -97,8 +96,7 @@ func (m ContractCallTxJSON) MarshalJSON() ([]byte, error) { }{ ContractCallTx: m.ContractCallTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ContractCallTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ContractCallTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contract call tx JSON based on the context it is used +func (m *ContractCallTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ContractCallTx + if err := m.ContractCallTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ContractCallTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_create_tx.go b/swagguard/node/models/contract_create_tx.go index 1ccb8229..5227740b 100644 --- a/swagguard/node/models/contract_create_tx.go +++ b/swagguard/node/models/contract_create_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // ContractCreateTx contract create tx +// // swagger:model ContractCreateTx type ContractCreateTx struct { @@ -25,7 +26,7 @@ type ContractCreateTx struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -37,11 +38,11 @@ type ContractCreateTx struct { // deposit // Required: true - Deposit utils.BigInt `json:"deposit"` + Deposit *utils.BigInt `json:"deposit"` // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // gas // Required: true @@ -49,7 +50,7 @@ type ContractCreateTx struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // Owner's nonce Nonce uint64 `json:"nonce,omitempty"` @@ -127,13 +128,23 @@ func (m *ContractCreateTx) validateAbiVersion(formats strfmt.Registry) error { func (m *ContractCreateTx) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -157,25 +168,45 @@ func (m *ContractCreateTx) validateCode(formats strfmt.Registry) error { func (m *ContractCreateTx) validateDeposit(formats strfmt.Registry) error { - if err := m.Deposit.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("deposit") - } + if err := validate.Required("deposit", "body", m.Deposit); err != nil { + return err + } + + if err := validate.Required("deposit", "body", m.Deposit); err != nil { return err } + if m.Deposit != nil { + if err := m.Deposit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deposit") + } + return err + } + } + return nil } func (m *ContractCreateTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -190,13 +221,23 @@ func (m *ContractCreateTx) validateGas(formats strfmt.Registry) error { func (m *ContractCreateTx) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } @@ -218,6 +259,88 @@ func (m *ContractCreateTx) validateVMVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contract create tx based on the context it is used +func (m *ContractCreateTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeposit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ContractCreateTx) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *ContractCreateTx) contextValidateDeposit(ctx context.Context, formats strfmt.Registry) error { + + if m.Deposit != nil { + if err := m.Deposit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deposit") + } + return err + } + } + + return nil +} + +func (m *ContractCreateTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *ContractCreateTx) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *ContractCreateTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_create_tx_json.go b/swagguard/node/models/contract_create_tx_json.go index 8579ad5b..235618c0 100644 --- a/swagguard/node/models/contract_create_tx_json.go +++ b/swagguard/node/models/contract_create_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ContractCreateTxJSON contract create tx JSON +// // swagger:model ContractCreateTxJSON type ContractCreateTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *ContractCreateTxJSON) Type() string { // SetType sets the type of this subtype func (m *ContractCreateTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *ContractCreateTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.ContractCreateTx = data.ContractCreateTx @@ -97,8 +96,7 @@ func (m ContractCreateTxJSON) MarshalJSON() ([]byte, error) { }{ ContractCreateTx: m.ContractCreateTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m ContractCreateTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *ContractCreateTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this contract create tx JSON based on the context it is used +func (m *ContractCreateTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with ContractCreateTx + if err := m.ContractCreateTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *ContractCreateTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_object.go b/swagguard/node/models/contract_object.go index f667c24d..772ccd87 100644 --- a/swagguard/node/models/contract_object.go +++ b/swagguard/node/models/contract_object.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // ContractObject contract object +// // swagger:model ContractObject type ContractObject struct { @@ -147,6 +149,11 @@ func (m *ContractObject) validateVMVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this contract object based on context it is used +func (m *ContractObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *ContractObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/contract_store.go b/swagguard/node/models/contract_store.go deleted file mode 100644 index 9a0b41fd..00000000 --- a/swagguard/node/models/contract_store.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "strconv" - - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/errors" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// ContractStore contract store -// swagger:model ContractStore -type ContractStore struct { - - // store - // Required: true - Store []*ContractStoreStoreItems0 `json:"store"` -} - -// Validate validates this contract store -func (m *ContractStore) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateStore(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *ContractStore) validateStore(formats strfmt.Registry) error { - - if err := validate.Required("store", "body", m.Store); err != nil { - return err - } - - for i := 0; i < len(m.Store); i++ { - if swag.IsZero(m.Store[i]) { // not required - continue - } - - if m.Store[i] != nil { - if err := m.Store[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("store" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *ContractStore) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ContractStore) UnmarshalBinary(b []byte) error { - var res ContractStore - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// ContractStoreStoreItems0 contract store store items0 -// swagger:model ContractStoreStoreItems0 -type ContractStoreStoreItems0 struct { - - // key - Key string `json:"key,omitempty"` - - // value - Value string `json:"value,omitempty"` -} - -// Validate validates this contract store store items0 -func (m *ContractStoreStoreItems0) Validate(formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ContractStoreStoreItems0) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ContractStoreStoreItems0) UnmarshalBinary(b []byte) error { - var res ContractStoreStoreItems0 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/swagguard/node/models/create_contract_unsigned_tx.go b/swagguard/node/models/create_contract_unsigned_tx.go index 700a6072..b6a33aa3 100644 --- a/swagguard/node/models/create_contract_unsigned_tx.go +++ b/swagguard/node/models/create_contract_unsigned_tx.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateContractUnsignedTx create contract unsigned tx +// // swagger:model CreateContractUnsignedTx type CreateContractUnsignedTx struct { UnsignedTx @@ -54,7 +56,6 @@ func (m CreateContractUnsignedTx) MarshalJSON() ([]byte, error) { return nil, err } _parts = append(_parts, aO0) - var dataAO1 struct { ContractID *string `json:"contract_id"` } @@ -66,7 +67,6 @@ func (m CreateContractUnsignedTx) MarshalJSON() ([]byte, error) { return nil, errAO1 } _parts = append(_parts, jsonDataAO1) - return swag.ConcatJSON(_parts...), nil } @@ -98,6 +98,21 @@ func (m *CreateContractUnsignedTx) validateContractID(formats strfmt.Registry) e return nil } +// ContextValidate validate this create contract unsigned tx based on the context it is used +func (m *CreateContractUnsignedTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with UnsignedTx + if err := m.UnsignedTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *CreateContractUnsignedTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/delegates_list.go b/swagguard/node/models/delegates_list.go new file mode 100644 index 00000000..7bcc9720 --- /dev/null +++ b/swagguard/node/models/delegates_list.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// DelegatesList delegates list +// +// swagger:model DelegatesList +type DelegatesList []string + +// Validate validates this delegates list +func (m DelegatesList) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this delegates list based on context it is used +func (m DelegatesList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/delegates_object.go b/swagguard/node/models/delegates_object.go new file mode 100644 index 00000000..530ae981 --- /dev/null +++ b/swagguard/node/models/delegates_object.go @@ -0,0 +1,134 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DelegatesObject delegates object +// +// swagger:model DelegatesObject +type DelegatesObject struct { + + // Initiator's delegates + Initiator DelegatesList `json:"initiator,omitempty"` + + // Responder's delegates + Responder DelegatesList `json:"responder,omitempty"` +} + +// Validate validates this delegates object +func (m *DelegatesObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInitiator(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResponder(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DelegatesObject) validateInitiator(formats strfmt.Registry) error { + if swag.IsZero(m.Initiator) { // not required + return nil + } + + if err := m.Initiator.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator") + } + return err + } + + return nil +} + +func (m *DelegatesObject) validateResponder(formats strfmt.Registry) error { + if swag.IsZero(m.Responder) { // not required + return nil + } + + if err := m.Responder.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder") + } + return err + } + + return nil +} + +// ContextValidate validate this delegates object based on the context it is used +func (m *DelegatesObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInitiator(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponder(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DelegatesObject) contextValidateInitiator(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Initiator.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("initiator") + } + return err + } + + return nil +} + +func (m *DelegatesObject) contextValidateResponder(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Responder.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("responder") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DelegatesObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DelegatesObject) UnmarshalBinary(b []byte) error { + var res DelegatesObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/dry_run_account.go b/swagguard/node/models/dry_run_account.go index 89baa1de..7bb4401d 100644 --- a/swagguard/node/models/dry_run_account.go +++ b/swagguard/node/models/dry_run_account.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // DryRunAccount dry run account +// // swagger:model DryRunAccount type DryRunAccount struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // pub key // Required: true @@ -48,13 +49,23 @@ func (m *DryRunAccount) Validate(formats strfmt.Registry) error { func (m *DryRunAccount) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -67,6 +78,34 @@ func (m *DryRunAccount) validatePubKey(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run account based on the context it is used +func (m *DryRunAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunAccount) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunAccount) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_call_context.go b/swagguard/node/models/dry_run_call_context.go index 287c1146..b4ae5f8f 100644 --- a/swagguard/node/models/dry_run_call_context.go +++ b/swagguard/node/models/dry_run_call_context.go @@ -6,18 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // DryRunCallContext dry run call context +// // swagger:model DryRunCallContext type DryRunCallContext struct { // This call will have effects on the next call in this dry-run (or not) Stateful bool `json:"stateful,omitempty"` + // tx + Tx string `json:"tx,omitempty"` + // tx hash TxHash string `json:"tx_hash,omitempty"` } @@ -27,6 +32,11 @@ func (m *DryRunCallContext) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate validates this dry run call context based on context it is used +func (m *DryRunCallContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *DryRunCallContext) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_call_req.go b/swagguard/node/models/dry_run_call_req.go index 16793039..b66ba512 100644 --- a/swagguard/node/models/dry_run_call_req.go +++ b/swagguard/node/models/dry_run_call_req.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // DryRunCallReq dry run call req +// // swagger:model DryRunCallReq type DryRunCallReq struct { @@ -77,7 +78,6 @@ func (m *DryRunCallReq) Validate(formats strfmt.Registry) error { } func (m *DryRunCallReq) validateAmount(formats strfmt.Registry) error { - if swag.IsZero(m.Amount) { // not required return nil } @@ -102,7 +102,6 @@ func (m *DryRunCallReq) validateCalldata(formats strfmt.Registry) error { } func (m *DryRunCallReq) validateContext(formats strfmt.Registry) error { - if swag.IsZero(m.Context) { // not required return nil } @@ -129,7 +128,6 @@ func (m *DryRunCallReq) validateContract(formats strfmt.Registry) error { } func (m *DryRunCallReq) validateGas(formats strfmt.Registry) error { - if swag.IsZero(m.Gas) { // not required return nil } @@ -144,6 +142,66 @@ func (m *DryRunCallReq) validateGas(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run call req based on the context it is used +func (m *DryRunCallReq) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContext(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGas(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunCallReq) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + + return nil +} + +func (m *DryRunCallReq) contextValidateContext(ctx context.Context, formats strfmt.Registry) error { + + if m.Context != nil { + if err := m.Context.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context") + } + return err + } + } + + return nil +} + +func (m *DryRunCallReq) contextValidateGas(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Gas.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunCallReq) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_input.go b/swagguard/node/models/dry_run_input.go index d4ace9ef..be8595ec 100644 --- a/swagguard/node/models/dry_run_input.go +++ b/swagguard/node/models/dry_run_input.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DryRunInput dry run input +// // swagger:model DryRunInput type DryRunInput struct { @@ -25,6 +26,9 @@ type DryRunInput struct { // top Top string `json:"top,omitempty"` + // Collect and return on-chain tx events that would result from the call + TxEvents *bool `json:"tx_events,omitempty"` + // Txs // Required: true Txs []*DryRunInputItem `json:"txs"` @@ -49,7 +53,6 @@ func (m *DryRunInput) Validate(formats strfmt.Registry) error { } func (m *DryRunInput) validateAccounts(formats strfmt.Registry) error { - if swag.IsZero(m.Accounts) { // not required return nil } @@ -98,6 +101,60 @@ func (m *DryRunInput) validateTxs(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run input based on the context it is used +func (m *DryRunInput) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTxs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunInput) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Accounts); i++ { + + if m.Accounts[i] != nil { + if err := m.Accounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DryRunInput) contextValidateTxs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Txs); i++ { + + if m.Txs[i] != nil { + if err := m.Txs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("txs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunInput) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_input_item.go b/swagguard/node/models/dry_run_input_item.go index 6f37a209..868df05b 100644 --- a/swagguard/node/models/dry_run_input_item.go +++ b/swagguard/node/models/dry_run_input_item.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // DryRunInputItem dry run input item +// // swagger:model DryRunInputItem type DryRunInputItem struct { @@ -38,7 +40,6 @@ func (m *DryRunInputItem) Validate(formats strfmt.Registry) error { } func (m *DryRunInputItem) validateCallReq(formats strfmt.Registry) error { - if swag.IsZero(m.CallReq) { // not required return nil } @@ -55,6 +56,34 @@ func (m *DryRunInputItem) validateCallReq(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run input item based on the context it is used +func (m *DryRunInputItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCallReq(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunInputItem) contextValidateCallReq(ctx context.Context, formats strfmt.Registry) error { + + if m.CallReq != nil { + if err := m.CallReq.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("call_req") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunInputItem) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_result.go b/swagguard/node/models/dry_run_result.go index f1f58648..a7899cda 100644 --- a/swagguard/node/models/dry_run_result.go +++ b/swagguard/node/models/dry_run_result.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DryRunResult dry run result +// // swagger:model DryRunResult type DryRunResult struct { @@ -55,7 +57,6 @@ func (m *DryRunResult) Validate(formats strfmt.Registry) error { } func (m *DryRunResult) validateCallObj(formats strfmt.Registry) error { - if swag.IsZero(m.CallObj) { // not required return nil } @@ -90,6 +91,34 @@ func (m *DryRunResult) validateType(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run result based on the context it is used +func (m *DryRunResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCallObj(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunResult) contextValidateCallObj(ctx context.Context, formats strfmt.Registry) error { + + if m.CallObj != nil { + if err := m.CallObj.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("call_obj") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunResult) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/dry_run_results.go b/swagguard/node/models/dry_run_results.go index 485c9a49..6890b095 100644 --- a/swagguard/node/models/dry_run_results.go +++ b/swagguard/node/models/dry_run_results.go @@ -6,22 +6,26 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // DryRunResults dry run results +// // swagger:model DryRunResults type DryRunResults struct { // results // Required: true Results []*DryRunResult `json:"results"` + + // on-chain tx events + TxEvents []TxEvent `json:"tx_events"` } // Validate validates this dry run results @@ -63,6 +67,38 @@ func (m *DryRunResults) validateResults(formats strfmt.Registry) error { return nil } +// ContextValidate validate this dry run results based on the context it is used +func (m *DryRunResults) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResults(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DryRunResults) contextValidateResults(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Results); i++ { + + if m.Results[i] != nil { + if err := m.Results[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("results" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *DryRunResults) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/encoded_byte_array.go b/swagguard/node/models/encoded_byte_array.go index 695cf10d..4dd72e42 100644 --- a/swagguard/node/models/encoded_byte_array.go +++ b/swagguard/node/models/encoded_byte_array.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // EncodedByteArray Base64Check encoded tagged byte array +// // swagger:model EncodedByteArray type EncodedByteArray string @@ -17,3 +20,8 @@ type EncodedByteArray string func (m EncodedByteArray) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this encoded byte array based on context it is used +func (m EncodedByteArray) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/encoded_hash.go b/swagguard/node/models/encoded_hash.go index 07010b70..332995ee 100644 --- a/swagguard/node/models/encoded_hash.go +++ b/swagguard/node/models/encoded_hash.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // EncodedHash Base58Check encoded tagged hash +// // swagger:model EncodedHash type EncodedHash string @@ -17,3 +20,8 @@ type EncodedHash string func (m EncodedHash) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this encoded hash based on context it is used +func (m EncodedHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/encoded_pubkey.go b/swagguard/node/models/encoded_pubkey.go index f1cb66ba..6e928ada 100644 --- a/swagguard/node/models/encoded_pubkey.go +++ b/swagguard/node/models/encoded_pubkey.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // EncodedPubkey Base58Check encoded tagged pubkey +// // swagger:model EncodedPubkey type EncodedPubkey string @@ -17,3 +20,8 @@ type EncodedPubkey string func (m EncodedPubkey) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this encoded pubkey based on context it is used +func (m EncodedPubkey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/encoded_value.go b/swagguard/node/models/encoded_value.go index 18d7d01a..c2279078 100644 --- a/swagguard/node/models/encoded_value.go +++ b/swagguard/node/models/encoded_value.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // EncodedValue Base58Check encoded tagged value +// // swagger:model EncodedValue type EncodedValue string @@ -17,3 +20,8 @@ type EncodedValue string func (m EncodedValue) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this encoded value based on context it is used +func (m EncodedValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/error.go b/swagguard/node/models/error.go index c2b8a818..1eb29c93 100644 --- a/swagguard/node/models/error.go +++ b/swagguard/node/models/error.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Error error +// // swagger:model Error type Error struct { @@ -45,6 +47,11 @@ func (m *Error) validateReason(formats strfmt.Registry) error { return nil } +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Error) MarshalBinary() ([]byte, error) { if m == nil { @@ -63,6 +70,7 @@ func (m *Error) UnmarshalBinary(b []byte) error { return nil } +// TODO: This is not auto generated, it should be avoided func (m *Error) String() string { return *m.Reason } diff --git a/swagguard/node/models/event.go b/swagguard/node/models/event.go index b5241b1a..f1258680 100644 --- a/swagguard/node/models/event.go +++ b/swagguard/node/models/event.go @@ -6,18 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // Event event +// // swagger:model Event type Event struct { @@ -94,6 +94,36 @@ func (m *Event) validateTopics(formats strfmt.Registry) error { return nil } +// ContextValidate validate this event based on the context it is used +func (m *Event) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTopics(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Event) contextValidateTopics(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Topics); i++ { + + if err := m.Topics[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("topics" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Event) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/g_a_attach_tx.go b/swagguard/node/models/g_a_attach_tx.go index 91a2d91f..cd155dc3 100644 --- a/swagguard/node/models/g_a_attach_tx.go +++ b/swagguard/node/models/g_a_attach_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // GAAttachTx g a attach tx +// // swagger:model GAAttachTx type GAAttachTx struct { @@ -25,7 +26,7 @@ type GAAttachTx struct { // Contract authorization function hash (hex encoded) // Required: true - // Pattern: ^(0x|0X)?[a-fA-F0-9]+$' + // Pattern: ^(0x|0X)?[a-fA-F0-9]+$ AuthFun *string `json:"auth_fun"` // Contract call data @@ -38,7 +39,7 @@ type GAAttachTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // gas // Required: true @@ -46,7 +47,7 @@ type GAAttachTx struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // Owner's nonce Nonce uint64 `json:"nonce,omitempty"` @@ -124,7 +125,7 @@ func (m *GAAttachTx) validateAuthFun(formats strfmt.Registry) error { return err } - if err := validate.Pattern("auth_fun", "body", string(*m.AuthFun), `^(0x|0X)?[a-fA-F0-9]+$'`); err != nil { + if err := validate.Pattern("auth_fun", "body", *m.AuthFun, `^(0x|0X)?[a-fA-F0-9]+$`); err != nil { return err } @@ -151,13 +152,23 @@ func (m *GAAttachTx) validateCode(formats strfmt.Registry) error { func (m *GAAttachTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -172,13 +183,23 @@ func (m *GAAttachTx) validateGas(formats strfmt.Registry) error { func (m *GAAttachTx) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } @@ -200,6 +221,52 @@ func (m *GAAttachTx) validateVMVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this g a attach tx based on the context it is used +func (m *GAAttachTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GAAttachTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *GAAttachTx) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GAAttachTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/g_a_attach_tx_json.go b/swagguard/node/models/g_a_attach_tx_json.go index 74b07864..fe217f8b 100644 --- a/swagguard/node/models/g_a_attach_tx_json.go +++ b/swagguard/node/models/g_a_attach_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // GAAttachTxJSON g a attach tx JSON +// // swagger:model GAAttachTxJSON type GAAttachTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *GAAttachTxJSON) Type() string { // SetType sets the type of this subtype func (m *GAAttachTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *GAAttachTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.GAAttachTx = data.GAAttachTx @@ -97,8 +96,7 @@ func (m GAAttachTxJSON) MarshalJSON() ([]byte, error) { }{ GAAttachTx: m.GAAttachTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m GAAttachTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *GAAttachTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this g a attach tx JSON based on the context it is used +func (m *GAAttachTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with GAAttachTx + if err := m.GAAttachTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *GAAttachTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/g_a_meta_tx.go b/swagguard/node/models/g_a_meta_tx.go index ad1ebe7f..90841413 100644 --- a/swagguard/node/models/g_a_meta_tx.go +++ b/swagguard/node/models/g_a_meta_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // GAMetaTx g a meta tx +// // swagger:model GAMetaTx type GAMetaTx struct { @@ -29,7 +30,7 @@ type GAMetaTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // Account owner pub_key // Required: true @@ -41,7 +42,7 @@ type GAMetaTx struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // ttl TTL uint64 `json:"ttl,omitempty"` @@ -109,13 +110,23 @@ func (m *GAMetaTx) validateAuthData(formats strfmt.Registry) error { func (m *GAMetaTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -139,13 +150,23 @@ func (m *GAMetaTx) validateGas(formats strfmt.Registry) error { func (m *GAMetaTx) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } @@ -167,6 +188,70 @@ func (m *GAMetaTx) validateTx(formats strfmt.Registry) error { return nil } +// ContextValidate validate this g a meta tx based on the context it is used +func (m *GAMetaTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTx(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GAMetaTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *GAMetaTx) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + +func (m *GAMetaTx) contextValidateTx(ctx context.Context, formats strfmt.Registry) error { + + if m.Tx != nil { + if err := m.Tx.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GAMetaTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/g_a_meta_tx_json.go b/swagguard/node/models/g_a_meta_tx_json.go index f92a18d8..66d713e8 100644 --- a/swagguard/node/models/g_a_meta_tx_json.go +++ b/swagguard/node/models/g_a_meta_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // GAMetaTxJSON g a meta tx JSON +// // swagger:model GAMetaTxJSON type GAMetaTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *GAMetaTxJSON) Type() string { // SetType sets the type of this subtype func (m *GAMetaTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *GAMetaTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.GAMetaTx = data.GAMetaTx @@ -97,8 +96,7 @@ func (m GAMetaTxJSON) MarshalJSON() ([]byte, error) { }{ GAMetaTx: m.GAMetaTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m GAMetaTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *GAMetaTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this g a meta tx JSON based on the context it is used +func (m *GAMetaTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with GAMetaTx + if err := m.GAMetaTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *GAMetaTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/g_a_object.go b/swagguard/node/models/g_a_object.go index 0d3a8a38..84461387 100644 --- a/swagguard/node/models/g_a_object.go +++ b/swagguard/node/models/g_a_object.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // GAObject g a object +// // swagger:model GAObject type GAObject struct { @@ -25,7 +26,7 @@ type GAObject struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` // gas used // Required: true @@ -96,13 +97,23 @@ func (m *GAObject) validateCallerID(formats strfmt.Registry) error { func (m *GAObject) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } @@ -125,7 +136,6 @@ func (m *GAObject) validateHeight(formats strfmt.Registry) error { } func (m *GAObject) validateInnerObject(formats strfmt.Registry) error { - if swag.IsZero(m.InnerObject) { // not required return nil } @@ -160,6 +170,52 @@ func (m *GAObject) validateReturnValue(formats strfmt.Registry) error { return nil } +// ContextValidate validate this g a object based on the context it is used +func (m *GAObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInnerObject(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GAObject) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + +func (m *GAObject) contextValidateInnerObject(ctx context.Context, formats strfmt.Registry) error { + + if m.InnerObject != nil { + if err := m.InnerObject.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("inner_object") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *GAObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/generation.go b/swagguard/node/models/generation.go index e0d2115f..b01eb87e 100644 --- a/swagguard/node/models/generation.go +++ b/swagguard/node/models/generation.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Generation generation +// // swagger:model Generation type Generation struct { @@ -71,6 +73,34 @@ func (m *Generation) validateMicroBlocks(formats strfmt.Registry) error { return nil } +// ContextValidate validate this generation based on the context it is used +func (m *Generation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyBlock(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Generation) contextValidateKeyBlock(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyBlock != nil { + if err := m.KeyBlock.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("key_block") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *Generation) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/generic_signed_tx.go b/swagguard/node/models/generic_signed_tx.go index c892cdb1..ebf8f38a 100644 --- a/swagguard/node/models/generic_signed_tx.go +++ b/swagguard/node/models/generic_signed_tx.go @@ -7,20 +7,20 @@ package models import ( "bytes" + "context" "encoding/json" "io" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // GenericSignedTx generic signed tx +// // swagger:model GenericSignedTx type GenericSignedTx struct { @@ -30,7 +30,7 @@ type GenericSignedTx struct { // block height // Required: true - BlockHeight utils.BigInt `json:"block_height"` + BlockHeight *utils.BigInt `json:"block_height"` // hash // Required: true @@ -57,7 +57,7 @@ func (m *GenericSignedTx) UnmarshalJSON(raw []byte) error { var data struct { BlockHash *string `json:"block_hash"` - BlockHeight utils.BigInt `json:"block_height"` + BlockHeight *utils.BigInt `json:"block_height"` Hash *string `json:"hash"` @@ -107,7 +107,7 @@ func (m GenericSignedTx) MarshalJSON() ([]byte, error) { b1, err = json.Marshal(struct { BlockHash *string `json:"block_hash"` - BlockHeight utils.BigInt `json:"block_height"` + BlockHeight *utils.BigInt `json:"block_height"` Hash *string `json:"hash"` @@ -121,8 +121,7 @@ func (m GenericSignedTx) MarshalJSON() ([]byte, error) { Hash: m.Hash, Signatures: m.Signatures, - }, - ) + }) if err != nil { return nil, err } @@ -131,8 +130,7 @@ func (m GenericSignedTx) MarshalJSON() ([]byte, error) { }{ Tx: m.txField, - }, - ) + }) if err != nil { return nil, err } @@ -177,13 +175,23 @@ func (m *GenericSignedTx) validateBlockHash(formats strfmt.Registry) error { func (m *GenericSignedTx) validateBlockHeight(formats strfmt.Registry) error { - if err := m.BlockHeight.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("block_height") - } + if err := validate.Required("block_height", "body", m.BlockHeight); err != nil { return err } + if err := validate.Required("block_height", "body", m.BlockHeight); err != nil { + return err + } + + if m.BlockHeight != nil { + if err := m.BlockHeight.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("block_height") + } + return err + } + } + return nil } @@ -198,6 +206,10 @@ func (m *GenericSignedTx) validateHash(formats strfmt.Registry) error { func (m *GenericSignedTx) validateTx(formats strfmt.Registry) error { + if err := validate.Required("tx", "body", m.Tx()); err != nil { + return err + } + if err := m.Tx().Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("tx") @@ -208,6 +220,50 @@ func (m *GenericSignedTx) validateTx(formats strfmt.Registry) error { return nil } +// ContextValidate validate this generic signed tx based on the context it is used +func (m *GenericSignedTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBlockHeight(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTx(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GenericSignedTx) contextValidateBlockHeight(ctx context.Context, formats strfmt.Registry) error { + + if m.BlockHeight != nil { + if err := m.BlockHeight.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("block_height") + } + return err + } + } + + return nil +} + +func (m *GenericSignedTx) contextValidateTx(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Tx().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *GenericSignedTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/generic_tx.go b/swagguard/node/models/generic_tx.go index eb57b659..69ff57c4 100644 --- a/swagguard/node/models/generic_tx.go +++ b/swagguard/node/models/generic_tx.go @@ -7,21 +7,23 @@ package models import ( "bytes" + "context" "encoding/json" "io" "io/ioutil" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // GenericTx generic tx +// // swagger:discriminator GenericTx type type GenericTx interface { runtime.Validatable + runtime.ContextValidatable // type // Required: true @@ -32,6 +34,9 @@ type GenericTx interface { // Required: true Version() *uint32 SetVersion(*uint32) + + // AdditionalProperties in base type shoud be handled just like regular properties + // At this moment, the base type property is pushed down to the subtype } type genericTx struct { @@ -47,7 +52,6 @@ func (m *genericTx) Type() string { // SetType sets the type of this polymorphic type func (m *genericTx) SetType(val string) { - } // Version gets the version of this polymorphic type @@ -112,171 +116,152 @@ func unmarshalGenericTx(data []byte, consumer runtime.Consumer) (GenericTx, erro return nil, err } return &result, nil - case "ChannelCloseSoloTxJSON", "ChannelCloseSoloTx": var result ChannelCloseSoloTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelCreateTxJSON", "ChannelCreateTx": var result ChannelCreateTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelDepositTxJSON", "ChannelDepositTx": var result ChannelDepositTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelForceProgressTxJSON", "ChannelForceProgressTx": var result ChannelForceProgressTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelSettleTxJSON", "ChannelSettleTx": var result ChannelSettleTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelSlashTxJSON", "ChannelSlashTx": - var result ChannelSLASHTxJSON + var result ChannelSlashTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelSnapshotSoloTxJSON", "ChannelSnapshotSoloTx": var result ChannelSnapshotSoloTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ChannelWithdrawalTxJSON", "ChannelWithdrawalTx": var result ChannelWithdrawalTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ContractCallTxJSON", "ContractCallTx": var result ContractCallTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "ContractCreateTxJSON", "ContractCreateTx": var result ContractCreateTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "GAAttachTxJSON", "GAAttachTx": var result GAAttachTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "GAMetaTxJSON", "GAMetaTx": var result GAMetaTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "GenericTx": var result genericTx if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "NameClaimTxJSON", "NameClaimTx": var result NameClaimTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "NamePreclaimTxJSON", "NamePreclaimTx": var result NamePreclaimTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "NameRevokeTxJSON", "NameRevokeTx": var result NameRevokeTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "NameTransferTxJSON", "NameTransferTx": var result NameTransferTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "NameUpdateTxJSON", "NameUpdateTx": var result NameUpdateTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OracleExtendTxJSON", "OracleExtendTx": var result OracleExtendTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OracleQueryTxJSON", "OracleQueryTx": var result OracleQueryTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OracleRegisterTxJSON", "OracleRegisterTx": var result OracleRegisterTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OracleRespondTxJSON", "OracleRespondTx": var result OracleRespondTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - + case "PayingForTxJSON", "PayingForTx": + var result PayingForTxJSON + if err := consumer.Consume(buf2, &result); err != nil { + return nil, err + } + return &result, nil case "SpendTxJSON", "SpendTx": var result SpendTxJSON if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - } return nil, errors.New(422, "invalid type value: %q", getType.Type) - } // Validate validates this generic tx @@ -301,3 +286,8 @@ func (m *genericTx) validateVersion(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this generic tx based on context it is used +func (m *genericTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/generic_txs.go b/swagguard/node/models/generic_txs.go index ca2820ec..11843292 100644 --- a/swagguard/node/models/generic_txs.go +++ b/swagguard/node/models/generic_txs.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // GenericTxs generic txs +// // swagger:model GenericTxs type GenericTxs struct { @@ -63,6 +64,38 @@ func (m *GenericTxs) validateTransactions(formats strfmt.Registry) error { return nil } +// ContextValidate validate this generic txs based on the context it is used +func (m *GenericTxs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTransactions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GenericTxs) contextValidateTransactions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Transactions); i++ { + + if m.Transactions[i] != nil { + if err := m.Transactions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("transactions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *GenericTxs) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/key_block.go b/swagguard/node/models/key_block.go index e663ad5e..f6657635 100644 --- a/swagguard/node/models/key_block.go +++ b/swagguard/node/models/key_block.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // KeyBlock key block +// // swagger:model KeyBlock type KeyBlock struct { @@ -172,7 +174,6 @@ func (m *KeyBlock) validateMiner(formats strfmt.Registry) error { } func (m *KeyBlock) validatePow(formats strfmt.Registry) error { - if swag.IsZero(m.Pow) { // not required return nil } @@ -241,6 +242,32 @@ func (m *KeyBlock) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this key block based on the context it is used +func (m *KeyBlock) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePow(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KeyBlock) contextValidatePow(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Pow.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pow") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *KeyBlock) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/key_block_or_micro_block_header.go b/swagguard/node/models/key_block_or_micro_block_header.go index 4c78e813..a298451e 100644 --- a/swagguard/node/models/key_block_or_micro_block_header.go +++ b/swagguard/node/models/key_block_or_micro_block_header.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // KeyBlockOrMicroBlockHeader key block or micro block header +// // swagger:model KeyBlockOrMicroBlockHeader type KeyBlockOrMicroBlockHeader struct { @@ -42,7 +44,6 @@ func (m *KeyBlockOrMicroBlockHeader) Validate(formats strfmt.Registry) error { } func (m *KeyBlockOrMicroBlockHeader) validateKeyBlock(formats strfmt.Registry) error { - if swag.IsZero(m.KeyBlock) { // not required return nil } @@ -60,7 +61,6 @@ func (m *KeyBlockOrMicroBlockHeader) validateKeyBlock(formats strfmt.Registry) e } func (m *KeyBlockOrMicroBlockHeader) validateMicroBlock(formats strfmt.Registry) error { - if swag.IsZero(m.MicroBlock) { // not required return nil } @@ -77,6 +77,52 @@ func (m *KeyBlockOrMicroBlockHeader) validateMicroBlock(formats strfmt.Registry) return nil } +// ContextValidate validate this key block or micro block header based on the context it is used +func (m *KeyBlockOrMicroBlockHeader) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyBlock(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMicroBlock(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *KeyBlockOrMicroBlockHeader) contextValidateKeyBlock(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyBlock != nil { + if err := m.KeyBlock.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("key_block") + } + return err + } + } + + return nil +} + +func (m *KeyBlockOrMicroBlockHeader) contextValidateMicroBlock(ctx context.Context, formats strfmt.Registry) error { + + if m.MicroBlock != nil { + if err := m.MicroBlock.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("micro_block") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *KeyBlockOrMicroBlockHeader) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/micro_block_header.go b/swagguard/node/models/micro_block_header.go index 590ed2f8..ed892c6f 100644 --- a/swagguard/node/models/micro_block_header.go +++ b/swagguard/node/models/micro_block_header.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // MicroBlockHeader micro block header +// // swagger:model MicroBlockHeader type MicroBlockHeader struct { @@ -198,6 +200,11 @@ func (m *MicroBlockHeader) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this micro block header based on context it is used +func (m *MicroBlockHeader) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *MicroBlockHeader) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_claim_tx.go b/swagguard/node/models/name_claim_tx.go index dfef6e8e..58b9eec4 100644 --- a/swagguard/node/models/name_claim_tx.go +++ b/swagguard/node/models/name_claim_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // NameClaimTx name claim tx +// // swagger:model NameClaimTx type NameClaimTx struct { @@ -25,7 +26,7 @@ type NameClaimTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // name // Required: true @@ -36,7 +37,7 @@ type NameClaimTx struct { // name salt // Required: true - NameSalt utils.BigInt `json:"name_salt"` + NameSalt *utils.BigInt `json:"name_salt"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -86,13 +87,23 @@ func (m *NameClaimTx) validateAccountID(formats strfmt.Registry) error { func (m *NameClaimTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -106,7 +117,6 @@ func (m *NameClaimTx) validateName(formats strfmt.Registry) error { } func (m *NameClaimTx) validateNameFee(formats strfmt.Registry) error { - if swag.IsZero(m.NameFee) { // not required return nil } @@ -123,9 +133,67 @@ func (m *NameClaimTx) validateNameFee(formats strfmt.Registry) error { func (m *NameClaimTx) validateNameSalt(formats strfmt.Registry) error { - if err := m.NameSalt.Validate(formats); err != nil { + if err := validate.Required("name_salt", "body", m.NameSalt); err != nil { + return err + } + + if err := validate.Required("name_salt", "body", m.NameSalt); err != nil { + return err + } + + if m.NameSalt != nil { + if err := m.NameSalt.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("name_salt") + } + return err + } + } + + return nil +} + +// ContextValidate validate this name claim tx based on the context it is used +func (m *NameClaimTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNameFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNameSalt(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NameClaimTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *NameClaimTx) contextValidateNameFee(ctx context.Context, formats strfmt.Registry) error { + + if err := m.NameFee.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("name_salt") + return ve.ValidateName("name_fee") } return err } @@ -133,6 +201,20 @@ func (m *NameClaimTx) validateNameSalt(formats strfmt.Registry) error { return nil } +func (m *NameClaimTx) contextValidateNameSalt(ctx context.Context, formats strfmt.Registry) error { + + if m.NameSalt != nil { + if err := m.NameSalt.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("name_salt") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NameClaimTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_claim_tx_json.go b/swagguard/node/models/name_claim_tx_json.go index db89af88..d4e61045 100644 --- a/swagguard/node/models/name_claim_tx_json.go +++ b/swagguard/node/models/name_claim_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameClaimTxJSON name claim tx JSON +// // swagger:model NameClaimTxJSON type NameClaimTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *NameClaimTxJSON) Type() string { // SetType sets the type of this subtype func (m *NameClaimTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *NameClaimTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.NameClaimTx = data.NameClaimTx @@ -97,8 +96,7 @@ func (m NameClaimTxJSON) MarshalJSON() ([]byte, error) { }{ NameClaimTx: m.NameClaimTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m NameClaimTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *NameClaimTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name claim tx JSON based on the context it is used +func (m *NameClaimTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with NameClaimTx + if err := m.NameClaimTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *NameClaimTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_entry.go b/swagguard/node/models/name_entry.go index cad1a4a0..f2e07235 100644 --- a/swagguard/node/models/name_entry.go +++ b/swagguard/node/models/name_entry.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameEntry name entry +// // swagger:model NameEntry type NameEntry struct { @@ -23,6 +24,9 @@ type NameEntry struct { // Required: true ID *string `json:"id"` + // owner + Owner string `json:"owner,omitempty"` + // pointers // Required: true Pointers []*NamePointer `json:"pointers"` @@ -97,6 +101,38 @@ func (m *NameEntry) validateTTL(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name entry based on the context it is used +func (m *NameEntry) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePointers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NameEntry) contextValidatePointers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pointers); i++ { + + if m.Pointers[i] != nil { + if err := m.Pointers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pointers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NameEntry) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_hash.go b/swagguard/node/models/name_hash.go index ae1d6889..e8a24d01 100644 --- a/swagguard/node/models/name_hash.go +++ b/swagguard/node/models/name_hash.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameHash name hash +// // swagger:model NameHash type NameHash struct { @@ -45,6 +47,11 @@ func (m *NameHash) validateNameID(formats strfmt.Registry) error { return nil } +// ContextValidate validates this name hash based on context it is used +func (m *NameHash) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NameHash) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_pointer.go b/swagguard/node/models/name_pointer.go index e51bab51..330e78cb 100644 --- a/swagguard/node/models/name_pointer.go +++ b/swagguard/node/models/name_pointer.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NamePointer name pointer +// // swagger:model NamePointer type NamePointer struct { @@ -62,6 +64,11 @@ func (m *NamePointer) validateKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this name pointer based on context it is used +func (m *NamePointer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *NamePointer) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_preclaim_tx.go b/swagguard/node/models/name_preclaim_tx.go index c539aae7..5c68970e 100644 --- a/swagguard/node/models/name_preclaim_tx.go +++ b/swagguard/node/models/name_preclaim_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // NamePreclaimTx name preclaim tx +// // swagger:model NamePreclaimTx type NamePreclaimTx struct { @@ -29,7 +30,7 @@ type NamePreclaimTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -80,13 +81,51 @@ func (m *NamePreclaimTx) validateCommitmentID(formats strfmt.Registry) error { func (m *NamePreclaimTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +// ContextValidate validate this name preclaim tx based on the context it is used +func (m *NamePreclaimTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NamePreclaimTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } diff --git a/swagguard/node/models/name_preclaim_tx_json.go b/swagguard/node/models/name_preclaim_tx_json.go index d52bb765..a4612f44 100644 --- a/swagguard/node/models/name_preclaim_tx_json.go +++ b/swagguard/node/models/name_preclaim_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NamePreclaimTxJSON name preclaim tx JSON +// // swagger:model NamePreclaimTxJSON type NamePreclaimTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *NamePreclaimTxJSON) Type() string { // SetType sets the type of this subtype func (m *NamePreclaimTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *NamePreclaimTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.NamePreclaimTx = data.NamePreclaimTx @@ -97,8 +96,7 @@ func (m NamePreclaimTxJSON) MarshalJSON() ([]byte, error) { }{ NamePreclaimTx: m.NamePreclaimTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m NamePreclaimTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *NamePreclaimTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name preclaim tx JSON based on the context it is used +func (m *NamePreclaimTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with NamePreclaimTx + if err := m.NamePreclaimTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *NamePreclaimTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_revoke_tx.go b/swagguard/node/models/name_revoke_tx.go index 9e2f7a48..0b5ab86c 100644 --- a/swagguard/node/models/name_revoke_tx.go +++ b/swagguard/node/models/name_revoke_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // NameRevokeTx name revoke tx +// // swagger:model NameRevokeTx type NameRevokeTx struct { @@ -25,7 +26,7 @@ type NameRevokeTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // name id // Required: true @@ -71,13 +72,23 @@ func (m *NameRevokeTx) validateAccountID(formats strfmt.Registry) error { func (m *NameRevokeTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -90,6 +101,34 @@ func (m *NameRevokeTx) validateNameID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name revoke tx based on the context it is used +func (m *NameRevokeTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NameRevokeTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NameRevokeTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_revoke_tx_json.go b/swagguard/node/models/name_revoke_tx_json.go index 225d33b5..86bca47c 100644 --- a/swagguard/node/models/name_revoke_tx_json.go +++ b/swagguard/node/models/name_revoke_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameRevokeTxJSON name revoke tx JSON +// // swagger:model NameRevokeTxJSON type NameRevokeTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *NameRevokeTxJSON) Type() string { // SetType sets the type of this subtype func (m *NameRevokeTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *NameRevokeTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.NameRevokeTx = data.NameRevokeTx @@ -97,8 +96,7 @@ func (m NameRevokeTxJSON) MarshalJSON() ([]byte, error) { }{ NameRevokeTx: m.NameRevokeTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m NameRevokeTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *NameRevokeTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name revoke tx JSON based on the context it is used +func (m *NameRevokeTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with NameRevokeTx + if err := m.NameRevokeTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *NameRevokeTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_transfer_tx.go b/swagguard/node/models/name_transfer_tx.go index a6f9d885..cd335f65 100644 --- a/swagguard/node/models/name_transfer_tx.go +++ b/swagguard/node/models/name_transfer_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // NameTransferTx name transfer tx +// // swagger:model NameTransferTx type NameTransferTx struct { @@ -25,7 +26,7 @@ type NameTransferTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // name id // Required: true @@ -79,13 +80,23 @@ func (m *NameTransferTx) validateAccountID(formats strfmt.Registry) error { func (m *NameTransferTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -107,6 +118,34 @@ func (m *NameTransferTx) validateRecipientID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name transfer tx based on the context it is used +func (m *NameTransferTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NameTransferTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *NameTransferTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_transfer_tx_json.go b/swagguard/node/models/name_transfer_tx_json.go index f9c0c81e..69ea87c0 100644 --- a/swagguard/node/models/name_transfer_tx_json.go +++ b/swagguard/node/models/name_transfer_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameTransferTxJSON name transfer tx JSON +// // swagger:model NameTransferTxJSON type NameTransferTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *NameTransferTxJSON) Type() string { // SetType sets the type of this subtype func (m *NameTransferTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *NameTransferTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.NameTransferTx = data.NameTransferTx @@ -97,8 +96,7 @@ func (m NameTransferTxJSON) MarshalJSON() ([]byte, error) { }{ NameTransferTx: m.NameTransferTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m NameTransferTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *NameTransferTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name transfer tx JSON based on the context it is used +func (m *NameTransferTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with NameTransferTx + if err := m.NameTransferTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *NameTransferTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_update_tx.go b/swagguard/node/models/name_update_tx.go index 752d1fde..73e14146 100644 --- a/swagguard/node/models/name_update_tx.go +++ b/swagguard/node/models/name_update_tx.go @@ -6,18 +6,18 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // NameUpdateTx name update tx +// // swagger:model NameUpdateTx type NameUpdateTx struct { @@ -31,7 +31,7 @@ type NameUpdateTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // name id // Required: true @@ -106,13 +106,23 @@ func (m *NameUpdateTx) validateClientTTL(formats strfmt.Registry) error { func (m *NameUpdateTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -159,6 +169,56 @@ func (m *NameUpdateTx) validatePointers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name update tx based on the context it is used +func (m *NameUpdateTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePointers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NameUpdateTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *NameUpdateTx) contextValidatePointers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Pointers); i++ { + + if m.Pointers[i] != nil { + if err := m.Pointers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pointers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *NameUpdateTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/name_update_tx_json.go b/swagguard/node/models/name_update_tx_json.go index a86a1be6..583accc0 100644 --- a/swagguard/node/models/name_update_tx_json.go +++ b/swagguard/node/models/name_update_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // NameUpdateTxJSON name update tx JSON +// // swagger:model NameUpdateTxJSON type NameUpdateTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *NameUpdateTxJSON) Type() string { // SetType sets the type of this subtype func (m *NameUpdateTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *NameUpdateTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.NameUpdateTx = data.NameUpdateTx @@ -97,8 +96,7 @@ func (m NameUpdateTxJSON) MarshalJSON() ([]byte, error) { }{ NameUpdateTx: m.NameUpdateTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m NameUpdateTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *NameUpdateTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this name update tx JSON based on the context it is used +func (m *NameUpdateTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with NameUpdateTx + if err := m.NameUpdateTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *NameUpdateTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/network_status.go b/swagguard/node/models/network_status.go new file mode 100644 index 00000000..d9bf9c3b --- /dev/null +++ b/swagguard/node/models/network_status.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// NetworkStatus network status +// +// swagger:model NetworkStatus +type NetworkStatus map[string]PeerDetails + +// Validate validates this network status +func (m NetworkStatus) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + if val, ok := m[k]; ok { + if err := val.Validate(formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this network status based on the context it is used +func (m NetworkStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/swagguard/node/models/off_chain_call_contract.go b/swagguard/node/models/off_chain_call_contract.go index 2cde0c28..09601f0d 100644 --- a/swagguard/node/models/off_chain_call_contract.go +++ b/swagguard/node/models/off_chain_call_contract.go @@ -7,18 +7,18 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OffChainCallContract off chain call contract +// // swagger:model OffChainCallContract type OffChainCallContract struct { @@ -28,7 +28,7 @@ type OffChainCallContract struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -48,7 +48,7 @@ type OffChainCallContract struct { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` } // Op gets the op of this subtype @@ -58,23 +58,8 @@ func (m *OffChainCallContract) Op() string { // SetOp sets the op of this subtype func (m *OffChainCallContract) SetOp(val string) { - } -// AbiVersion gets the abi version of this subtype - -// Amount gets the amount of this subtype - -// CallData gets the call data of this subtype - -// Caller gets the caller of this subtype - -// Contract gets the contract of this subtype - -// Gas gets the gas of this subtype - -// GasPrice gets the gas price of this subtype - // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { var data struct { @@ -85,7 +70,7 @@ func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -105,7 +90,7 @@ func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` } buf := bytes.NewBuffer(raw) dec := json.NewDecoder(buf) @@ -136,17 +121,11 @@ func (m *OffChainCallContract) UnmarshalJSON(raw []byte) error { } result.AbiVersion = data.AbiVersion - result.Amount = data.Amount - result.CallData = data.CallData - result.Caller = data.Caller - result.Contract = data.Contract - result.Gas = data.Gas - result.GasPrice = data.GasPrice *m = result @@ -166,7 +145,7 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Contract call data // Required: true @@ -186,7 +165,7 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { // gas price // Required: true - GasPrice utils.BigInt `json:"gas_price"` + GasPrice *utils.BigInt `json:"gas_price"` }{ AbiVersion: m.AbiVersion, @@ -202,8 +181,7 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { Gas: m.Gas, GasPrice: m.GasPrice, - }, - ) + }) if err != nil { return nil, err } @@ -212,8 +190,7 @@ func (m OffChainCallContract) MarshalJSON() ([]byte, error) { }{ Op: m.Op(), - }, - ) + }) if err != nil { return nil, err } @@ -270,13 +247,23 @@ func (m *OffChainCallContract) validateAbiVersion(formats strfmt.Registry) error func (m *OffChainCallContract) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -318,13 +305,69 @@ func (m *OffChainCallContract) validateGas(formats strfmt.Registry) error { func (m *OffChainCallContract) validateGasPrice(formats strfmt.Registry) error { - if err := m.GasPrice.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gas_price") - } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { return err } + if err := validate.Required("gas_price", "body", m.GasPrice); err != nil { + return err + } + + if m.GasPrice != nil { + if err := m.GasPrice.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + + return nil +} + +// ContextValidate validate this off chain call contract based on the context it is used +func (m *OffChainCallContract) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGasPrice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OffChainCallContract) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *OffChainCallContract) contextValidateGasPrice(ctx context.Context, formats strfmt.Registry) error { + + if m.GasPrice != nil { + if err := m.GasPrice.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gas_price") + } + return err + } + } + return nil } diff --git a/swagguard/node/models/off_chain_deposit.go b/swagguard/node/models/off_chain_deposit.go index b6f8379c..ab124723 100644 --- a/swagguard/node/models/off_chain_deposit.go +++ b/swagguard/node/models/off_chain_deposit.go @@ -7,24 +7,24 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OffChainDeposit off chain deposit +// // swagger:model OffChainDeposit type OffChainDeposit struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Depositor of tokens // Required: true @@ -38,20 +38,15 @@ func (m *OffChainDeposit) Op() string { // SetOp sets the op of this subtype func (m *OffChainDeposit) SetOp(val string) { - } -// Amount gets the amount of this subtype - -// From gets the from of this subtype - // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *OffChainDeposit) UnmarshalJSON(raw []byte) error { var data struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Depositor of tokens // Required: true @@ -86,7 +81,6 @@ func (m *OffChainDeposit) UnmarshalJSON(raw []byte) error { } result.Amount = data.Amount - result.From = data.From *m = result @@ -102,7 +96,7 @@ func (m OffChainDeposit) MarshalJSON() ([]byte, error) { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Depositor of tokens // Required: true @@ -112,8 +106,7 @@ func (m OffChainDeposit) MarshalJSON() ([]byte, error) { Amount: m.Amount, From: m.From, - }, - ) + }) if err != nil { return nil, err } @@ -122,8 +115,7 @@ func (m OffChainDeposit) MarshalJSON() ([]byte, error) { }{ Op: m.Op(), - }, - ) + }) if err != nil { return nil, err } @@ -151,13 +143,23 @@ func (m *OffChainDeposit) Validate(formats strfmt.Registry) error { func (m *OffChainDeposit) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -170,6 +172,34 @@ func (m *OffChainDeposit) validateFrom(formats strfmt.Registry) error { return nil } +// ContextValidate validate this off chain deposit based on the context it is used +func (m *OffChainDeposit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OffChainDeposit) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OffChainDeposit) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/off_chain_new_contract.go b/swagguard/node/models/off_chain_new_contract.go index 47594b66..d4ece6e2 100644 --- a/swagguard/node/models/off_chain_new_contract.go +++ b/swagguard/node/models/off_chain_new_contract.go @@ -7,18 +7,18 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OffChainNewContract off chain new contract +// // swagger:model OffChainNewContract type OffChainNewContract struct { @@ -36,7 +36,7 @@ type OffChainNewContract struct { // deposit // Required: true - Deposit utils.BigInt `json:"deposit"` + Deposit *utils.BigInt `json:"deposit"` // Contract owner // Required: true @@ -54,21 +54,8 @@ func (m *OffChainNewContract) Op() string { // SetOp sets the op of this subtype func (m *OffChainNewContract) SetOp(val string) { - } -// AbiVersion gets the abi version of this subtype - -// CallData gets the call data of this subtype - -// Code gets the code of this subtype - -// Deposit gets the deposit of this subtype - -// Owner gets the owner of this subtype - -// VMVersion gets the vm version of this subtype - // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { var data struct { @@ -87,7 +74,7 @@ func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { // deposit // Required: true - Deposit utils.BigInt `json:"deposit"` + Deposit *utils.BigInt `json:"deposit"` // Contract owner // Required: true @@ -126,15 +113,10 @@ func (m *OffChainNewContract) UnmarshalJSON(raw []byte) error { } result.AbiVersion = data.AbiVersion - result.CallData = data.CallData - result.Code = data.Code - result.Deposit = data.Deposit - result.Owner = data.Owner - result.VMVersion = data.VMVersion *m = result @@ -162,7 +144,7 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { // deposit // Required: true - Deposit utils.BigInt `json:"deposit"` + Deposit *utils.BigInt `json:"deposit"` // Contract owner // Required: true @@ -184,8 +166,7 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { Owner: m.Owner, VMVersion: m.VMVersion, - }, - ) + }) if err != nil { return nil, err } @@ -194,8 +175,7 @@ func (m OffChainNewContract) MarshalJSON() ([]byte, error) { }{ Op: m.Op(), - }, - ) + }) if err != nil { return nil, err } @@ -275,13 +255,23 @@ func (m *OffChainNewContract) validateCode(formats strfmt.Registry) error { func (m *OffChainNewContract) validateDeposit(formats strfmt.Registry) error { - if err := m.Deposit.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("deposit") - } + if err := validate.Required("deposit", "body", m.Deposit); err != nil { return err } + if err := validate.Required("deposit", "body", m.Deposit); err != nil { + return err + } + + if m.Deposit != nil { + if err := m.Deposit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deposit") + } + return err + } + } + return nil } @@ -303,6 +293,52 @@ func (m *OffChainNewContract) validateVMVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this off chain new contract based on the context it is used +func (m *OffChainNewContract) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCode(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDeposit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OffChainNewContract) contextValidateCode(ctx context.Context, formats strfmt.Registry) error { + + if m.Code != nil { + if err := m.Code.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("code") + } + return err + } + } + + return nil +} + +func (m *OffChainNewContract) contextValidateDeposit(ctx context.Context, formats strfmt.Registry) error { + + if m.Deposit != nil { + if err := m.Deposit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deposit") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OffChainNewContract) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/off_chain_transfer.go b/swagguard/node/models/off_chain_transfer.go index 2dad704b..79437a4b 100644 --- a/swagguard/node/models/off_chain_transfer.go +++ b/swagguard/node/models/off_chain_transfer.go @@ -7,24 +7,24 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OffChainTransfer off chain transfer +// // swagger:model OffChainTransfer type OffChainTransfer struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Sender of tokens // Required: true @@ -42,22 +42,15 @@ func (m *OffChainTransfer) Op() string { // SetOp sets the op of this subtype func (m *OffChainTransfer) SetOp(val string) { - } -// Amount gets the amount of this subtype - -// From gets the from of this subtype - -// To gets the to of this subtype - // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *OffChainTransfer) UnmarshalJSON(raw []byte) error { var data struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Sender of tokens // Required: true @@ -96,9 +89,7 @@ func (m *OffChainTransfer) UnmarshalJSON(raw []byte) error { } result.Amount = data.Amount - result.From = data.From - result.To = data.To *m = result @@ -114,7 +105,7 @@ func (m OffChainTransfer) MarshalJSON() ([]byte, error) { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Sender of tokens // Required: true @@ -130,8 +121,7 @@ func (m OffChainTransfer) MarshalJSON() ([]byte, error) { From: m.From, To: m.To, - }, - ) + }) if err != nil { return nil, err } @@ -140,8 +130,7 @@ func (m OffChainTransfer) MarshalJSON() ([]byte, error) { }{ Op: m.Op(), - }, - ) + }) if err != nil { return nil, err } @@ -173,13 +162,23 @@ func (m *OffChainTransfer) Validate(formats strfmt.Registry) error { func (m *OffChainTransfer) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -201,6 +200,34 @@ func (m *OffChainTransfer) validateTo(formats strfmt.Registry) error { return nil } +// ContextValidate validate this off chain transfer based on the context it is used +func (m *OffChainTransfer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OffChainTransfer) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OffChainTransfer) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/off_chain_update.go b/swagguard/node/models/off_chain_update.go index d2ee7dba..12a1ea7f 100644 --- a/swagguard/node/models/off_chain_update.go +++ b/swagguard/node/models/off_chain_update.go @@ -7,26 +7,31 @@ package models import ( "bytes" + "context" "encoding/json" "io" "io/ioutil" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // OffChainUpdate off chain update +// // swagger:discriminator OffChainUpdate op type OffChainUpdate interface { runtime.Validatable + runtime.ContextValidatable // op // Required: true Op() string SetOp(string) + + // AdditionalProperties in base type shoud be handled just like regular properties + // At this moment, the base type property is pushed down to the subtype } type offChainUpdate struct { @@ -40,7 +45,6 @@ func (m *offChainUpdate) Op() string { // SetOp sets the op of this polymorphic type func (m *offChainUpdate) SetOp(val string) { - } // UnmarshalOffChainUpdateSlice unmarshals polymorphic slices of OffChainUpdate @@ -95,48 +99,46 @@ func unmarshalOffChainUpdate(data []byte, consumer runtime.Consumer) (OffChainUp return nil, err } return &result, nil - case "OffChainDeposit": var result OffChainDeposit if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OffChainNewContract": var result OffChainNewContract if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OffChainTransfer": var result OffChainTransfer if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OffChainUpdate": var result offChainUpdate if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - case "OffChainWithdrawal": var result OffChainWithdrawal if err := consumer.Consume(buf2, &result); err != nil { return nil, err } return &result, nil - } return nil, errors.New(422, "invalid op value: %q", getType.Op) - } // Validate validates this off chain update func (m *offChainUpdate) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this off chain update based on context it is used +func (m *offChainUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/off_chain_withdrawal.go b/swagguard/node/models/off_chain_withdrawal.go index 9cd42edb..63817c0d 100644 --- a/swagguard/node/models/off_chain_withdrawal.go +++ b/swagguard/node/models/off_chain_withdrawal.go @@ -7,24 +7,24 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OffChainWithdrawal off chain withdrawal +// // swagger:model OffChainWithdrawal type OffChainWithdrawal struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Withdrawer of tokens // Required: true @@ -38,20 +38,15 @@ func (m *OffChainWithdrawal) Op() string { // SetOp sets the op of this subtype func (m *OffChainWithdrawal) SetOp(val string) { - } -// Amount gets the amount of this subtype - -// To gets the to of this subtype - // UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure func (m *OffChainWithdrawal) UnmarshalJSON(raw []byte) error { var data struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Withdrawer of tokens // Required: true @@ -86,7 +81,6 @@ func (m *OffChainWithdrawal) UnmarshalJSON(raw []byte) error { } result.Amount = data.Amount - result.To = data.To *m = result @@ -102,7 +96,7 @@ func (m OffChainWithdrawal) MarshalJSON() ([]byte, error) { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // Withdrawer of tokens // Required: true @@ -112,8 +106,7 @@ func (m OffChainWithdrawal) MarshalJSON() ([]byte, error) { Amount: m.Amount, To: m.To, - }, - ) + }) if err != nil { return nil, err } @@ -122,8 +115,7 @@ func (m OffChainWithdrawal) MarshalJSON() ([]byte, error) { }{ Op: m.Op(), - }, - ) + }) if err != nil { return nil, err } @@ -151,13 +143,23 @@ func (m *OffChainWithdrawal) Validate(formats strfmt.Registry) error { func (m *OffChainWithdrawal) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } @@ -170,6 +172,34 @@ func (m *OffChainWithdrawal) validateTo(formats strfmt.Registry) error { return nil } +// ContextValidate validate this off chain withdrawal based on the context it is used +func (m *OffChainWithdrawal) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OffChainWithdrawal) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OffChainWithdrawal) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_extend_tx.go b/swagguard/node/models/oracle_extend_tx.go index 6018b97a..f4555dc8 100644 --- a/swagguard/node/models/oracle_extend_tx.go +++ b/swagguard/node/models/oracle_extend_tx.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OracleExtendTx oracle extend tx +// // swagger:model OracleExtendTx type OracleExtendTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -62,13 +63,23 @@ func (m *OracleExtendTx) Validate(formats strfmt.Registry) error { func (m *OracleExtendTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -99,6 +110,52 @@ func (m *OracleExtendTx) validateOracleTTL(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle extend tx based on the context it is used +func (m *OracleExtendTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOracleTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleExtendTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *OracleExtendTx) contextValidateOracleTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.OracleTTL != nil { + if err := m.OracleTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oracle_ttl") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleExtendTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_extend_tx_json.go b/swagguard/node/models/oracle_extend_tx_json.go index b23cbdae..4c755004 100644 --- a/swagguard/node/models/oracle_extend_tx_json.go +++ b/swagguard/node/models/oracle_extend_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OracleExtendTxJSON oracle extend tx JSON +// // swagger:model OracleExtendTxJSON type OracleExtendTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *OracleExtendTxJSON) Type() string { // SetType sets the type of this subtype func (m *OracleExtendTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *OracleExtendTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.OracleExtendTx = data.OracleExtendTx @@ -97,8 +96,7 @@ func (m OracleExtendTxJSON) MarshalJSON() ([]byte, error) { }{ OracleExtendTx: m.OracleExtendTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m OracleExtendTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *OracleExtendTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle extend tx JSON based on the context it is used +func (m *OracleExtendTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with OracleExtendTx + if err := m.OracleExtendTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *OracleExtendTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_queries.go b/swagguard/node/models/oracle_queries.go index 77e90b89..b6a5bfb0 100644 --- a/swagguard/node/models/oracle_queries.go +++ b/swagguard/node/models/oracle_queries.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OracleQueries oracle queries +// // swagger:model OracleQueries type OracleQueries struct { @@ -63,6 +64,38 @@ func (m *OracleQueries) validateOracleQueries(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle queries based on the context it is used +func (m *OracleQueries) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOracleQueries(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleQueries) contextValidateOracleQueries(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.OracleQueries); i++ { + + if m.OracleQueries[i] != nil { + if err := m.OracleQueries[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oracle_queries" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleQueries) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_query.go b/swagguard/node/models/oracle_query.go index eb28ccdc..59f59323 100644 --- a/swagguard/node/models/oracle_query.go +++ b/swagguard/node/models/oracle_query.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OracleQuery oracle query +// // swagger:model OracleQuery type OracleQuery struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // id // Required: true @@ -104,13 +105,23 @@ func (m *OracleQuery) Validate(formats strfmt.Registry) error { func (m *OracleQuery) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -195,6 +206,52 @@ func (m *OracleQuery) validateTTL(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle query based on the context it is used +func (m *OracleQuery) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponseTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleQuery) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *OracleQuery) contextValidateResponseTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponseTTL != nil { + if err := m.ResponseTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("response_ttl") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleQuery) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_query_tx.go b/swagguard/node/models/oracle_query_tx.go index 2b986e93..a802fb67 100644 --- a/swagguard/node/models/oracle_query_tx.go +++ b/swagguard/node/models/oracle_query_tx.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OracleQueryTx oracle query tx +// // swagger:model OracleQueryTx type OracleQueryTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // Sender nonce Nonce uint64 `json:"nonce,omitempty"` @@ -36,7 +37,7 @@ type OracleQueryTx struct { // query fee // Required: true - QueryFee utils.BigInt `json:"query_fee"` + QueryFee *utils.BigInt `json:"query_fee"` // query ttl // Required: true @@ -94,13 +95,23 @@ func (m *OracleQueryTx) Validate(formats strfmt.Registry) error { func (m *OracleQueryTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -124,13 +135,23 @@ func (m *OracleQueryTx) validateQuery(formats strfmt.Registry) error { func (m *OracleQueryTx) validateQueryFee(formats strfmt.Registry) error { - if err := m.QueryFee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("query_fee") - } + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { + return err + } + + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { return err } + if m.QueryFee != nil { + if err := m.QueryFee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + return nil } @@ -179,6 +200,88 @@ func (m *OracleQueryTx) validateSenderID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle query tx based on the context it is used +func (m *OracleQueryTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQueryFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQueryTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponseTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleQueryTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *OracleQueryTx) contextValidateQueryFee(ctx context.Context, formats strfmt.Registry) error { + + if m.QueryFee != nil { + if err := m.QueryFee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + + return nil +} + +func (m *OracleQueryTx) contextValidateQueryTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.QueryTTL != nil { + if err := m.QueryTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_ttl") + } + return err + } + } + + return nil +} + +func (m *OracleQueryTx) contextValidateResponseTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponseTTL != nil { + if err := m.ResponseTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("response_ttl") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleQueryTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_query_tx_json.go b/swagguard/node/models/oracle_query_tx_json.go index 582688fa..7a01dee0 100644 --- a/swagguard/node/models/oracle_query_tx_json.go +++ b/swagguard/node/models/oracle_query_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OracleQueryTxJSON oracle query tx JSON +// // swagger:model OracleQueryTxJSON type OracleQueryTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *OracleQueryTxJSON) Type() string { // SetType sets the type of this subtype func (m *OracleQueryTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *OracleQueryTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.OracleQueryTx = data.OracleQueryTx @@ -97,8 +96,7 @@ func (m OracleQueryTxJSON) MarshalJSON() ([]byte, error) { }{ OracleQueryTx: m.OracleQueryTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m OracleQueryTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *OracleQueryTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle query tx JSON based on the context it is used +func (m *OracleQueryTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with OracleQueryTx + if err := m.OracleQueryTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *OracleQueryTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_register_tx.go b/swagguard/node/models/oracle_register_tx.go index c5c15515..718f2164 100644 --- a/swagguard/node/models/oracle_register_tx.go +++ b/swagguard/node/models/oracle_register_tx.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OracleRegisterTx oracle register tx +// // swagger:model OracleRegisterTx type OracleRegisterTx struct { @@ -28,7 +29,7 @@ type OracleRegisterTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -39,7 +40,7 @@ type OracleRegisterTx struct { // query fee // Required: true - QueryFee utils.BigInt `json:"query_fee"` + QueryFee *utils.BigInt `json:"query_fee"` // query format // Required: true @@ -98,13 +99,23 @@ func (m *OracleRegisterTx) validateAccountID(formats strfmt.Registry) error { func (m *OracleRegisterTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -128,13 +139,23 @@ func (m *OracleRegisterTx) validateOracleTTL(formats strfmt.Registry) error { func (m *OracleRegisterTx) validateQueryFee(formats strfmt.Registry) error { - if err := m.QueryFee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("query_fee") - } + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { return err } + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { + return err + } + + if m.QueryFee != nil { + if err := m.QueryFee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + return nil } @@ -156,6 +177,70 @@ func (m *OracleRegisterTx) validateResponseFormat(formats strfmt.Registry) error return nil } +// ContextValidate validate this oracle register tx based on the context it is used +func (m *OracleRegisterTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOracleTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQueryFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleRegisterTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *OracleRegisterTx) contextValidateOracleTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.OracleTTL != nil { + if err := m.OracleTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oracle_ttl") + } + return err + } + } + + return nil +} + +func (m *OracleRegisterTx) contextValidateQueryFee(ctx context.Context, formats strfmt.Registry) error { + + if m.QueryFee != nil { + if err := m.QueryFee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleRegisterTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_register_tx_json.go b/swagguard/node/models/oracle_register_tx_json.go index a60a5069..adef7ce1 100644 --- a/swagguard/node/models/oracle_register_tx_json.go +++ b/swagguard/node/models/oracle_register_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OracleRegisterTxJSON oracle register tx JSON +// // swagger:model OracleRegisterTxJSON type OracleRegisterTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *OracleRegisterTxJSON) Type() string { // SetType sets the type of this subtype func (m *OracleRegisterTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *OracleRegisterTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.OracleRegisterTx = data.OracleRegisterTx @@ -97,8 +96,7 @@ func (m OracleRegisterTxJSON) MarshalJSON() ([]byte, error) { }{ OracleRegisterTx: m.OracleRegisterTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m OracleRegisterTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *OracleRegisterTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle register tx JSON based on the context it is used +func (m *OracleRegisterTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with OracleRegisterTx + if err := m.OracleRegisterTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *OracleRegisterTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_respond_tx.go b/swagguard/node/models/oracle_respond_tx.go index a1e19e19..03face9a 100644 --- a/swagguard/node/models/oracle_respond_tx.go +++ b/swagguard/node/models/oracle_respond_tx.go @@ -6,22 +6,23 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // OracleRespondTx oracle respond tx +// // swagger:model OracleRespondTx type OracleRespondTx struct { // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -78,13 +79,23 @@ func (m *OracleRespondTx) Validate(formats strfmt.Registry) error { func (m *OracleRespondTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -133,6 +144,52 @@ func (m *OracleRespondTx) validateResponseTTL(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle respond tx based on the context it is used +func (m *OracleRespondTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateResponseTTL(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OracleRespondTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *OracleRespondTx) contextValidateResponseTTL(ctx context.Context, formats strfmt.Registry) error { + + if m.ResponseTTL != nil { + if err := m.ResponseTTL.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("response_ttl") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *OracleRespondTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/oracle_respond_tx_json.go b/swagguard/node/models/oracle_respond_tx_json.go index f3618c58..a4cf8f36 100644 --- a/swagguard/node/models/oracle_respond_tx_json.go +++ b/swagguard/node/models/oracle_respond_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // OracleRespondTxJSON oracle respond tx JSON +// // swagger:model OracleRespondTxJSON type OracleRespondTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *OracleRespondTxJSON) Type() string { // SetType sets the type of this subtype func (m *OracleRespondTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *OracleRespondTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.OracleRespondTx = data.OracleRespondTx @@ -97,8 +96,7 @@ func (m OracleRespondTxJSON) MarshalJSON() ([]byte, error) { }{ OracleRespondTx: m.OracleRespondTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m OracleRespondTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *OracleRespondTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this oracle respond tx JSON based on the context it is used +func (m *OracleRespondTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with OracleRespondTx + if err := m.OracleRespondTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *OracleRespondTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/paying_for_tx.go b/swagguard/node/models/paying_for_tx.go new file mode 100644 index 00000000..1fb6599e --- /dev/null +++ b/swagguard/node/models/paying_for_tx.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/aeternity/aepp-sdk-go/v9/utils" + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PayingForTx paying for tx +// +// swagger:model PayingForTx +type PayingForTx struct { + + // fee + // Required: true + Fee *utils.BigInt `json:"fee"` + + // nonce + Nonce uint64 `json:"nonce,omitempty"` + + // payer id + // Required: true + PayerID *string `json:"payer_id"` + + // tx + // Required: true + Tx *SignedTx `json:"tx"` +} + +// Validate validates this paying for tx +func (m *PayingForTx) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFee(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePayerID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTx(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PayingForTx) validateFee(formats strfmt.Registry) error { + + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *PayingForTx) validatePayerID(formats strfmt.Registry) error { + + if err := validate.Required("payer_id", "body", m.PayerID); err != nil { + return err + } + + return nil +} + +func (m *PayingForTx) validateTx(formats strfmt.Registry) error { + + if err := validate.Required("tx", "body", m.Tx); err != nil { + return err + } + + if m.Tx != nil { + if err := m.Tx.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + } + + return nil +} + +// ContextValidate validate this paying for tx based on the context it is used +func (m *PayingForTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTx(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PayingForTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + +func (m *PayingForTx) contextValidateTx(ctx context.Context, formats strfmt.Registry) error { + + if m.Tx != nil { + if err := m.Tx.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PayingForTx) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PayingForTx) UnmarshalBinary(b []byte) error { + var res PayingForTx + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/paying_for_tx_json.go b/swagguard/node/models/paying_for_tx_json.go new file mode 100644 index 00000000..e234bbd8 --- /dev/null +++ b/swagguard/node/models/paying_for_tx_json.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PayingForTxJSON paying for tx JSON +// +// swagger:model PayingForTxJSON +type PayingForTxJSON struct { + versionField *uint32 + + PayingForTx +} + +// Type gets the type of this subtype +func (m *PayingForTxJSON) Type() string { + return "PayingForTx" +} + +// SetType sets the type of this subtype +func (m *PayingForTxJSON) SetType(val string) { +} + +// Version gets the version of this subtype +func (m *PayingForTxJSON) Version() *uint32 { + return m.versionField +} + +// SetVersion sets the version of this subtype +func (m *PayingForTxJSON) SetVersion(val *uint32) { + m.versionField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *PayingForTxJSON) UnmarshalJSON(raw []byte) error { + var data struct { + PayingForTx + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + var base struct { + /* Just the base type fields. Used for unmashalling polymorphic types.*/ + + Type string `json:"type"` + + Version *uint32 `json:"version"` + } + buf = bytes.NewBuffer(raw) + dec = json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&base); err != nil { + return err + } + + var result PayingForTxJSON + + if base.Type != result.Type() { + /* Not the type we're looking for. */ + return errors.New(422, "invalid type value: %q", base.Type) + } + result.versionField = base.Version + + result.PayingForTx = data.PayingForTx + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m PayingForTxJSON) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + PayingForTx + }{ + + PayingForTx: m.PayingForTx, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + Type string `json:"type"` + + Version *uint32 `json:"version"` + }{ + + Type: m.Type(), + + Version: m.Version(), + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this paying for tx JSON +func (m *PayingForTxJSON) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + // validation for a type composition with PayingForTx + if err := m.PayingForTx.Validate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PayingForTxJSON) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version()); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this paying for tx JSON based on the context it is used +func (m *PayingForTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with PayingForTx + if err := m.PayingForTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// MarshalBinary interface implementation +func (m *PayingForTxJSON) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PayingForTxJSON) UnmarshalBinary(b []byte) error { + var res PayingForTxJSON + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/peer.go b/swagguard/node/models/peer.go index e4328b30..808ef2be 100644 --- a/swagguard/node/models/peer.go +++ b/swagguard/node/models/peer.go @@ -6,10 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + + "github.com/go-openapi/strfmt" ) // Peer Aeternity node +// // swagger:model Peer type Peer string @@ -17,3 +20,8 @@ type Peer string func (m Peer) Validate(formats strfmt.Registry) error { return nil } + +// ContextValidate validates this peer based on context it is used +func (m Peer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/peer_connections.go b/swagguard/node/models/peer_connections.go new file mode 100644 index 00000000..c979932e --- /dev/null +++ b/swagguard/node/models/peer_connections.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PeerConnections peer connections +// +// swagger:model PeerConnections +type PeerConnections struct { + + // Number of inbound peer connections + // Required: true + Inbound *uint32 `json:"inbound"` + + // Number of outbound peer connections + // Required: true + Outbound *uint32 `json:"outbound"` +} + +// Validate validates this peer connections +func (m *PeerConnections) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInbound(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOutbound(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PeerConnections) validateInbound(formats strfmt.Registry) error { + + if err := validate.Required("inbound", "body", m.Inbound); err != nil { + return err + } + + return nil +} + +func (m *PeerConnections) validateOutbound(formats strfmt.Registry) error { + + if err := validate.Required("outbound", "body", m.Outbound); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this peer connections based on context it is used +func (m *PeerConnections) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PeerConnections) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PeerConnections) UnmarshalBinary(b []byte) error { + var res PeerConnections + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/peer_details.go b/swagguard/node/models/peer_details.go new file mode 100644 index 00000000..accd4dc3 --- /dev/null +++ b/swagguard/node/models/peer_details.go @@ -0,0 +1,188 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// PeerDetails peer details +// +// swagger:model PeerDetails +type PeerDetails struct { + + // Unix timestamp of when the peer was first pinged + // Required: true + FirstSeen *uint32 `json:"first_seen"` + + // The genesis hash the remote node reports + // Required: true + GenesisHash *string `json:"genesis_hash"` + + // Hostname of peer + // Required: true + Host *string `json:"host"` + + // Unix timestamp of when the peer was last pinged + // Required: true + LastSeen *uint32 `json:"last_seen"` + + // network id + NetworkID string `json:"network_id,omitempty"` + + // node os + NodeOs string `json:"node_os,omitempty"` + + // node revision + NodeRevision string `json:"node_revision,omitempty"` + + // node vendor + NodeVendor string `json:"node_vendor,omitempty"` + + // node version + NodeVersion string `json:"node_version,omitempty"` + + // Port of peer + // Required: true + Port *uint32 `json:"port"` + + // The total top difficulty the node reports + // Required: true + TopDifficulty *uint64 `json:"top_difficulty"` + + // The top hash the remote node reports + // Required: true + TopHash *string `json:"top_hash"` +} + +// Validate validates this peer details +func (m *PeerDetails) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFirstSeen(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGenesisHash(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHost(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastSeen(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePort(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTopDifficulty(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTopHash(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PeerDetails) validateFirstSeen(formats strfmt.Registry) error { + + if err := validate.Required("first_seen", "body", m.FirstSeen); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validateGenesisHash(formats strfmt.Registry) error { + + if err := validate.Required("genesis_hash", "body", m.GenesisHash); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validateHost(formats strfmt.Registry) error { + + if err := validate.Required("host", "body", m.Host); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validateLastSeen(formats strfmt.Registry) error { + + if err := validate.Required("last_seen", "body", m.LastSeen); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validatePort(formats strfmt.Registry) error { + + if err := validate.Required("port", "body", m.Port); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validateTopDifficulty(formats strfmt.Registry) error { + + if err := validate.Required("top_difficulty", "body", m.TopDifficulty); err != nil { + return err + } + + return nil +} + +func (m *PeerDetails) validateTopHash(formats strfmt.Registry) error { + + if err := validate.Required("top_hash", "body", m.TopHash); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this peer details based on context it is used +func (m *PeerDetails) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PeerDetails) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PeerDetails) UnmarshalBinary(b []byte) error { + var res PeerDetails + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/peer_pub_key.go b/swagguard/node/models/peer_pub_key.go index 157c4544..2ef076b8 100644 --- a/swagguard/node/models/peer_pub_key.go +++ b/swagguard/node/models/peer_pub_key.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PeerPubKey peer pub key +// // swagger:model PeerPubKey type PeerPubKey struct { @@ -45,6 +47,11 @@ func (m *PeerPubKey) validatePubkey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this peer pub key based on context it is used +func (m *PeerPubKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PeerPubKey) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/peers.go b/swagguard/node/models/peers.go index 43a68fd5..0f9ac4d3 100644 --- a/swagguard/node/models/peers.go +++ b/swagguard/node/models/peers.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Peers peers +// // swagger:model Peers type Peers struct { @@ -86,6 +87,56 @@ func (m *Peers) validatePeers(formats strfmt.Registry) error { return nil } +// ContextValidate validate this peers based on the context it is used +func (m *Peers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBlocked(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePeers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Peers) contextValidateBlocked(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Blocked); i++ { + + if err := m.Blocked[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("blocked" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *Peers) contextValidatePeers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Peers); i++ { + + if err := m.Peers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peers" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Peers) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/po_i.go b/swagguard/node/models/po_i.go index 6f5fb361..2fa2a8d2 100644 --- a/swagguard/node/models/po_i.go +++ b/swagguard/node/models/po_i.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PoI po i +// // swagger:model PoI type PoI struct { @@ -45,6 +47,11 @@ func (m *PoI) validatePoi(formats strfmt.Registry) error { return nil } +// ContextValidate validates this po i based on context it is used +func (m *PoI) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PoI) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/post_tx_response.go b/swagguard/node/models/post_tx_response.go index b99f83bd..09fa2172 100644 --- a/swagguard/node/models/post_tx_response.go +++ b/swagguard/node/models/post_tx_response.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PostTxResponse post tx response +// // swagger:model PostTxResponse type PostTxResponse struct { @@ -45,6 +47,11 @@ func (m *PostTxResponse) validateTxHash(formats strfmt.Registry) error { return nil } +// ContextValidate validates this post tx response based on context it is used +func (m *PostTxResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PostTxResponse) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/pow.go b/swagguard/node/models/pow.go index 9701a05e..32f49f01 100644 --- a/swagguard/node/models/pow.go +++ b/swagguard/node/models/pow.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // Pow pow +// // swagger:model Pow type Pow []uint32 @@ -35,3 +37,8 @@ func (m Pow) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this pow based on context it is used +func (m Pow) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/protocol.go b/swagguard/node/models/protocol.go index 645d7e23..d2435a4c 100644 --- a/swagguard/node/models/protocol.go +++ b/swagguard/node/models/protocol.go @@ -6,22 +6,24 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Protocol protocol +// // swagger:model Protocol type Protocol struct { - // effective at height + // Height at which protocol becomes active // Required: true EffectiveAtHeight *uint64 `json:"effective_at_height"` - // version + // Protocol version (can include protocol activated by miner signalling) // Required: true Version *uint32 `json:"version"` } @@ -62,6 +64,11 @@ func (m *Protocol) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validates this protocol based on context it is used +func (m *Protocol) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Protocol) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/pub_key.go b/swagguard/node/models/pub_key.go index 4bb54cd4..bc8d2f03 100644 --- a/swagguard/node/models/pub_key.go +++ b/swagguard/node/models/pub_key.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PubKey pub key +// // swagger:model PubKey type PubKey struct { @@ -45,6 +47,11 @@ func (m *PubKey) validatePubKey(formats strfmt.Registry) error { return nil } +// ContextValidate validates this pub key based on context it is used +func (m *PubKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *PubKey) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/registered_oracle.go b/swagguard/node/models/registered_oracle.go index 48b502b4..b79ee0dc 100644 --- a/swagguard/node/models/registered_oracle.go +++ b/swagguard/node/models/registered_oracle.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // RegisteredOracle registered oracle +// // swagger:model RegisteredOracle type RegisteredOracle struct { @@ -29,7 +30,7 @@ type RegisteredOracle struct { // query fee // Required: true - QueryFee utils.BigInt `json:"query_fee"` + QueryFee *utils.BigInt `json:"query_fee"` // query format // Required: true @@ -98,13 +99,23 @@ func (m *RegisteredOracle) validateID(formats strfmt.Registry) error { func (m *RegisteredOracle) validateQueryFee(formats strfmt.Registry) error { - if err := m.QueryFee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("query_fee") - } + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { return err } + if err := validate.Required("query_fee", "body", m.QueryFee); err != nil { + return err + } + + if m.QueryFee != nil { + if err := m.QueryFee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + return nil } @@ -135,6 +146,34 @@ func (m *RegisteredOracle) validateTTL(formats strfmt.Registry) error { return nil } +// ContextValidate validate this registered oracle based on the context it is used +func (m *RegisteredOracle) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateQueryFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RegisteredOracle) contextValidateQueryFee(ctx context.Context, formats strfmt.Registry) error { + + if m.QueryFee != nil { + if err := m.QueryFee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("query_fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *RegisteredOracle) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/relative_ttl.go b/swagguard/node/models/relative_ttl.go index fde7f8d1..7eea902e 100644 --- a/swagguard/node/models/relative_ttl.go +++ b/swagguard/node/models/relative_ttl.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // RelativeTTL relative TTL +// // swagger:model RelativeTTL type RelativeTTL struct { @@ -67,7 +68,7 @@ const ( // prop value enum func (m *RelativeTTL) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, relativeTtlTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, relativeTtlTypeTypePropEnum, true); err != nil { return err } return nil @@ -96,6 +97,11 @@ func (m *RelativeTTL) validateValue(formats strfmt.Registry) error { return nil } +// ContextValidate validates this relative TTL based on context it is used +func (m *RelativeTTL) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *RelativeTTL) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/signed_tx.go b/swagguard/node/models/signed_tx.go new file mode 100644 index 00000000..d062c08d --- /dev/null +++ b/swagguard/node/models/signed_tx.go @@ -0,0 +1,194 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "bytes" + "context" + "encoding/json" + "io" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// SignedTx signed tx +// +// swagger:model SignedTx +type SignedTx struct { + + // At least one signature is required unless for Generalized Account Meta transactions + // Required: true + // Min Items: 0 + Signatures []string `json:"signatures"` + + txField GenericTx +} + +// Tx gets the tx of this base type +func (m *SignedTx) Tx() GenericTx { + return m.txField +} + +// SetTx sets the tx of this base type +func (m *SignedTx) SetTx(val GenericTx) { + m.txField = val +} + +// UnmarshalJSON unmarshals this object with a polymorphic type from a JSON structure +func (m *SignedTx) UnmarshalJSON(raw []byte) error { + var data struct { + Signatures []string `json:"signatures"` + + Tx json.RawMessage `json:"tx"` + } + buf := bytes.NewBuffer(raw) + dec := json.NewDecoder(buf) + dec.UseNumber() + + if err := dec.Decode(&data); err != nil { + return err + } + + propTx, err := UnmarshalGenericTx(bytes.NewBuffer(data.Tx), runtime.JSONConsumer()) + if err != nil && err != io.EOF { + return err + } + + var result SignedTx + + // signatures + result.Signatures = data.Signatures + + // tx + result.txField = propTx + + *m = result + + return nil +} + +// MarshalJSON marshals this object with a polymorphic type to a JSON structure +func (m SignedTx) MarshalJSON() ([]byte, error) { + var b1, b2, b3 []byte + var err error + b1, err = json.Marshal(struct { + Signatures []string `json:"signatures"` + }{ + + Signatures: m.Signatures, + }) + if err != nil { + return nil, err + } + b2, err = json.Marshal(struct { + Tx GenericTx `json:"tx"` + }{ + + Tx: m.txField, + }) + if err != nil { + return nil, err + } + + return swag.ConcatJSON(b1, b2, b3), nil +} + +// Validate validates this signed tx +func (m *SignedTx) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSignatures(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTx(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SignedTx) validateSignatures(formats strfmt.Registry) error { + + if err := validate.Required("signatures", "body", m.Signatures); err != nil { + return err + } + + iSignaturesSize := int64(len(m.Signatures)) + + if err := validate.MinItems("signatures", "body", iSignaturesSize, 0); err != nil { + return err + } + + return nil +} + +func (m *SignedTx) validateTx(formats strfmt.Registry) error { + + if err := validate.Required("tx", "body", m.Tx()); err != nil { + return err + } + + if err := m.Tx().Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + + return nil +} + +// ContextValidate validate this signed tx based on the context it is used +func (m *SignedTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTx(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SignedTx) contextValidateTx(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Tx().ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tx") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SignedTx) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SignedTx) UnmarshalBinary(b []byte) error { + var res SignedTx + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/swagguard/node/models/spend_tx.go b/swagguard/node/models/spend_tx.go index 4aa9acd4..4dceb612 100644 --- a/swagguard/node/models/spend_tx.go +++ b/swagguard/node/models/spend_tx.go @@ -6,26 +6,27 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // SpendTx spend tx +// // swagger:model SpendTx type SpendTx struct { // amount // Required: true - Amount utils.BigInt `json:"amount"` + Amount *utils.BigInt `json:"amount"` // fee // Required: true - Fee utils.BigInt `json:"fee"` + Fee *utils.BigInt `json:"fee"` // nonce Nonce uint64 `json:"nonce,omitempty"` @@ -78,25 +79,45 @@ func (m *SpendTx) Validate(formats strfmt.Registry) error { func (m *SpendTx) validateAmount(formats strfmt.Registry) error { - if err := m.Amount.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("amount") - } + if err := validate.Required("amount", "body", m.Amount); err != nil { + return err + } + + if err := validate.Required("amount", "body", m.Amount); err != nil { return err } + if m.Amount != nil { + if err := m.Amount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + return nil } func (m *SpendTx) validateFee(formats strfmt.Registry) error { - if err := m.Fee.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("fee") - } + if err := validate.Required("fee", "body", m.Fee); err != nil { + return err + } + + if err := validate.Required("fee", "body", m.Fee); err != nil { return err } + if m.Fee != nil { + if err := m.Fee.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + return nil } @@ -127,6 +148,52 @@ func (m *SpendTx) validateSenderID(formats strfmt.Registry) error { return nil } +// ContextValidate validate this spend tx based on the context it is used +func (m *SpendTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAmount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFee(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SpendTx) contextValidateAmount(ctx context.Context, formats strfmt.Registry) error { + + if m.Amount != nil { + if err := m.Amount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("amount") + } + return err + } + } + + return nil +} + +func (m *SpendTx) contextValidateFee(ctx context.Context, formats strfmt.Registry) error { + + if m.Fee != nil { + if err := m.Fee.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fee") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *SpendTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/spend_tx_json.go b/swagguard/node/models/spend_tx_json.go index 5126a8f5..ca00613e 100644 --- a/swagguard/node/models/spend_tx_json.go +++ b/swagguard/node/models/spend_tx_json.go @@ -7,16 +7,17 @@ package models import ( "bytes" + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SpendTxJSON spend tx JSON +// // swagger:model SpendTxJSON type SpendTxJSON struct { versionField *uint32 @@ -31,7 +32,6 @@ func (m *SpendTxJSON) Type() string { // SetType sets the type of this subtype func (m *SpendTxJSON) SetType(val string) { - } // Version gets the version of this subtype @@ -78,7 +78,6 @@ func (m *SpendTxJSON) UnmarshalJSON(raw []byte) error { /* Not the type we're looking for. */ return errors.New(422, "invalid type value: %q", base.Type) } - result.versionField = base.Version result.SpendTx = data.SpendTx @@ -97,8 +96,7 @@ func (m SpendTxJSON) MarshalJSON() ([]byte, error) { }{ SpendTx: m.SpendTx, - }, - ) + }) if err != nil { return nil, err } @@ -111,8 +109,7 @@ func (m SpendTxJSON) MarshalJSON() ([]byte, error) { Type: m.Type(), Version: m.Version(), - }, - ) + }) if err != nil { return nil, err } @@ -148,6 +145,21 @@ func (m *SpendTxJSON) validateVersion(formats strfmt.Registry) error { return nil } +// ContextValidate validate this spend tx JSON based on the context it is used +func (m *SpendTxJSON) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with SpendTx + if err := m.SpendTx.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + // MarshalBinary interface implementation func (m *SpendTxJSON) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/status.go b/swagguard/node/models/status.go index e4841096..75c38c4c 100644 --- a/swagguard/node/models/status.go +++ b/swagguard/node/models/status.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Status status +// // swagger:model Status type Status struct { @@ -43,6 +44,10 @@ type Status struct { // Required: true NodeVersion *string `json:"node_version"` + // peer connections + // Required: true + PeerConnections *PeerConnections `json:"peer_connections"` + // peer count // Required: true PeerCount *uint32 `json:"peer_count"` @@ -109,6 +114,10 @@ func (m *Status) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validatePeerConnections(formats); err != nil { + res = append(res, err) + } + if err := m.validatePeerCount(formats); err != nil { res = append(res, err) } @@ -205,6 +214,24 @@ func (m *Status) validateNodeVersion(formats strfmt.Registry) error { return nil } +func (m *Status) validatePeerConnections(formats strfmt.Registry) error { + + if err := validate.Required("peer_connections", "body", m.PeerConnections); err != nil { + return err + } + + if m.PeerConnections != nil { + if err := m.PeerConnections.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peer_connections") + } + return err + } + } + + return nil +} + func (m *Status) validatePeerCount(formats strfmt.Registry) error { if err := validate.Required("peer_count", "body", m.PeerCount); err != nil { @@ -267,7 +294,6 @@ func (m *Status) validateSolutions(formats strfmt.Registry) error { } func (m *Status) validateSyncProgress(formats strfmt.Registry) error { - if swag.IsZero(m.SyncProgress) { // not required return nil } @@ -310,6 +336,56 @@ func (m *Status) validateTopKeyBlockHash(formats strfmt.Registry) error { return nil } +// ContextValidate validate this status based on the context it is used +func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeerConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateProtocols(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) contextValidatePeerConnections(ctx context.Context, formats strfmt.Registry) error { + + if m.PeerConnections != nil { + if err := m.PeerConnections.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peer_connections") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateProtocols(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Protocols); i++ { + + if m.Protocols[i] != nil { + if err := m.Protocols[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("protocols" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *Status) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/token_supply.go b/swagguard/node/models/token_supply.go index e00beb3a..3d848d7d 100644 --- a/swagguard/node/models/token_supply.go +++ b/swagguard/node/models/token_supply.go @@ -6,15 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" + "github.com/aeternity/aepp-sdk-go/v9/utils" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - utils "github.com/aeternity/aepp-sdk-go/v8/utils" ) // TokenSupply token supply +// // swagger:model TokenSupply type TokenSupply struct { @@ -86,7 +87,6 @@ func (m *TokenSupply) Validate(formats strfmt.Registry) error { } func (m *TokenSupply) validateAccounts(formats strfmt.Registry) error { - if swag.IsZero(m.Accounts) { // not required return nil } @@ -102,7 +102,6 @@ func (m *TokenSupply) validateAccounts(formats strfmt.Registry) error { } func (m *TokenSupply) validateContractOracles(formats strfmt.Registry) error { - if swag.IsZero(m.ContractOracles) { // not required return nil } @@ -118,7 +117,6 @@ func (m *TokenSupply) validateContractOracles(formats strfmt.Registry) error { } func (m *TokenSupply) validateContracts(formats strfmt.Registry) error { - if swag.IsZero(m.Contracts) { // not required return nil } @@ -134,7 +132,6 @@ func (m *TokenSupply) validateContracts(formats strfmt.Registry) error { } func (m *TokenSupply) validateLocked(formats strfmt.Registry) error { - if swag.IsZero(m.Locked) { // not required return nil } @@ -150,7 +147,6 @@ func (m *TokenSupply) validateLocked(formats strfmt.Registry) error { } func (m *TokenSupply) validateOracleQueries(formats strfmt.Registry) error { - if swag.IsZero(m.OracleQueries) { // not required return nil } @@ -166,7 +162,6 @@ func (m *TokenSupply) validateOracleQueries(formats strfmt.Registry) error { } func (m *TokenSupply) validateOracles(formats strfmt.Registry) error { - if swag.IsZero(m.Oracles) { // not required return nil } @@ -182,7 +177,6 @@ func (m *TokenSupply) validateOracles(formats strfmt.Registry) error { } func (m *TokenSupply) validatePendingRewards(formats strfmt.Registry) error { - if swag.IsZero(m.PendingRewards) { // not required return nil } @@ -198,7 +192,6 @@ func (m *TokenSupply) validatePendingRewards(formats strfmt.Registry) error { } func (m *TokenSupply) validateTotal(formats strfmt.Registry) error { - if swag.IsZero(m.Total) { // not required return nil } @@ -213,6 +206,144 @@ func (m *TokenSupply) validateTotal(formats strfmt.Registry) error { return nil } +// ContextValidate validate this token supply based on the context it is used +func (m *TokenSupply) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContractOracles(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContracts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLocked(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOracleQueries(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOracles(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePendingRewards(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTotal(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenSupply) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Accounts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateContractOracles(ctx context.Context, formats strfmt.Registry) error { + + if err := m.ContractOracles.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contract_oracles") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateContracts(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Contracts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contracts") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateLocked(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Locked.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("locked") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateOracleQueries(ctx context.Context, formats strfmt.Registry) error { + + if err := m.OracleQueries.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oracle_queries") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateOracles(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Oracles.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oracles") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidatePendingRewards(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PendingRewards.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pending_rewards") + } + return err + } + + return nil +} + +func (m *TokenSupply) contextValidateTotal(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Total.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("total") + } + return err + } + + return nil +} + // MarshalBinary interface implementation func (m *TokenSupply) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/ttl.go b/swagguard/node/models/ttl.go index b474fde2..e6b30f3d 100644 --- a/swagguard/node/models/ttl.go +++ b/swagguard/node/models/ttl.go @@ -6,16 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( + "context" "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // TTL TTL +// // swagger:model TTL type TTL struct { @@ -70,7 +71,7 @@ const ( // prop value enum func (m *TTL) validateTypeEnum(path, location string, value string) error { - if err := validate.Enum(path, location, value, ttlTypeTypePropEnum); err != nil { + if err := validate.EnumCase(path, location, value, ttlTypeTypePropEnum, true); err != nil { return err } return nil @@ -99,6 +100,11 @@ func (m *TTL) validateValue(formats strfmt.Registry) error { return nil } +// ContextValidate validates this TTL based on context it is used +func (m *TTL) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *TTL) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/tx.go b/swagguard/node/models/tx.go index d76cfcb7..0365b1d3 100644 --- a/swagguard/node/models/tx.go +++ b/swagguard/node/models/tx.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Tx tx +// // swagger:model Tx type Tx struct { @@ -45,6 +47,11 @@ func (m *Tx) validateTx(formats strfmt.Registry) error { return nil } +// ContextValidate validates this tx based on context it is used +func (m *Tx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *Tx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/tx_block_height.go b/swagguard/node/models/tx_block_height.go index bd9c5adc..de3ab015 100644 --- a/swagguard/node/models/tx_block_height.go +++ b/swagguard/node/models/tx_block_height.go @@ -6,15 +6,17 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/validate" ) // TxBlockHeight tx block height +// // swagger:model TxBlockHeight -type TxBlockHeight uint64 +type TxBlockHeight int64 // Validate validates this tx block height func (m TxBlockHeight) Validate(formats strfmt.Registry) error { @@ -29,3 +31,8 @@ func (m TxBlockHeight) Validate(formats strfmt.Registry) error { } return nil } + +// ContextValidate validates this tx block height based on context it is used +func (m TxBlockHeight) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/tx_event.go b/swagguard/node/models/tx_event.go new file mode 100644 index 00000000..5dd5ea6a --- /dev/null +++ b/swagguard/node/models/tx_event.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// TxEvent tx event +// +// swagger:model TxEvent +type TxEvent interface{} diff --git a/swagguard/node/models/tx_info_object.go b/swagguard/node/models/tx_info_object.go index 1e9b0e16..1576eaba 100644 --- a/swagguard/node/models/tx_info_object.go +++ b/swagguard/node/models/tx_info_object.go @@ -6,13 +6,15 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // TxInfoObject tx info object +// // swagger:model TxInfoObject type TxInfoObject struct { @@ -45,7 +47,6 @@ func (m *TxInfoObject) Validate(formats strfmt.Registry) error { } func (m *TxInfoObject) validateCallInfo(formats strfmt.Registry) error { - if swag.IsZero(m.CallInfo) { // not required return nil } @@ -63,7 +64,6 @@ func (m *TxInfoObject) validateCallInfo(formats strfmt.Registry) error { } func (m *TxInfoObject) validateGaInfo(formats strfmt.Registry) error { - if swag.IsZero(m.GaInfo) { // not required return nil } @@ -80,6 +80,52 @@ func (m *TxInfoObject) validateGaInfo(formats strfmt.Registry) error { return nil } +// ContextValidate validate this tx info object based on the context it is used +func (m *TxInfoObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCallInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateGaInfo(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TxInfoObject) contextValidateCallInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.CallInfo != nil { + if err := m.CallInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("call_info") + } + return err + } + } + + return nil +} + +func (m *TxInfoObject) contextValidateGaInfo(ctx context.Context, formats strfmt.Registry) error { + + if m.GaInfo != nil { + if err := m.GaInfo.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ga_info") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *TxInfoObject) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node/models/u_int16.go b/swagguard/node/models/u_int16.go new file mode 100644 index 00000000..a866df6a --- /dev/null +++ b/swagguard/node/models/u_int16.go @@ -0,0 +1,38 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// UInt16 u int16 +// +// swagger:model UInt16 +type UInt16 uint64 + +// Validate validates this u int16 +func (m UInt16) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.MinimumUint("", "body", uint64(m), 0, false); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this u int16 based on context it is used +func (m UInt16) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/u_int32.go b/swagguard/node/models/u_int32.go new file mode 100644 index 00000000..669f7f00 --- /dev/null +++ b/swagguard/node/models/u_int32.go @@ -0,0 +1,38 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// UInt32 u int32 +// +// swagger:model UInt32 +type UInt32 uint64 + +// Validate validates this u int32 +func (m UInt32) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.MinimumUint("", "body", uint64(m), 0, false); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this u int32 based on context it is used +func (m UInt32) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/u_int64.go b/swagguard/node/models/u_int64.go new file mode 100644 index 00000000..c2aa048e --- /dev/null +++ b/swagguard/node/models/u_int64.go @@ -0,0 +1,38 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// UInt64 u int64 +// +// swagger:model UInt64 +type UInt64 uint64 + +// Validate validates this u int64 +func (m UInt64) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.MinimumUint("", "body", uint64(m), 0, false); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this u int64 based on context it is used +func (m UInt64) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/swagguard/node/models/uint16.go b/swagguard/node/models/uint16.go deleted file mode 100644 index 988bbb40..00000000 --- a/swagguard/node/models/uint16.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/errors" - "github.com/go-openapi/validate" -) - -// Uint16 uint16 -// swagger:model UInt16 -type Uint16 uint64 - -// Validate validates this uint16 -func (m Uint16) Validate(formats strfmt.Registry) error { - var res []error - - if err := validate.MinimumInt("", "body", int64(m), 0, false); err != nil { - return err - } - - if err := validate.MaximumInt("", "body", int64(m), 65535, false); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/swagguard/node/models/uint32.go b/swagguard/node/models/uint32.go deleted file mode 100644 index ec15e3ba..00000000 --- a/swagguard/node/models/uint32.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/errors" - "github.com/go-openapi/validate" -) - -// Uint32 uint32 -// swagger:model UInt32 -type Uint32 uint64 - -// Validate validates this uint32 -func (m Uint32) Validate(formats strfmt.Registry) error { - var res []error - - if err := validate.MinimumInt("", "body", int64(m), 0, false); err != nil { - return err - } - - if err := validate.MaximumInt("", "body", int64(m), 4.294967295e+09, false); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/swagguard/node/models/uint64.go b/swagguard/node/models/uint64.go deleted file mode 100644 index f9f0d09a..00000000 --- a/swagguard/node/models/uint64.go +++ /dev/null @@ -1,31 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/errors" - "github.com/go-openapi/validate" -) - -// Uint64 uint64 -// swagger:model UInt64 -type Uint64 uint64 - -// Validate validates this uint64 -func (m Uint64) Validate(formats strfmt.Registry) error { - var res []error - - if err := validate.MinimumInt("", "body", int64(m), 0, false); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/swagguard/node/models/unsigned_tx.go b/swagguard/node/models/unsigned_tx.go index 56f10e91..e9026c2d 100644 --- a/swagguard/node/models/unsigned_tx.go +++ b/swagguard/node/models/unsigned_tx.go @@ -6,14 +6,16 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" + "context" "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // UnsignedTx unsigned tx +// // swagger:model UnsignedTx type UnsignedTx struct { @@ -45,6 +47,11 @@ func (m *UnsignedTx) validateTx(formats strfmt.Registry) error { return nil } +// ContextValidate validates this unsigned tx based on context it is used +func (m *UnsignedTx) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + // MarshalBinary interface implementation func (m *UnsignedTx) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/swagguard/node_error_test.go b/swagguard/node_error_test.go index 61b82ce6..b8f6a832 100644 --- a/swagguard/node_error_test.go +++ b/swagguard/node_error_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/client/external" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/client/external" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) func TestErrorModelDereferencing(t *testing.T) { diff --git a/swagguard/node_generic_txs_test.go b/swagguard/node_generic_txs_test.go index 8a916058..5b8b795f 100644 --- a/swagguard/node_generic_txs_test.go +++ b/swagguard/node_generic_txs_test.go @@ -3,13 +3,13 @@ package swagguard_test import ( "testing" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" ) // Unfortunately, one must patch the generated go-swagger code to correctly parse the GenericTx into a specific Transaction type. // Ideally the test JSON snippet should include every possible transaction type, but it only tests SpendTx for now. func TestGenericTxsPolymorphicDeserialization(t *testing.T) { - genericTxsJSON := []byte("{\"transactions\":[{\"block_hash\":\"mh_qoxFYgZoG7NxocZqBk1Dx9DJZKboT9WCKGFWV26QHKhB3oPDp\",\"block_height\":8835,\"hash\":\"th_uRnWPL3iqiLB7MzsVQ3aAgHsFALd62cmcNkw7ea1n9sfXybcr\",\"signatures\":[\"sg_RBq5vRuRchZ26HCPnZk5Xorn3ooQtfZSxf4mEPCsnpV9UD9KuZvqEKHM3vosoVvCvxvF5CyfdDkzCHnYW8bs3Ai7EtMBY\"],\"tx\":{\"amount\":10,\"fee\":20000000000000,\"nonce\":54,\"payload\":\"Hello World\",\"recipient_id\":\"ak_Egp9yVdpxmvAfQ7vsXGvpnyfNq71msbdUpkMNYGTeTe8kPL3v\",\"sender_id\":\"ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi\",\"ttl\":9335,\"type\":\"SpendTx\",\"version\":1}}]}") + genericTxsJSON := []byte("{\"transactions\":[{\"block_hash\":\"mh_qoxFYgZoG7NxocZqBk1Dx9DJZKboT9WCKGFWV26QHKhB3oPDp\",\"block_height\":8835,\"hash\":\"th_uRnWPL3iqiLB7MzsVQ3aAgHsFALd62cmcNkw7ea1n9sfXybcr\",\"signatures\":[\"sg_RBq5vRuRchZ26HCPnZk5Xorn3ooQtfZSxf4mEPCsnpV9UD9KuZvqEKHM3vosoVvCvxvF5CyfdDkzCHnYW8bs3Ai7EtMBY\"],\"tx\":{\"amount\":10,\"fee\":20000000000000,\"nonce\":54,\"payload\":\"Hello World\",\"recipient_id\":\"ak_wJ3iKZcqvgdnQ6YVz8pY2xPjtVTNNEL61qF4AYQdksZfXZLks\",\"sender_id\":\"ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi\",\"ttl\":9335,\"type\":\"SpendTx\",\"version\":1}}]}") genericTxs := models.GenericTxs{} err := genericTxs.UnmarshalBinary(genericTxsJSON) if err != nil { diff --git a/transactions/transactions.go b/transactions/transactions.go index b5b27909..4cf2ca72 100644 --- a/transactions/transactions.go +++ b/transactions/transactions.go @@ -6,13 +6,13 @@ import ( "io" "math/big" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/naet" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/naet" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) // TransactionTypes is a map between the ObjectTags defined above and the @@ -41,6 +41,7 @@ func TransactionTypes() map[uint]Transaction { // RLP message version used in RLP serialization const ( rlpMessageVersion uint = 1 + rlpMessageVersion2 uint = 2 ) // Address-like bytearrays are converted in to an ID (uint8 bytearray) for RLP @@ -539,6 +540,10 @@ func CreateNoncer(n naet.GetAccounter) Noncer { return func(accountID string) (nextNonce uint64, err error) { a, err := n.GetAccount(accountID) if err != nil { + if err.Error() == "Account not found" { + nextNonce = 0 + err = nil + } return } nextNonce = *a.Nonce + 1 diff --git a/transactions/transactions_test.go b/transactions/transactions_test.go index b5e5eb5b..de89dd0f 100644 --- a/transactions/transactions_test.go +++ b/transactions/transactions_test.go @@ -6,11 +6,11 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/account" - "github.com/aeternity/aepp-sdk-go/v8/config" + "github.com/aeternity/aepp-sdk-go/v9/account" + "github.com/aeternity/aepp-sdk-go/v9/config" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) func getRLPSerialized(tx1 string, tx2 string) ([]interface{}, []interface{}) { diff --git a/transactions/tx_aens.go b/transactions/tx_aens.go index bb0c3a94..7b562eba 100644 --- a/transactions/tx_aens.go +++ b/transactions/tx_aens.go @@ -8,11 +8,11 @@ import ( "strconv" "strings" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) // NameID computes the nm_ string of a given AENS name. @@ -68,7 +68,7 @@ func computeCommitmentID(name string, salt []byte) (ch string, err error) { // includes an extra byte at the start and end of the string, messing up // the hashing process. if !isPrintable(name) { - return "", fmt.Errorf("The name %s must contain only printable characters", name) + return "", fmt.Errorf("the name %s must contain only printable characters", name) } nh = append([]byte(name), salt...) @@ -177,10 +177,11 @@ func (tx *NamePreclaimTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *NamePreclaimTx) JSON() (string, error) { + fee := utils.BigInt(*tx.Fee) swaggerT := models.NamePreclaimTx{ AccountID: &tx.AccountID, CommitmentID: &tx.CommitmentID, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Nonce: tx.AccountNonce, TTL: tx.TTL, } @@ -206,7 +207,6 @@ func (tx *NamePreclaimTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -320,11 +320,13 @@ func (tx *NameClaimTx) JSON() (string, error) { // When talking JSON to the node, the name should be 'API encoded' // (base58), not namehash-ed. nameAPIEncoded := binary.Encode(binary.PrefixName, []byte(tx.Name)) + fee := utils.BigInt(*tx.Fee) + nameSalt := utils.BigInt(*tx.NameSalt) swaggerT := models.NameClaimTx{ AccountID: &tx.AccountID, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Name: &nameAPIEncoded, - NameSalt: utils.BigInt(*tx.NameSalt), + NameSalt: &nameSalt, NameFee: utils.BigInt(*tx.NameFee), Nonce: tx.AccountNonce, TTL: tx.TTL, @@ -352,7 +354,6 @@ func (tx *NameClaimTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -473,27 +474,27 @@ func (np *NamePointer) Validate() (err error) { func (np *NamePointer) validateAccountPubkey() error { if !strings.HasPrefix(np.Pointer, string(binary.PrefixAccountPubkey)) { - return fmt.Errorf("If the Key is \"account_pubkey\", the Pointer must start with %s", binary.PrefixAccountPubkey) + return fmt.Errorf("if the Key is \"account_pubkey\", the Pointer must start with %s", binary.PrefixAccountPubkey) } return nil } func (np *NamePointer) validateOraclePubkey() error { if !strings.HasPrefix(np.Pointer, string(binary.PrefixOraclePubkey)) { - return fmt.Errorf("If the Key is \"oracle_pubkey\", the Pointer must start with %s", binary.PrefixOraclePubkey) + return fmt.Errorf("if the Key is \"oracle_pubkey\", the Pointer must start with %s", binary.PrefixOraclePubkey) } return nil } func (np *NamePointer) validateContractPubkey() error { if !strings.HasPrefix(np.Pointer, string(binary.PrefixContractPubkey)) { - return fmt.Errorf("If the Key is \"contract_pubkey\", the Pointer must start with %s", binary.PrefixContractPubkey) + return fmt.Errorf("if the Key is \"contract_pubkey\", the Pointer must start with %s", binary.PrefixContractPubkey) } return nil } func (np *NamePointer) validateChannel() error { if !strings.HasPrefix(np.Pointer, string(binary.PrefixChannel)) { - return fmt.Errorf("If the Key is \"channel\", the Pointer must start with %s", binary.PrefixChannel) + return fmt.Errorf("if the Key is \"channel\", the Pointer must start with %s", binary.PrefixChannel) } return nil } @@ -630,10 +631,11 @@ func (tx *NameUpdateTx) JSON() (string, error) { swaggerNamePointers = append(swaggerNamePointers, np.Swagger()) } + fee := utils.BigInt(*tx.Fee) swaggerT := models.NameUpdateTx{ AccountID: &tx.AccountID, ClientTTL: &tx.ClientTTL, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, NameID: &tx.NameID, NameTTL: &tx.NameTTL, Nonce: tx.AccountNonce, @@ -663,7 +665,6 @@ func (tx *NameUpdateTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -772,9 +773,10 @@ func (tx *NameRevokeTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *NameRevokeTx) JSON() (string, error) { + fee := utils.BigInt(*tx.Fee) swaggerT := models.NameRevokeTx{ AccountID: &tx.AccountID, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, NameID: &tx.NameID, Nonce: tx.AccountNonce, TTL: tx.TTL, @@ -802,7 +804,6 @@ func (tx *NameRevokeTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -926,9 +927,10 @@ func (tx *NameTransferTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *NameTransferTx) JSON() (string, error) { + fee := utils.BigInt(*tx.Fee) swaggerT := models.NameTransferTx{ AccountID: &tx.AccountID, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, NameID: &tx.NameID, Nonce: tx.AccountNonce, RecipientID: &tx.RecipientID, @@ -957,7 +959,6 @@ func (tx *NameTransferTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } diff --git a/transactions/tx_aens_test.go b/transactions/tx_aens_test.go index 59cc4dfa..334f85d5 100644 --- a/transactions/tx_aens_test.go +++ b/transactions/tx_aens_test.go @@ -6,9 +6,9 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) func TestNamePointer(t *testing.T) { diff --git a/transactions/tx_contracts.go b/transactions/tx_contracts.go index 3ecd93d8..c38e5de3 100644 --- a/transactions/tx_contracts.go +++ b/transactions/tx_contracts.go @@ -4,11 +4,11 @@ import ( "io" "math/big" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) // ABIVersionFATE indicates that the bytecode payload is for the FATE VM. Only @@ -157,18 +157,22 @@ func (tx *ContractCreateTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *ContractCreateTx) JSON() (string, error) { - g := tx.GasLimit.Uint64() + deposit := utils.BigInt(*tx.Deposit) + amount := utils.BigInt(*tx.Amount) + gas := tx.GasLimit.Uint64() + gasPrice := utils.BigInt(*tx.GasPrice) + fee := utils.BigInt(*tx.Fee) swaggerT := models.ContractCreateTx{ OwnerID: &tx.OwnerID, Nonce: tx.AccountNonce, Code: &tx.Code, VMVersion: &tx.VMVersion, AbiVersion: &tx.AbiVersion, - Deposit: utils.BigInt(*tx.Deposit), - Amount: utils.BigInt(*tx.Amount), - Gas: &g, - GasPrice: utils.BigInt(*tx.GasPrice), - Fee: utils.BigInt(*tx.Fee), + Deposit: &deposit, + Amount: &amount, + Gas: &gas, + GasPrice: &gasPrice, + Fee: &fee, TTL: tx.TTL, CallData: &tx.CallData, } @@ -199,7 +203,6 @@ func (tx *ContractCreateTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -340,17 +343,20 @@ func (tx *ContractCallTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *ContractCallTx) JSON() (string, error) { + amount := utils.BigInt(*tx.Amount) gas := tx.GasLimit.Uint64() + gasPrice := utils.BigInt(*tx.GasPrice) + fee := utils.BigInt(*tx.Fee) swaggerT := models.ContractCallTx{ CallerID: &tx.CallerID, Nonce: tx.AccountNonce, ContractID: &tx.ContractID, - Amount: utils.BigInt(*tx.Amount), + Amount: &amount, Gas: &gas, - GasPrice: utils.BigInt(*tx.GasPrice), + GasPrice: &gasPrice, AbiVersion: &tx.AbiVersion, CallData: &tx.CallData, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, TTL: tx.TTL, } output, err := swaggerT.MarshalBinary() @@ -379,7 +385,6 @@ func (tx *ContractCallTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } diff --git a/transactions/tx_contracts_test.go b/transactions/tx_contracts_test.go index d992dac6..d7f239c4 100644 --- a/transactions/tx_contracts_test.go +++ b/transactions/tx_contracts_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) func TestContractTx(t *testing.T) { diff --git a/transactions/tx_ga.go b/transactions/tx_ga.go index b1587acf..cda0221e 100644 --- a/transactions/tx_ga.go +++ b/transactions/tx_ga.go @@ -4,9 +4,9 @@ import ( "io" "math/big" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + rlp "github.com/aeternity/rlp-go" ) // GAAttachTx is a transaction that converts a plain old account (POA) into a @@ -139,7 +139,6 @@ func (tx *GAAttachTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } @@ -177,7 +176,6 @@ type GAMetaTx struct { GasLimit *big.Int GasPrice *big.Int Fee *big.Int - TTL uint64 Tx *SignedTx } @@ -198,14 +196,13 @@ func (tx *GAMetaTx) EncodeRLP(w io.Writer) (err error) { rlpRawMsg, err := buildRLPMessage( ObjectTagGeneralizedAccountMetaTransaction, - rlpMessageVersion, + rlpMessageVersion2, aID, authDataBinary, tx.AbiVersion, tx.Fee, tx.GasLimit, tx.GasPrice, - tx.TTL, txRLP, ) @@ -228,7 +225,6 @@ type gaMetaRLP struct { Fee *big.Int GasLimit *big.Int GasPrice *big.Int - TTL uint64 WrappedTx []byte } @@ -266,7 +262,6 @@ func (tx *GAMetaTx) DecodeRLP(s *rlp.Stream) (err error) { tx.GasLimit = gtx.GasLimit tx.GasPrice = gtx.GasPrice tx.Fee = gtx.Fee - tx.TTL = gtx.TTL tx.Tx = wtx.(*SignedTx) return } @@ -290,18 +285,12 @@ func (tx *GAMetaTx) CalcGas() (g *big.Int, err error) { if err != nil { return } - g = new(big.Int) g = baseGas.Add(baseGas, gasComponent) return } // NewGAMetaTx creates a GAMetaTx func NewGAMetaTx(accountID string, authData string, abiVersion uint16, gasLimit *big.Int, gasPrice *big.Int, wrappedTx Transaction, ttlnoncer TTLNoncer) (tx *GAMetaTx, err error) { - ttl, _, _, err := ttlnoncer(accountID, config.Client.TTL) - if err != nil { - return - } - tx = &GAMetaTx{ AccountID: accountID, AuthData: authData, @@ -309,7 +298,6 @@ func NewGAMetaTx(accountID string, authData string, abiVersion uint16, gasLimit GasLimit: gasLimit, GasPrice: gasPrice, Fee: config.Client.Fee, - TTL: ttl, Tx: &SignedTx{ Signatures: [][]byte{}, Tx: wrappedTx, diff --git a/transactions/tx_oracles.go b/transactions/tx_oracles.go index dbf967a0..483c25b6 100644 --- a/transactions/tx_oracles.go +++ b/transactions/tx_oracles.go @@ -7,11 +7,11 @@ import ( "math/big" "strings" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) func timeGas(ttl uint64) (timeGasComponent uint64) { @@ -119,7 +119,7 @@ func (tx *OracleRegisterTx) DecodeRLP(s *rlp.Stream) (err error) { } // JSON representation of a Tx is useful for querying the node's debug endpoint -// BUG: Account Nonce won't be represented in JSON output if nonce is 0, thanks to swagger.json +// BUG: Account Nonce won't be represented in JSON output if nonce is 0, thanks to node.json func (tx *OracleRegisterTx) JSON() (string, error) { // # Oracles // ORACLE_TTL_TYPE_DELTA = 'delta' @@ -138,17 +138,19 @@ func (tx *OracleRegisterTx) JSON() (string, error) { // ABI_SOLIDITY = 2 ttlTypeStr := ttlTypeIntToStr(tx.OracleTTLType) + fee := utils.BigInt(*tx.Fee) + queryFee := utils.BigInt(*tx.QueryFee) swaggerT := models.OracleRegisterTx{ AbiVersion: tx.AbiVersion, AccountID: &tx.AccountID, - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Nonce: tx.AccountNonce, OracleTTL: &models.TTL{ Type: &ttlTypeStr, Value: &tx.OracleTTLValue, }, - QueryFee: utils.BigInt(*tx.QueryFee), + QueryFee: &queryFee, QueryFormat: &tx.QuerySpec, ResponseFormat: &tx.ResponseSpec, TTL: tx.TTL, @@ -276,9 +278,9 @@ func (tx *OracleExtendTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *OracleExtendTx) JSON() (string, error) { oracleTTLTypeStr := ttlTypeIntToStr(tx.OracleTTLType) - + fee := utils.BigInt(*tx.Fee) swaggerT := models.OracleExtendTx{ - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Nonce: tx.AccountNonce, OracleID: &tx.OracleID, OracleTTL: &models.RelativeTTL{ @@ -468,13 +470,14 @@ func (tx *OracleQueryTx) DecodeRLP(s *rlp.Stream) (err error) { func (tx *OracleQueryTx) JSON() (string, error) { responseTTLTypeStr := ttlTypeIntToStr(tx.ResponseTTLType) queryTTLTypeStr := ttlTypeIntToStr(tx.QueryTTLType) - + fee := utils.BigInt(*tx.Fee) + queryFee := utils.BigInt(*tx.QueryFee) swaggerT := models.OracleQueryTx{ - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Nonce: tx.AccountNonce, OracleID: &tx.OracleID, Query: &tx.Query, - QueryFee: utils.BigInt(*tx.QueryFee), + QueryFee: &queryFee, QueryTTL: &models.TTL{ Type: &queryTTLTypeStr, Value: &tx.QueryTTLValue, @@ -625,9 +628,9 @@ func (tx *OracleRespondTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *OracleRespondTx) JSON() (string, error) { responseTTLTypeStr := ttlTypeIntToStr(tx.ResponseTTLType) - + fee := utils.BigInt(*tx.Fee) swaggerT := models.OracleRespondTx{ - Fee: utils.BigInt(*tx.Fee), + Fee: &fee, Nonce: tx.AccountNonce, OracleID: &tx.OracleID, QueryID: &tx.QueryID, diff --git a/transactions/tx_oracles_test.go b/transactions/tx_oracles_test.go index bffea113..4e4e500a 100644 --- a/transactions/tx_oracles_test.go +++ b/transactions/tx_oracles_test.go @@ -5,8 +5,8 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/utils" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/utils" ) func TestOracleTx_ID(t *testing.T) { diff --git a/transactions/tx_spend.go b/transactions/tx_spend.go index 4228e5c7..bb427ef7 100644 --- a/transactions/tx_spend.go +++ b/transactions/tx_spend.go @@ -4,11 +4,11 @@ import ( "io" "math/big" - "github.com/aeternity/aepp-sdk-go/v8/binary" - "github.com/aeternity/aepp-sdk-go/v8/config" - "github.com/aeternity/aepp-sdk-go/v8/swagguard/node/models" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/binary" + "github.com/aeternity/aepp-sdk-go/v9/config" + "github.com/aeternity/aepp-sdk-go/v9/swagguard/node/models" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) // SpendTx represents a simple transaction where one party sends another AE @@ -106,9 +106,11 @@ func (tx *SpendTx) DecodeRLP(s *rlp.Stream) (err error) { // JSON representation of a Tx is useful for querying the node's debug endpoint func (tx *SpendTx) JSON() (string, error) { baseEncodedPayload := binary.Encode(binary.PrefixByteArray, tx.Payload) + amount := utils.BigInt(*tx.Amount) + fee := utils.BigInt(*tx.Fee) swaggerT := models.SpendTx{ - Amount: utils.BigInt(*tx.Amount), - Fee: utils.BigInt(*tx.Fee), + Amount: &amount, + Fee: &fee, Nonce: tx.Nonce, Payload: &baseEncodedPayload, RecipientID: &tx.RecipientID, diff --git a/transactions/tx_spend_test.go b/transactions/tx_spend_test.go index d7e076fe..fc05f6d4 100644 --- a/transactions/tx_spend_test.go +++ b/transactions/tx_spend_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/aeternity/aepp-sdk-go/v8/utils" - rlp "github.com/randomshinichi/rlpae" + "github.com/aeternity/aepp-sdk-go/v9/utils" + rlp "github.com/aeternity/rlp-go" ) func TestSpendTx_EncodeRLP(t *testing.T) { @@ -49,6 +49,9 @@ func TestSpendTx_EncodeRLP(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { txJSON, err := tt.tx.JSON() + if err != nil { + t.Error(err) + } fmt.Println(txJSON) fmt.Println(rlp.EncodeToBytes(tt.tx)) diff --git a/utils/utils.go b/utils/utils.go index 43db8d3b..951cb4e0 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -1,6 +1,7 @@ package utils import ( + "context" "errors" "fmt" "math/big" @@ -28,24 +29,22 @@ func (b *BigInt) Validate(formats strfmt.Registry) error { return nil } +// ContextValidate does the same as Validate +func (b *BigInt) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return b.Validate(formats) +} + // LargerThanZero returns true if it is >0 func (b *BigInt) LargerThanZero() bool { zero := new(BigInt) - if b.Cmp(zero) != 1 { - return false - } - return true + return b.Cmp(zero) == 1 } // LargerOrEqualToZero checks that the number is >=0 func (b *BigInt) LargerOrEqualToZero() bool { zero := new(BigInt) - - if b.Cmp(zero) == -1 { - return false - } - return true + return b.Cmp(zero) != -1 } // UnmarshalJSON implements the json.Unmarshaler interface. @@ -85,8 +84,8 @@ func (b *BigInt) Cmp(i *BigInt) int { func NewIntFromString(number string) (i *big.Int, err error) { i = new(big.Int) _, success := i.SetString(number, 10) - if success == false { - return nil, errors.New("Could not parse string as a number") + if !success { + return nil, errors.New("could not parse string as a number") } return i, nil }