From af3db4cbbbf94cd788bc8271f4466775fc393576 Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Sun, 8 Sep 2024 14:39:17 -0700 Subject: [PATCH] feat(connector-chainlink): add skeleton implementation - oracle streams WORK IN PROGRESS Fixes #3530 Signed-off-by: Peter Somogyvari --- .../README.md | 34 + .../openapitools.json | 7 + .../package.json | 117 + .../go-client/.openapi-generator/FILES | 16 + .../go-client/.openapi-generator/VERSION | 1 + .../generated/openapi/go-client/.travis.yml | 8 + .../go/generated/openapi/go-client/README.md | 118 + .../openapi/go-client/api/openapi.yaml | 189 + .../openapi/go-client/api_default.go | 225 + .../go/generated/openapi/go-client/client.go | 656 ++ .../openapi/go-client/configuration.go | 215 + .../go/generated/openapi/go-client/go.mod | 6 + .../go/generated/openapi/go-client/go.sum | 11 + .../model_deploy_contract_v1_request.go | 378 ++ .../model_deploy_contract_v1_response.go | 117 + .../go-client/model_watch_blocks_v1.go | 117 + .../model_watch_blocks_v1_progress.go | 117 + .../model_watch_blocks_v1_request.go | 117 + ...web3_signing_credential_private_key_hex.go | 146 + .../generated/openapi/go-client/response.go | 47 + .../go-client/test/api_default_test.go | 37 + .../go/generated/openapi/go-client/utils.go | 347 + .../src/main/json/openapi.json | 219 + .../src/main/json/openapi.tpl.json | 219 + .../templates/protobuf-schema/api.mustache | 46 + .../templates/protobuf-schema/model.mustache | 41 + .../templates/protobuf-schema/root.mustache | 22 + .../openapi/.openapi-generator/FILES | 8 + .../openapi/.openapi-generator/VERSION | 1 + .../main/proto/generated/openapi/README.md | 31 + .../deploy_contract_v1_request_pb.proto | 44 + .../deploy_contract_v1_response_pb.proto | 22 + .../openapi/models/watch_blocks_v1_pb.proto | 24 + .../models/watch_blocks_v1_progress_pb.proto | 22 + .../models/watch_blocks_v1_request_pb.proto | 23 + ...igning_credential_private_key_hex_pb.proto | 26 + .../openapi/services/default_service.proto | 34 + .../services/avalanche-grpc-svc-streams.proto | 10 + .../api-client/avalanche-api-client.ts | 78 + .../typescript-axios/.openapi-generator/FILES | 5 + .../.openapi-generator/VERSION | 1 + .../generated/openapi/typescript-axios/api.ts | 329 + .../openapi/typescript-axios/base.ts | 72 + .../openapi/typescript-axios/common.ts | 150 + .../openapi/typescript-axios/configuration.ts | 101 + .../openapi/typescript-axios/index.ts | 18 + .../protoc-gen-ts/google/protobuf/any.ts | 98 + .../protoc-gen-ts/google/protobuf/empty.ts | 48 + .../models/deploy_contract_v1_request_pb.ts | 264 + .../models/deploy_contract_v1_response_pb.ts | 79 + .../models/watch_blocks_v1_pb.ts | 16 + .../models/watch_blocks_v1_progress_pb.ts | 90 + .../models/watch_blocks_v1_request_pb.ts | 77 + ...3_signing_credential_private_key_hex_pb.ts | 99 + .../services/avalanche-grpc-svc-streams.ts | 57 + .../protoc-gen-ts/services/default_service.ts | 209 + .../avalanche-grpc-svc-open-api.ts | 74 + .../avalanche-grpc-svc-streams.ts | 75 + .../common/grpc-credentials-factory.ts | 91 + .../common/grpc-server-factory.ts | 21 + .../typescript/impl/deploy-contract-impl.ts | 32 + .../src/main/typescript/index.ts | 1 + .../src/main/typescript/index.web.ts | 6 + .../plugin-factory-ledger-connector.ts | 20 + .../plugin-ledger-connector-avalanche.ts | 290 + .../prometheus-exporter/data-fetcher.ts | 12 + .../typescript/prometheus-exporter/metrics.ts | 11 + .../prometheus-exporter.ts | 39 + .../prometheus-exporter/response.type.ts | 3 + .../src/main/typescript/public-api.ts | 51 + .../deploy-contract-v1-endpoint.ts | 102 + .../get-open-api-spec-v1-endpoint.ts | 39 + .../web-services/watch-blocks-v1-endpoint.ts | 49 + .../integration/api-surface.test.ts | 6 + .../test/typescript/unit/api-surface.test.ts | 6 + ...en-api-spec-v1-connector-avalanche.test.ts | 89 + .../tsconfig.json | 32 + .../README.md | 268 + .../openapitools.json | 7 + .../package.json | 113 + .../go-client/.openapi-generator/FILES | 16 + .../go-client/.openapi-generator/VERSION | 1 + .../generated/openapi/go-client/.travis.yml | 8 + .../go/generated/openapi/go-client/README.md | 118 + .../openapi/go-client/api/openapi.yaml | 151 + .../openapi/go-client/api_default.go | 228 + .../go/generated/openapi/go-client/client.go | 656 ++ .../openapi/go-client/configuration.go | 215 + .../go/generated/openapi/go-client/go.mod | 6 + .../go/generated/openapi/go-client/go.sum | 11 + .../model_get_subscription_info_v1_request.go | 117 + ...ription_info_v1_request_subscription_id.go | 148 + ...model_get_subscription_info_v1_response.go | 126 + .../go-client/model_subscription_info.go | 252 + .../go-client/model_watch_blocks_v1.go | 117 + .../model_watch_blocks_v1_progress.go | 117 + .../model_watch_blocks_v1_request.go | 117 + .../generated/openapi/go-client/response.go | 47 + .../go-client/test/api_default_test.go | 37 + .../go/generated/openapi/go-client/utils.go | 347 + .../src/main/json/openapi.json | 184 + .../src/main/json/openapi.tpl.json | 183 + .../templates/protobuf-schema/api.mustache | 46 + .../templates/protobuf-schema/model.mustache | 41 + .../templates/protobuf-schema/root.mustache | 22 + .../openapi/.openapi-generator/FILES | 8 + .../openapi/.openapi-generator/VERSION | 1 + .../main/proto/generated/openapi/README.md | 31 + .../get_subscription_info_v1_request_pb.proto | 22 + ...n_info_v1_request_subscription_id_pb.proto | 20 + ...get_subscription_info_v1_response_pb.proto | 23 + .../openapi/models/subscription_info_pb.proto | 32 + .../openapi/models/watch_blocks_v1_pb.proto | 24 + .../models/watch_blocks_v1_progress_pb.proto | 22 + .../models/watch_blocks_v1_request_pb.proto | 23 + .../openapi/services/default_service.proto | 34 + .../services/chainlink-grpc-svc-streams.proto | 12 + .../api-client/chainlink-api-client.ts | 78 + .../typescript-axios/.openapi-generator/FILES | 5 + .../.openapi-generator/VERSION | 1 + .../generated/openapi/typescript-axios/api.ts | 307 + .../openapi/typescript-axios/base.ts | 72 + .../openapi/typescript-axios/common.ts | 150 + .../openapi/typescript-axios/configuration.ts | 101 + .../openapi/typescript-axios/index.ts | 18 + .../protoc-gen-ts/google/protobuf/any.ts | 98 + .../protoc-gen-ts/google/protobuf/empty.ts | 48 + .../get_subscription_info_v1_request_pb.ts | 76 + ...tion_info_v1_request_subscription_id_pb.ts | 49 + .../get_subscription_info_v1_response_pb.ts | 80 + .../models/subscription_info_pb.ts | 191 + .../models/watch_blocks_v1_pb.ts | 16 + .../models/watch_blocks_v1_progress_pb.ts | 90 + .../models/watch_blocks_v1_request_pb.ts | 77 + .../services/chainlink-grpc-svc-streams.ts | 71 + .../protoc-gen-ts/services/default_service.ts | 209 + .../chainlink-grpc-svc-open-api.ts | 89 + .../chainlink-grpc-svc-streams.ts | 65 + .../common/grpc-credentials-factory.ts | 91 + .../common/grpc-server-factory.ts | 21 + .../get-subscription-info-v1-grpc.ts | 47 + .../get-subscription-info-v1-http.ts | 15 + .../get-subscription-info-v1-impl.ts | 18 + .../src/main/typescript/index.ts | 1 + .../src/main/typescript/index.web.ts | 6 + .../plugin-factory-ledger-connector.ts | 20 + .../plugin-ledger-connector-chainlink.ts | 258 + .../prometheus-exporter/data-fetcher.ts | 12 + .../typescript/prometheus-exporter/metrics.ts | 11 + .../prometheus-exporter.ts | 39 + .../prometheus-exporter/response.type.ts | 3 + .../src/main/typescript/public-api.ts | 68 + .../get-open-api-spec-v1-endpoint.ts | 39 + .../get-subscription-info-v1-endpoint-.ts | 100 + .../hello-world-contract/HelloWorld.json | 5619 +++++++++++++++++ .../hello-world-contract/HelloWorld.sol | 40 + .../hello-world-contract/LockAsset.json | 2007 ++++++ .../hello-world-contract/lock-asset.sol | 50 + ...-plugin-ledger-connector-besu-benchmark.ts | 238 + .../integration/api-surface.test.ts | 6 + .../test/typescript/unit/api-surface.test.ts | 6 + ...en-api-spec-v1-connector-chainlink.test.ts | 101 + .../tsconfig.json | 32 + .../README.md | 6 + .../package.json | 86 + .../src/main/typescript/index.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/public-api.ts | 1 + .../hello-world-contract/HelloWorld.json | 5619 +++++++++++++++++ .../hello-world-contract/HelloWorld.sol | 40 + .../integration/api-surface.test.ts | 5 + .../connector-avalanche-grpc-services.test.ts | 279 + .../tsconfig.json | 38 + .../README.md | 6 + .../package.json | 78 + .../src/main/typescript/index.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/public-api.ts | 1 + .../integration/api-surface.test.ts | 5 + .../connector-chainlink-grpc-services.test.ts | 267 + .../get-balance-endpoint.test.ts | 167 + .../get-subscription-info-v1-endpoint.test.ts | 154 + .../tsconfig.json | 35 + .../plugin-ledger-connector-besu.ts | 1 + packages/cactus-test-tooling/package.json | 5 +- .../main/resources/cacti/cacti.config.json | 15 + .../chainlink/LinkToken_solc_v0.6.json | 404 ++ .../src/main/resources/chainlink/README.md | 38 + .../avalanche/config/avalanche.config.json | 4 + .../chainlink-aio.docker-compose.yaml | 179 + .../chainlink-demo-gui-email-and-password.txt | 2 + .../resources/chainlink/config/config.toml | 61 + .../resources/chainlink/secrets/secrets.toml | 6 + ...eploy-avalanche-link-token-v06-contract.sh | 433 ++ .../deploy-besu-link-token-v06-contract.sh | 433 ++ .../src/main/resources/infra-bootstrap.sh | 30 + .../set-keychain-link-token-v06-contract.sh | 29 + ...build-image-chainlink-all-in-one-latest.ts | 49 + .../chainlink/chainlink-test-ledger.ts | 268 + .../src/main/typescript/public-api.ts | 7 + tools/docker/avalanche-all-in-one/Dockerfile | 29 + tools/docker/avalanche-all-in-one/README.md | 14 + .../avalanche-cli.config.json | 1 + tools/docker/chainlink-all-in-one/Dockerfile | 20 + tools/docker/chainlink-all-in-one/README.md | 29 + .../chainlink.config.yaml | 19 + tsconfig.json | 12 + yarn.lock | 712 ++- 208 files changed, 30853 insertions(+), 86 deletions(-) create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/README.md create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/openapitools.json create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/package.json create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.travis.yml create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/README.md create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api/openapi.yaml create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api_default.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/client.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/configuration.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.mod create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.sum create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_request.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_response.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_web3_signing_credential_private_key_hex.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/response.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/test/api_default_test.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/utils.go create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.json create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.tpl.json create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/README.md create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_request_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_response_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/web3_signing_credential_private_key_hex_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/services/default_service.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/services/avalanche-grpc-svc-streams.proto create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/api-client/avalanche-api-client.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/api.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/base.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/common.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/configuration.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/index.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_request_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_response_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/web3_signing_credential_private_key_hex_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-open-api.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-streams.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-server-factory.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/impl/deploy-contract-impl.ts create mode 100755 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.ts create mode 100755 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-factory-ledger-connector.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-ledger-connector-avalanche.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/data-fetcher.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/metrics.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/prometheus-exporter.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/response.type.ts create mode 100755 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/deploy-contract-v1-endpoint.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/watch-blocks-v1-endpoint.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/api-surface.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/get-open-api-spec-v1-connector-avalanche.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-avalanche/tsconfig.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/README.md create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/openapitools.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/package.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.travis.yml create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/README.md create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api/openapi.yaml create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api_default.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/client.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/configuration.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.mod create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.sum create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request_subscription_id.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_response.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_subscription_info.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/response.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/test/api_default_test.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/utils.go create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.tpl.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/README.md create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_subscription_id_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_response_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/subscription_info_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/services/default_service.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/services/chainlink-grpc-svc-streams.proto create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/api-client/chainlink-api-client.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/api.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/base.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/common.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/configuration.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/index.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_subscription_id_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/subscription_info_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-open-api.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-streams.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-server-factory.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-grpc.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-http.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-impl.ts create mode 100755 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.ts create mode 100755 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-factory-ledger-connector.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-ledger-connector-chainlink.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/data-fetcher.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/metrics.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/prometheus-exporter.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/response.type.ts create mode 100755 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-subscription-info-v1-endpoint-.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.sol create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/LockAsset.json create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/benchmark/run-plugin-ledger-connector-besu-benchmark.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/api-surface.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/get-open-api-spec-v1-connector-chainlink.test.ts create mode 100644 packages/cacti-plugin-ledger-connector-chainlink/tsconfig.json create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/README.md create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/package.json create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.json create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.sol create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/grpc-services/connector-avalanche-grpc-services.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-avalanche/tsconfig.json create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/README.md create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/package.json create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/grpc-services/connector-chainlink-grpc-services.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-balance-endpoint.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-subscription-info-v1-endpoint.test.ts create mode 100644 packages/cacti-test-plugin-ledger-connector-chainlink/tsconfig.json create mode 100644 packages/cactus-test-tooling/src/main/resources/cacti/cacti.config.json create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/LinkToken_solc_v0.6.json create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/README.md create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/avalanche/config/avalanche.config.json create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-aio.docker-compose.yaml create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-demo-gui-email-and-password.txt create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/config/config.toml create mode 100644 packages/cactus-test-tooling/src/main/resources/chainlink/secrets/secrets.toml create mode 100644 packages/cactus-test-tooling/src/main/resources/deploy-avalanche-link-token-v06-contract.sh create mode 100644 packages/cactus-test-tooling/src/main/resources/deploy-besu-link-token-v06-contract.sh create mode 100755 packages/cactus-test-tooling/src/main/resources/infra-bootstrap.sh create mode 100644 packages/cactus-test-tooling/src/main/resources/set-keychain-link-token-v06-contract.sh create mode 100644 packages/cactus-test-tooling/src/main/typescript/chainlink/build-image-chainlink-all-in-one-latest.ts create mode 100644 packages/cactus-test-tooling/src/main/typescript/chainlink/chainlink-test-ledger.ts create mode 100644 tools/docker/avalanche-all-in-one/Dockerfile create mode 100644 tools/docker/avalanche-all-in-one/README.md create mode 100644 tools/docker/avalanche-all-in-one/avalanche-cli.config.json create mode 100644 tools/docker/chainlink-all-in-one/Dockerfile create mode 100644 tools/docker/chainlink-all-in-one/README.md create mode 100644 tools/docker/chainlink-all-in-one/chainlink.config.yaml diff --git a/packages/cacti-plugin-ledger-connector-avalanche/README.md b/packages/cacti-plugin-ledger-connector-avalanche/README.md new file mode 100644 index 00000000000..6a79e5df087 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/README.md @@ -0,0 +1,34 @@ +# `@hyperledger/cacti-plugin-ledger-connector-avalanche` + +This plugin provides `Cacti` a way to interact with Avalanche networks. Using this we can perform: +* Deploy Smart-contracts through bytecode. +* Build and sign transactions using different keystores. +* Invoke smart-contract functions that we have deployed on the network. + +## Summary + +- [`@hyperledger/cacti-plugin-ledger-connector-avalanche`](#hyperledgercacti-plugin-ledger-connector-avalanche) + - [Summary](#summary) + - [Getting Started](#getting-started) + - [References](#references) + - [Contributing](#contributing) + - [License](#license) + - [Acknowledgments](#acknowledgments) + +## Getting Started + +## References + +1. https://docs.avax.network/tooling/rpc-providers + +## Contributing + +We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do! + +Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. + +## License + +This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file. + +## Acknowledgments diff --git a/packages/cacti-plugin-ledger-connector-avalanche/openapitools.json b/packages/cacti-plugin-ledger-connector-avalanche/openapitools.json new file mode 100644 index 00000000000..225ff1aaaee --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.6.0" + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/package.json b/packages/cacti-plugin-ledger-connector-avalanche/package.json new file mode 100644 index 00000000000..3f9bfb61dc0 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/package.json @@ -0,0 +1,117 @@ +{ + "name": "@hyperledger/cacti-plugin-ledger-connector-avalanche", + "version": "2.0.0-rc.4", + "description": "Allows Cacti nodes to connect to a Avalanche ledger.", + "keywords": [ + "Hyperledger", + "Cacti", + "Integration", + "Blockchain", + "Distributed Ledger Technology" + ], + "homepage": "https://github.com/hyperledger/cacti#readme", + "bugs": { + "url": "https://github.com/hyperledger/cacti/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/cacti.git" + }, + "license": "Apache-2.0", + "author": { + "name": "Hyperledger Cacti Contributors", + "email": "cacti@lists.hyperledger.org", + "url": "https://www.hyperledger.org/use/cacti" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + }, + { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + } + ], + "main": "dist/lib/main/typescript/index.js", + "module": "dist/lib/main/typescript/index.js", + "browser": "dist/cacti-plugin-ledger-connector-avalanche.web.umd.js", + "types": "dist/lib/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "benchmark": "tsx ./src/test/typescript/benchmark/run-plugin-ledger-connector-avalanche-benchmark.ts .tmp/benchmark-results/plugin-ledger-connector-avalanche/run-plugin-ledger-connector-avalanche-benchmark.ts.log", + "codegen": "yarn run --top-level run-s 'codegen:*'", + "codegen:openapi": "npm run generate-sdk", + "codegen:proto": "run-s proto:openapi proto:protoc-gen-ts", + "generate-sdk": "run-s 'generate-sdk:*'", + "generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "proto:openapi": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --model-name-suffix=PB --language-specific-primitives=google.protobuf.Any --type-mappings=AnyType=google.protobuf.Any --type-mappings=object=google.protobuf.Any --additional-properties=packageName=org.hyperledger.cacti.plugin.ledger.connector.avalanche -o ./src/main/proto/generated/openapi/ -t=./src/main/mustache/openapi-generator/templates/protobuf-schema/ --ignore-file-override ../../openapi-generator-ignore", + "proto:protoc-gen-ts": "yarn run --top-level grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/ ./src/main/proto/generated/openapi/services/*.proto ./src/main/proto/services/*.proto", + "watch": "npm-watch", + "webpack": "npm-run-all webpack:dev", + "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", + "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", + "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" + }, + "dependencies": { + "@avalabs/avalanchejs": "4.0.5", + "@grpc/grpc-js": "1.11.2", + "@hyperledger/cactus-common": "2.0.0-rc.4", + "@hyperledger/cactus-core": "2.0.0-rc.4", + "@hyperledger/cactus-core-api": "2.0.0-rc.4", + "axios": "1.7.7", + "ethers": "6.13.2", + "express": "4.19.2", + "google-protobuf": "3.21.4", + "http-errors-enhanced-cjs": "2.0.1", + "joi": "17.13.3", + "openapi-types": "12.1.3", + "prom-client": "15.1.3", + "run-time-error-cjs": "1.4.0", + "rxjs": "7.8.1", + "socket.io-client-fixed-types": "4.5.4", + "typescript-optional": "2.0.1" + }, + "devDependencies": { + "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.4", + "@hyperledger/cactus-test-tooling": "2.0.0-rc.4", + "@openapitools/openapi-generator-cli": "2.7.0", + "@types/benchmark": "2.1.5", + "@types/body-parser": "1.19.4", + "@types/express": "4.17.21", + "@types/fs-extra": "11.0.4", + "@types/google-protobuf": "3.15.5", + "@types/http-errors": "2.0.4", + "@types/uuid": "10.0.0", + "benchmark": "2.1.4", + "body-parser": "1.20.2", + "fs-extra": "11.2.0", + "grpc-tools": "1.12.4", + "grpc_tools_node_protoc_ts": "5.3.3", + "npm-run-all2": "6.1.2", + "protobufjs": "7.4.0", + "socket.io": "4.6.2", + "tsx": "4.16.2" + }, + "engines": { + "node": ">=18", + "npm": ">=8" + }, + "publishConfig": { + "access": "public" + }, + "browserMinified": "dist/cacti-plugin-ledger-connector-avalanche.web.umd.min.js", + "mainMinified": "dist/cacti-plugin-ledger-connector-avalanche.node.umd.min.js", + "watch": { + "codegen:openapi": { + "patterns": [ + "./src/main/json/openapi.json" + ] + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/FILES new file mode 100644 index 00000000000..5e7651071c6 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/FILES @@ -0,0 +1,16 @@ +.travis.yml +README.md +api/openapi.yaml +api_default.go +client.go +configuration.go +go.mod +go.sum +model_deploy_contract_v1_request.go +model_deploy_contract_v1_response.go +model_watch_blocks_v1.go +model_watch_blocks_v1_progress.go +model_watch_blocks_v1_request.go +model_web3_signing_credential_private_key_hex.go +response.go +utils.go diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.travis.yml b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.travis.yml new file mode 100644 index 00000000000..f5cb2ce9a5a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/README.md b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/README.md new file mode 100644 index 00000000000..209020fc98a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/README.md @@ -0,0 +1,118 @@ +# Go API client for cacti-plugin-ledger-connector-avalanche + +Can perform basic tasks on a Avalanche ledger + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 2.0.0-rc.4 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import cacti-plugin-ledger-connector-avalanche "github.com/hyperledger/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), cacti-plugin-ledger-connector-avalanche.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://cacti.local:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**DeployContractV1**](docs/DefaultApi.md#deploycontractv1) | **Post** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract | Deploys the bytecode of a Solidity contract without the need of keychain +*DefaultApi* | [**GetOpenApiSpecV1**](docs/DefaultApi.md#getopenapispecv1) | **Get** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec | Retrieves the .json file that contains the OpenAPI specification for the plugin. + + +## Documentation For Models + + - [DeployContractV1Request](docs/DeployContractV1Request.md) + - [DeployContractV1Response](docs/DeployContractV1Response.md) + - [WatchBlocksV1](docs/WatchBlocksV1.md) + - [WatchBlocksV1Progress](docs/WatchBlocksV1Progress.md) + - [WatchBlocksV1Request](docs/WatchBlocksV1Request.md) + - [Web3SigningCredentialPrivateKeyHex](docs/Web3SigningCredentialPrivateKeyHex.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api/openapi.yaml b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api/openapi.yaml new file mode 100644 index 00000000000..ccc48dfc51f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api/openapi.yaml @@ -0,0 +1,189 @@ +openapi: 3.0.3 +info: + description: Can perform basic tasks on a Avalanche ledger + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Hyperledger Cacti Plugin - Connector Avalanche + version: 2.0.0-rc.4 +servers: +- description: Local Development Server + url: http://cacti.local:3000 +paths: + /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec: + get: + operationId: getOpenApiSpecV1 + parameters: [] + responses: + "200": + content: + application/json: + schema: + type: string + description: OK + "401": + description: Unauthorized + security: [] + summary: Retrieves the .json file that contains the OpenAPI specification for + the plugin. + x-hyperledger-cacti: + http: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec + /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract: + post: + operationId: deployContractV1 + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeployContractV1Request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeployContractV1Response' + description: OK + "401": + description: Unauthorized + summary: Deploys the bytecode of a Solidity contract without the need of keychain + x-hyperledger-cacti: + http: + verbLowerCase: post + path: /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract +components: + schemas: + Web3SigningCredentialPrivateKeyHex: + example: + ethAccount: ethAccount + secret: secret + properties: + ethAccount: + description: The ethereum account (public key) that the credential belongs + to. Basically the username in the traditional terminology of authentication. + maxLength: 64 + minLength: 64 + nullable: false + type: string + secret: + description: The HEX encoded private key of an eth account. + maxLength: 65535 + minLength: 0 + type: string + required: + - ethAccount + - secret + - type + type: object + DeployContractV1Request: + additionalProperties: false + example: + bytecode: bytecode + constructorArgs: + - "" + - "" + timeoutMs: 0.6027456183070403 + contractAbi: + - "" + - "" + gas: 0.8008281904610115 + web3SigningCredential: + ethAccount: ethAccount + secret: secret + contractName: contractName + contractJSONString: contractJSONString + gasPrice: gasPrice + properties: + contractName: + description: The contract name for retrieve the contracts json on the keychain. + maxLength: 100 + minLength: 1 + nullable: false + type: string + contractAbi: + description: The application binary interface of the solidity contract + items: {} + nullable: false + type: array + contractJSONString: + description: "For use when not using keychain, pass the contract in as this\ + \ string variable" + nullable: false + type: string + constructorArgs: + default: [] + items: {} + type: array + web3SigningCredential: + $ref: '#/components/schemas/Web3SigningCredentialPrivateKeyHex' + bytecode: + description: See https://ethereum.stackexchange.com/a/47556 regarding the + maximum length of the bytecode + maxLength: 24576 + minLength: 1 + nullable: false + type: string + gas: + nullable: false + type: number + gasPrice: + nullable: false + type: string + timeoutMs: + default: 60000 + description: The amount of milliseconds to wait for a transaction receipt + with theaddress of the contract(which indicates successful deployment) + beforegiving up and crashing. + minimum: 0 + nullable: false + type: number + required: + - bytecode + - constructorArgs + - contractAbi + - contractJson + - contractName + - keychainId + - web3SigningCredential + type: object + DeployContractV1Response: + example: + txReceipt: "{}" + properties: + txReceipt: + type: object + required: + - txReceipt + type: object + WatchBlocksV1: + enum: + - org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe + - org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next + - org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe + - org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error + - org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete + type: string + x-enum-varnames: + - Subscribe + - Next + - Unsubscribe + - Error + - Complete + WatchBlocksV1Request: + properties: + event: + $ref: '#/components/schemas/WatchBlocksV1' + required: + - event + type: object + WatchBlocksV1Progress: + description: FIXME - the payload is not well defined + properties: + block: + additionalProperties: true + type: object + required: + - block + type: object diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api_default.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api_default.go new file mode 100644 index 00000000000..eb840e90f36 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/api_default.go @@ -0,0 +1,225 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiDeployContractV1Request struct { + ctx context.Context + ApiService *DefaultApiService + deployContractV1Request *DeployContractV1Request +} + +func (r ApiDeployContractV1Request) DeployContractV1Request(deployContractV1Request DeployContractV1Request) ApiDeployContractV1Request { + r.deployContractV1Request = &deployContractV1Request + return r +} + +func (r ApiDeployContractV1Request) Execute() (*DeployContractV1Response, *http.Response, error) { + return r.ApiService.DeployContractV1Execute(r) +} + +/* +DeployContractV1 Deploys the bytecode of a Solidity contract without the need of keychain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiDeployContractV1Request +*/ +func (a *DefaultApiService) DeployContractV1(ctx context.Context) ApiDeployContractV1Request { + return ApiDeployContractV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return DeployContractV1Response +func (a *DefaultApiService) DeployContractV1Execute(r ApiDeployContractV1Request) (*DeployContractV1Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeployContractV1Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeployContractV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.deployContractV1Request + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetOpenApiSpecV1Request struct { + ctx context.Context + ApiService *DefaultApiService +} + +func (r ApiGetOpenApiSpecV1Request) Execute() (string, *http.Response, error) { + return r.ApiService.GetOpenApiSpecV1Execute(r) +} + +/* +GetOpenApiSpecV1 Retrieves the .json file that contains the OpenAPI specification for the plugin. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOpenApiSpecV1Request +*/ +func (a *DefaultApiService) GetOpenApiSpecV1(ctx context.Context) ApiGetOpenApiSpecV1Request { + return ApiGetOpenApiSpecV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *DefaultApiService) GetOpenApiSpecV1Execute(r ApiGetOpenApiSpecV1Request) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOpenApiSpecV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/client.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/client.go new file mode 100644 index 00000000000..f69a02c63db --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/client.go @@ -0,0 +1,656 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Hyperledger Cacti Plugin - Connector Avalanche API v2.0.0-rc.4 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultApi = (*DefaultApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/configuration.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/configuration.go new file mode 100644 index 00000000000..2028c04d1cf --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/configuration.go @@ -0,0 +1,215 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "http://cacti.local:3000", + Description: "Local Development Server", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.mod b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.mod new file mode 100644 index 00000000000..d52702ff3c9 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.mod @@ -0,0 +1,6 @@ +module github.com/hyperledger/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client + +go 1.18 + +require ( +) diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.sum b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.sum new file mode 100644 index 00000000000..c966c8ddfd0 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_request.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_request.go new file mode 100644 index 00000000000..1d61193c2f5 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_request.go @@ -0,0 +1,378 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" +) + +// checks if the DeployContractV1Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeployContractV1Request{} + +// DeployContractV1Request struct for DeployContractV1Request +type DeployContractV1Request struct { + // The contract name for retrieve the contracts json on the keychain. + ContractName string `json:"contractName"` + // The application binary interface of the solidity contract + ContractAbi []interface{} `json:"contractAbi"` + // For use when not using keychain, pass the contract in as this string variable + ContractJSONString *string `json:"contractJSONString,omitempty"` + ConstructorArgs []interface{} `json:"constructorArgs"` + Web3SigningCredential Web3SigningCredentialPrivateKeyHex `json:"web3SigningCredential"` + // See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode + Bytecode string `json:"bytecode"` + Gas *float32 `json:"gas,omitempty"` + GasPrice *string `json:"gasPrice,omitempty"` + // The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. + TimeoutMs *float32 `json:"timeoutMs,omitempty"` +} + +// NewDeployContractV1Request instantiates a new DeployContractV1Request object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeployContractV1Request(contractName string, contractAbi []interface{}, constructorArgs []interface{}, web3SigningCredential Web3SigningCredentialPrivateKeyHex, bytecode string) *DeployContractV1Request { + this := DeployContractV1Request{} + this.ContractName = contractName + this.ContractAbi = contractAbi + this.ConstructorArgs = constructorArgs + this.Web3SigningCredential = web3SigningCredential + this.Bytecode = bytecode + var timeoutMs float32 = 60000 + this.TimeoutMs = &timeoutMs + return &this +} + +// NewDeployContractV1RequestWithDefaults instantiates a new DeployContractV1Request object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeployContractV1RequestWithDefaults() *DeployContractV1Request { + this := DeployContractV1Request{} + var timeoutMs float32 = 60000 + this.TimeoutMs = &timeoutMs + return &this +} + +// GetContractName returns the ContractName field value +func (o *DeployContractV1Request) GetContractName() string { + if o == nil { + var ret string + return ret + } + + return o.ContractName +} + +// GetContractNameOk returns a tuple with the ContractName field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetContractNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractName, true +} + +// SetContractName sets field value +func (o *DeployContractV1Request) SetContractName(v string) { + o.ContractName = v +} + +// GetContractAbi returns the ContractAbi field value +func (o *DeployContractV1Request) GetContractAbi() []interface{} { + if o == nil { + var ret []interface{} + return ret + } + + return o.ContractAbi +} + +// GetContractAbiOk returns a tuple with the ContractAbi field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetContractAbiOk() ([]interface{}, bool) { + if o == nil { + return nil, false + } + return o.ContractAbi, true +} + +// SetContractAbi sets field value +func (o *DeployContractV1Request) SetContractAbi(v []interface{}) { + o.ContractAbi = v +} + +// GetContractJSONString returns the ContractJSONString field value if set, zero value otherwise. +func (o *DeployContractV1Request) GetContractJSONString() string { + if o == nil || IsNil(o.ContractJSONString) { + var ret string + return ret + } + return *o.ContractJSONString +} + +// GetContractJSONStringOk returns a tuple with the ContractJSONString field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetContractJSONStringOk() (*string, bool) { + if o == nil || IsNil(o.ContractJSONString) { + return nil, false + } + return o.ContractJSONString, true +} + +// HasContractJSONString returns a boolean if a field has been set. +func (o *DeployContractV1Request) HasContractJSONString() bool { + if o != nil && !IsNil(o.ContractJSONString) { + return true + } + + return false +} + +// SetContractJSONString gets a reference to the given string and assigns it to the ContractJSONString field. +func (o *DeployContractV1Request) SetContractJSONString(v string) { + o.ContractJSONString = &v +} + +// GetConstructorArgs returns the ConstructorArgs field value +func (o *DeployContractV1Request) GetConstructorArgs() []interface{} { + if o == nil { + var ret []interface{} + return ret + } + + return o.ConstructorArgs +} + +// GetConstructorArgsOk returns a tuple with the ConstructorArgs field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetConstructorArgsOk() ([]interface{}, bool) { + if o == nil { + return nil, false + } + return o.ConstructorArgs, true +} + +// SetConstructorArgs sets field value +func (o *DeployContractV1Request) SetConstructorArgs(v []interface{}) { + o.ConstructorArgs = v +} + +// GetWeb3SigningCredential returns the Web3SigningCredential field value +func (o *DeployContractV1Request) GetWeb3SigningCredential() Web3SigningCredentialPrivateKeyHex { + if o == nil { + var ret Web3SigningCredentialPrivateKeyHex + return ret + } + + return o.Web3SigningCredential +} + +// GetWeb3SigningCredentialOk returns a tuple with the Web3SigningCredential field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetWeb3SigningCredentialOk() (*Web3SigningCredentialPrivateKeyHex, bool) { + if o == nil { + return nil, false + } + return &o.Web3SigningCredential, true +} + +// SetWeb3SigningCredential sets field value +func (o *DeployContractV1Request) SetWeb3SigningCredential(v Web3SigningCredentialPrivateKeyHex) { + o.Web3SigningCredential = v +} + +// GetBytecode returns the Bytecode field value +func (o *DeployContractV1Request) GetBytecode() string { + if o == nil { + var ret string + return ret + } + + return o.Bytecode +} + +// GetBytecodeOk returns a tuple with the Bytecode field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetBytecodeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Bytecode, true +} + +// SetBytecode sets field value +func (o *DeployContractV1Request) SetBytecode(v string) { + o.Bytecode = v +} + +// GetGas returns the Gas field value if set, zero value otherwise. +func (o *DeployContractV1Request) GetGas() float32 { + if o == nil || IsNil(o.Gas) { + var ret float32 + return ret + } + return *o.Gas +} + +// GetGasOk returns a tuple with the Gas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetGasOk() (*float32, bool) { + if o == nil || IsNil(o.Gas) { + return nil, false + } + return o.Gas, true +} + +// HasGas returns a boolean if a field has been set. +func (o *DeployContractV1Request) HasGas() bool { + if o != nil && !IsNil(o.Gas) { + return true + } + + return false +} + +// SetGas gets a reference to the given float32 and assigns it to the Gas field. +func (o *DeployContractV1Request) SetGas(v float32) { + o.Gas = &v +} + +// GetGasPrice returns the GasPrice field value if set, zero value otherwise. +func (o *DeployContractV1Request) GetGasPrice() string { + if o == nil || IsNil(o.GasPrice) { + var ret string + return ret + } + return *o.GasPrice +} + +// GetGasPriceOk returns a tuple with the GasPrice field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetGasPriceOk() (*string, bool) { + if o == nil || IsNil(o.GasPrice) { + return nil, false + } + return o.GasPrice, true +} + +// HasGasPrice returns a boolean if a field has been set. +func (o *DeployContractV1Request) HasGasPrice() bool { + if o != nil && !IsNil(o.GasPrice) { + return true + } + + return false +} + +// SetGasPrice gets a reference to the given string and assigns it to the GasPrice field. +func (o *DeployContractV1Request) SetGasPrice(v string) { + o.GasPrice = &v +} + +// GetTimeoutMs returns the TimeoutMs field value if set, zero value otherwise. +func (o *DeployContractV1Request) GetTimeoutMs() float32 { + if o == nil || IsNil(o.TimeoutMs) { + var ret float32 + return ret + } + return *o.TimeoutMs +} + +// GetTimeoutMsOk returns a tuple with the TimeoutMs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeployContractV1Request) GetTimeoutMsOk() (*float32, bool) { + if o == nil || IsNil(o.TimeoutMs) { + return nil, false + } + return o.TimeoutMs, true +} + +// HasTimeoutMs returns a boolean if a field has been set. +func (o *DeployContractV1Request) HasTimeoutMs() bool { + if o != nil && !IsNil(o.TimeoutMs) { + return true + } + + return false +} + +// SetTimeoutMs gets a reference to the given float32 and assigns it to the TimeoutMs field. +func (o *DeployContractV1Request) SetTimeoutMs(v float32) { + o.TimeoutMs = &v +} + +func (o DeployContractV1Request) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeployContractV1Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contractName"] = o.ContractName + toSerialize["contractAbi"] = o.ContractAbi + if !IsNil(o.ContractJSONString) { + toSerialize["contractJSONString"] = o.ContractJSONString + } + toSerialize["constructorArgs"] = o.ConstructorArgs + toSerialize["web3SigningCredential"] = o.Web3SigningCredential + toSerialize["bytecode"] = o.Bytecode + if !IsNil(o.Gas) { + toSerialize["gas"] = o.Gas + } + if !IsNil(o.GasPrice) { + toSerialize["gasPrice"] = o.GasPrice + } + if !IsNil(o.TimeoutMs) { + toSerialize["timeoutMs"] = o.TimeoutMs + } + return toSerialize, nil +} + +type NullableDeployContractV1Request struct { + value *DeployContractV1Request + isSet bool +} + +func (v NullableDeployContractV1Request) Get() *DeployContractV1Request { + return v.value +} + +func (v *NullableDeployContractV1Request) Set(val *DeployContractV1Request) { + v.value = val + v.isSet = true +} + +func (v NullableDeployContractV1Request) IsSet() bool { + return v.isSet +} + +func (v *NullableDeployContractV1Request) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeployContractV1Request(val *DeployContractV1Request) *NullableDeployContractV1Request { + return &NullableDeployContractV1Request{value: val, isSet: true} +} + +func (v NullableDeployContractV1Request) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeployContractV1Request) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_response.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_response.go new file mode 100644 index 00000000000..c8d737a6d78 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_deploy_contract_v1_response.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" +) + +// checks if the DeployContractV1Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeployContractV1Response{} + +// DeployContractV1Response struct for DeployContractV1Response +type DeployContractV1Response struct { + TxReceipt map[string]interface{} `json:"txReceipt"` +} + +// NewDeployContractV1Response instantiates a new DeployContractV1Response object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDeployContractV1Response(txReceipt map[string]interface{}) *DeployContractV1Response { + this := DeployContractV1Response{} + this.TxReceipt = txReceipt + return &this +} + +// NewDeployContractV1ResponseWithDefaults instantiates a new DeployContractV1Response object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDeployContractV1ResponseWithDefaults() *DeployContractV1Response { + this := DeployContractV1Response{} + return &this +} + +// GetTxReceipt returns the TxReceipt field value +func (o *DeployContractV1Response) GetTxReceipt() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.TxReceipt +} + +// GetTxReceiptOk returns a tuple with the TxReceipt field value +// and a boolean to check if the value has been set. +func (o *DeployContractV1Response) GetTxReceiptOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.TxReceipt, true +} + +// SetTxReceipt sets field value +func (o *DeployContractV1Response) SetTxReceipt(v map[string]interface{}) { + o.TxReceipt = v +} + +func (o DeployContractV1Response) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeployContractV1Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["txReceipt"] = o.TxReceipt + return toSerialize, nil +} + +type NullableDeployContractV1Response struct { + value *DeployContractV1Response + isSet bool +} + +func (v NullableDeployContractV1Response) Get() *DeployContractV1Response { + return v.value +} + +func (v *NullableDeployContractV1Response) Set(val *DeployContractV1Response) { + v.value = val + v.isSet = true +} + +func (v NullableDeployContractV1Response) IsSet() bool { + return v.isSet +} + +func (v *NullableDeployContractV1Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeployContractV1Response(val *DeployContractV1Response) *NullableDeployContractV1Response { + return &NullableDeployContractV1Response{value: val, isSet: true} +} + +func (v NullableDeployContractV1Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeployContractV1Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go new file mode 100644 index 00000000000..9595a356871 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" + "fmt" +) + +// WatchBlocksV1 the model 'WatchBlocksV1' +type WatchBlocksV1 string + +// List of WatchBlocksV1 +const ( + Subscribe WatchBlocksV1 = "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe" + Next WatchBlocksV1 = "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next" + Unsubscribe WatchBlocksV1 = "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe" + Error WatchBlocksV1 = "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error" + Complete WatchBlocksV1 = "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete" +) + +// All allowed values of WatchBlocksV1 enum +var AllowedWatchBlocksV1EnumValues = []WatchBlocksV1{ + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete", +} + +func (v *WatchBlocksV1) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := WatchBlocksV1(value) + for _, existing := range AllowedWatchBlocksV1EnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WatchBlocksV1", value) +} + +// NewWatchBlocksV1FromValue returns a pointer to a valid WatchBlocksV1 +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWatchBlocksV1FromValue(v string) (*WatchBlocksV1, error) { + ev := WatchBlocksV1(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WatchBlocksV1: valid values are %v", v, AllowedWatchBlocksV1EnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WatchBlocksV1) IsValid() bool { + for _, existing := range AllowedWatchBlocksV1EnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WatchBlocksV1 value +func (v WatchBlocksV1) Ptr() *WatchBlocksV1 { + return &v +} + +type NullableWatchBlocksV1 struct { + value *WatchBlocksV1 + isSet bool +} + +func (v NullableWatchBlocksV1) Get() *WatchBlocksV1 { + return v.value +} + +func (v *NullableWatchBlocksV1) Set(val *WatchBlocksV1) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1(val *WatchBlocksV1) *NullableWatchBlocksV1 { + return &NullableWatchBlocksV1{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go new file mode 100644 index 00000000000..c193c41e47d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" +) + +// checks if the WatchBlocksV1Progress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WatchBlocksV1Progress{} + +// WatchBlocksV1Progress FIXME - the payload is not well defined +type WatchBlocksV1Progress struct { + Block map[string]interface{} `json:"block"` +} + +// NewWatchBlocksV1Progress instantiates a new WatchBlocksV1Progress object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWatchBlocksV1Progress(block map[string]interface{}) *WatchBlocksV1Progress { + this := WatchBlocksV1Progress{} + this.Block = block + return &this +} + +// NewWatchBlocksV1ProgressWithDefaults instantiates a new WatchBlocksV1Progress object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWatchBlocksV1ProgressWithDefaults() *WatchBlocksV1Progress { + this := WatchBlocksV1Progress{} + return &this +} + +// GetBlock returns the Block field value +func (o *WatchBlocksV1Progress) GetBlock() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Block +} + +// GetBlockOk returns a tuple with the Block field value +// and a boolean to check if the value has been set. +func (o *WatchBlocksV1Progress) GetBlockOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Block, true +} + +// SetBlock sets field value +func (o *WatchBlocksV1Progress) SetBlock(v map[string]interface{}) { + o.Block = v +} + +func (o WatchBlocksV1Progress) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WatchBlocksV1Progress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["block"] = o.Block + return toSerialize, nil +} + +type NullableWatchBlocksV1Progress struct { + value *WatchBlocksV1Progress + isSet bool +} + +func (v NullableWatchBlocksV1Progress) Get() *WatchBlocksV1Progress { + return v.value +} + +func (v *NullableWatchBlocksV1Progress) Set(val *WatchBlocksV1Progress) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1Progress) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1Progress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1Progress(val *WatchBlocksV1Progress) *NullableWatchBlocksV1Progress { + return &NullableWatchBlocksV1Progress{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1Progress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1Progress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go new file mode 100644 index 00000000000..747825ada9e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" +) + +// checks if the WatchBlocksV1Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WatchBlocksV1Request{} + +// WatchBlocksV1Request struct for WatchBlocksV1Request +type WatchBlocksV1Request struct { + Event WatchBlocksV1 `json:"event"` +} + +// NewWatchBlocksV1Request instantiates a new WatchBlocksV1Request object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWatchBlocksV1Request(event WatchBlocksV1) *WatchBlocksV1Request { + this := WatchBlocksV1Request{} + this.Event = event + return &this +} + +// NewWatchBlocksV1RequestWithDefaults instantiates a new WatchBlocksV1Request object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWatchBlocksV1RequestWithDefaults() *WatchBlocksV1Request { + this := WatchBlocksV1Request{} + return &this +} + +// GetEvent returns the Event field value +func (o *WatchBlocksV1Request) GetEvent() WatchBlocksV1 { + if o == nil { + var ret WatchBlocksV1 + return ret + } + + return o.Event +} + +// GetEventOk returns a tuple with the Event field value +// and a boolean to check if the value has been set. +func (o *WatchBlocksV1Request) GetEventOk() (*WatchBlocksV1, bool) { + if o == nil { + return nil, false + } + return &o.Event, true +} + +// SetEvent sets field value +func (o *WatchBlocksV1Request) SetEvent(v WatchBlocksV1) { + o.Event = v +} + +func (o WatchBlocksV1Request) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WatchBlocksV1Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["event"] = o.Event + return toSerialize, nil +} + +type NullableWatchBlocksV1Request struct { + value *WatchBlocksV1Request + isSet bool +} + +func (v NullableWatchBlocksV1Request) Get() *WatchBlocksV1Request { + return v.value +} + +func (v *NullableWatchBlocksV1Request) Set(val *WatchBlocksV1Request) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1Request) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1Request) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1Request(val *WatchBlocksV1Request) *NullableWatchBlocksV1Request { + return &NullableWatchBlocksV1Request{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1Request) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1Request) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_web3_signing_credential_private_key_hex.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_web3_signing_credential_private_key_hex.go new file mode 100644 index 00000000000..d287215473c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/model_web3_signing_credential_private_key_hex.go @@ -0,0 +1,146 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" +) + +// checks if the Web3SigningCredentialPrivateKeyHex type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Web3SigningCredentialPrivateKeyHex{} + +// Web3SigningCredentialPrivateKeyHex struct for Web3SigningCredentialPrivateKeyHex +type Web3SigningCredentialPrivateKeyHex struct { + // The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. + EthAccount string `json:"ethAccount"` + // The HEX encoded private key of an eth account. + Secret string `json:"secret"` +} + +// NewWeb3SigningCredentialPrivateKeyHex instantiates a new Web3SigningCredentialPrivateKeyHex object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWeb3SigningCredentialPrivateKeyHex(ethAccount string, secret string) *Web3SigningCredentialPrivateKeyHex { + this := Web3SigningCredentialPrivateKeyHex{} + this.EthAccount = ethAccount + this.Secret = secret + return &this +} + +// NewWeb3SigningCredentialPrivateKeyHexWithDefaults instantiates a new Web3SigningCredentialPrivateKeyHex object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWeb3SigningCredentialPrivateKeyHexWithDefaults() *Web3SigningCredentialPrivateKeyHex { + this := Web3SigningCredentialPrivateKeyHex{} + return &this +} + +// GetEthAccount returns the EthAccount field value +func (o *Web3SigningCredentialPrivateKeyHex) GetEthAccount() string { + if o == nil { + var ret string + return ret + } + + return o.EthAccount +} + +// GetEthAccountOk returns a tuple with the EthAccount field value +// and a boolean to check if the value has been set. +func (o *Web3SigningCredentialPrivateKeyHex) GetEthAccountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EthAccount, true +} + +// SetEthAccount sets field value +func (o *Web3SigningCredentialPrivateKeyHex) SetEthAccount(v string) { + o.EthAccount = v +} + +// GetSecret returns the Secret field value +func (o *Web3SigningCredentialPrivateKeyHex) GetSecret() string { + if o == nil { + var ret string + return ret + } + + return o.Secret +} + +// GetSecretOk returns a tuple with the Secret field value +// and a boolean to check if the value has been set. +func (o *Web3SigningCredentialPrivateKeyHex) GetSecretOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Secret, true +} + +// SetSecret sets field value +func (o *Web3SigningCredentialPrivateKeyHex) SetSecret(v string) { + o.Secret = v +} + +func (o Web3SigningCredentialPrivateKeyHex) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Web3SigningCredentialPrivateKeyHex) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ethAccount"] = o.EthAccount + toSerialize["secret"] = o.Secret + return toSerialize, nil +} + +type NullableWeb3SigningCredentialPrivateKeyHex struct { + value *Web3SigningCredentialPrivateKeyHex + isSet bool +} + +func (v NullableWeb3SigningCredentialPrivateKeyHex) Get() *Web3SigningCredentialPrivateKeyHex { + return v.value +} + +func (v *NullableWeb3SigningCredentialPrivateKeyHex) Set(val *Web3SigningCredentialPrivateKeyHex) { + v.value = val + v.isSet = true +} + +func (v NullableWeb3SigningCredentialPrivateKeyHex) IsSet() bool { + return v.isSet +} + +func (v *NullableWeb3SigningCredentialPrivateKeyHex) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWeb3SigningCredentialPrivateKeyHex(val *Web3SigningCredentialPrivateKeyHex) *NullableWeb3SigningCredentialPrivateKeyHex { + return &NullableWeb3SigningCredentialPrivateKeyHex{value: val, isSet: true} +} + +func (v NullableWeb3SigningCredentialPrivateKeyHex) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWeb3SigningCredentialPrivateKeyHex) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/response.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/response.go new file mode 100644 index 00000000000..33539b7fb05 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/response.go @@ -0,0 +1,47 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/test/api_default_test.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/test/api_default_test.go new file mode 100644 index 00000000000..8d4a0b1a341 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/test/api_default_test.go @@ -0,0 +1,37 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package cacti-plugin-ledger-connector-avalanche + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/hyperledger/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client" +) + +func Test_cacti-plugin-ledger-connector-avalanche_DefaultApiService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DefaultApiService GetOpenApiSpecV1", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultApi.GetOpenApiSpecV1(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/utils.go b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/utils.go new file mode 100644 index 00000000000..23404cc3a58 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/go/generated/openapi/go-client/utils.go @@ -0,0 +1,347 @@ +/* +Hyperledger Cacti Plugin - Connector Avalanche + +Can perform basic tasks on a Avalanche ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-avalanche + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.json b/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.json new file mode 100644 index 00000000000..f14570c0efc --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.json @@ -0,0 +1,219 @@ +{ + "openapi": "3.0.3", + "servers": [ + { + "description": "Local Development Server", + "url": "http://cacti.local:3000" + } + ], + "info": { + "title": "Hyperledger Cacti Plugin - Connector Avalanche", + "description": "Can perform basic tasks on a Avalanche ledger", + "version": "2.0.0-rc.4", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "DeployContractV1Request": { + "type": "object", + "required": [ + "contractName", + "contractAbi", + "contractJson", + "bytecode", + "web3SigningCredential", + "keychainId", + "constructorArgs" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractAbi": { + "description": "The application binary interface of the solidity contract", + "type": "array", + "items": {}, + "nullable": false + }, + "contractJSONString": { + "description": "For use when not using keychain, pass the contract in as this string variable", + "nullable": false, + "type": "string" + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "DeployContractV1Response": { + "type": "object", + "required": ["txReceipt"], + "properties": { + "txReceipt": { + "type": "object" + } + } + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Request": { + "type": "object", + "required": ["event"], + "properties": { + "event": { + "$ref": "#/components/schemas/WatchBlocksV1" + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "required": ["block"], + "description": "FIXME - the payload is not well defined", + "properties": { + "block": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec": { + "get": { + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + } + } + }, + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract" + } + }, + "operationId": "deployContractV1", + "summary": "Deploys the bytecode of a Solidity contract without the need of keychain", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + } + } + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.tpl.json b/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.tpl.json new file mode 100644 index 00000000000..3e4947c542e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/json/openapi.tpl.json @@ -0,0 +1,219 @@ +{ + "openapi": "3.0.3", + "servers": [ + { + "description": "Local Development Server", + "url": "http://cacti.local:3000" + } + ], + "info": { + "title": "Hyperledger Cacti Plugin - Connector Avalanche", + "description": "Can perform basic tasks on a Avalanche ledger", + "version": "2.0.0-rc.4", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "components": { + "schemas": { + "Web3SigningCredentialPrivateKeyHex": { + "type": "object", + "required": ["type", "ethAccount", "secret"], + "properties": { + "ethAccount": { + "type": "string", + "description": "The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication.", + "minLength": 64, + "maxLength": 64, + "nullable": false + }, + "secret": { + "type": "string", + "description": "The HEX encoded private key of an eth account.", + "minLength": 0, + "maxLength": 65535 + } + } + }, + "DeployContractV1Request": { + "type": "object", + "required": [ + "contractName", + "contractAbi", + "contractJson", + "bytecode", + "web3SigningCredential", + "keychainId", + "constructorArgs" + ], + "additionalProperties": false, + "properties": { + "contractName": { + "type": "string", + "description": "The contract name for retrieve the contracts json on the keychain.", + "minLength": 1, + "maxLength": 100, + "nullable": false + }, + "contractAbi": { + "description": "The application binary interface of the solidity contract", + "type": "array", + "items": {}, + "nullable": false + }, + "contractJSONString": { + "description": "For use when not using keychain, pass the contract in as this string variable", + "nullable": false, + "type": "string" + }, + "constructorArgs": { + "type": "array", + "items": {}, + "default": [] + }, + "web3SigningCredential": { + "$ref": "#/components/schemas/Web3SigningCredentialPrivateKeyHex", + "nullable": false + }, + "bytecode": { + "type": "string", + "nullable": false, + "minLength": 1, + "maxLength": 24576, + "description": "See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode" + }, + "gas": { + "type": "number", + "nullable": false + }, + "gasPrice": { + "type": "string", + "nullable": false + }, + "timeoutMs": { + "type": "number", + "description": "The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing.", + "minimum": 0, + "default": 60000, + "nullable": false + } + } + }, + "DeployContractV1Response": { + "type": "object", + "required": ["txReceipt"], + "properties": { + "txReceipt": { + "type": "object" + } + } + }, + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Request": { + "type": "object", + "required": ["event"], + "properties": { + "event": { + "$ref": "#/components/schemas/WatchBlocksV1" + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "required": ["block"], + "description": "FIXME - the payload is not well defined", + "properties": { + "block": { + "type": "object", + "additionalProperties": true + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec": { + "get": { + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "401": { + "description": "Unauthorized" + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract": { + "post": { + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "post", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract" + } + }, + "operationId": "deployContractV1", + "summary": "Deploys the bytecode of a Solidity contract without the need of keychain", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Request" + } + } + } + }, + "responses": { + "401": { + "description": "Unauthorized" + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeployContractV1Response" + } + } + } + } + } + } + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache new file mode 100644 index 00000000000..b728d9e71ff --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache @@ -0,0 +1,46 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{#lambda.lowercase}}{{{packageName}}}.{{{apiPackage}}}.{{{classname}}};{{/lambda.lowercase}} + +import "google/protobuf/empty.proto"; +{{#imports}} +{{#import}} +import "{{{modelPackage}}}/{{{.}}}.proto"; +{{/import}} +{{/imports}} + +service {{classname}} { +{{#operations}} +{{#operation}} + {{#description}} + // {{{.}}} + {{/description}} + rpc {{operationId}} ({{#hasParams}}{{operationId}}Request{{/hasParams}}{{^hasParams}}google.protobuf.Empty{{/hasParams}}) returns ({{#vendorExtensions.x-grpc-response}}{{.}}{{/vendorExtensions.x-grpc-response}}{{^vendorExtensions.x-grpc-response}}{{operationId}}Response{{/vendorExtensions.x-grpc-response}}); + +{{/operation}} +{{/operations}} +} + +{{#operations}} +{{#operation}} +{{#hasParams}} +message {{operationId}}Request { + {{#allParams}} + {{#description}} + // {{{.}}} + {{/description}} + {{#vendorExtensions.x-protobuf-type}}{{.}} {{/vendorExtensions.x-protobuf-type}}{{vendorExtensions.x-protobuf-data-type}} {{paramName}} = {{vendorExtensions.x-protobuf-index}}; + {{/allParams}} + +} + +{{/hasParams}} +{{^vendorExtensions.x-grpc-response}} +message {{operationId}}Response { + {{{vendorExtensions.x-grpc-response-type}}} data = 1; +} + +{{/vendorExtensions.x-grpc-response}} +{{/operation}} +{{/operations}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache new file mode 100644 index 00000000000..a350fd9e144 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache @@ -0,0 +1,41 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{#lambda.lowercase}}{{{packageName}}};{{/lambda.lowercase}} + +import "google/protobuf/any.proto"; + +{{#imports}} +{{#import}} +import "{{{modelPackage}}}/{{{import}}}.proto"; +{{/import}} +{{/imports}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}message {{classname}} { + + {{#vars}} + {{#description}} + // {{{.}}} + {{/description}} + {{^isEnum}} + {{#vendorExtensions.x-protobuf-type}}{{{.}}} {{/vendorExtensions.x-protobuf-type}}{{{vendorExtensions.x-protobuf-data-type}}} {{{name}}} = {{vendorExtensions.x-protobuf-index}}{{#vendorExtensions.x-protobuf-packed}} [packed=true]{{/vendorExtensions.x-protobuf-packed}}; + {{/isEnum}} + {{#isEnum}} + enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{protobuf-enum-index}}}; + {{/enumVars}} + {{/allowableValues}} + } + + {{enumName}} {{name}} = {{vendorExtensions.x-protobuf-index}}; + {{/isEnum}} + + {{/vars}} +} +{{/isEnum}} +{{/model}} +{{/models}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache new file mode 100644 index 00000000000..e2df456144c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache @@ -0,0 +1,22 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{{packageName}}}; + +{{#vendorExtensions.x-grpc-options}} +option {{{.}}}; +{{/vendorExtensions.x-grpc-options}} + +// Models +{{#models}} +{{#model}} +import "{{modelPackage}}/{{classFilename}}.proto"; +{{/model}} +{{/models}} + +// APIs +{{#apiInfo}} +{{#apis}} +import "{{apiPackage}}/{{classFilename}}.proto"; +{{/apis}} +{{/apiInfo}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/FILES new file mode 100644 index 00000000000..dba12d236dd --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/FILES @@ -0,0 +1,8 @@ +README.md +models/deploy_contract_v1_request_pb.proto +models/deploy_contract_v1_response_pb.proto +models/watch_blocks_v1_pb.proto +models/watch_blocks_v1_progress_pb.proto +models/watch_blocks_v1_request_pb.proto +models/web3_signing_credential_private_key_hex_pb.proto +services/default_service.proto diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/README.md b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/README.md new file mode 100644 index 00000000000..ee81b5c8f41 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/README.md @@ -0,0 +1,31 @@ +# gPRC for org.hyperledger.cacti.plugin.ledger.connector.avalanche + +Can perform basic tasks on a Avalanche ledger + +## Overview +These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project. + +- API version: 2.0.0-rc.4 +- Package version: +- Build package: org.openapitools.codegen.languages.ProtobufSchemaCodegen + +## Usage + +Below are some usage examples for Go and Ruby. For other languages, please refer to https://grpc.io/docs/quickstart/. + +### Go +``` +# assuming `protoc-gen-go` has been installed with `go get -u github.com/golang/protobuf/protoc-gen-go` +mkdir /var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.avalanche +protoc --go_out=/var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.avalanche services/* +protoc --go_out=/var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.avalanche models/* +``` + +### Ruby +``` +# assuming `grpc_tools_ruby_protoc` has been installed via `gem install grpc-tools` +RUBY_OUTPUT_DIR="/var/tmp/ruby/org.hyperledger.cacti.plugin.ledger.connector.avalanche" +mkdir $RUBY_OUTPUT_DIR +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib services/* +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib models/* +``` diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_request_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_request_pb.proto new file mode 100644 index 00000000000..85ccfae4fc5 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_request_pb.proto @@ -0,0 +1,44 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + +import "models/web3_signing_credential_private_key_hex_pb.proto"; + +message DeployContractV1RequestPB { + + // The contract name for retrieve the contracts json on the keychain. + string contractName = 328784197; + + // The application binary interface of the solidity contract + repeated google.protobuf.Any contractAbi = 512852493; + + // For use when not using keychain, pass the contract in as this string variable + string contractJSONString = 405816750; + + repeated google.protobuf.Any constructorArgs = 336490508; + + Web3SigningCredentialPrivateKeyHexPB web3SigningCredential = 451211679; + + // See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode + string bytecode = 256554254; + + float gas = 102105; + + string gasPrice = 5271059; + + // The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. + float timeoutMs = 51479271; + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_response_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_response_pb.proto new file mode 100644 index 00000000000..13fec540a54 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/deploy_contract_v1_response_pb.proto @@ -0,0 +1,22 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + + +message DeployContractV1ResponsePB { + + google.protobuf.Any txReceipt = 464888047; + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto new file mode 100644 index 00000000000..4abcaf99795 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto @@ -0,0 +1,24 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + + +enum WatchBlocksV1PB { + WatchBlocksV1PB_Subscribe = 0; + WatchBlocksV1PB_Next = 1; + WatchBlocksV1PB_Unsubscribe = 2; + WatchBlocksV1PB_Error = 3; + WatchBlocksV1PB_Complete = 4; +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto new file mode 100644 index 00000000000..47a0fbb9830 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto @@ -0,0 +1,22 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + + +message WatchBlocksV1ProgressPB { + + map block = 93832333; + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto new file mode 100644 index 00000000000..b3d3e7a9ff8 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto @@ -0,0 +1,23 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + +import "models/watch_blocks_v1_pb.proto"; + +message WatchBlocksV1RequestPB { + + WatchBlocksV1PB event = 96891546; + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/web3_signing_credential_private_key_hex_pb.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/web3_signing_credential_private_key_hex_pb.proto new file mode 100644 index 00000000000..75859b485b8 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/models/web3_signing_credential_private_key_hex_pb.proto @@ -0,0 +1,26 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche; + +import "google/protobuf/any.proto"; + + +message Web3SigningCredentialPrivateKeyHexPB { + + // The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. + string ethAccount = 528332204; + + // The HEX encoded private key of an eth account. + string secret = 369406289; + +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/services/default_service.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/services/default_service.proto new file mode 100644 index 00000000000..ba916dd5a2f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/generated/openapi/services/default_service.proto @@ -0,0 +1,34 @@ +/* + Hyperledger Cacti Plugin - Connector Avalanche + + Can perform basic tasks on a Avalanche ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice; + +import "google/protobuf/empty.proto"; +import "models/deploy_contract_v1_request_pb.proto"; +import "models/deploy_contract_v1_response_pb.proto"; + +service DefaultService { + rpc DeployContractV1 (DeployContractV1Request) returns (DeployContractV1ResponsePB); + + rpc GetOpenApiSpecV1 (google.protobuf.Empty) returns (GetOpenApiSpecV1Response); + +} + +message DeployContractV1Request { + DeployContractV1RequestPB deployContractV1RequestPB = 1; + +} + +message GetOpenApiSpecV1Response { + string data = 1; +} + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/services/avalanche-grpc-svc-streams.proto b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/services/avalanche-grpc-svc-streams.proto new file mode 100644 index 00000000000..ebf449f7621 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/proto/services/avalanche-grpc-svc-streams.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice; + +import "models/watch_blocks_v1_progress_pb.proto"; +import "models/watch_blocks_v1_request_pb.proto"; + +service AvalancheGrpcSvcStreams { + rpc WatchBlocksV1(stream WatchBlocksV1RequestPB) returns (stream WatchBlocksV1ProgressPB) {}; +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/api-client/avalanche-api-client.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/api-client/avalanche-api-client.ts new file mode 100644 index 00000000000..c1bd8fbeb2d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/api-client/avalanche-api-client.ts @@ -0,0 +1,78 @@ +import { Observable, ReplaySubject } from "rxjs"; +import { finalize } from "rxjs/operators"; +import { Socket, io } from "socket.io-client-fixed-types"; +import { Logger, Checks } from "@hyperledger/cactus-common"; +import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; +import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; +import { + DefaultApi, + WatchBlocksV1, + WatchBlocksV1Progress, +} from "../generated/openapi/typescript-axios"; +import { Configuration } from "../generated/openapi/typescript-axios/configuration"; + +export class AvalancheApiClientOptions extends Configuration { + readonly logLevel?: LogLevelDesc; + readonly wsApiHost?: string; + readonly wsApiPath?: string; +} + +export class AvalancheApiClient + extends DefaultApi + implements ISocketApiClient +{ + public static readonly CLASS_NAME = "AvalancheApiClient"; + + private readonly log: Logger; + private readonly wsApiHost: string; + private readonly wsApiPath: string; + + public get className(): string { + return AvalancheApiClient.CLASS_NAME; + } + + constructor(public readonly options: AvalancheApiClientOptions) { + super(options); + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + + const level = this.options.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + + this.wsApiHost = options.wsApiHost || options.basePath || location.host; + this.wsApiPath = options.wsApiPath || Constants.SocketIoConnectionPathV1; + this.log.debug(`Created ${this.className} OK.`); + this.log.debug(`wsApiHost=${this.wsApiHost}`); + this.log.debug(`wsApiPath=${this.wsApiPath}`); + this.log.debug(`basePath=${this.options.basePath}`); + } + + public watchBlocksV1(): Observable { + const socket: Socket = io(this.wsApiHost, { path: this.wsApiPath }); + const subject = new ReplaySubject(0); + + socket.on(WatchBlocksV1.Next, (data: WatchBlocksV1Progress) => { + subject.next(data); + }); + + socket.on("connect", () => { + console.log("connected OK..."); + socket.emit(WatchBlocksV1.Subscribe); + }); + + socket.connect(); + + return subject.pipe( + finalize(() => { + console.log("FINALIZE - unsubscribing from the stream..."); + socket.emit(WatchBlocksV1.Unsubscribe); + socket.disconnect(); + }), + // TODO: Investigate if we need these below - in theory without these + // it could happen that only the fist subscriber gets the last emitted value + // publishReplay(1), + // refCount(), + ); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES new file mode 100644 index 00000000000..53250c02696 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES @@ -0,0 +1,5 @@ +api.ts +base.ts +common.ts +configuration.ts +index.ts diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/api.ts new file mode 100644 index 00000000000..e4272d6cf86 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -0,0 +1,329 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Avalanche + * Can perform basic tasks on a Avalanche ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; + +/** + * + * @export + * @interface DeployContractV1Request + */ +export interface DeployContractV1Request { + /** + * The contract name for retrieve the contracts json on the keychain. + * @type {string} + * @memberof DeployContractV1Request + */ + 'contractName': string; + /** + * The application binary interface of the solidity contract + * @type {Array} + * @memberof DeployContractV1Request + */ + 'contractAbi': Array; + /** + * For use when not using keychain, pass the contract in as this string variable + * @type {string} + * @memberof DeployContractV1Request + */ + 'contractJSONString'?: string; + /** + * + * @type {Array} + * @memberof DeployContractV1Request + */ + 'constructorArgs': Array; + /** + * + * @type {Web3SigningCredentialPrivateKeyHex} + * @memberof DeployContractV1Request + */ + 'web3SigningCredential': Web3SigningCredentialPrivateKeyHex; + /** + * See https://ethereum.stackexchange.com/a/47556 regarding the maximum length of the bytecode + * @type {string} + * @memberof DeployContractV1Request + */ + 'bytecode': string; + /** + * + * @type {number} + * @memberof DeployContractV1Request + */ + 'gas'?: number; + /** + * + * @type {string} + * @memberof DeployContractV1Request + */ + 'gasPrice'?: string; + /** + * The amount of milliseconds to wait for a transaction receipt with theaddress of the contract(which indicates successful deployment) beforegiving up and crashing. + * @type {number} + * @memberof DeployContractV1Request + */ + 'timeoutMs'?: number; +} +/** + * + * @export + * @interface DeployContractV1Response + */ +export interface DeployContractV1Response { + /** + * + * @type {object} + * @memberof DeployContractV1Response + */ + 'txReceipt': object; +} +/** + * + * @export + * @enum {string} + */ + +export const WatchBlocksV1 = { + Subscribe: 'org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Subscribe', + Next: 'org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Next', + Unsubscribe: 'org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Unsubscribe', + Error: 'org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Error', + Complete: 'org.hyperledger.cactus.api.async.avalanche.WatchBlocksV1.Complete' +} as const; + +export type WatchBlocksV1 = typeof WatchBlocksV1[keyof typeof WatchBlocksV1]; + + +/** + * FIXME - the payload is not well defined + * @export + * @interface WatchBlocksV1Progress + */ +export interface WatchBlocksV1Progress { + /** + * + * @type {{ [key: string]: any; }} + * @memberof WatchBlocksV1Progress + */ + 'block': { [key: string]: any; }; +} +/** + * + * @export + * @interface WatchBlocksV1Request + */ +export interface WatchBlocksV1Request { + /** + * + * @type {WatchBlocksV1} + * @memberof WatchBlocksV1Request + */ + 'event': WatchBlocksV1; +} + + +/** + * + * @export + * @interface Web3SigningCredentialPrivateKeyHex + */ +export interface Web3SigningCredentialPrivateKeyHex { + /** + * The ethereum account (public key) that the credential belongs to. Basically the username in the traditional terminology of authentication. + * @type {string} + * @memberof Web3SigningCredentialPrivateKeyHex + */ + 'ethAccount': string; + /** + * The HEX encoded private key of an eth account. + * @type {string} + * @memberof Web3SigningCredentialPrivateKeyHex + */ + 'secret': string; +} + +/** + * DefaultApi - axios parameter creator + * @export + */ +export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Deploys the bytecode of a Solidity contract without the need of keychain + * @param {DeployContractV1Request} [deployContractV1Request] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deployContractV1: async (deployContractV1Request?: DeployContractV1Request, options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(deployContractV1Request, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOpenApiSpecV1: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DefaultApi - functional programming interface + * @export + */ +export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Deploys the bytecode of a Solidity contract without the need of keychain + * @param {DeployContractV1Request} [deployContractV1Request] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deployContractV1(deployContractV1Request?: DeployContractV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deployContractV1(deployContractV1Request, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getOpenApiSpecV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getOpenApiSpecV1(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * DefaultApi - factory interface + * @export + */ +export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) + return { + /** + * + * @summary Deploys the bytecode of a Solidity contract without the need of keychain + * @param {DeployContractV1Request} [deployContractV1Request] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deployContractV1(deployContractV1Request?: DeployContractV1Request, options?: any): AxiosPromise { + return localVarFp.deployContractV1(deployContractV1Request, options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOpenApiSpecV1(options?: any): AxiosPromise { + return localVarFp.getOpenApiSpecV1(options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DefaultApi - object-oriented interface + * @export + * @class DefaultApi + * @extends {BaseAPI} + */ +export class DefaultApi extends BaseAPI { + /** + * + * @summary Deploys the bytecode of a Solidity contract without the need of keychain + * @param {DeployContractV1Request} [deployContractV1Request] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public deployContractV1(deployContractV1Request?: DeployContractV1Request, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).deployContractV1(deployContractV1Request, options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getOpenApiSpecV1(options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getOpenApiSpecV1(options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/base.ts new file mode 100644 index 00000000000..c3fa0dfdf7b --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Avalanche + * Can perform basic tasks on a Avalanche ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://cacti.local:3000".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/common.ts new file mode 100644 index 00000000000..2a439bee242 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Avalanche + * Can perform basic tasks on a Avalanche ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/configuration.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/configuration.ts new file mode 100644 index 00000000000..f97a8b3ab66 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Avalanche + * Can perform basic tasks on a Avalanche ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/index.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/index.ts new file mode 100644 index 00000000000..6ef222b3aea --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/openapi/typescript-axios/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Avalanche + * Can perform basic tasks on a Avalanche ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts new file mode 100644 index 00000000000..d3816d414f9 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts @@ -0,0 +1,98 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: google/protobuf/any.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from "google-protobuf"; +export namespace google.protobuf { + export class Any extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + type_url?: string; + value?: Uint8Array; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type_url" in data && data.type_url != undefined) { + this.type_url = data.type_url; + } + if ("value" in data && data.value != undefined) { + this.value = data.value; + } + } + } + get type_url() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set type_url(value: string) { + pb_1.Message.setField(this, 1, value); + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; + } + set value(value: Uint8Array) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + type_url?: string; + value?: Uint8Array; + }): Any { + const message = new Any({}); + if (data.type_url != null) { + message.type_url = data.type_url; + } + if (data.value != null) { + message.value = data.value; + } + return message; + } + toObject() { + const data: { + type_url?: string; + value?: Uint8Array; + } = {}; + if (this.type_url != null) { + data.type_url = this.type_url; + } + if (this.value != null) { + data.value = this.value; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.type_url.length) + writer.writeString(1, this.type_url); + if (this.value.length) + writer.writeBytes(2, this.value); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Any { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Any(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type_url = reader.readString(); + break; + case 2: + message.value = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Any { + return Any.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts new file mode 100644 index 00000000000..7b5a551bf98 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts @@ -0,0 +1,48 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: google/protobuf/empty.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from "google-protobuf"; +export namespace google.protobuf { + export class Empty extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | {}) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { } + } + static fromObject(data: {}): Empty { + const message = new Empty({}); + return message; + } + toObject() { + const data: {} = {}; + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Empty { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Empty(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Empty { + return Empty.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_request_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_request_pb.ts new file mode 100644 index 00000000000..d12b7808b2d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_request_pb.ts @@ -0,0 +1,264 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/deploy_contract_v1_request_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as dependency_2 from "./web3_signing_credential_private_key_hex_pb"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export class DeployContractV1RequestPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + contractName?: string; + contractAbi?: dependency_1.google.protobuf.Any[]; + contractJSONString?: string; + constructorArgs?: dependency_1.google.protobuf.Any[]; + web3SigningCredential?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB; + bytecode?: string; + gas?: number; + gasPrice?: string; + timeoutMs?: number; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [512852493, 336490508], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("contractName" in data && data.contractName != undefined) { + this.contractName = data.contractName; + } + if ("contractAbi" in data && data.contractAbi != undefined) { + this.contractAbi = data.contractAbi; + } + if ("contractJSONString" in data && data.contractJSONString != undefined) { + this.contractJSONString = data.contractJSONString; + } + if ("constructorArgs" in data && data.constructorArgs != undefined) { + this.constructorArgs = data.constructorArgs; + } + if ("web3SigningCredential" in data && data.web3SigningCredential != undefined) { + this.web3SigningCredential = data.web3SigningCredential; + } + if ("bytecode" in data && data.bytecode != undefined) { + this.bytecode = data.bytecode; + } + if ("gas" in data && data.gas != undefined) { + this.gas = data.gas; + } + if ("gasPrice" in data && data.gasPrice != undefined) { + this.gasPrice = data.gasPrice; + } + if ("timeoutMs" in data && data.timeoutMs != undefined) { + this.timeoutMs = data.timeoutMs; + } + } + } + get contractName() { + return pb_1.Message.getFieldWithDefault(this, 328784197, "") as string; + } + set contractName(value: string) { + pb_1.Message.setField(this, 328784197, value); + } + get contractAbi() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.google.protobuf.Any, 512852493) as dependency_1.google.protobuf.Any[]; + } + set contractAbi(value: dependency_1.google.protobuf.Any[]) { + pb_1.Message.setRepeatedWrapperField(this, 512852493, value); + } + get contractJSONString() { + return pb_1.Message.getFieldWithDefault(this, 405816750, "") as string; + } + set contractJSONString(value: string) { + pb_1.Message.setField(this, 405816750, value); + } + get constructorArgs() { + return pb_1.Message.getRepeatedWrapperField(this, dependency_1.google.protobuf.Any, 336490508) as dependency_1.google.protobuf.Any[]; + } + set constructorArgs(value: dependency_1.google.protobuf.Any[]) { + pb_1.Message.setRepeatedWrapperField(this, 336490508, value); + } + get web3SigningCredential() { + return pb_1.Message.getWrapperField(this, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB, 451211679) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB; + } + set web3SigningCredential(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB) { + pb_1.Message.setWrapperField(this, 451211679, value); + } + get has_web3SigningCredential() { + return pb_1.Message.getField(this, 451211679) != null; + } + get bytecode() { + return pb_1.Message.getFieldWithDefault(this, 256554254, "") as string; + } + set bytecode(value: string) { + pb_1.Message.setField(this, 256554254, value); + } + get gas() { + return pb_1.Message.getFieldWithDefault(this, 102105, 0) as number; + } + set gas(value: number) { + pb_1.Message.setField(this, 102105, value); + } + get gasPrice() { + return pb_1.Message.getFieldWithDefault(this, 5271059, "") as string; + } + set gasPrice(value: string) { + pb_1.Message.setField(this, 5271059, value); + } + get timeoutMs() { + return pb_1.Message.getFieldWithDefault(this, 51479271, 0) as number; + } + set timeoutMs(value: number) { + pb_1.Message.setField(this, 51479271, value); + } + static fromObject(data: { + contractName?: string; + contractAbi?: ReturnType[]; + contractJSONString?: string; + constructorArgs?: ReturnType[]; + web3SigningCredential?: ReturnType; + bytecode?: string; + gas?: number; + gasPrice?: string; + timeoutMs?: number; + }): DeployContractV1RequestPB { + const message = new DeployContractV1RequestPB({}); + if (data.contractName != null) { + message.contractName = data.contractName; + } + if (data.contractAbi != null) { + message.contractAbi = data.contractAbi.map(item => dependency_1.google.protobuf.Any.fromObject(item)); + } + if (data.contractJSONString != null) { + message.contractJSONString = data.contractJSONString; + } + if (data.constructorArgs != null) { + message.constructorArgs = data.constructorArgs.map(item => dependency_1.google.protobuf.Any.fromObject(item)); + } + if (data.web3SigningCredential != null) { + message.web3SigningCredential = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB.fromObject(data.web3SigningCredential); + } + if (data.bytecode != null) { + message.bytecode = data.bytecode; + } + if (data.gas != null) { + message.gas = data.gas; + } + if (data.gasPrice != null) { + message.gasPrice = data.gasPrice; + } + if (data.timeoutMs != null) { + message.timeoutMs = data.timeoutMs; + } + return message; + } + toObject() { + const data: { + contractName?: string; + contractAbi?: ReturnType[]; + contractJSONString?: string; + constructorArgs?: ReturnType[]; + web3SigningCredential?: ReturnType; + bytecode?: string; + gas?: number; + gasPrice?: string; + timeoutMs?: number; + } = {}; + if (this.contractName != null) { + data.contractName = this.contractName; + } + if (this.contractAbi != null) { + data.contractAbi = this.contractAbi.map((item: dependency_1.google.protobuf.Any) => item.toObject()); + } + if (this.contractJSONString != null) { + data.contractJSONString = this.contractJSONString; + } + if (this.constructorArgs != null) { + data.constructorArgs = this.constructorArgs.map((item: dependency_1.google.protobuf.Any) => item.toObject()); + } + if (this.web3SigningCredential != null) { + data.web3SigningCredential = this.web3SigningCredential.toObject(); + } + if (this.bytecode != null) { + data.bytecode = this.bytecode; + } + if (this.gas != null) { + data.gas = this.gas; + } + if (this.gasPrice != null) { + data.gasPrice = this.gasPrice; + } + if (this.timeoutMs != null) { + data.timeoutMs = this.timeoutMs; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.contractName.length) + writer.writeString(328784197, this.contractName); + if (this.contractAbi.length) + writer.writeRepeatedMessage(512852493, this.contractAbi, (item: dependency_1.google.protobuf.Any) => item.serialize(writer)); + if (this.contractJSONString.length) + writer.writeString(405816750, this.contractJSONString); + if (this.constructorArgs.length) + writer.writeRepeatedMessage(336490508, this.constructorArgs, (item: dependency_1.google.protobuf.Any) => item.serialize(writer)); + if (this.has_web3SigningCredential) + writer.writeMessage(451211679, this.web3SigningCredential, () => this.web3SigningCredential.serialize(writer)); + if (this.bytecode.length) + writer.writeString(256554254, this.bytecode); + if (this.gas != 0) + writer.writeFloat(102105, this.gas); + if (this.gasPrice.length) + writer.writeString(5271059, this.gasPrice); + if (this.timeoutMs != 0) + writer.writeFloat(51479271, this.timeoutMs); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DeployContractV1RequestPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DeployContractV1RequestPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 328784197: + message.contractName = reader.readString(); + break; + case 512852493: + reader.readMessage(message.contractAbi, () => pb_1.Message.addToRepeatedWrapperField(message, 512852493, dependency_1.google.protobuf.Any.deserialize(reader), dependency_1.google.protobuf.Any)); + break; + case 405816750: + message.contractJSONString = reader.readString(); + break; + case 336490508: + reader.readMessage(message.constructorArgs, () => pb_1.Message.addToRepeatedWrapperField(message, 336490508, dependency_1.google.protobuf.Any.deserialize(reader), dependency_1.google.protobuf.Any)); + break; + case 451211679: + reader.readMessage(message.web3SigningCredential, () => message.web3SigningCredential = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.Web3SigningCredentialPrivateKeyHexPB.deserialize(reader)); + break; + case 256554254: + message.bytecode = reader.readString(); + break; + case 102105: + message.gas = reader.readFloat(); + break; + case 5271059: + message.gasPrice = reader.readString(); + break; + case 51479271: + message.timeoutMs = reader.readFloat(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): DeployContractV1RequestPB { + return DeployContractV1RequestPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_response_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_response_pb.ts new file mode 100644 index 00000000000..ef987f38e5f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/deploy_contract_v1_response_pb.ts @@ -0,0 +1,79 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/deploy_contract_v1_response_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export class DeployContractV1ResponsePB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + txReceipt?: dependency_1.google.protobuf.Any; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("txReceipt" in data && data.txReceipt != undefined) { + this.txReceipt = data.txReceipt; + } + } + } + get txReceipt() { + return pb_1.Message.getWrapperField(this, dependency_1.google.protobuf.Any, 464888047) as dependency_1.google.protobuf.Any; + } + set txReceipt(value: dependency_1.google.protobuf.Any) { + pb_1.Message.setWrapperField(this, 464888047, value); + } + get has_txReceipt() { + return pb_1.Message.getField(this, 464888047) != null; + } + static fromObject(data: { + txReceipt?: ReturnType; + }): DeployContractV1ResponsePB { + const message = new DeployContractV1ResponsePB({}); + if (data.txReceipt != null) { + message.txReceipt = dependency_1.google.protobuf.Any.fromObject(data.txReceipt); + } + return message; + } + toObject() { + const data: { + txReceipt?: ReturnType; + } = {}; + if (this.txReceipt != null) { + data.txReceipt = this.txReceipt.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_txReceipt) + writer.writeMessage(464888047, this.txReceipt, () => this.txReceipt.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DeployContractV1ResponsePB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DeployContractV1ResponsePB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 464888047: + reader.readMessage(message.txReceipt, () => message.txReceipt = dependency_1.google.protobuf.Any.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): DeployContractV1ResponsePB { + return DeployContractV1ResponsePB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts new file mode 100644 index 00000000000..421b73e5119 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts @@ -0,0 +1,16 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export enum WatchBlocksV1PB { + WatchBlocksV1PB_Subscribe = 0, + WatchBlocksV1PB_Next = 1, + WatchBlocksV1PB_Unsubscribe = 2, + WatchBlocksV1PB_Error = 3, + WatchBlocksV1PB_Complete = 4 + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts new file mode 100644 index 00000000000..a0719363243 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts @@ -0,0 +1,90 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_progress_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export class WatchBlocksV1ProgressPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + block?: Map; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("block" in data && data.block != undefined) { + this.block = data.block; + } + } + if (!this.block) + this.block = new Map(); + } + get block() { + return pb_1.Message.getField(this, 93832333) as any as Map; + } + set block(value: Map) { + pb_1.Message.setField(this, 93832333, value as any); + } + static fromObject(data: { + block?: { + [key: string]: ReturnType; + }; + }): WatchBlocksV1ProgressPB { + const message = new WatchBlocksV1ProgressPB({}); + if (typeof data.block == "object") { + message.block = new Map(Object.entries(data.block).map(([key, value]) => [key, dependency_1.google.protobuf.Any.fromObject(value)])); + } + return message; + } + toObject() { + const data: { + block?: { + [key: string]: ReturnType; + }; + } = {}; + if (this.block != null) { + data.block = (Object.fromEntries)((Array.from)(this.block).map(([key, value]) => [key, value.toObject()])); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + for (const [key, value] of this.block) { + writer.writeMessage(93832333, this.block, () => { + writer.writeString(1, key); + writer.writeMessage(2, value, () => value.serialize(writer)); + }); + } + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WatchBlocksV1ProgressPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WatchBlocksV1ProgressPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 93832333: + reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.block as any, reader, reader.readString, () => { + let value; + reader.readMessage(message, () => value = dependency_1.google.protobuf.Any.deserialize(reader)); + return value; + })); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WatchBlocksV1ProgressPB { + return WatchBlocksV1ProgressPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts new file mode 100644 index 00000000000..93da71fad22 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts @@ -0,0 +1,77 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_request_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as dependency_2 from "./watch_blocks_v1_pb"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export class WatchBlocksV1RequestPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("event" in data && data.event != undefined) { + this.event = data.event; + } + } + } + get event() { + return pb_1.Message.getFieldWithDefault(this, 96891546, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB.WatchBlocksV1PB_Subscribe) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB; + } + set event(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB) { + pb_1.Message.setField(this, 96891546, value); + } + static fromObject(data: { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB; + }): WatchBlocksV1RequestPB { + const message = new WatchBlocksV1RequestPB({}); + if (data.event != null) { + message.event = data.event; + } + return message; + } + toObject() { + const data: { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB; + } = {}; + if (this.event != null) { + data.event = this.event; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.event != dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB.WatchBlocksV1PB_Subscribe) + writer.writeEnum(96891546, this.event); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WatchBlocksV1RequestPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WatchBlocksV1RequestPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 96891546: + message.event = reader.readEnum(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WatchBlocksV1RequestPB { + return WatchBlocksV1RequestPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/web3_signing_credential_private_key_hex_pb.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/web3_signing_credential_private_key_hex_pb.ts new file mode 100644 index 00000000000..71f52ce1f4f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/models/web3_signing_credential_private_key_hex_pb.ts @@ -0,0 +1,99 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/web3_signing_credential_private_key_hex_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche { + export class Web3SigningCredentialPrivateKeyHexPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + ethAccount?: string; + secret?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("ethAccount" in data && data.ethAccount != undefined) { + this.ethAccount = data.ethAccount; + } + if ("secret" in data && data.secret != undefined) { + this.secret = data.secret; + } + } + } + get ethAccount() { + return pb_1.Message.getFieldWithDefault(this, 528332204, "") as string; + } + set ethAccount(value: string) { + pb_1.Message.setField(this, 528332204, value); + } + get secret() { + return pb_1.Message.getFieldWithDefault(this, 369406289, "") as string; + } + set secret(value: string) { + pb_1.Message.setField(this, 369406289, value); + } + static fromObject(data: { + ethAccount?: string; + secret?: string; + }): Web3SigningCredentialPrivateKeyHexPB { + const message = new Web3SigningCredentialPrivateKeyHexPB({}); + if (data.ethAccount != null) { + message.ethAccount = data.ethAccount; + } + if (data.secret != null) { + message.secret = data.secret; + } + return message; + } + toObject() { + const data: { + ethAccount?: string; + secret?: string; + } = {}; + if (this.ethAccount != null) { + data.ethAccount = this.ethAccount; + } + if (this.secret != null) { + data.secret = this.secret; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.ethAccount.length) + writer.writeString(528332204, this.ethAccount); + if (this.secret.length) + writer.writeString(369406289, this.secret); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Web3SigningCredentialPrivateKeyHexPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Web3SigningCredentialPrivateKeyHexPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 528332204: + message.ethAccount = reader.readString(); + break; + case 369406289: + message.secret = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Web3SigningCredentialPrivateKeyHexPB { + return Web3SigningCredentialPrivateKeyHexPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams.ts new file mode 100644 index 00000000000..b49d8e7ac05 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams.ts @@ -0,0 +1,57 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: services/avalanche-grpc-svc-streams.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../models/watch_blocks_v1_progress_pb"; +import * as dependency_2 from "./../models/watch_blocks_v1_request_pb"; +import * as grpc_1 from "@grpc/grpc-js"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice { + interface GrpcUnaryServiceInterface { + (message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + } + interface GrpcStreamServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + (message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + } + interface GrpWritableServiceInterface { + (metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + } + interface GrpcChunkServiceInterface { + (metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + (options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + } + interface GrpcPromiseServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise; + (message: P, options?: grpc_1.CallOptions): Promise; + } + export abstract class UnimplementedAvalancheGrpcSvcStreamsService { + static definition = { + WatchBlocksV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice.AvalancheGrpcSvcStreams/WatchBlocksV1", + requestStream: true, + responseStream: true, + requestSerialize: (message: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1RequestPB) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1RequestPB.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: dependency_1.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1ProgressPB) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => dependency_1.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1ProgressPB.deserialize(new Uint8Array(bytes)) + } + }; + [method: string]: grpc_1.UntypedHandleCall; + abstract WatchBlocksV1(call: grpc_1.ServerDuplexStream): void; + } + export class AvalancheGrpcSvcStreamsClient extends grpc_1.makeGenericClientConstructor(UnimplementedAvalancheGrpcSvcStreamsService.definition, "AvalancheGrpcSvcStreams", {}) { + constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial) { + super(address, credentials, options); + } + WatchBlocksV1: GrpcChunkServiceInterface = (metadata?: grpc_1.Metadata | grpc_1.CallOptions, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream => { + return super.WatchBlocksV1(metadata, options); + }; + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts new file mode 100644 index 00000000000..26fc77d9f46 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts @@ -0,0 +1,209 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: services/default_service.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/empty"; +import * as dependency_2 from "./../models/deploy_contract_v1_request_pb"; +import * as dependency_3 from "./../models/deploy_contract_v1_response_pb"; +import * as pb_1 from "google-protobuf"; +import * as grpc_1 from "@grpc/grpc-js"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice { + export class DeployContractV1Request extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + deployContractV1RequestPB?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("deployContractV1RequestPB" in data && data.deployContractV1RequestPB != undefined) { + this.deployContractV1RequestPB = data.deployContractV1RequestPB; + } + } + } + get deployContractV1RequestPB() { + return pb_1.Message.getWrapperField(this, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB, 1) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB; + } + set deployContractV1RequestPB(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_deployContractV1RequestPB() { + return pb_1.Message.getField(this, 1) != null; + } + static fromObject(data: { + deployContractV1RequestPB?: ReturnType; + }): DeployContractV1Request { + const message = new DeployContractV1Request({}); + if (data.deployContractV1RequestPB != null) { + message.deployContractV1RequestPB = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB.fromObject(data.deployContractV1RequestPB); + } + return message; + } + toObject() { + const data: { + deployContractV1RequestPB?: ReturnType; + } = {}; + if (this.deployContractV1RequestPB != null) { + data.deployContractV1RequestPB = this.deployContractV1RequestPB.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_deployContractV1RequestPB) + writer.writeMessage(1, this.deployContractV1RequestPB, () => this.deployContractV1RequestPB.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DeployContractV1Request { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DeployContractV1Request(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.deployContractV1RequestPB, () => message.deployContractV1RequestPB = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1RequestPB.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): DeployContractV1Request { + return DeployContractV1Request.deserialize(bytes); + } + } + export class GetOpenApiSpecV1Response extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + data?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("data" in data && data.data != undefined) { + this.data = data.data; + } + } + } + get data() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set data(value: string) { + pb_1.Message.setField(this, 1, value); + } + static fromObject(data: { + data?: string; + }): GetOpenApiSpecV1Response { + const message = new GetOpenApiSpecV1Response({}); + if (data.data != null) { + message.data = data.data; + } + return message; + } + toObject() { + const data: { + data?: string; + } = {}; + if (this.data != null) { + data.data = this.data; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.data.length) + writer.writeString(1, this.data); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetOpenApiSpecV1Response { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetOpenApiSpecV1Response(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.data = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetOpenApiSpecV1Response { + return GetOpenApiSpecV1Response.deserialize(bytes); + } + } + interface GrpcUnaryServiceInterface { + (message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + } + interface GrpcStreamServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + (message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + } + interface GrpWritableServiceInterface { + (metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + } + interface GrpcChunkServiceInterface { + (metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + (options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + } + interface GrpcPromiseServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise; + (message: P, options?: grpc_1.CallOptions): Promise; + } + export abstract class UnimplementedDefaultServiceService { + static definition = { + DeployContractV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.DefaultService/DeployContractV1", + requestStream: false, + responseStream: false, + requestSerialize: (message: DeployContractV1Request) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => DeployContractV1Request.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: dependency_3.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1ResponsePB) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => dependency_3.org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1ResponsePB.deserialize(new Uint8Array(bytes)) + }, + GetOpenApiSpecV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.DefaultService/GetOpenApiSpecV1", + requestStream: false, + responseStream: false, + requestSerialize: (message: dependency_1.google.protobuf.Empty) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => dependency_1.google.protobuf.Empty.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: GetOpenApiSpecV1Response) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => GetOpenApiSpecV1Response.deserialize(new Uint8Array(bytes)) + } + }; + [method: string]: grpc_1.UntypedHandleCall; + abstract DeployContractV1(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; + abstract GetOpenApiSpecV1(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; + } + export class DefaultServiceClient extends grpc_1.makeGenericClientConstructor(UnimplementedDefaultServiceService.definition, "DefaultService", {}) { + constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial) { + super(address, credentials, options); + } + DeployContractV1: GrpcUnaryServiceInterface = (message: DeployContractV1Request, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { + return super.DeployContractV1(message, metadata, options, callback); + }; + GetOpenApiSpecV1: GrpcUnaryServiceInterface = (message: dependency_1.google.protobuf.Empty, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { + return super.GetOpenApiSpecV1(message, metadata, options, callback); + }; + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-open-api.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-open-api.ts new file mode 100644 index 00000000000..9daf9754939 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-open-api.ts @@ -0,0 +1,74 @@ +import { ServerUnaryCall, sendUnaryData } from "@grpc/grpc-js"; +import { status } from "@grpc/grpc-js"; + +import { google } from "../generated/proto/protoc-gen-ts/google/protobuf/empty"; +import * as default_service from "../generated/proto/protoc-gen-ts/services/default_service"; +import { + LogLevelDesc, + Logger, + LoggerProvider, +} from "@hyperledger/cactus-common"; +import { org } from "../generated/proto/protoc-gen-ts/models/deploy_contract_v1_response_pb"; + +export interface IAvalancheGrpcSvcOpenApiOptions { + readonly logLevel?: LogLevelDesc; +} + +export class AvalancheGrpcSvcOpenApi extends default_service.org.hyperledger + .cacti.plugin.ledger.connector.avalanche.services.defaultservice + .UnimplementedDefaultServiceService { + // No choice but to disable the linter here because we need to be able to + // declare fields on the implementation class but the parent class forces to + // only have methods implementations not fields. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [field: string]: any; + + public static readonly CLASS_NAME = "AvalancheGrpcSvcOpenApi"; + + public get className(): string { + return AvalancheGrpcSvcOpenApi.CLASS_NAME; + } + + private readonly log: Logger; + + /** + * The log level that will be used throughout all the methods of this class. + */ + private readonly logLevel: LogLevelDesc; + constructor(public readonly opts: IAvalancheGrpcSvcOpenApiOptions) { + super(); + this.logLevel = opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + this.log.debug(`Created instance of ${this.className} OK`); + } + + // FIXME + DeployContractV1( + call: ServerUnaryCall< + default_service.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.DeployContractV1Request, + org.hyperledger.cacti.plugin.ledger.connector.avalanche.DeployContractV1ResponsePB + >, + callback: sendUnaryData, + ): void { + return callback({ + message: "Status.UNIMPLEMENTED", + code: status.UNIMPLEMENTED, + details: "Service endpoint not yet implemented.", + }); + } + + public GetOpenApiSpecV1( + call: ServerUnaryCall< + google.protobuf.Empty, + default_service.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.GetOpenApiSpecV1Response + >, + callback: sendUnaryData, + ): void { + return callback({ + message: "Status.UNIMPLEMENTED", + code: status.UNIMPLEMENTED, + details: "Service endpoint not yet implemented.", + }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-streams.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-streams.ts new file mode 100644 index 00000000000..8be1b60839f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/avalanche-grpc-svc-streams.ts @@ -0,0 +1,75 @@ +import { ServerDuplexStream } from "@grpc/grpc-js"; + +import { + LogLevelDesc, + Logger, + LoggerProvider, +} from "@hyperledger/cactus-common"; + +import * as watch_blocks_v1_progress_pb from "../generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb"; +import * as watch_blocks_v1_request_pb from "../generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb"; +import * as avalanche_grpc_svc_streams from "../generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams"; +import { watch_blocks_v1_pb } from "../public-api"; + +export interface IAvalancheGrpcSvcStreamsOptions { + readonly logLevel?: LogLevelDesc; +} + +export class AvalancheGrpcSvcStreams extends avalanche_grpc_svc_streams.org + .hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice + .UnimplementedAvalancheGrpcSvcStreamsService { + // No choice but to disable the linter here because we need to be able to + // declare fields on the implementation class but the parent class forces to + // only have methods implementations not fields. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [field: string]: any; + + public static readonly CLASS_NAME = "AvalancheGrpcSvcStreams"; + + public get className(): string { + return AvalancheGrpcSvcStreams.CLASS_NAME; + } + + private readonly log: Logger; + + /** + * The log level that will be used throughout all the methods of this class. + */ + private readonly logLevel: LogLevelDesc; + + constructor(public readonly opts: IAvalancheGrpcSvcStreamsOptions) { + super(); + this.logLevel = opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + this.log.debug(`Created instance of ${this.className} OK`); + } + + WatchBlocksV1( + call: ServerDuplexStream< + watch_blocks_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1RequestPB, + watch_blocks_v1_progress_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1ProgressPB + >, + ): void { + this.log.debug("WatchBlocksV1::MAIN_FN="); + + const WatchBlocksV1PB = + watch_blocks_v1_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche + .WatchBlocksV1PB; + + type WatchBlocksV1RequestPB = + watch_blocks_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1RequestPB; + + call.on("data", (chunk: WatchBlocksV1RequestPB) => { + this.log.debug("WatchBlocksV1::data=%o", chunk); + if (chunk.event === WatchBlocksV1PB.WatchBlocksV1PB_Unsubscribe) { + this.log.debug("WatchBlocksV1::data=WatchBlocksV1PB_Unsubscribe"); + call.end(); + } + }); + + call.once("close", () => { + this.log.debug("subscribe_newBlockHeaders::event=CLOSE"); + }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts new file mode 100644 index 00000000000..f587e182850 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts @@ -0,0 +1,91 @@ +import * as grpc from "@grpc/grpc-js"; + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ServerCredentials} + */ +export function createGrpcInsecureServerCredentials(): grpc.ServerCredentials { + return grpc.ServerCredentials.createInsecure(); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ServerCredentials} + */ +export function createGrpcSslServerCredentials( + rootCerts: Buffer | null, + keyCertPairs: grpc.KeyCertPair[], + checkClientCertificate?: boolean, +): grpc.ServerCredentials { + return grpc.ServerCredentials.createSsl( + rootCerts, + keyCertPairs, + checkClientCertificate, + ); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ChannelCredentials} + */ +export function createGrpcInsecureChannelCredentials(): grpc.ChannelCredentials { + return grpc.ChannelCredentials.createInsecure(); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ChannelCredentials} + */ +export function createGrpcSslChannelCredentials( + rootCerts?: Buffer | null, + privateKey?: Buffer | null, + certChain?: Buffer | null, + verifyOptions?: grpc.VerifyOptions, +): grpc.ChannelCredentials { + return grpc.ChannelCredentials.createSsl( + rootCerts, + privateKey, + certChain, + verifyOptions, + ); +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-server-factory.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-server-factory.ts new file mode 100644 index 00000000000..288bd7ea859 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/grpc-services/common/grpc-server-factory.ts @@ -0,0 +1,21 @@ +import * as grpc from "@grpc/grpc-js"; + +/** + * Re-exports the underlying `new grpc.Server()` call verbatim. + * + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects/servers with the same import of the `@grpc/grpc-js` library that the + * {ApiServer} of this package is using internally. + * + * @returns {grpc.Server} + */ +export function createGrpcServer( + options?: grpc.ServerOptions | undefined, +): grpc.Server { + return new grpc.Server(options); +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/impl/deploy-contract-impl.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/impl/deploy-contract-impl.ts new file mode 100644 index 00000000000..3602113504b --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/impl/deploy-contract-impl.ts @@ -0,0 +1,32 @@ +import { ethers } from "ethers"; + +import { LoggerProvider, LogLevelDesc } from "@hyperledger/cactus-common"; + +export async function deployContractImpl(opts: { + readonly logLevel: LogLevelDesc; + readonly providerWs: ethers.WebSocketProvider; + readonly wallet: ethers.Wallet; + readonly abi: ethers.InterfaceAbi; + readonly bytecode: ethers.BytesLike; +}): Promise { + const log = LoggerProvider.getOrCreate({ + level: opts.logLevel, + label: "deployContractImpl()", + }); + log.debug("ENTER"); + + const { abi, bytecode, wallet } = opts; + + log.debug("Instantiating ethers ContractFactory..."); + const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet); + + log.debug("Deploying contract..."); + const contract = await contractFactory.deploy(); + + log.debug("Waiting for deployment confirmation..."); + const out = await contract.waitForDeployment(); + + log.debug("Deployment confirmed OK: %o", out); + log.debug("EXIT"); + return; +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.ts new file mode 100755 index 00000000000..87cb558397c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts new file mode 100755 index 00000000000..d3ab1646830 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts @@ -0,0 +1,6 @@ +export { + AvalancheApiClient, + AvalancheApiClientOptions, +} from "./api-client/avalanche-api-client"; + +export * from "./generated/openapi/typescript-axios/api"; diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-factory-ledger-connector.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-factory-ledger-connector.ts new file mode 100644 index 00000000000..9b960774149 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-factory-ledger-connector.ts @@ -0,0 +1,20 @@ +import { + IPluginFactoryOptions, + PluginFactory, +} from "@hyperledger/cactus-core-api"; +import { + IPluginLedgerConnectorAvalancheOptions, + PluginLedgerConnectorAvalanche, +} from "./plugin-ledger-connector-avalanche"; + +export class PluginFactoryLedgerConnector extends PluginFactory< + PluginLedgerConnectorAvalanche, + IPluginLedgerConnectorAvalancheOptions, + IPluginFactoryOptions +> { + async create( + pluginOptions: IPluginLedgerConnectorAvalancheOptions, + ): Promise { + return new PluginLedgerConnectorAvalanche(pluginOptions); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-ledger-connector-avalanche.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-ledger-connector-avalanche.ts new file mode 100644 index 00000000000..326b2876b8f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/plugin-ledger-connector-avalanche.ts @@ -0,0 +1,290 @@ +import type { Server as SocketIoServer } from "socket.io"; +import type { Socket as SocketIoSocket } from "socket.io"; +import type { Express } from "express"; +// import { +// avm /** X-chain */, +// pvm /** P-chain */, +// evm /** C-chain */, +// utils, +// } from "@avalabs/avalanchejs"; + +import { ethers } from "ethers"; + +import OAS from "../json/openapi.json"; + +import { + ConsensusAlgorithmFamily, + IPluginLedgerConnector, + IWebServiceEndpoint, + IPluginWebService, + ICactusPlugin, + ICactusPluginOptions, + IPluginGrpcService, + IGrpcSvcDefAndImplPair, +} from "@hyperledger/cactus-core-api"; + +import { + PluginRegistry, + consensusHasTransactionFinality, +} from "@hyperledger/cactus-core"; + +import { + Checks, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { WatchBlocksV1 } from "./generated/openapi/typescript-axios"; + +import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; +import { WatchBlocksV1Endpoint } from "./web-services/watch-blocks-v1-endpoint"; +import { + GetOpenApiSpecV1Endpoint, + IGetOpenApiSpecV1EndpointOptions, +} from "./web-services/get-open-api-spec-v1-endpoint"; +import * as grpc_default_service from "./generated/proto/protoc-gen-ts/services/default_service"; +import * as avalanche_grpc_svc_streams from "./generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams"; +import { AvalancheGrpcSvcOpenApi } from "./grpc-services/avalanche-grpc-svc-open-api"; +import { AvalancheGrpcSvcStreams } from "./grpc-services/avalanche-grpc-svc-streams"; +import { deployContractImpl } from "./impl/deploy-contract-impl"; +import { + DeployContractV1Endpoint, + IDeployContractV1EndpointOptions, +} from "./web-services/deploy-contract-v1-endpoint"; + +export const E_KEYCHAIN_NOT_FOUND = + "cacti.connector.avalanche.keychain_not_found"; + +export interface IPluginLedgerConnectorAvalancheOptions + extends ICactusPluginOptions { + rpcUrlHttp: string; + rpcUrlWs: string; + pluginRegistry: PluginRegistry; + prometheus?: PrometheusExporter; + logLevel?: LogLevelDesc; +} + +export class PluginLedgerConnectorAvalanche + implements + IPluginLedgerConnector< + any, // FIXME + any, // FIXME + any, // FIXME + any // FIXME + >, + ICactusPlugin, + IPluginGrpcService, + IPluginWebService +{ + private readonly instanceId: string; + public prometheus: PrometheusExporter; + private readonly log: Logger; + private readonly logLevel: LogLevelDesc; + private readonly pluginRegistry: PluginRegistry; + private readonly providerWs: ethers.WebSocketProvider; + private readonly providerHttp: ethers.JsonRpcProvider; + + private endpoints: IWebServiceEndpoint[] | undefined; + + public static readonly CLASS_NAME = "PluginLedgerConnectorAvalanche"; + + public get className(): string { + return PluginLedgerConnectorAvalanche.CLASS_NAME; + } + + constructor(public readonly opts: IPluginLedgerConnectorAvalancheOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(opts, `${fnTag} arg opts`); + Checks.truthy(opts.rpcUrlHttp, `${fnTag} opts.rpcUrlHttp`); + Checks.truthy(opts.rpcUrlWs, `${fnTag} opts.rpcUrlWs`); + Checks.truthy(opts.pluginRegistry, `${fnTag} opts.pluginRegistry`); + Checks.truthy(opts.instanceId, `${fnTag} opts.instanceId`); + + this.providerHttp = new ethers.JsonRpcProvider( + opts.rpcUrlHttp, + { chainId: 1337, name: "local-http" }, + { + staticNetwork: true, + }, + ); + + this.providerWs = new ethers.WebSocketProvider( + opts.rpcUrlWs, + { + chainId: 1337, + name: "local-ws", + }, + { + staticNetwork: true, + }, + ); + + this.logLevel = this.opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + + this.instanceId = opts.instanceId; + this.pluginRegistry = opts.pluginRegistry; + this.prometheus = opts.prometheus || new PrometheusExporter({}); + Checks.truthy(this.prometheus, `${fnTag} opts.prometheus`); + + this.prometheus.startMetricsCollection(); + } + + /** + * FIXME + */ + public async deployContract(req: any): Promise { + this.log.debug("ENTER"); + const out = deployContractImpl({ logLevel: this.logLevel, ...req }); + this.log.debug("EXIT %o", out); + return out; + } + + public async transact(): Promise { + throw new Error("Method not implemented."); + } + + public getOpenApiSpec(): unknown { + return OAS; + } + + public getPrometheusExporter(): PrometheusExporter { + return this.prometheus; + } + + public async getPrometheusExporterMetrics(): Promise { + const res: string = await this.prometheus.getPrometheusMetrics(); + this.log.debug(`getPrometheusExporterMetrics() response: %o`, res); + return res; + } + + public getInstanceId(): string { + return this.instanceId; + } + + public async onPluginInit(): Promise { + this.log.debug("onPluginInit() ENTER"); + this.log.debug("onPluginInit() EXIT"); + } + + public async shutdown(): Promise { + this.log.info(`Shutting down ${this.className}...`); + } + + async registerWebServices( + app: Express, + wsApi: SocketIoServer, + ): Promise { + const { logLevel } = this.opts; + const webServices = await this.getOrCreateWebServices(); + await Promise.all(webServices.map((ws) => ws.registerExpress(app))); + + wsApi.on("connection", (socket: SocketIoSocket) => { + this.log.debug(`New Socket connected. ID=${socket.id}`); + + socket.on(WatchBlocksV1.Subscribe, () => { + new WatchBlocksV1Endpoint({ socket, logLevel }).subscribe(); + }); + }); + return webServices; + } + public async createGrpcSvcDefAndImplPairs(): Promise< + IGrpcSvcDefAndImplPair[] + > { + const openApiSvc = await this.createGrpcOpenApiSvcDefAndImplPair(); + const streamsSvc = await this.createGrpcStreamsSvcDefAndImplPair(); + return [openApiSvc, streamsSvc]; + } + + public async createGrpcStreamsSvcDefAndImplPair(): Promise { + const definition = + avalanche_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector + .avalanche.services.avalancheservice + .UnimplementedAvalancheGrpcSvcStreamsService.definition; + + const implementation = new AvalancheGrpcSvcStreams({ + logLevel: this.logLevel, + }); + + return { definition, implementation }; + } + + /** + * Create a new instance of the service implementation. + * Note: This does not cache the returned objects internally. A new instance + * is created during every invocation. + * + * @returns The gRPC service definition+implementation pair that is backed + * by the code generated by the OpenAPI generator from the openapi.json spec + * of this package. Used by the API server to obtain the service objects dynamically + * at runtime so that the plugin's gRPC services can be exposed in a similar + * fashion how the HTTP REST endpoints are registered as well. + */ + public async createGrpcOpenApiSvcDefAndImplPair(): Promise { + const definition = + grpc_default_service.org.hyperledger.cacti.plugin.ledger.connector + .avalanche.services.defaultservice.DefaultServiceClient.service; + + const implementation = new AvalancheGrpcSvcOpenApi({ + logLevel: this.logLevel, + }); + + return { definition, implementation }; + } + + public async getOrCreateWebServices(): Promise { + if (Array.isArray(this.endpoints)) { + return this.endpoints; + } + + const endpoints: IWebServiceEndpoint[] = []; + + { + const oasPath = + OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec" + ]; + + const operationId = oasPath.get.operationId; + const opts: IGetOpenApiSpecV1EndpointOptions = { + oas: OAS, + oasPath, + operationId, + path: oasPath.get["x-hyperledger-cacti"].http.path, + pluginRegistry: this.pluginRegistry, + verbLowerCase: oasPath.get["x-hyperledger-cacti"].http.verbLowerCase, + logLevel: this.opts.logLevel, + }; + const endpoint = new GetOpenApiSpecV1Endpoint(opts); + endpoints.push(endpoint); + } + + { + const opts: IDeployContractV1EndpointOptions = { + logLevel: this.opts.logLevel, + connector: this, + }; + const endpoint = new DeployContractV1Endpoint(opts); + endpoints.push(endpoint); + } + + this.endpoints = endpoints; + return endpoints; + } + + public getPackageName(): string { + return `@hyperledger/cacti-plugin-ledger-connector-avalanche`; + } + + public async getConsensusAlgorithmFamily(): Promise { + return ConsensusAlgorithmFamily.Authority; + } + public async hasTransactionFinality(): Promise { + const currentConsensusAlgorithmFamily = + await this.getConsensusAlgorithmFamily(); + + return consensusHasTransactionFinality(currentConsensusAlgorithmFamily); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/data-fetcher.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/data-fetcher.ts new file mode 100644 index 00000000000..5f88783e0f9 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/data-fetcher.ts @@ -0,0 +1,12 @@ +import { Transactions } from "./response.type"; + +import { totalTxCount, K_CACTUS_AVALANCHE_TOTAL_TX_COUNT } from "./metrics"; + +export async function collectMetrics( + transactions: Transactions, +): Promise { + transactions.counter++; + totalTxCount + .labels(K_CACTUS_AVALANCHE_TOTAL_TX_COUNT) + .set(transactions.counter); +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/metrics.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/metrics.ts new file mode 100644 index 00000000000..39b86eb7d7a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/metrics.ts @@ -0,0 +1,11 @@ +import { Gauge } from "prom-client"; + +export const K_CACTUS_AVALANCHE_TOTAL_TX_COUNT = + "cactus_avalanche_total_tx_count"; + +export const totalTxCount = new Gauge({ + registers: [], + name: "cactus_avalanche_total_tx_count", + help: "Total transactions executed", + labelNames: ["type"], +}); diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/prometheus-exporter.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/prometheus-exporter.ts new file mode 100644 index 00000000000..3ab649d4f96 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/prometheus-exporter.ts @@ -0,0 +1,39 @@ +import promClient, { Registry } from "prom-client"; +import { Transactions } from "./response.type"; +import { collectMetrics } from "./data-fetcher"; +import { K_CACTUS_AVALANCHE_TOTAL_TX_COUNT } from "./metrics"; +import { totalTxCount } from "./metrics"; + +export interface IPrometheusExporterOptions { + pollingIntervalInMin?: number; +} + +export class PrometheusExporter { + public readonly metricsPollingIntervalInMin: number; + public readonly transactions: Transactions = { counter: 0 }; + public readonly registry: Registry; + + constructor( + public readonly prometheusExporterOptions: IPrometheusExporterOptions, + ) { + this.metricsPollingIntervalInMin = + prometheusExporterOptions.pollingIntervalInMin || 1; + this.registry = new Registry(); + } + + public addCurrentTransaction(): void { + collectMetrics(this.transactions); + } + + public async getPrometheusMetrics(): Promise { + const result = await this.registry.getSingleMetricAsString( + K_CACTUS_AVALANCHE_TOTAL_TX_COUNT, + ); + return result; + } + + public startMetricsCollection(): void { + this.registry.registerMetric(totalTxCount); + promClient.collectDefaultMetrics({ register: this.registry }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/response.type.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/response.type.ts new file mode 100644 index 00000000000..3f1bc7f4911 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/prometheus-exporter/response.type.ts @@ -0,0 +1,3 @@ +export type Transactions = { + counter: number; +}; diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts new file mode 100755 index 00000000000..c8521978b65 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts @@ -0,0 +1,51 @@ +export { + E_KEYCHAIN_NOT_FOUND, + IPluginLedgerConnectorAvalancheOptions, + PluginLedgerConnectorAvalanche, +} from "./plugin-ledger-connector-avalanche"; +export { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector"; + +import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api"; +import { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector"; + +export { + AvalancheApiClient, + AvalancheApiClientOptions, +} from "./api-client/avalanche-api-client"; + +export * from "./generated/openapi/typescript-axios/api"; + +export async function createPluginFactory( + pluginFactoryOptions: IPluginFactoryOptions, +): Promise { + return new PluginFactoryLedgerConnector(pluginFactoryOptions); +} + +export { + IAvalancheGrpcSvcOpenApiOptions, + AvalancheGrpcSvcOpenApi, +} from "./grpc-services/avalanche-grpc-svc-open-api"; + +export { + AvalancheGrpcSvcStreams, + IAvalancheGrpcSvcStreamsOptions, +} from "./grpc-services/avalanche-grpc-svc-streams"; + +export * as google_protobuf_any from "./generated/proto/protoc-gen-ts/google/protobuf/any"; +export * as google_protobuf_empty from "./generated/proto/protoc-gen-ts/google/protobuf/empty"; + +export * as default_service from "./generated/proto/protoc-gen-ts/services/default_service"; + +export * as avalanche_grpc_svc_streams from "./generated/proto/protoc-gen-ts/services/avalanche-grpc-svc-streams"; +export * as watch_blocks_v1_progress_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb"; +export * as watch_blocks_v1_request_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb"; +export * as watch_blocks_v1_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb"; + +export { + createGrpcInsecureChannelCredentials, + createGrpcInsecureServerCredentials, + createGrpcSslChannelCredentials, + createGrpcSslServerCredentials, +} from "./grpc-services/common/grpc-credentials-factory"; + +export { createGrpcServer } from "./grpc-services/common/grpc-server-factory"; diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/deploy-contract-v1-endpoint.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/deploy-contract-v1-endpoint.ts new file mode 100644 index 00000000000..20351af738c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/deploy-contract-v1-endpoint.ts @@ -0,0 +1,102 @@ +import { Express, Request, Response } from "express"; + +import { + IWebServiceEndpoint, + IExpressRequestHandler, + IEndpointAuthzOptions, +} from "@hyperledger/cactus-core-api"; + +import { + Logger, + Checks, + LogLevelDesc, + LoggerProvider, + IAsyncProvider, +} from "@hyperledger/cactus-common"; + +import { + handleRestEndpointException, + registerWebServiceEndpoint, +} from "@hyperledger/cactus-core"; + +import { PluginLedgerConnectorAvalanche } from "../plugin-ledger-connector-avalanche"; +import OAS from "../../json/openapi.json"; + +export interface IDeployContractV1EndpointOptions { + logLevel?: LogLevelDesc; + connector: PluginLedgerConnectorAvalanche; +} + +export class DeployContractV1Endpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "DeployContractV1Endpoint"; + + private readonly log: Logger; + + public get className(): string { + return DeployContractV1Endpoint.CLASS_NAME; + } + + constructor(public readonly options: IDeployContractV1EndpointOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + Checks.truthy(options.connector, `${fnTag} arg options.connector`); + + const level = this.options.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/deploy-contract" + ]; + } + + public getPath(): string { + return this.oasPath.post["x-hyperledger-cacti"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.post["x-hyperledger-cacti"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.post.operationId; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + // TODO: make this an injectable dependency in the constructor + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async handleRequest(req: Request, res: Response): Promise { + const reqTag = `${this.getVerbLowerCase()} - ${this.getPath()}`; + this.log.debug(reqTag); + try { + res + .status(200) + .json(await this.options.connector.deployContract(req.body)); + } catch (err) { + this.log.error(`Crash while serving ${reqTag}`, err); + const { log } = this; + const errorMsg = "Failed to invoke deployContract method of connector."; + await handleRestEndpointException({ error: err, errorMsg, log, res }); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts new file mode 100644 index 00000000000..cd1704d2ec8 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts @@ -0,0 +1,39 @@ +import { + GetOpenApiSpecV1EndpointBase, + IGetOpenApiSpecV1EndpointBaseOptions, +} from "@hyperledger/cactus-core"; + +import { Checks, LogLevelDesc } from "@hyperledger/cactus-common"; +import { IWebServiceEndpoint } from "@hyperledger/cactus-core-api"; + +import OAS from "../../json/openapi.json"; + +export const OasPathGetOpenApiSpecV1 = + OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-avalanche/get-open-api-spec" + ]; + +export type OasPathTypeGetOpenApiSpecV1 = typeof OasPathGetOpenApiSpecV1; + +export interface IGetOpenApiSpecV1EndpointOptions + extends IGetOpenApiSpecV1EndpointBaseOptions< + typeof OAS, + OasPathTypeGetOpenApiSpecV1 + > { + readonly logLevel?: LogLevelDesc; +} + +export class GetOpenApiSpecV1Endpoint + extends GetOpenApiSpecV1EndpointBase + implements IWebServiceEndpoint +{ + public get className(): string { + return GetOpenApiSpecV1Endpoint.CLASS_NAME; + } + + constructor(public readonly options: IGetOpenApiSpecV1EndpointOptions) { + super(options); + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/watch-blocks-v1-endpoint.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/watch-blocks-v1-endpoint.ts new file mode 100644 index 00000000000..7a0a741c280 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/main/typescript/web-services/watch-blocks-v1-endpoint.ts @@ -0,0 +1,49 @@ +import type { Socket as SocketIoSocket } from "socket.io"; + +import { Logger, Checks } from "@hyperledger/cactus-common"; +import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; +import { WatchBlocksV1Progress } from "../generated/openapi/typescript-axios"; +import { WatchBlocksV1 } from "../generated/openapi/typescript-axios"; + +export interface IWatchBlocksV1EndpointOptions { + logLevel?: LogLevelDesc; + socket: SocketIoSocket; +} + +export class WatchBlocksV1Endpoint { + public static readonly CLASS_NAME = "WatchBlocksV1Endpoint"; + + private readonly log: Logger; + private readonly socket: SocketIoSocket< + Record void>, + Record void> + >; + + public get className(): string { + return WatchBlocksV1Endpoint.CLASS_NAME; + } + + constructor(public readonly options: IWatchBlocksV1EndpointOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + Checks.truthy(options.socket, `${fnTag} arg options.socket`); + + this.socket = options.socket; + + const level = this.options.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + } + + public async subscribe(): Promise { + const { socket, log } = this; + log.debug(`${WatchBlocksV1.Subscribe} => ${socket.id}`); + socket.on("disconnect", async (reason: string) => { + log.debug("WebSocket:disconnect reason=%o", reason); + }); + + socket.on(WatchBlocksV1.Unsubscribe, () => { + log.debug(`${WatchBlocksV1.Unsubscribe}: unsubscribing Web3...`); + }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts new file mode 100644 index 00000000000..34aba3a0aea --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts @@ -0,0 +1,6 @@ +import * as apiSurface from "../../../main/typescript/public-api"; +import "jest-extended"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/api-surface.test.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/api-surface.test.ts new file mode 100644 index 00000000000..34aba3a0aea --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/api-surface.test.ts @@ -0,0 +1,6 @@ +import * as apiSurface from "../../../main/typescript/public-api"; +import "jest-extended"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/get-open-api-spec-v1-connector-avalanche.test.ts b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/get-open-api-spec-v1-connector-avalanche.test.ts new file mode 100644 index 00000000000..244129cc21e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/src/test/typescript/unit/get-open-api-spec-v1-connector-avalanche.test.ts @@ -0,0 +1,89 @@ +import { + IListenOptions, + LogLevelDesc, + LoggerProvider, + Servers, +} from "@hyperledger/cactus-common"; +import { PluginRegistry } from "@hyperledger/cactus-core"; +import { Constants, PluginImportType } from "@hyperledger/cactus-core-api"; +import bodyParser from "body-parser"; +import express from "express"; +import http from "http"; +import "jest-extended"; +import { AddressInfo } from "net"; +import { Server as SocketIoServer } from "socket.io"; +import { v4 as uuidv4 } from "uuid"; +import { + AvalancheApiClient, + AvalancheApiClientOptions, + PluginFactoryLedgerConnector, + PluginLedgerConnectorAvalanche, +} from "../../../main/typescript/public-api"; + +describe(__filename, () => { + const logLevel: LogLevelDesc = "TRACE"; + + const log = LoggerProvider.getOrCreate({ + label: __filename, + level: logLevel, + }); + + const rpcApiHttpHost = "http://127.0.0.1:8000"; + const rpcApiWsHost = "ws://127.0.0.1:9000"; + + const expressApp = express(); + expressApp.use(bodyParser.json({ limit: "250mb" })); + const server = http.createServer(expressApp); + let apiClient: AvalancheApiClient; + + afterAll(async () => { + await Servers.shutdown(server); + }); + + beforeAll(async () => { + const factory = new PluginFactoryLedgerConnector({ + pluginImportType: PluginImportType.Local, + }); + + const connector: PluginLedgerConnectorAvalanche = await factory.create({ + rpcUrlHttp: rpcApiHttpHost, + rpcUrlWs: rpcApiWsHost, + logLevel, + instanceId: uuidv4(), + pluginRegistry: new PluginRegistry({ plugins: [] }), + }); + + const wsApi = new SocketIoServer(server, { + path: Constants.SocketIoConnectionPathV1, + }); + + await connector.registerWebServices(expressApp, wsApi); + + const listenOptions: IListenOptions = { + hostname: "127.0.0.1", + port: 0, + server, + }; + const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; + const { address, port } = addressInfo; + const apiHost = `http://${address}:${port}`; + + const avalancheApiClientOptions = new AvalancheApiClientOptions({ + basePath: apiHost, + }); + apiClient = new AvalancheApiClient(avalancheApiClientOptions); + log.debug("Instantiated AvalancheApiClient OK"); + }); + + it("Returns a JSON document containing the Open API specification of the plugin.", async () => { + const res1Promise = apiClient.getOpenApiSpecV1(); + await expect(res1Promise).resolves.not.toThrow(); + const res1 = await res1Promise; + expect(res1.status).toEqual(200); + expect(res1.data).toBeTruthy(); + expect(res1.config).toBeTruthy(); + expect(res1.config.url).toBeString(); + log.debug("Fetched URL OK=%s", res1.config.url); + expect(res1.data).toBeObject(); + }); +}); diff --git a/packages/cacti-plugin-ledger-connector-avalanche/tsconfig.json b/packages/cacti-plugin-ledger-connector-avalanche/tsconfig.json new file mode 100644 index 00000000000..13d410eb330 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-avalanche/tsconfig.json @@ -0,0 +1,32 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/lib/", + "declarationDir": "dist/lib", + "resolveJsonModule": true, + "rootDir": "./src", + "tsBuildInfoFile": "../../.build-cache/cacti-plugin-ledger-connector-avalanche.tsbuildinfo" + }, + "include": [ + "./src", + "src/**/*.json" + ], + "references": [ + { + "path": "../cactus-common/tsconfig.json" + }, + { + "path": "../cactus-core/tsconfig.json" + }, + { + "path": "../cactus-core-api/tsconfig.json" + }, + { + "path": "../cactus-plugin-keychain-memory/tsconfig.json" + }, + { + "path": "../cactus-test-tooling/tsconfig.json" + } + ] +} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/README.md b/packages/cacti-plugin-ledger-connector-chainlink/README.md new file mode 100644 index 00000000000..b98a5b9e12e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/README.md @@ -0,0 +1,268 @@ +# `@hyperledger/cacti-plugin-ledger-connector-chainlink` + +This plugin provides `Cactus` a way to interact with Chainlink networks. Using this we can perform: +* Deploy Smart-contracts through bytecode. +* Build and sign transactions using different keystores. +* Invoke smart-contract functions that we have deployed on the network. +## Summary + + - [Getting Started](#getting-started) + - [Architecture](#architecture) + - [Usage](#usage) + - [Prometheus Exporter](#prometheus-exporter) + - [Runing the tests](#running-the-tests) + - [Built With](#built-with) + - [Contributing](#contributing) + - [License](#license) + - [Acknowledgments](#acknowledgments) + +## Getting Started + +Clone the git repository on your local machine. Follow these instructions that will get you a copy of the project up and running on +your local machine for development and testing purposes. + +### Prerequisites + +In the root of the project to install the dependencies execute the command: +```sh +npm run configure +``` + +### Compiling + +In the project root folder, run this command to compile the plugin and create the dist directory: +```sh +npm run tsc +``` + +### Usage + +#### Typescript Library (NodeJS) + +> TODO + +#### HTTP API Client + +> TODO + +#### ConnectRPC Client + +> TODO + +#### gRPC Client + +> TODO + +#### Running the container + +Launch container with plugin configuration as an **environment variable**: +```sh +docker run \ + --rm \ + --publish 3000:3000 \ + --publish 4000:4000 \ + --env AUTHORIZATION_PROTOCOL='NONE' \ + --env AUTHORIZATION_CONFIG_JSON='{}' \ + --env GRPC_TLS_ENABLED=false \ + --env API_TLS_CERT_PEM=- \ + --env API_TLS_CLIENT_CA_PEM=- \ + --env API_TLS_KEY_PEM=- \ + --env API_TLS_ENABLED=false \ + --env API_MTLS_ENABLED=false \ + --env API_HOST=0.0.0.0 \ + --env LOG_LEVEL=INFO \ + ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255 \ + node index.js \ + --plugins='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-chainlink", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcApiWsHost":"ws://localhost:8546", "instanceId": "some-unique-chainlink-connector-instance-id"}}]' +``` + +Launch container with plugin configuration as a **CLI argument**: +```sh +docker run \ + --rm \ + --publish 3000:3000 \ + --publish 4000:4000 \ + --env AUTHORIZATION_PROTOCOL='NONE' \ + --env AUTHORIZATION_CONFIG_JSON='{}' \ + --env GRPC_TLS_ENABLED=false \ + --env API_TLS_CERT_PEM=- \ + --env API_TLS_CLIENT_CA_PEM=- \ + --env API_TLS_KEY_PEM=- \ + --env API_TLS_ENABLED=false \ + --env API_MTLS_ENABLED=false \ + --env API_HOST=0.0.0.0 \ + --env LOG_LEVEL=INFO \ + ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255 \ + node index.js \ + --plugins='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-chainlink", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcApiWsHost":"ws://localhost:8546", "instanceId": "some-unique-chainlink-connector-instance-id"}}]' +``` + +Launch container with **configuration file** mounted from host machine: +```sh +echo '{"plugins": [{"packageName": "@hyperledger/cacti-plugin-ledger-connector-chainlink", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://localhost:8545", "rpcApiWsHost":"ws://localhost:8546", "instanceId": "some-unique-chainlink-connector-instance-id"}}]}' > .cacti-config.json +``` + +```sh +docker run \ + --rm \ + --publish 3000:3000 \ + --publish 4000:4000 \ + --env AUTHORIZATION_PROTOCOL='NONE' \ + --env AUTHORIZATION_CONFIG_JSON='{}' \ + --env GRPC_TLS_ENABLED=false \ + --env API_TLS_CERT_PEM=- \ + --env API_TLS_CLIENT_CA_PEM=- \ + --env API_TLS_KEY_PEM=- \ + --env API_TLS_ENABLED=false \ + --env API_MTLS_ENABLED=false \ + --env API_HOST=0.0.0.0 \ + --env LOG_LEVEL=INFO \ + --mount type=bind,source="$(pwd)"/.cacti-config.json,target=/.cacti-config.json \ + ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255 \ + node index.js \ + --config-file=/.cacti-config.json +``` + +#### Testing API calls with the container + +Don't have a Chainlink network on hand to test with? Test or develop against our Chainlink All-In-One container! + +**Terminal Window 1 (Ledger)** +```sh +docker run \ + --publish 0.0.0.0:8545:8545/tcp \ + --publish 0.0.0.0:8546:8546/tcp \ + --publish 0.0.0.0:8888:8888/tcp \ + --publish 0.0.0.0:9001:9001/tcp \ + --publish 0.0.0.0:9545:9545/tcp \ + ghcr.io/hyperledger/cactus-chainlink-all-in-one:2024-07-04-8c030ae +``` + +**Terminal Window 2 (Cacti API Server)** +```sh +docker run \ + --network=host \ + --rm \ + --publish 3000:3000 \ + --publish 4000:4000 \ + --env AUTHORIZATION_PROTOCOL='NONE' \ + --env AUTHORIZATION_CONFIG_JSON='{}' \ + --env GRPC_TLS_ENABLED=false \ + --env API_TLS_CERT_PEM=- \ + --env API_TLS_CLIENT_CA_PEM=- \ + --env API_TLS_KEY_PEM=- \ + --env API_TLS_ENABLED=false \ + --env API_MTLS_ENABLED=false \ + --env API_HOST=0.0.0.0 \ + --env LOG_LEVEL=INFO \ + ghcr.io/hyperledger/cactus-cmd-api-server:2024-07-03t18-38-45-dev-65adc3255 \ + node index.js \ + --plugins='[{"packageName": "@hyperledger/cacti-plugin-ledger-connector-chainlink", "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", "options": {"rpcApiHttpHost": "http://127.0.0.1:8545", "rpcApiWsHost":"ws://127.0.0.1:8546", "instanceId": "some-unique-chainlink-connector-instance-id"}}]' +``` + +**Terminal Window 3 (curl - replace eth accounts as needed)** +```sh +curl --location --request POST 'http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/run-transaction' \ +--header 'Content-Type: application/json' \ +--data-raw '{ + "web3SigningCredential": { + "ethAccount": "627306090abaB3A6e1400e9345bC60c78a8BEf57", + "secret": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "type": "PRIVATE_KEY_HEX" + }, + "consistencyStrategy": { + "blockConfirmations": 0, + "receiptType": "NODE_TX_POOL_ACK" + }, + "transactionConfig": { + "from": "627306090abaB3A6e1400e9345bC60c78a8BEf57", + "to": "f17f52151EbEF6C7334FAD080c5704D77216b732", + "value": 1, + "gas": 10000000 + } +}' +``` + +The above should produce a response that looks similar to this: + +```json +{ + "success": true, + "data": { + "transactionReceipt": { + "blockHash": "0x7c97c038a5d3bd84613fe23ed442695276d5d2df97f4e7c4f10ca06765033ffd", + "blockNumber": 1218, + "contractAddress": null, + "cumulativeGasUsed": 21000, + "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57", + "gasUsed": 21000, + "logs": [], + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "status": true, + "to": "0xf17f52151ebef6c7334fad080c5704d77216b732", + "transactionHash": "0xc7fcb46c735bdc696d500bfc70c72595a2b8c31813929e5c61d9a5aec3376d6f", + "transactionIndex": 0 + } + } +} +``` + +## Prometheus Exporter + +This class creates a prometheus exporter, which scrapes the transactions (total transaction count) for the use cases incorporating the use of Chainlink connector plugin. + +### Prometheus Exporter Usage +The prometheus exporter object is initialized in the `PluginLedgerConnectorChainlink` class constructor itself, so instantiating the object of the `PluginLedgerConnectorChainlink` class, gives access to the exporter object. +You can also initialize the prometheus exporter object seperately and then pass it to the `IPluginLedgerConnectorChainlinkOptions` interface for `PluginLedgerConnectoChainlink` constructor. + +`getPrometheusMetricsV1` function returns the prometheus exporter metrics, currently displaying the total transaction count, which currently increments everytime the `transact()` method of the `PluginLedgerConnectorChainlink` class is called. + +### Prometheus Integration +To use Prometheus with this exporter make sure to install [Prometheus main component](https://prometheus.io/download/). +Once Prometheus is setup, the corresponding scrape_config needs to be added to the prometheus.yml + +```(yaml) +- job_name: 'chainlink_ledger_connector_exporter' + metrics_path: api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-prometheus-exporter-metrics + scrape_interval: 5s + static_configs: + - targets: ['{host}:{port}'] +``` + +Here the `host:port` is where the prometheus exporter metrics are exposed. The test cases (For example, packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/integration/plugin-ledger-connector-chainlink/deploy-contract/deploy-contract-from-json.test.ts) exposes it over `0.0.0.0` and a random port(). The random port can be found in the running logs of the test case and looks like (42379 in the below mentioned URL) +`Metrics URL: http://0.0.0.0:42379/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-prometheus-exporter-metrics` + +Once edited, you can start the prometheus service by referencing the above edited prometheus.yml file. +On the prometheus graphical interface (defaulted to http://localhost:9090), choose **Graph** from the menu bar, then select the **Console** tab. From the **Insert metric at cursor** drop down, select **cactus_chainlink_total_tx_count** and click **execute** + +### Helper code + +###### response.type.ts +This file contains the various responses of the metrics. + +###### data-fetcher.ts +This file contains functions encasing the logic to process the data points + +###### metrics.ts +This file lists all the prometheus metrics and what they are used for. + +## Running the tests + +To check that all has been installed correctly and that the pugin has no errors run the tests: + +* Run this command at the project's root: +```sh +npm run test:plugin-ledger-connector-chainlink +``` + +## Contributing + +We welcome contributions to Hyperledger Cactus in many forms, and there’s always plenty to do! + +Please review [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. + +## License + +This distribution is published under the Apache License Version 2.0 found in the [LICENSE](../../LICENSE) file. + +## Acknowledgments diff --git a/packages/cacti-plugin-ledger-connector-chainlink/openapitools.json b/packages/cacti-plugin-ledger-connector-chainlink/openapitools.json new file mode 100644 index 00000000000..225ff1aaaee --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.6.0" + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/package.json b/packages/cacti-plugin-ledger-connector-chainlink/package.json new file mode 100644 index 00000000000..4fe3cfc8fbd --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/package.json @@ -0,0 +1,113 @@ +{ + "name": "@hyperledger/cacti-plugin-ledger-connector-chainlink", + "version": "2.0.0-rc.4", + "description": "Allows Cacti users to perform read/write operations on a Chainlink ledger.", + "keywords": [ + "Hyperledger", + "Cacti", + "Integration", + "Blockchain", + "Distributed Ledger Technology" + ], + "homepage": "https://github.com/hyperledger/cacti#readme", + "bugs": { + "url": "https://github.com/hyperledger/cacti/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/cacti.git" + }, + "license": "Apache-2.0", + "author": { + "name": "Hyperledger Cactus Contributors", + "email": "cactus@lists.hyperledger.org", + "url": "https://www.hyperledger.org/use/cacti" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + }, + { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + } + ], + "main": "dist/lib/main/typescript/index.js", + "module": "dist/lib/main/typescript/index.js", + "browser": "dist/cacti-plugin-ledger-connector-chainlink.web.umd.js", + "types": "dist/lib/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "benchmark": "tsx ./src/test/typescript/benchmark/run-plugin-ledger-connector-chainlink-benchmark.ts .tmp/benchmark-results/plugin-ledger-connector-chainlink/run-plugin-ledger-connector-chainlink-benchmark.ts.log", + "codegen": "yarn run --top-level run-s 'codegen:*'", + "codegen:openapi": "npm run generate-sdk", + "codegen:proto": "run-s proto:openapi proto:protoc-gen-ts", + "generate-sdk": "run-s 'generate-sdk:*'", + "generate-sdk:go": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g go -o ./src/main/go/generated/openapi/go-client/ --git-user-id hyperledger --git-repo-id $(echo $npm_package_name | replace @hyperledger/ \"\" -z)/src/main/go/generated/openapi/go-client --package-name $(echo $npm_package_name | replace @hyperledger/ \"\" -z) --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore", + "proto:openapi": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --model-name-suffix=PB --language-specific-primitives=google.protobuf.Any --type-mappings=AnyType=google.protobuf.Any --type-mappings=object=google.protobuf.Any --additional-properties=packageName=org.hyperledger.cacti.plugin.ledger.connector.chainlink -o ./src/main/proto/generated/openapi/ -t=./src/main/mustache/openapi-generator/templates/protobuf-schema/ --ignore-file-override ../../openapi-generator-ignore", + "proto:protoc-gen-ts": "yarn run --top-level grpc_tools_node_protoc --plugin=protoc-gen-ts=../../node_modules/.bin/protoc-gen-ts --ts_out=grpc_js:./src/main/typescript/generated/proto/protoc-gen-ts/ --proto_path ./src/main/proto/generated/openapi/ --proto_path ./src/main/proto/generated/openapi/models/ --proto_path ./src/main/proto/ ./src/main/proto/generated/openapi/services/*.proto ./src/main/proto/services/*.proto", + "watch": "npm-watch", + "webpack": "npm-run-all webpack:dev", + "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", + "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", + "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" + }, + "dependencies": { + "@chainlink/functions-toolkit": "0.3.1", + "@grpc/grpc-js": "1.11.1", + "@hyperledger/cactus-common": "2.0.0-rc.4", + "@hyperledger/cactus-core": "2.0.0-rc.4", + "@hyperledger/cactus-core-api": "2.0.0-rc.4", + "axios": "1.7.7", + "express": "4.19.2", + "google-protobuf": "3.21.4", + "http-errors-enhanced-cjs": "2.0.1", + "openapi-types": "12.1.3", + "prom-client": "15.1.3", + "run-time-error-cjs": "1.4.0", + "rxjs": "7.8.1", + "socket.io-client-fixed-types": "4.5.4", + "ts-results": "3.3.0" + }, + "devDependencies": { + "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.4", + "@hyperledger/cactus-test-tooling": "2.0.0-rc.4", + "@openapitools/openapi-generator-cli": "2.7.0", + "@types/benchmark": "2.1.5", + "@types/body-parser": "1.19.4", + "@types/express": "4.17.21", + "@types/fs-extra": "11.0.4", + "@types/google-protobuf": "3.15.5", + "benchmark": "2.1.4", + "body-parser": "1.20.2", + "fs-extra": "11.2.0", + "grpc-tools": "1.12.4", + "grpc_tools_node_protoc_ts": "5.3.3", + "npm-run-all2": "6.1.2", + "protobufjs": "7.4.0", + "socket.io": "4.6.2", + "tsx": "4.16.2" + }, + "engines": { + "node": ">=18", + "npm": ">=8" + }, + "publishConfig": { + "access": "public" + }, + "browserMinified": "dist/cacti-plugin-ledger-connector-chainlink.web.umd.min.js", + "mainMinified": "dist/cacti-plugin-ledger-connector-chainlink.node.umd.min.js", + "watch": { + "codegen:openapi": { + "patterns": [ + "./src/main/json/openapi.json" + ] + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/FILES new file mode 100644 index 00000000000..1f22e9a214c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/FILES @@ -0,0 +1,16 @@ +.travis.yml +README.md +api/openapi.yaml +api_default.go +client.go +configuration.go +go.mod +go.sum +model_get_subscription_info_v1_request.go +model_get_subscription_info_v1_response.go +model_subscription_info.go +model_watch_blocks_v1.go +model_watch_blocks_v1_progress.go +model_watch_blocks_v1_request.go +response.go +utils.go diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.travis.yml b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.travis.yml new file mode 100644 index 00000000000..f5cb2ce9a5a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/README.md b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/README.md new file mode 100644 index 00000000000..f3e0c0501a2 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/README.md @@ -0,0 +1,118 @@ +# Go API client for cacti-plugin-ledger-connector-chainlink + +Can perform basic tasks on a Chainlink ledger + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 2.0.0-rc.4 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import cacti-plugin-ledger-connector-chainlink "github.com/hyperledger/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-chainlink.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-chainlink.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. + +```golang +ctx := context.WithValue(context.Background(), cacti-plugin-ledger-connector-chainlink.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), cacti-plugin-ledger-connector-chainlink.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://127.0.0.1:4000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**GetOpenApiSpecV1**](docs/DefaultApi.md#getopenapispecv1) | **Get** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec | Retrieves the .json file that contains the OpenAPI specification for the plugin. +*DefaultApi* | [**GetSubscriptionInfoV1**](docs/DefaultApi.md#getsubscriptioninfov1) | **Post** /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info | You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + + +## Documentation For Models + + - [GetSubscriptionInfoV1Request](docs/GetSubscriptionInfoV1Request.md) + - [GetSubscriptionInfoV1Response](docs/GetSubscriptionInfoV1Response.md) + - [SubscriptionInfo](docs/SubscriptionInfo.md) + - [WatchBlocksV1](docs/WatchBlocksV1.md) + - [WatchBlocksV1Progress](docs/WatchBlocksV1Progress.md) + - [WatchBlocksV1Request](docs/WatchBlocksV1Request.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api/openapi.yaml b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api/openapi.yaml new file mode 100644 index 00000000000..61761b89792 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api/openapi.yaml @@ -0,0 +1,151 @@ +openapi: 3.0.3 +info: + description: Can perform basic tasks on a Chainlink ledger + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Hyperledger Cacti Plugin - Connector Chainlink + version: 2.0.0-rc.4 +servers: +- description: Local development environment. + url: http://127.0.0.1:4000 +paths: + /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info: + post: + operationId: getSubscriptionInfoV1 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GetSubscriptionInfoV1Request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GetSubscriptionInfoV1Response' + description: Success + "401": + description: Unauthorized + security: [] + summary: You can request details for a given subscription (on the network on + which it has been created) using this service. This is a read-only interaction + with the ledger. + x-hyperledger-cacti: + http: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info + /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec: + get: + operationId: getOpenApiSpecV1 + parameters: [] + responses: + "200": + content: + application/json: + schema: + type: string + description: OK + "401": + description: Unauthorized request received. + security: [] + summary: Retrieves the .json file that contains the OpenAPI specification for + the plugin. + x-hyperledger-cacti: + http: + verbLowerCase: get + path: /api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec +components: + schemas: + WatchBlocksV1: + enum: + - org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe + - org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next + - org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe + - org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error + - org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete + type: string + x-enum-varnames: + - Subscribe + - Next + - Unsubscribe + - Error + - Complete + WatchBlocksV1Request: + properties: + event: + $ref: '#/components/schemas/WatchBlocksV1' + required: + - event + type: object + WatchBlocksV1Progress: + properties: + data: + additionalProperties: true + type: object + required: + - data + type: object + GetSubscriptionInfoV1Request: + additionalProperties: false + example: + subscriptionId: subscriptionId + properties: + subscriptionId: + format: bigint + type: string + required: + - subscriptionId + type: object + SubscriptionInfo: + example: + owner: owner + balance: balance + flags: flags + proposedOwner: proposedOwner + consumers: + - consumers + - consumers + blockedBalance: blockedBalance + properties: + balance: + format: bigint + type: string + owner: + type: string + blockedBalance: + format: bigint + type: string + proposedOwner: + type: string + consumers: + items: + type: string + type: array + flags: + type: string + required: + - balance + - blockedBalance + - consumers + - flags + - owner + - proposedOwner + type: object + GetSubscriptionInfoV1Response: + additionalProperties: false + example: + subscriptionInfo: + owner: owner + balance: balance + flags: flags + proposedOwner: proposedOwner + consumers: + - consumers + - consumers + blockedBalance: blockedBalance + properties: + subscriptionInfo: + $ref: '#/components/schemas/SubscriptionInfo' + type: object diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api_default.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api_default.go new file mode 100644 index 00000000000..8c61acb1ae6 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/api_default.go @@ -0,0 +1,228 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiGetOpenApiSpecV1Request struct { + ctx context.Context + ApiService *DefaultApiService +} + +func (r ApiGetOpenApiSpecV1Request) Execute() (string, *http.Response, error) { + return r.ApiService.GetOpenApiSpecV1Execute(r) +} + +/* +GetOpenApiSpecV1 Retrieves the .json file that contains the OpenAPI specification for the plugin. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetOpenApiSpecV1Request +*/ +func (a *DefaultApiService) GetOpenApiSpecV1(ctx context.Context) ApiGetOpenApiSpecV1Request { + return ApiGetOpenApiSpecV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return string +func (a *DefaultApiService) GetOpenApiSpecV1Execute(r ApiGetOpenApiSpecV1Request) (string, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue string + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOpenApiSpecV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetSubscriptionInfoV1Request struct { + ctx context.Context + ApiService *DefaultApiService + getSubscriptionInfoV1Request *GetSubscriptionInfoV1Request +} + +func (r ApiGetSubscriptionInfoV1Request) GetSubscriptionInfoV1Request(getSubscriptionInfoV1Request GetSubscriptionInfoV1Request) ApiGetSubscriptionInfoV1Request { + r.getSubscriptionInfoV1Request = &getSubscriptionInfoV1Request + return r +} + +func (r ApiGetSubscriptionInfoV1Request) Execute() (*GetSubscriptionInfoV1Response, *http.Response, error) { + return r.ApiService.GetSubscriptionInfoV1Execute(r) +} + +/* +GetSubscriptionInfoV1 You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetSubscriptionInfoV1Request +*/ +func (a *DefaultApiService) GetSubscriptionInfoV1(ctx context.Context) ApiGetSubscriptionInfoV1Request { + return ApiGetSubscriptionInfoV1Request{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return GetSubscriptionInfoV1Response +func (a *DefaultApiService) GetSubscriptionInfoV1Execute(r ApiGetSubscriptionInfoV1Request) (*GetSubscriptionInfoV1Response, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetSubscriptionInfoV1Response + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSubscriptionInfoV1") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.getSubscriptionInfoV1Request == nil { + return localVarReturnValue, nil, reportError("getSubscriptionInfoV1Request is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.getSubscriptionInfoV1Request + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/client.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/client.go new file mode 100644 index 00000000000..3bb26426397 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/client.go @@ -0,0 +1,656 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Hyperledger Cacti Plugin - Connector Chainlink API v2.0.0-rc.4 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultApi = (*DefaultApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/configuration.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/configuration.go new file mode 100644 index 00000000000..b31b3919a35 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/configuration.go @@ -0,0 +1,215 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "http://127.0.0.1:4000", + Description: "Local development environment.", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.mod b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.mod new file mode 100644 index 00000000000..700c097b45f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.mod @@ -0,0 +1,6 @@ +module github.com/hyperledger/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client + +go 1.18 + +require ( +) diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.sum b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.sum new file mode 100644 index 00000000000..c966c8ddfd0 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request.go new file mode 100644 index 00000000000..c7b31023e3f --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" +) + +// checks if the GetSubscriptionInfoV1Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetSubscriptionInfoV1Request{} + +// GetSubscriptionInfoV1Request struct for GetSubscriptionInfoV1Request +type GetSubscriptionInfoV1Request struct { + SubscriptionId string `json:"subscriptionId"` +} + +// NewGetSubscriptionInfoV1Request instantiates a new GetSubscriptionInfoV1Request object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetSubscriptionInfoV1Request(subscriptionId string) *GetSubscriptionInfoV1Request { + this := GetSubscriptionInfoV1Request{} + this.SubscriptionId = subscriptionId + return &this +} + +// NewGetSubscriptionInfoV1RequestWithDefaults instantiates a new GetSubscriptionInfoV1Request object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetSubscriptionInfoV1RequestWithDefaults() *GetSubscriptionInfoV1Request { + this := GetSubscriptionInfoV1Request{} + return &this +} + +// GetSubscriptionId returns the SubscriptionId field value +func (o *GetSubscriptionInfoV1Request) GetSubscriptionId() string { + if o == nil { + var ret string + return ret + } + + return o.SubscriptionId +} + +// GetSubscriptionIdOk returns a tuple with the SubscriptionId field value +// and a boolean to check if the value has been set. +func (o *GetSubscriptionInfoV1Request) GetSubscriptionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SubscriptionId, true +} + +// SetSubscriptionId sets field value +func (o *GetSubscriptionInfoV1Request) SetSubscriptionId(v string) { + o.SubscriptionId = v +} + +func (o GetSubscriptionInfoV1Request) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetSubscriptionInfoV1Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["subscriptionId"] = o.SubscriptionId + return toSerialize, nil +} + +type NullableGetSubscriptionInfoV1Request struct { + value *GetSubscriptionInfoV1Request + isSet bool +} + +func (v NullableGetSubscriptionInfoV1Request) Get() *GetSubscriptionInfoV1Request { + return v.value +} + +func (v *NullableGetSubscriptionInfoV1Request) Set(val *GetSubscriptionInfoV1Request) { + v.value = val + v.isSet = true +} + +func (v NullableGetSubscriptionInfoV1Request) IsSet() bool { + return v.isSet +} + +func (v *NullableGetSubscriptionInfoV1Request) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetSubscriptionInfoV1Request(val *GetSubscriptionInfoV1Request) *NullableGetSubscriptionInfoV1Request { + return &NullableGetSubscriptionInfoV1Request{value: val, isSet: true} +} + +func (v NullableGetSubscriptionInfoV1Request) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetSubscriptionInfoV1Request) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request_subscription_id.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request_subscription_id.go new file mode 100644 index 00000000000..934bf084a24 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_request_subscription_id.go @@ -0,0 +1,148 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" + "fmt" +) + +// GetSubscriptionInfoV1RequestSubscriptionId - struct for GetSubscriptionInfoV1RequestSubscriptionId +type GetSubscriptionInfoV1RequestSubscriptionId struct { + Float32 *float32 + String *string +} + +// float32AsGetSubscriptionInfoV1RequestSubscriptionId is a convenience function that returns float32 wrapped in GetSubscriptionInfoV1RequestSubscriptionId +func Float32AsGetSubscriptionInfoV1RequestSubscriptionId(v *float32) GetSubscriptionInfoV1RequestSubscriptionId { + return GetSubscriptionInfoV1RequestSubscriptionId{ + Float32: v, + } +} + +// stringAsGetSubscriptionInfoV1RequestSubscriptionId is a convenience function that returns string wrapped in GetSubscriptionInfoV1RequestSubscriptionId +func StringAsGetSubscriptionInfoV1RequestSubscriptionId(v *string) GetSubscriptionInfoV1RequestSubscriptionId { + return GetSubscriptionInfoV1RequestSubscriptionId{ + String: v, + } +} + + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *GetSubscriptionInfoV1RequestSubscriptionId) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into Float32 + err = newStrictDecoder(data).Decode(&dst.Float32) + if err == nil { + jsonFloat32, _ := json.Marshal(dst.Float32) + if string(jsonFloat32) == "{}" { // empty struct + dst.Float32 = nil + } else { + match++ + } + } else { + dst.Float32 = nil + } + + // try to unmarshal data into String + err = newStrictDecoder(data).Decode(&dst.String) + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + match++ + } + } else { + dst.String = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Float32 = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(GetSubscriptionInfoV1RequestSubscriptionId)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(GetSubscriptionInfoV1RequestSubscriptionId)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src GetSubscriptionInfoV1RequestSubscriptionId) MarshalJSON() ([]byte, error) { + if src.Float32 != nil { + return json.Marshal(&src.Float32) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in oneOf schemas +} + +// Get the actual instance +func (obj *GetSubscriptionInfoV1RequestSubscriptionId) GetActualInstance() (interface{}) { + if obj == nil { + return nil + } + if obj.Float32 != nil { + return obj.Float32 + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableGetSubscriptionInfoV1RequestSubscriptionId struct { + value *GetSubscriptionInfoV1RequestSubscriptionId + isSet bool +} + +func (v NullableGetSubscriptionInfoV1RequestSubscriptionId) Get() *GetSubscriptionInfoV1RequestSubscriptionId { + return v.value +} + +func (v *NullableGetSubscriptionInfoV1RequestSubscriptionId) Set(val *GetSubscriptionInfoV1RequestSubscriptionId) { + v.value = val + v.isSet = true +} + +func (v NullableGetSubscriptionInfoV1RequestSubscriptionId) IsSet() bool { + return v.isSet +} + +func (v *NullableGetSubscriptionInfoV1RequestSubscriptionId) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetSubscriptionInfoV1RequestSubscriptionId(val *GetSubscriptionInfoV1RequestSubscriptionId) *NullableGetSubscriptionInfoV1RequestSubscriptionId { + return &NullableGetSubscriptionInfoV1RequestSubscriptionId{value: val, isSet: true} +} + +func (v NullableGetSubscriptionInfoV1RequestSubscriptionId) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetSubscriptionInfoV1RequestSubscriptionId) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_response.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_response.go new file mode 100644 index 00000000000..719122122e2 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_get_subscription_info_v1_response.go @@ -0,0 +1,126 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" +) + +// checks if the GetSubscriptionInfoV1Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetSubscriptionInfoV1Response{} + +// GetSubscriptionInfoV1Response struct for GetSubscriptionInfoV1Response +type GetSubscriptionInfoV1Response struct { + SubscriptionInfo *SubscriptionInfo `json:"subscriptionInfo,omitempty"` +} + +// NewGetSubscriptionInfoV1Response instantiates a new GetSubscriptionInfoV1Response object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetSubscriptionInfoV1Response() *GetSubscriptionInfoV1Response { + this := GetSubscriptionInfoV1Response{} + return &this +} + +// NewGetSubscriptionInfoV1ResponseWithDefaults instantiates a new GetSubscriptionInfoV1Response object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetSubscriptionInfoV1ResponseWithDefaults() *GetSubscriptionInfoV1Response { + this := GetSubscriptionInfoV1Response{} + return &this +} + +// GetSubscriptionInfo returns the SubscriptionInfo field value if set, zero value otherwise. +func (o *GetSubscriptionInfoV1Response) GetSubscriptionInfo() SubscriptionInfo { + if o == nil || IsNil(o.SubscriptionInfo) { + var ret SubscriptionInfo + return ret + } + return *o.SubscriptionInfo +} + +// GetSubscriptionInfoOk returns a tuple with the SubscriptionInfo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetSubscriptionInfoV1Response) GetSubscriptionInfoOk() (*SubscriptionInfo, bool) { + if o == nil || IsNil(o.SubscriptionInfo) { + return nil, false + } + return o.SubscriptionInfo, true +} + +// HasSubscriptionInfo returns a boolean if a field has been set. +func (o *GetSubscriptionInfoV1Response) HasSubscriptionInfo() bool { + if o != nil && !IsNil(o.SubscriptionInfo) { + return true + } + + return false +} + +// SetSubscriptionInfo gets a reference to the given SubscriptionInfo and assigns it to the SubscriptionInfo field. +func (o *GetSubscriptionInfoV1Response) SetSubscriptionInfo(v SubscriptionInfo) { + o.SubscriptionInfo = &v +} + +func (o GetSubscriptionInfoV1Response) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetSubscriptionInfoV1Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.SubscriptionInfo) { + toSerialize["subscriptionInfo"] = o.SubscriptionInfo + } + return toSerialize, nil +} + +type NullableGetSubscriptionInfoV1Response struct { + value *GetSubscriptionInfoV1Response + isSet bool +} + +func (v NullableGetSubscriptionInfoV1Response) Get() *GetSubscriptionInfoV1Response { + return v.value +} + +func (v *NullableGetSubscriptionInfoV1Response) Set(val *GetSubscriptionInfoV1Response) { + v.value = val + v.isSet = true +} + +func (v NullableGetSubscriptionInfoV1Response) IsSet() bool { + return v.isSet +} + +func (v *NullableGetSubscriptionInfoV1Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetSubscriptionInfoV1Response(val *GetSubscriptionInfoV1Response) *NullableGetSubscriptionInfoV1Response { + return &NullableGetSubscriptionInfoV1Response{value: val, isSet: true} +} + +func (v NullableGetSubscriptionInfoV1Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetSubscriptionInfoV1Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_subscription_info.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_subscription_info.go new file mode 100644 index 00000000000..887599c9318 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_subscription_info.go @@ -0,0 +1,252 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" +) + +// checks if the SubscriptionInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SubscriptionInfo{} + +// SubscriptionInfo struct for SubscriptionInfo +type SubscriptionInfo struct { + Balance string `json:"balance"` + Owner string `json:"owner"` + BlockedBalance string `json:"blockedBalance"` + ProposedOwner string `json:"proposedOwner"` + Consumers []string `json:"consumers"` + Flags string `json:"flags"` +} + +// NewSubscriptionInfo instantiates a new SubscriptionInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSubscriptionInfo(balance string, owner string, blockedBalance string, proposedOwner string, consumers []string, flags string) *SubscriptionInfo { + this := SubscriptionInfo{} + this.Balance = balance + this.Owner = owner + this.BlockedBalance = blockedBalance + this.ProposedOwner = proposedOwner + this.Consumers = consumers + this.Flags = flags + return &this +} + +// NewSubscriptionInfoWithDefaults instantiates a new SubscriptionInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSubscriptionInfoWithDefaults() *SubscriptionInfo { + this := SubscriptionInfo{} + return &this +} + +// GetBalance returns the Balance field value +func (o *SubscriptionInfo) GetBalance() string { + if o == nil { + var ret string + return ret + } + + return o.Balance +} + +// GetBalanceOk returns a tuple with the Balance field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetBalanceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Balance, true +} + +// SetBalance sets field value +func (o *SubscriptionInfo) SetBalance(v string) { + o.Balance = v +} + +// GetOwner returns the Owner field value +func (o *SubscriptionInfo) GetOwner() string { + if o == nil { + var ret string + return ret + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Owner, true +} + +// SetOwner sets field value +func (o *SubscriptionInfo) SetOwner(v string) { + o.Owner = v +} + +// GetBlockedBalance returns the BlockedBalance field value +func (o *SubscriptionInfo) GetBlockedBalance() string { + if o == nil { + var ret string + return ret + } + + return o.BlockedBalance +} + +// GetBlockedBalanceOk returns a tuple with the BlockedBalance field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetBlockedBalanceOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BlockedBalance, true +} + +// SetBlockedBalance sets field value +func (o *SubscriptionInfo) SetBlockedBalance(v string) { + o.BlockedBalance = v +} + +// GetProposedOwner returns the ProposedOwner field value +func (o *SubscriptionInfo) GetProposedOwner() string { + if o == nil { + var ret string + return ret + } + + return o.ProposedOwner +} + +// GetProposedOwnerOk returns a tuple with the ProposedOwner field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetProposedOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProposedOwner, true +} + +// SetProposedOwner sets field value +func (o *SubscriptionInfo) SetProposedOwner(v string) { + o.ProposedOwner = v +} + +// GetConsumers returns the Consumers field value +func (o *SubscriptionInfo) GetConsumers() []string { + if o == nil { + var ret []string + return ret + } + + return o.Consumers +} + +// GetConsumersOk returns a tuple with the Consumers field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetConsumersOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Consumers, true +} + +// SetConsumers sets field value +func (o *SubscriptionInfo) SetConsumers(v []string) { + o.Consumers = v +} + +// GetFlags returns the Flags field value +func (o *SubscriptionInfo) GetFlags() string { + if o == nil { + var ret string + return ret + } + + return o.Flags +} + +// GetFlagsOk returns a tuple with the Flags field value +// and a boolean to check if the value has been set. +func (o *SubscriptionInfo) GetFlagsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Flags, true +} + +// SetFlags sets field value +func (o *SubscriptionInfo) SetFlags(v string) { + o.Flags = v +} + +func (o SubscriptionInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SubscriptionInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["balance"] = o.Balance + toSerialize["owner"] = o.Owner + toSerialize["blockedBalance"] = o.BlockedBalance + toSerialize["proposedOwner"] = o.ProposedOwner + toSerialize["consumers"] = o.Consumers + toSerialize["flags"] = o.Flags + return toSerialize, nil +} + +type NullableSubscriptionInfo struct { + value *SubscriptionInfo + isSet bool +} + +func (v NullableSubscriptionInfo) Get() *SubscriptionInfo { + return v.value +} + +func (v *NullableSubscriptionInfo) Set(val *SubscriptionInfo) { + v.value = val + v.isSet = true +} + +func (v NullableSubscriptionInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableSubscriptionInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSubscriptionInfo(val *SubscriptionInfo) *NullableSubscriptionInfo { + return &NullableSubscriptionInfo{value: val, isSet: true} +} + +func (v NullableSubscriptionInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSubscriptionInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go new file mode 100644 index 00000000000..da14970b688 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" + "fmt" +) + +// WatchBlocksV1 the model 'WatchBlocksV1' +type WatchBlocksV1 string + +// List of WatchBlocksV1 +const ( + Subscribe WatchBlocksV1 = "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe" + Next WatchBlocksV1 = "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next" + Unsubscribe WatchBlocksV1 = "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe" + Error WatchBlocksV1 = "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error" + Complete WatchBlocksV1 = "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete" +) + +// All allowed values of WatchBlocksV1 enum +var AllowedWatchBlocksV1EnumValues = []WatchBlocksV1{ + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete", +} + +func (v *WatchBlocksV1) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := WatchBlocksV1(value) + for _, existing := range AllowedWatchBlocksV1EnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid WatchBlocksV1", value) +} + +// NewWatchBlocksV1FromValue returns a pointer to a valid WatchBlocksV1 +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewWatchBlocksV1FromValue(v string) (*WatchBlocksV1, error) { + ev := WatchBlocksV1(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for WatchBlocksV1: valid values are %v", v, AllowedWatchBlocksV1EnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v WatchBlocksV1) IsValid() bool { + for _, existing := range AllowedWatchBlocksV1EnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to WatchBlocksV1 value +func (v WatchBlocksV1) Ptr() *WatchBlocksV1 { + return &v +} + +type NullableWatchBlocksV1 struct { + value *WatchBlocksV1 + isSet bool +} + +func (v NullableWatchBlocksV1) Get() *WatchBlocksV1 { + return v.value +} + +func (v *NullableWatchBlocksV1) Set(val *WatchBlocksV1) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1(val *WatchBlocksV1) *NullableWatchBlocksV1 { + return &NullableWatchBlocksV1{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go new file mode 100644 index 00000000000..c1a50dadbc1 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_progress.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" +) + +// checks if the WatchBlocksV1Progress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WatchBlocksV1Progress{} + +// WatchBlocksV1Progress struct for WatchBlocksV1Progress +type WatchBlocksV1Progress struct { + Data map[string]interface{} `json:"data"` +} + +// NewWatchBlocksV1Progress instantiates a new WatchBlocksV1Progress object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWatchBlocksV1Progress(data map[string]interface{}) *WatchBlocksV1Progress { + this := WatchBlocksV1Progress{} + this.Data = data + return &this +} + +// NewWatchBlocksV1ProgressWithDefaults instantiates a new WatchBlocksV1Progress object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWatchBlocksV1ProgressWithDefaults() *WatchBlocksV1Progress { + this := WatchBlocksV1Progress{} + return &this +} + +// GetData returns the Data field value +func (o *WatchBlocksV1Progress) GetData() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *WatchBlocksV1Progress) GetDataOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Data, true +} + +// SetData sets field value +func (o *WatchBlocksV1Progress) SetData(v map[string]interface{}) { + o.Data = v +} + +func (o WatchBlocksV1Progress) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WatchBlocksV1Progress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + return toSerialize, nil +} + +type NullableWatchBlocksV1Progress struct { + value *WatchBlocksV1Progress + isSet bool +} + +func (v NullableWatchBlocksV1Progress) Get() *WatchBlocksV1Progress { + return v.value +} + +func (v *NullableWatchBlocksV1Progress) Set(val *WatchBlocksV1Progress) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1Progress) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1Progress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1Progress(val *WatchBlocksV1Progress) *NullableWatchBlocksV1Progress { + return &NullableWatchBlocksV1Progress{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1Progress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1Progress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go new file mode 100644 index 00000000000..530f9d7383d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/model_watch_blocks_v1_request.go @@ -0,0 +1,117 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" +) + +// checks if the WatchBlocksV1Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WatchBlocksV1Request{} + +// WatchBlocksV1Request struct for WatchBlocksV1Request +type WatchBlocksV1Request struct { + Event WatchBlocksV1 `json:"event"` +} + +// NewWatchBlocksV1Request instantiates a new WatchBlocksV1Request object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWatchBlocksV1Request(event WatchBlocksV1) *WatchBlocksV1Request { + this := WatchBlocksV1Request{} + this.Event = event + return &this +} + +// NewWatchBlocksV1RequestWithDefaults instantiates a new WatchBlocksV1Request object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWatchBlocksV1RequestWithDefaults() *WatchBlocksV1Request { + this := WatchBlocksV1Request{} + return &this +} + +// GetEvent returns the Event field value +func (o *WatchBlocksV1Request) GetEvent() WatchBlocksV1 { + if o == nil { + var ret WatchBlocksV1 + return ret + } + + return o.Event +} + +// GetEventOk returns a tuple with the Event field value +// and a boolean to check if the value has been set. +func (o *WatchBlocksV1Request) GetEventOk() (*WatchBlocksV1, bool) { + if o == nil { + return nil, false + } + return &o.Event, true +} + +// SetEvent sets field value +func (o *WatchBlocksV1Request) SetEvent(v WatchBlocksV1) { + o.Event = v +} + +func (o WatchBlocksV1Request) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WatchBlocksV1Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["event"] = o.Event + return toSerialize, nil +} + +type NullableWatchBlocksV1Request struct { + value *WatchBlocksV1Request + isSet bool +} + +func (v NullableWatchBlocksV1Request) Get() *WatchBlocksV1Request { + return v.value +} + +func (v *NullableWatchBlocksV1Request) Set(val *WatchBlocksV1Request) { + v.value = val + v.isSet = true +} + +func (v NullableWatchBlocksV1Request) IsSet() bool { + return v.isSet +} + +func (v *NullableWatchBlocksV1Request) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWatchBlocksV1Request(val *WatchBlocksV1Request) *NullableWatchBlocksV1Request { + return &NullableWatchBlocksV1Request{value: val, isSet: true} +} + +func (v NullableWatchBlocksV1Request) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWatchBlocksV1Request) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/response.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/response.go new file mode 100644 index 00000000000..88f25a31708 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/response.go @@ -0,0 +1,47 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/test/api_default_test.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/test/api_default_test.go new file mode 100644 index 00000000000..5af0895fa9b --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/test/api_default_test.go @@ -0,0 +1,37 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package cacti-plugin-ledger-connector-chainlink + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/hyperledger/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client" +) + +func Test_cacti-plugin-ledger-connector-chainlink_DefaultApiService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DefaultApiService GetOpenApiSpecV1", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.DefaultApi.GetOpenApiSpecV1(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/utils.go b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/utils.go new file mode 100644 index 00000000000..93c5e8f4707 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/go/generated/openapi/go-client/utils.go @@ -0,0 +1,347 @@ +/* +Hyperledger Cacti Plugin - Connector Chainlink + +Can perform basic tasks on a Chainlink ledger + +API version: 2.0.0-rc.4 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cacti-plugin-ledger-connector-chainlink + +import ( + "encoding/json" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.json b/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.json new file mode 100644 index 00000000000..b27b9afbc33 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.json @@ -0,0 +1,184 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Chainlink", + "description": "Can perform basic tasks on a Chainlink ledger", + "version": "2.0.0-rc.4", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "description": "Local development environment.", + "url": "http://127.0.0.1:4000", + "variables": {} + } + ], + "components": { + "schemas": { + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Request": { + "type": "object", + "required": ["event"], + "properties": { + "event": { + "$ref": "#/components/schemas/WatchBlocksV1" + } + } + }, + "WatchBlocksV1Progress": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "type": "object", + "additionalProperties": true + } + } + }, + "GetSubscriptionInfoV1Request": { + "type": "object", + "additionalProperties": false, + "required": ["subscriptionId"], + "properties": { + "subscriptionId": { + "type": "string", + "format": "bigint" + } + } + }, + "SubscriptionInfo": { + "type": "object", + "required": [ + "balance", + "owner", + "blockedBalance", + "proposedOwner", + "consumers", + "flags" + ], + "properties": { + "balance": { + "type": "string", + "format": "bigint" + }, + "owner": { + "type": "string" + }, + "blockedBalance": { + "type": "string", + "format": "bigint" + }, + "proposedOwner": { + "type": "string" + }, + "consumers": { + "type": "array", + "items": { + "type": "string" + } + }, + "flags": { + "type": "string" + } + } + }, + "GetSubscriptionInfoV1Response": { + "type": "object", + "additionalProperties": false, + "properties": { + "subscriptionInfo": { + "$ref": "#/components/schemas/SubscriptionInfo" + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info": { + "post": { + "operationId": "getSubscriptionInfoV1", + "summary": "You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger.", + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info" + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSubscriptionInfoV1Response" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSubscriptionInfoV1Request" + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec": { + "get": { + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + }, + "401": { + "description": "Unauthorized request received." + } + } + } + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.tpl.json b/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.tpl.json new file mode 100644 index 00000000000..5bb01142b61 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/json/openapi.tpl.json @@ -0,0 +1,183 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "Hyperledger Cacti Plugin - Connector Chainlink", + "description": "Can perform basic tasks on a Chainlink ledger", + "version": "2.0.0-rc.4", + "license": { + "name": "Apache-2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "servers": [ + { + "description": "Local development environment.", + "url": "http://127.0.0.1:4000", + "variables": {} + } + ], + "components": { + "schemas": { + "WatchBlocksV1": { + "type": "string", + "enum": [ + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error", + "org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete" + ], + "x-enum-varnames": [ + "Subscribe", + "Next", + "Unsubscribe", + "Error", + "Complete" + ] + }, + "WatchBlocksV1Request": { + "type": "object", + "required": ["event"], + "properties": { + "event": { + "$ref": "#/components/schemas/WatchBlocksV1" + } + } + }, + + "WatchBlocksV1Progress": { + "type": "object", + "required": ["data"], + "properties": { + "data": { + "type": "object", + "additionalProperties": true + } + } + }, + "GetSubscriptionInfoV1Request": { + "type": "object", + "additionalProperties": false, + "required": ["subscriptionId"], + "properties": { + "subscriptionId": { + "type": "string", + "format": "bigint" + } + } + }, + "SubscriptionInfo": { + "type": "object", + "required": [ + "balance", + "owner", + "blockedBalance", + "proposedOwner", + "consumers", + "flags" + ], + "properties": { + "balance": { + "type": "string", + "format": "bigint" + }, + "owner": { + "type": "string" + }, + "blockedBalance": { + "type": "string", + "format": "bigint" + }, + "proposedOwner": { + "type": "string" + }, + "consumers": { + "type": "array", + "items": { "type": "string" } + }, + "flags": { + "type": "string" + } + } + }, + "GetSubscriptionInfoV1Response": { + "type": "object", + "additionalProperties": false, + "properties": { + "subscriptionInfo": { + "$ref": "#/components/schemas/SubscriptionInfo" + } + } + } + } + }, + "paths": { + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info": { + "post": { + "operationId": "getSubscriptionInfoV1", + "summary": "You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger.", + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info" + } + }, + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSubscriptionInfoV1Response" + } + } + } + }, + "401": { + "description": "Unauthorized" + } + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetSubscriptionInfoV1Request" + } + } + } + } + } + }, + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec": { + "get": { + "security": [], + "x-hyperledger-cacti": { + "http": { + "verbLowerCase": "get", + "path": "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec" + } + }, + "operationId": "getOpenApiSpecV1", + "summary": "Retrieves the .json file that contains the OpenAPI specification for the plugin.", + "parameters": [], + "responses": { + "401": { + "description": "Unauthorized request received." + }, + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache new file mode 100644 index 00000000000..b728d9e71ff --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/api.mustache @@ -0,0 +1,46 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{#lambda.lowercase}}{{{packageName}}}.{{{apiPackage}}}.{{{classname}}};{{/lambda.lowercase}} + +import "google/protobuf/empty.proto"; +{{#imports}} +{{#import}} +import "{{{modelPackage}}}/{{{.}}}.proto"; +{{/import}} +{{/imports}} + +service {{classname}} { +{{#operations}} +{{#operation}} + {{#description}} + // {{{.}}} + {{/description}} + rpc {{operationId}} ({{#hasParams}}{{operationId}}Request{{/hasParams}}{{^hasParams}}google.protobuf.Empty{{/hasParams}}) returns ({{#vendorExtensions.x-grpc-response}}{{.}}{{/vendorExtensions.x-grpc-response}}{{^vendorExtensions.x-grpc-response}}{{operationId}}Response{{/vendorExtensions.x-grpc-response}}); + +{{/operation}} +{{/operations}} +} + +{{#operations}} +{{#operation}} +{{#hasParams}} +message {{operationId}}Request { + {{#allParams}} + {{#description}} + // {{{.}}} + {{/description}} + {{#vendorExtensions.x-protobuf-type}}{{.}} {{/vendorExtensions.x-protobuf-type}}{{vendorExtensions.x-protobuf-data-type}} {{paramName}} = {{vendorExtensions.x-protobuf-index}}; + {{/allParams}} + +} + +{{/hasParams}} +{{^vendorExtensions.x-grpc-response}} +message {{operationId}}Response { + {{{vendorExtensions.x-grpc-response-type}}} data = 1; +} + +{{/vendorExtensions.x-grpc-response}} +{{/operation}} +{{/operations}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache new file mode 100644 index 00000000000..a350fd9e144 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/model.mustache @@ -0,0 +1,41 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{#lambda.lowercase}}{{{packageName}}};{{/lambda.lowercase}} + +import "google/protobuf/any.proto"; + +{{#imports}} +{{#import}} +import "{{{modelPackage}}}/{{{import}}}.proto"; +{{/import}} +{{/imports}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}message {{classname}} { + + {{#vars}} + {{#description}} + // {{{.}}} + {{/description}} + {{^isEnum}} + {{#vendorExtensions.x-protobuf-type}}{{{.}}} {{/vendorExtensions.x-protobuf-type}}{{{vendorExtensions.x-protobuf-data-type}}} {{{name}}} = {{vendorExtensions.x-protobuf-index}}{{#vendorExtensions.x-protobuf-packed}} [packed=true]{{/vendorExtensions.x-protobuf-packed}}; + {{/isEnum}} + {{#isEnum}} + enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{protobuf-enum-index}}}; + {{/enumVars}} + {{/allowableValues}} + } + + {{enumName}} {{name}} = {{vendorExtensions.x-protobuf-index}}; + {{/isEnum}} + + {{/vars}} +} +{{/isEnum}} +{{/model}} +{{/models}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache new file mode 100644 index 00000000000..e2df456144c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/mustache/openapi-generator/templates/protobuf-schema/root.mustache @@ -0,0 +1,22 @@ +{{>partial_header}} +syntax = "proto3"; + +package {{{packageName}}}; + +{{#vendorExtensions.x-grpc-options}} +option {{{.}}}; +{{/vendorExtensions.x-grpc-options}} + +// Models +{{#models}} +{{#model}} +import "{{modelPackage}}/{{classFilename}}.proto"; +{{/model}} +{{/models}} + +// APIs +{{#apiInfo}} +{{#apis}} +import "{{apiPackage}}/{{classFilename}}.proto"; +{{/apis}} +{{/apiInfo}} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/FILES new file mode 100644 index 00000000000..46b018c269a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/FILES @@ -0,0 +1,8 @@ +README.md +models/get_subscription_info_v1_request_pb.proto +models/get_subscription_info_v1_response_pb.proto +models/subscription_info_pb.proto +models/watch_blocks_v1_pb.proto +models/watch_blocks_v1_progress_pb.proto +models/watch_blocks_v1_request_pb.proto +services/default_service.proto diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/README.md b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/README.md new file mode 100644 index 00000000000..c247ecda7ad --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/README.md @@ -0,0 +1,31 @@ +# gPRC for org.hyperledger.cacti.plugin.ledger.connector.chainlink + +Can perform basic tasks on a Chainlink ledger + +## Overview +These files were generated by the [OpenAPI Generator](https://openapi-generator.tech) project. + +- API version: 2.0.0-rc.4 +- Package version: +- Build package: org.openapitools.codegen.languages.ProtobufSchemaCodegen + +## Usage + +Below are some usage examples for Go and Ruby. For other languages, please refer to https://grpc.io/docs/quickstart/. + +### Go +``` +# assuming `protoc-gen-go` has been installed with `go get -u github.com/golang/protobuf/protoc-gen-go` +mkdir /var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.chainlink +protoc --go_out=/var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.chainlink services/* +protoc --go_out=/var/tmp/go/org.hyperledger.cacti.plugin.ledger.connector.chainlink models/* +``` + +### Ruby +``` +# assuming `grpc_tools_ruby_protoc` has been installed via `gem install grpc-tools` +RUBY_OUTPUT_DIR="/var/tmp/ruby/org.hyperledger.cacti.plugin.ledger.connector.chainlink" +mkdir $RUBY_OUTPUT_DIR +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib services/* +grpc_tools_ruby_protoc --ruby_out=$RUBY_OUTPUT_DIR --grpc_out=$RUBY_OUTPUT_DIR/lib models/* +``` diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_pb.proto new file mode 100644 index 00000000000..f2faac76bde --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_pb.proto @@ -0,0 +1,22 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + + +message GetSubscriptionInfoV1RequestPB { + + string subscriptionId = 405049114; + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_subscription_id_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_subscription_id_pb.proto new file mode 100644 index 00000000000..3a7d01a95c4 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_request_subscription_id_pb.proto @@ -0,0 +1,20 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + + +message GetSubscriptionInfoV1RequestSubscriptionIdPB { + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_response_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_response_pb.proto new file mode 100644 index 00000000000..c74961a810c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/get_subscription_info_v1_response_pb.proto @@ -0,0 +1,23 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + +import "models/subscription_info_pb.proto"; + +message GetSubscriptionInfoV1ResponsePB { + + SubscriptionInfoPB subscriptionInfo = 516072597; + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/subscription_info_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/subscription_info_pb.proto new file mode 100644 index 00000000000..84d52877629 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/subscription_info_pb.proto @@ -0,0 +1,32 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + + +message SubscriptionInfoPB { + + string balance = 339185956; + + string owner = 106164915; + + string blockedBalance = 491676499; + + string proposedOwner = 141048085; + + repeated string consumers = 421004483; + + string flags = 97513095; + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto new file mode 100644 index 00000000000..f9fd1ef8a87 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_pb.proto @@ -0,0 +1,24 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + + +enum WatchBlocksV1PB { + WatchBlocksV1PB_Subscribe = 0; + WatchBlocksV1PB_Next = 1; + WatchBlocksV1PB_Unsubscribe = 2; + WatchBlocksV1PB_Error = 3; + WatchBlocksV1PB_Complete = 4; +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto new file mode 100644 index 00000000000..e67e71d8f4b --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_progress_pb.proto @@ -0,0 +1,22 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + + +message WatchBlocksV1ProgressPB { + + map data = 3076010; + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto new file mode 100644 index 00000000000..7ac0302b419 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/models/watch_blocks_v1_request_pb.proto @@ -0,0 +1,23 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink; + +import "google/protobuf/any.proto"; + +import "models/watch_blocks_v1_pb.proto"; + +message WatchBlocksV1RequestPB { + + WatchBlocksV1PB event = 96891546; + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/services/default_service.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/services/default_service.proto new file mode 100644 index 00000000000..a60523b331a --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/generated/openapi/services/default_service.proto @@ -0,0 +1,34 @@ +/* + Hyperledger Cacti Plugin - Connector Chainlink + + Can perform basic tasks on a Chainlink ledger + + The version of the OpenAPI document: 2.0.0-rc.4 + + Generated by OpenAPI Generator: https://openapi-generator.tech +*/ + +syntax = "proto3"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice; + +import "google/protobuf/empty.proto"; +import "models/get_subscription_info_v1_request_pb.proto"; +import "models/get_subscription_info_v1_response_pb.proto"; + +service DefaultService { + rpc GetOpenApiSpecV1 (google.protobuf.Empty) returns (GetOpenApiSpecV1Response); + + rpc GetSubscriptionInfoV1 (GetSubscriptionInfoV1Request) returns (GetSubscriptionInfoV1ResponsePB); + +} + +message GetOpenApiSpecV1Response { + string data = 1; +} + +message GetSubscriptionInfoV1Request { + GetSubscriptionInfoV1RequestPB getSubscriptionInfoV1RequestPB = 1; + +} + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/services/chainlink-grpc-svc-streams.proto b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/services/chainlink-grpc-svc-streams.proto new file mode 100644 index 00000000000..e9fd30b9a11 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/proto/services/chainlink-grpc-svc-streams.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +import "google/protobuf/empty.proto"; +import "models/watch_blocks_v1_progress_pb.proto"; +import "models/watch_blocks_v1_request_pb.proto"; + +package org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice; + +service ChainlinkGrpcSvcStreams { + rpc GetOpenApiV1(google.protobuf.Empty) returns (google.protobuf.Empty) {} + rpc WatchBlocksV1(stream WatchBlocksV1RequestPB) returns (stream WatchBlocksV1ProgressPB) {}; +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/api-client/chainlink-api-client.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/api-client/chainlink-api-client.ts new file mode 100644 index 00000000000..82387e28b96 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/api-client/chainlink-api-client.ts @@ -0,0 +1,78 @@ +import { Observable, ReplaySubject } from "rxjs"; +import { finalize } from "rxjs/operators"; +import { Socket, io } from "socket.io-client-fixed-types"; +import { Logger, Checks } from "@hyperledger/cactus-common"; +import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; +import { Constants, ISocketApiClient } from "@hyperledger/cactus-core-api"; +import { + DefaultApi, + WatchBlocksV1, + WatchBlocksV1Progress, +} from "../generated/openapi/typescript-axios"; +import { Configuration } from "../generated/openapi/typescript-axios/configuration"; + +export class ChainlinkApiClientOptions extends Configuration { + readonly logLevel?: LogLevelDesc; + readonly wsApiHost?: string; + readonly wsApiPath?: string; +} + +export class ChainlinkApiClient + extends DefaultApi + implements ISocketApiClient +{ + public static readonly CLASS_NAME = "ChainlinkApiClient"; + + private readonly log: Logger; + private readonly wsApiHost: string; + private readonly wsApiPath: string; + + public get className(): string { + return ChainlinkApiClient.CLASS_NAME; + } + + constructor(public readonly options: ChainlinkApiClientOptions) { + super(options); + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + + const level = this.options.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + + this.wsApiHost = options.wsApiHost || options.basePath || location.host; + this.wsApiPath = options.wsApiPath || Constants.SocketIoConnectionPathV1; + this.log.debug(`Created ${this.className} OK.`); + this.log.debug(`wsApiHost=${this.wsApiHost}`); + this.log.debug(`wsApiPath=${this.wsApiPath}`); + this.log.debug(`basePath=${this.options.basePath}`); + } + + public watchBlocksV1(): Observable { + const socket: Socket = io(this.wsApiHost, { path: this.wsApiPath }); + const subject = new ReplaySubject(0); + + socket.on(WatchBlocksV1.Next, (data: WatchBlocksV1Progress) => { + subject.next(data); + }); + + socket.on("connect", () => { + console.log("connected OK..."); + socket.emit(WatchBlocksV1.Subscribe); + }); + + socket.connect(); + + return subject.pipe( + finalize(() => { + console.log("FINALIZE - unsubscribing from the stream..."); + socket.emit(WatchBlocksV1.Unsubscribe); + socket.disconnect(); + }), + // TODO: Investigate if we need these below - in theory without these + // it could happen that only the fist subscriber gets the last emitted value + // publishReplay(1), + // refCount(), + ); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES new file mode 100644 index 00000000000..53250c02696 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/FILES @@ -0,0 +1,5 @@ +api.ts +base.ts +common.ts +configuration.ts +index.ts diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION new file mode 100644 index 00000000000..cd802a1ec4e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/api.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/api.ts new file mode 100644 index 00000000000..fa8ce20cf96 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/api.ts @@ -0,0 +1,307 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Chainlink + * Can perform basic tasks on a Chainlink ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// Some imports not used depending on template conditions +// @ts-ignore +import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base'; + +/** + * + * @export + * @interface GetSubscriptionInfoV1Request + */ +export interface GetSubscriptionInfoV1Request { + /** + * + * @type {string} + * @memberof GetSubscriptionInfoV1Request + */ + 'subscriptionId': string; +} +/** + * + * @export + * @interface GetSubscriptionInfoV1Response + */ +export interface GetSubscriptionInfoV1Response { + /** + * + * @type {SubscriptionInfo} + * @memberof GetSubscriptionInfoV1Response + */ + 'subscriptionInfo'?: SubscriptionInfo; +} +/** + * + * @export + * @interface SubscriptionInfo + */ +export interface SubscriptionInfo { + /** + * + * @type {string} + * @memberof SubscriptionInfo + */ + 'balance': string; + /** + * + * @type {string} + * @memberof SubscriptionInfo + */ + 'owner': string; + /** + * + * @type {string} + * @memberof SubscriptionInfo + */ + 'blockedBalance': string; + /** + * + * @type {string} + * @memberof SubscriptionInfo + */ + 'proposedOwner': string; + /** + * + * @type {Array} + * @memberof SubscriptionInfo + */ + 'consumers': Array; + /** + * + * @type {string} + * @memberof SubscriptionInfo + */ + 'flags': string; +} +/** + * + * @export + * @enum {string} + */ + +export const WatchBlocksV1 = { + Subscribe: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Subscribe', + Next: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Next', + Unsubscribe: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Unsubscribe', + Error: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Error', + Complete: 'org.hyperledger.cactus.api.async.besu.WatchBlocksV1.Complete' +} as const; + +export type WatchBlocksV1 = typeof WatchBlocksV1[keyof typeof WatchBlocksV1]; + + +/** + * + * @export + * @interface WatchBlocksV1Progress + */ +export interface WatchBlocksV1Progress { + /** + * + * @type {{ [key: string]: any; }} + * @memberof WatchBlocksV1Progress + */ + 'data': { [key: string]: any; }; +} +/** + * + * @export + * @interface WatchBlocksV1Request + */ +export interface WatchBlocksV1Request { + /** + * + * @type {WatchBlocksV1} + * @memberof WatchBlocksV1Request + */ + 'event': WatchBlocksV1; +} + + + +/** + * DefaultApi - axios parameter creator + * @export + */ +export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOpenApiSpecV1: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + * @param {GetSubscriptionInfoV1Request} getSubscriptionInfoV1Request + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSubscriptionInfoV1: async (getSubscriptionInfoV1Request: GetSubscriptionInfoV1Request, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'getSubscriptionInfoV1Request' is not null or undefined + assertParamExists('getSubscriptionInfoV1', 'getSubscriptionInfoV1Request', getSubscriptionInfoV1Request) + const localVarPath = `/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(getSubscriptionInfoV1Request, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * DefaultApi - functional programming interface + * @export + */ +export const DefaultApiFp = function(configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration) + return { + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getOpenApiSpecV1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getOpenApiSpecV1(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @summary You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + * @param {GetSubscriptionInfoV1Request} getSubscriptionInfoV1Request + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSubscriptionInfoV1(getSubscriptionInfoV1Request: GetSubscriptionInfoV1Request, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSubscriptionInfoV1(getSubscriptionInfoV1Request, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + } +}; + +/** + * DefaultApi - factory interface + * @export + */ +export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { + const localVarFp = DefaultApiFp(configuration) + return { + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOpenApiSpecV1(options?: any): AxiosPromise { + return localVarFp.getOpenApiSpecV1(options).then((request) => request(axios, basePath)); + }, + /** + * + * @summary You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + * @param {GetSubscriptionInfoV1Request} getSubscriptionInfoV1Request + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSubscriptionInfoV1(getSubscriptionInfoV1Request: GetSubscriptionInfoV1Request, options?: any): AxiosPromise { + return localVarFp.getSubscriptionInfoV1(getSubscriptionInfoV1Request, options).then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DefaultApi - object-oriented interface + * @export + * @class DefaultApi + * @extends {BaseAPI} + */ +export class DefaultApi extends BaseAPI { + /** + * + * @summary Retrieves the .json file that contains the OpenAPI specification for the plugin. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getOpenApiSpecV1(options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getOpenApiSpecV1(options).then((request) => request(this.axios, this.basePath)); + } + + /** + * + * @summary You can request details for a given subscription (on the network on which it has been created) using this service. This is a read-only interaction with the ledger. + * @param {GetSubscriptionInfoV1Request} getSubscriptionInfoV1Request + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public getSubscriptionInfoV1(getSubscriptionInfoV1Request: GetSubscriptionInfoV1Request, options?: AxiosRequestConfig) { + return DefaultApiFp(this.configuration).getSubscriptionInfoV1(getSubscriptionInfoV1Request, options).then((request) => request(this.axios, this.basePath)); + } +} + + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/base.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/base.ts new file mode 100644 index 00000000000..5686e963084 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/base.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Chainlink + * Can perform basic tasks on a Chainlink ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = "http://127.0.0.1:4000".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: AxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = "RequiredError" + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/common.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/common.ts new file mode 100644 index 00000000000..de2ef9659e2 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/common.ts @@ -0,0 +1,150 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Chainlink + * Can perform basic tasks on a Chainlink ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import type { Configuration } from "./configuration"; +import type { RequestArgs } from "./base"; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from "./base"; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com' + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); + } +} + +/** + * + * @export + */ +export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +} + +/** + * + * @export + */ +export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { username: configuration.username, password: configuration.password }; + } +} + +/** + * + * @export + */ +export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const accessToken = typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +} + +/** + * + * @export + */ +export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +} + +function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); + } + else { + Object.keys(parameter).forEach(currentKey => + setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) + ); + } + } + else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } + else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +} + +/** + * + * @export + */ +export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { + const nonString = typeof value !== 'string'; + const needsSerialization = nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : (value || ""); +} + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash +} + +/** + * + * @export + */ +export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { + return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { + const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url}; + return axios.request(axiosRequestArgs); + }; +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/configuration.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/configuration.ts new file mode 100644 index 00000000000..502042d44b8 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/configuration.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Chainlink + * Can perform basic tasks on a Chainlink ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/index.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/index.ts new file mode 100644 index 00000000000..de21184c68c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/openapi/typescript-axios/index.ts @@ -0,0 +1,18 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Hyperledger Cacti Plugin - Connector Chainlink + * Can perform basic tasks on a Chainlink ledger + * + * The version of the OpenAPI document: 2.0.0-rc.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; + diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts new file mode 100644 index 00000000000..d3816d414f9 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/any.ts @@ -0,0 +1,98 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: google/protobuf/any.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from "google-protobuf"; +export namespace google.protobuf { + export class Any extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + type_url?: string; + value?: Uint8Array; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("type_url" in data && data.type_url != undefined) { + this.type_url = data.type_url; + } + if ("value" in data && data.value != undefined) { + this.value = data.value; + } + } + } + get type_url() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set type_url(value: string) { + pb_1.Message.setField(this, 1, value); + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0)) as Uint8Array; + } + set value(value: Uint8Array) { + pb_1.Message.setField(this, 2, value); + } + static fromObject(data: { + type_url?: string; + value?: Uint8Array; + }): Any { + const message = new Any({}); + if (data.type_url != null) { + message.type_url = data.type_url; + } + if (data.value != null) { + message.value = data.value; + } + return message; + } + toObject() { + const data: { + type_url?: string; + value?: Uint8Array; + } = {}; + if (this.type_url != null) { + data.type_url = this.type_url; + } + if (this.value != null) { + data.value = this.value; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.type_url.length) + writer.writeString(1, this.type_url); + if (this.value.length) + writer.writeBytes(2, this.value); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Any { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Any(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.type_url = reader.readString(); + break; + case 2: + message.value = reader.readBytes(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Any { + return Any.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts new file mode 100644 index 00000000000..7b5a551bf98 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/google/protobuf/empty.ts @@ -0,0 +1,48 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: google/protobuf/empty.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from "google-protobuf"; +export namespace google.protobuf { + export class Empty extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | {}) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { } + } + static fromObject(data: {}): Empty { + const message = new Empty({}); + return message; + } + toObject() { + const data: {} = {}; + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Empty { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Empty(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): Empty { + return Empty.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_pb.ts new file mode 100644 index 00000000000..94ec2e7c72d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_pb.ts @@ -0,0 +1,76 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/get_subscription_info_v1_request_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class GetSubscriptionInfoV1RequestPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + subscriptionId?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("subscriptionId" in data && data.subscriptionId != undefined) { + this.subscriptionId = data.subscriptionId; + } + } + } + get subscriptionId() { + return pb_1.Message.getFieldWithDefault(this, 405049114, "") as string; + } + set subscriptionId(value: string) { + pb_1.Message.setField(this, 405049114, value); + } + static fromObject(data: { + subscriptionId?: string; + }): GetSubscriptionInfoV1RequestPB { + const message = new GetSubscriptionInfoV1RequestPB({}); + if (data.subscriptionId != null) { + message.subscriptionId = data.subscriptionId; + } + return message; + } + toObject() { + const data: { + subscriptionId?: string; + } = {}; + if (this.subscriptionId != null) { + data.subscriptionId = this.subscriptionId; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.subscriptionId.length) + writer.writeString(405049114, this.subscriptionId); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetSubscriptionInfoV1RequestPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetSubscriptionInfoV1RequestPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 405049114: + message.subscriptionId = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetSubscriptionInfoV1RequestPB { + return GetSubscriptionInfoV1RequestPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_subscription_id_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_subscription_id_pb.ts new file mode 100644 index 00000000000..cf2ddd02041 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_subscription_id_pb.ts @@ -0,0 +1,49 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/get_subscription_info_v1_request_subscription_id_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class GetSubscriptionInfoV1RequestSubscriptionIdPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | {}) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { } + } + static fromObject(data: {}): GetSubscriptionInfoV1RequestSubscriptionIdPB { + const message = new GetSubscriptionInfoV1RequestSubscriptionIdPB({}); + return message; + } + toObject() { + const data: {} = {}; + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetSubscriptionInfoV1RequestSubscriptionIdPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetSubscriptionInfoV1RequestSubscriptionIdPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetSubscriptionInfoV1RequestSubscriptionIdPB { + return GetSubscriptionInfoV1RequestSubscriptionIdPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb.ts new file mode 100644 index 00000000000..f45214022f2 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb.ts @@ -0,0 +1,80 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/get_subscription_info_v1_response_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as dependency_2 from "./subscription_info_pb"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class GetSubscriptionInfoV1ResponsePB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + subscriptionInfo?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("subscriptionInfo" in data && data.subscriptionInfo != undefined) { + this.subscriptionInfo = data.subscriptionInfo; + } + } + } + get subscriptionInfo() { + return pb_1.Message.getWrapperField(this, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB, 516072597) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB; + } + set subscriptionInfo(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB) { + pb_1.Message.setWrapperField(this, 516072597, value); + } + get has_subscriptionInfo() { + return pb_1.Message.getField(this, 516072597) != null; + } + static fromObject(data: { + subscriptionInfo?: ReturnType; + }): GetSubscriptionInfoV1ResponsePB { + const message = new GetSubscriptionInfoV1ResponsePB({}); + if (data.subscriptionInfo != null) { + message.subscriptionInfo = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB.fromObject(data.subscriptionInfo); + } + return message; + } + toObject() { + const data: { + subscriptionInfo?: ReturnType; + } = {}; + if (this.subscriptionInfo != null) { + data.subscriptionInfo = this.subscriptionInfo.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_subscriptionInfo) + writer.writeMessage(516072597, this.subscriptionInfo, () => this.subscriptionInfo.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetSubscriptionInfoV1ResponsePB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetSubscriptionInfoV1ResponsePB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 516072597: + reader.readMessage(message.subscriptionInfo, () => message.subscriptionInfo = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetSubscriptionInfoV1ResponsePB { + return GetSubscriptionInfoV1ResponsePB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/subscription_info_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/subscription_info_pb.ts new file mode 100644 index 00000000000..b301b9b6ce2 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/subscription_info_pb.ts @@ -0,0 +1,191 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/subscription_info_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class SubscriptionInfoPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + balance?: string; + owner?: string; + blockedBalance?: string; + proposedOwner?: string; + consumers?: string[]; + flags?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [421004483], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("balance" in data && data.balance != undefined) { + this.balance = data.balance; + } + if ("owner" in data && data.owner != undefined) { + this.owner = data.owner; + } + if ("blockedBalance" in data && data.blockedBalance != undefined) { + this.blockedBalance = data.blockedBalance; + } + if ("proposedOwner" in data && data.proposedOwner != undefined) { + this.proposedOwner = data.proposedOwner; + } + if ("consumers" in data && data.consumers != undefined) { + this.consumers = data.consumers; + } + if ("flags" in data && data.flags != undefined) { + this.flags = data.flags; + } + } + } + get balance() { + return pb_1.Message.getFieldWithDefault(this, 339185956, "") as string; + } + set balance(value: string) { + pb_1.Message.setField(this, 339185956, value); + } + get owner() { + return pb_1.Message.getFieldWithDefault(this, 106164915, "") as string; + } + set owner(value: string) { + pb_1.Message.setField(this, 106164915, value); + } + get blockedBalance() { + return pb_1.Message.getFieldWithDefault(this, 491676499, "") as string; + } + set blockedBalance(value: string) { + pb_1.Message.setField(this, 491676499, value); + } + get proposedOwner() { + return pb_1.Message.getFieldWithDefault(this, 141048085, "") as string; + } + set proposedOwner(value: string) { + pb_1.Message.setField(this, 141048085, value); + } + get consumers() { + return pb_1.Message.getFieldWithDefault(this, 421004483, []) as string[]; + } + set consumers(value: string[]) { + pb_1.Message.setField(this, 421004483, value); + } + get flags() { + return pb_1.Message.getFieldWithDefault(this, 97513095, "") as string; + } + set flags(value: string) { + pb_1.Message.setField(this, 97513095, value); + } + static fromObject(data: { + balance?: string; + owner?: string; + blockedBalance?: string; + proposedOwner?: string; + consumers?: string[]; + flags?: string; + }): SubscriptionInfoPB { + const message = new SubscriptionInfoPB({}); + if (data.balance != null) { + message.balance = data.balance; + } + if (data.owner != null) { + message.owner = data.owner; + } + if (data.blockedBalance != null) { + message.blockedBalance = data.blockedBalance; + } + if (data.proposedOwner != null) { + message.proposedOwner = data.proposedOwner; + } + if (data.consumers != null) { + message.consumers = data.consumers; + } + if (data.flags != null) { + message.flags = data.flags; + } + return message; + } + toObject() { + const data: { + balance?: string; + owner?: string; + blockedBalance?: string; + proposedOwner?: string; + consumers?: string[]; + flags?: string; + } = {}; + if (this.balance != null) { + data.balance = this.balance; + } + if (this.owner != null) { + data.owner = this.owner; + } + if (this.blockedBalance != null) { + data.blockedBalance = this.blockedBalance; + } + if (this.proposedOwner != null) { + data.proposedOwner = this.proposedOwner; + } + if (this.consumers != null) { + data.consumers = this.consumers; + } + if (this.flags != null) { + data.flags = this.flags; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.balance.length) + writer.writeString(339185956, this.balance); + if (this.owner.length) + writer.writeString(106164915, this.owner); + if (this.blockedBalance.length) + writer.writeString(491676499, this.blockedBalance); + if (this.proposedOwner.length) + writer.writeString(141048085, this.proposedOwner); + if (this.consumers.length) + writer.writeRepeatedString(421004483, this.consumers); + if (this.flags.length) + writer.writeString(97513095, this.flags); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SubscriptionInfoPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new SubscriptionInfoPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 339185956: + message.balance = reader.readString(); + break; + case 106164915: + message.owner = reader.readString(); + break; + case 491676499: + message.blockedBalance = reader.readString(); + break; + case 141048085: + message.proposedOwner = reader.readString(); + break; + case 421004483: + pb_1.Message.addToRepeatedField(message, 421004483, reader.readString()); + break; + case 97513095: + message.flags = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): SubscriptionInfoPB { + return SubscriptionInfoPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts new file mode 100644 index 00000000000..ed4143a7243 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb.ts @@ -0,0 +1,16 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export enum WatchBlocksV1PB { + WatchBlocksV1PB_Subscribe = 0, + WatchBlocksV1PB_Next = 1, + WatchBlocksV1PB_Unsubscribe = 2, + WatchBlocksV1PB_Error = 3, + WatchBlocksV1PB_Complete = 4 + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts new file mode 100644 index 00000000000..3386251453e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb.ts @@ -0,0 +1,90 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_progress_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class WatchBlocksV1ProgressPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + data?: Map; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("data" in data && data.data != undefined) { + this.data = data.data; + } + } + if (!this.data) + this.data = new Map(); + } + get data() { + return pb_1.Message.getField(this, 3076010) as any as Map; + } + set data(value: Map) { + pb_1.Message.setField(this, 3076010, value as any); + } + static fromObject(data: { + data?: { + [key: string]: ReturnType; + }; + }): WatchBlocksV1ProgressPB { + const message = new WatchBlocksV1ProgressPB({}); + if (typeof data.data == "object") { + message.data = new Map(Object.entries(data.data).map(([key, value]) => [key, dependency_1.google.protobuf.Any.fromObject(value)])); + } + return message; + } + toObject() { + const data: { + data?: { + [key: string]: ReturnType; + }; + } = {}; + if (this.data != null) { + data.data = (Object.fromEntries)((Array.from)(this.data).map(([key, value]) => [key, value.toObject()])); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + for (const [key, value] of this.data) { + writer.writeMessage(3076010, this.data, () => { + writer.writeString(1, key); + writer.writeMessage(2, value, () => value.serialize(writer)); + }); + } + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WatchBlocksV1ProgressPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WatchBlocksV1ProgressPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 3076010: + reader.readMessage(message, () => pb_1.Map.deserializeBinary(message.data as any, reader, reader.readString, () => { + let value; + reader.readMessage(message, () => value = dependency_1.google.protobuf.Any.deserialize(reader)); + return value; + })); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WatchBlocksV1ProgressPB { + return WatchBlocksV1ProgressPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts new file mode 100644 index 00000000000..d7f903665fd --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb.ts @@ -0,0 +1,77 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: models/watch_blocks_v1_request_pb.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/any"; +import * as dependency_2 from "./watch_blocks_v1_pb"; +import * as pb_1 from "google-protobuf"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink { + export class WatchBlocksV1RequestPB extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("event" in data && data.event != undefined) { + this.event = data.event; + } + } + } + get event() { + return pb_1.Message.getFieldWithDefault(this, 96891546, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB.WatchBlocksV1PB_Subscribe) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB; + } + set event(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB) { + pb_1.Message.setField(this, 96891546, value); + } + static fromObject(data: { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB; + }): WatchBlocksV1RequestPB { + const message = new WatchBlocksV1RequestPB({}); + if (data.event != null) { + message.event = data.event; + } + return message; + } + toObject() { + const data: { + event?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB; + } = {}; + if (this.event != null) { + data.event = this.event; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.event != dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB.WatchBlocksV1PB_Subscribe) + writer.writeEnum(96891546, this.event); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WatchBlocksV1RequestPB { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new WatchBlocksV1RequestPB(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 96891546: + message.event = reader.readEnum(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): WatchBlocksV1RequestPB { + return WatchBlocksV1RequestPB.deserialize(bytes); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams.ts new file mode 100644 index 00000000000..14f1f7253e1 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams.ts @@ -0,0 +1,71 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: services/chainlink-grpc-svc-streams.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/empty"; +import * as dependency_2 from "./../models/watch_blocks_v1_progress_pb"; +import * as dependency_3 from "./../models/watch_blocks_v1_request_pb"; +import * as grpc_1 from "@grpc/grpc-js"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice { + interface GrpcUnaryServiceInterface { + (message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + } + interface GrpcStreamServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + (message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + } + interface GrpWritableServiceInterface { + (metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + } + interface GrpcChunkServiceInterface { + (metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + (options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + } + interface GrpcPromiseServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise; + (message: P, options?: grpc_1.CallOptions): Promise; + } + export abstract class UnimplementedChainlinkGrpcSvcStreamsService { + static definition = { + GetOpenApiV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice.ChainlinkGrpcSvcStreams/GetOpenApiV1", + requestStream: false, + responseStream: false, + requestSerialize: (message: dependency_1.google.protobuf.Empty) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => dependency_1.google.protobuf.Empty.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: dependency_1.google.protobuf.Empty) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => dependency_1.google.protobuf.Empty.deserialize(new Uint8Array(bytes)) + }, + WatchBlocksV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice.ChainlinkGrpcSvcStreams/WatchBlocksV1", + requestStream: true, + responseStream: true, + requestSerialize: (message: dependency_3.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1RequestPB) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => dependency_3.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1RequestPB.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1ProgressPB) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1ProgressPB.deserialize(new Uint8Array(bytes)) + } + }; + [method: string]: grpc_1.UntypedHandleCall; + abstract GetOpenApiV1(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; + abstract WatchBlocksV1(call: grpc_1.ServerDuplexStream): void; + } + export class ChainlinkGrpcSvcStreamsClient extends grpc_1.makeGenericClientConstructor(UnimplementedChainlinkGrpcSvcStreamsService.definition, "ChainlinkGrpcSvcStreams", {}) { + constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial) { + super(address, credentials, options); + } + GetOpenApiV1: GrpcUnaryServiceInterface = (message: dependency_1.google.protobuf.Empty, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { + return super.GetOpenApiV1(message, metadata, options, callback); + }; + WatchBlocksV1: GrpcChunkServiceInterface = (metadata?: grpc_1.Metadata | grpc_1.CallOptions, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream => { + return super.WatchBlocksV1(metadata, options); + }; + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts new file mode 100644 index 00000000000..2f426ee8019 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/generated/proto/protoc-gen-ts/services/default_service.ts @@ -0,0 +1,209 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 3.19.1 + * source: services/default_service.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as dependency_1 from "./../google/protobuf/empty"; +import * as dependency_2 from "./../models/get_subscription_info_v1_request_pb"; +import * as dependency_3 from "./../models/get_subscription_info_v1_response_pb"; +import * as pb_1 from "google-protobuf"; +import * as grpc_1 from "@grpc/grpc-js"; +export namespace org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice { + export class GetOpenApiSpecV1Response extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + data?: string; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("data" in data && data.data != undefined) { + this.data = data.data; + } + } + } + get data() { + return pb_1.Message.getFieldWithDefault(this, 1, "") as string; + } + set data(value: string) { + pb_1.Message.setField(this, 1, value); + } + static fromObject(data: { + data?: string; + }): GetOpenApiSpecV1Response { + const message = new GetOpenApiSpecV1Response({}); + if (data.data != null) { + message.data = data.data; + } + return message; + } + toObject() { + const data: { + data?: string; + } = {}; + if (this.data != null) { + data.data = this.data; + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.data.length) + writer.writeString(1, this.data); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetOpenApiSpecV1Response { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetOpenApiSpecV1Response(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + message.data = reader.readString(); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetOpenApiSpecV1Response { + return GetOpenApiSpecV1Response.deserialize(bytes); + } + } + export class GetSubscriptionInfoV1Request extends pb_1.Message { + #one_of_decls: number[][] = []; + constructor(data?: any[] | { + getSubscriptionInfoV1RequestPB?: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB; + }) { + super(); + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls); + if (!Array.isArray(data) && typeof data == "object") { + if ("getSubscriptionInfoV1RequestPB" in data && data.getSubscriptionInfoV1RequestPB != undefined) { + this.getSubscriptionInfoV1RequestPB = data.getSubscriptionInfoV1RequestPB; + } + } + } + get getSubscriptionInfoV1RequestPB() { + return pb_1.Message.getWrapperField(this, dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB, 1) as dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB; + } + set getSubscriptionInfoV1RequestPB(value: dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB) { + pb_1.Message.setWrapperField(this, 1, value); + } + get has_getSubscriptionInfoV1RequestPB() { + return pb_1.Message.getField(this, 1) != null; + } + static fromObject(data: { + getSubscriptionInfoV1RequestPB?: ReturnType; + }): GetSubscriptionInfoV1Request { + const message = new GetSubscriptionInfoV1Request({}); + if (data.getSubscriptionInfoV1RequestPB != null) { + message.getSubscriptionInfoV1RequestPB = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB.fromObject(data.getSubscriptionInfoV1RequestPB); + } + return message; + } + toObject() { + const data: { + getSubscriptionInfoV1RequestPB?: ReturnType; + } = {}; + if (this.getSubscriptionInfoV1RequestPB != null) { + data.getSubscriptionInfoV1RequestPB = this.getSubscriptionInfoV1RequestPB.toObject(); + } + return data; + } + serialize(): Uint8Array; + serialize(w: pb_1.BinaryWriter): void; + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter(); + if (this.has_getSubscriptionInfoV1RequestPB) + writer.writeMessage(1, this.getSubscriptionInfoV1RequestPB, () => this.getSubscriptionInfoV1RequestPB.serialize(writer)); + if (!w) + return writer.getResultBuffer(); + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): GetSubscriptionInfoV1Request { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new GetSubscriptionInfoV1Request(); + while (reader.nextField()) { + if (reader.isEndGroup()) + break; + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.getSubscriptionInfoV1RequestPB, () => message.getSubscriptionInfoV1RequestPB = dependency_2.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1RequestPB.deserialize(reader)); + break; + default: reader.skipField(); + } + } + return message; + } + serializeBinary(): Uint8Array { + return this.serialize(); + } + static deserializeBinary(bytes: Uint8Array): GetSubscriptionInfoV1Request { + return GetSubscriptionInfoV1Request.deserialize(bytes); + } + } + interface GrpcUnaryServiceInterface { + (message: P, metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + (message: P, callback: grpc_1.requestCallback): grpc_1.ClientUnaryCall; + } + interface GrpcStreamServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + (message: P, options?: grpc_1.CallOptions): grpc_1.ClientReadableStream; + } + interface GrpWritableServiceInterface { + (metadata: grpc_1.Metadata, options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (metadata: grpc_1.Metadata, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (options: grpc_1.CallOptions, callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + (callback: grpc_1.requestCallback): grpc_1.ClientWritableStream

; + } + interface GrpcChunkServiceInterface { + (metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + (options?: grpc_1.CallOptions): grpc_1.ClientDuplexStream; + } + interface GrpcPromiseServiceInterface { + (message: P, metadata: grpc_1.Metadata, options?: grpc_1.CallOptions): Promise; + (message: P, options?: grpc_1.CallOptions): Promise; + } + export abstract class UnimplementedDefaultServiceService { + static definition = { + GetOpenApiSpecV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.DefaultService/GetOpenApiSpecV1", + requestStream: false, + responseStream: false, + requestSerialize: (message: dependency_1.google.protobuf.Empty) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => dependency_1.google.protobuf.Empty.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: GetOpenApiSpecV1Response) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => GetOpenApiSpecV1Response.deserialize(new Uint8Array(bytes)) + }, + GetSubscriptionInfoV1: { + path: "/org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.DefaultService/GetSubscriptionInfoV1", + requestStream: false, + responseStream: false, + requestSerialize: (message: GetSubscriptionInfoV1Request) => Buffer.from(message.serialize()), + requestDeserialize: (bytes: Buffer) => GetSubscriptionInfoV1Request.deserialize(new Uint8Array(bytes)), + responseSerialize: (message: dependency_3.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1ResponsePB) => Buffer.from(message.serialize()), + responseDeserialize: (bytes: Buffer) => dependency_3.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1ResponsePB.deserialize(new Uint8Array(bytes)) + } + }; + [method: string]: grpc_1.UntypedHandleCall; + abstract GetOpenApiSpecV1(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; + abstract GetSubscriptionInfoV1(call: grpc_1.ServerUnaryCall, callback: grpc_1.sendUnaryData): void; + } + export class DefaultServiceClient extends grpc_1.makeGenericClientConstructor(UnimplementedDefaultServiceService.definition, "DefaultService", {}) { + constructor(address: string, credentials: grpc_1.ChannelCredentials, options?: Partial) { + super(address, credentials, options); + } + GetOpenApiSpecV1: GrpcUnaryServiceInterface = (message: dependency_1.google.protobuf.Empty, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { + return super.GetOpenApiSpecV1(message, metadata, options, callback); + }; + GetSubscriptionInfoV1: GrpcUnaryServiceInterface = (message: GetSubscriptionInfoV1Request, metadata: grpc_1.Metadata | grpc_1.CallOptions | grpc_1.requestCallback, options?: grpc_1.CallOptions | grpc_1.requestCallback, callback?: grpc_1.requestCallback): grpc_1.ClientUnaryCall => { + return super.GetSubscriptionInfoV1(message, metadata, options, callback); + }; + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-open-api.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-open-api.ts new file mode 100644 index 00000000000..1aaab6e52fa --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-open-api.ts @@ -0,0 +1,89 @@ +import { ServerUnaryCall, sendUnaryData } from "@grpc/grpc-js"; +import { status } from "@grpc/grpc-js"; + +import { + LogLevelDesc, + Logger, + LoggerProvider, + createRuntimeErrorWithCause, + safeStringifyException, +} from "@hyperledger/cactus-common"; + +import { google } from "../generated/proto/protoc-gen-ts/google/protobuf/empty"; +import * as default_service from "../generated/proto/protoc-gen-ts/services/default_service"; +import { getSubscriptionInfoV1Grpc } from "../impl/get-subscription-info-v1/get-subscription-info-v1-grpc"; +import { org } from "../generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb"; + +export interface IChainlinkGrpcSvcOpenApiOptions { + readonly logLevel?: LogLevelDesc; +} + +export class ChainlinkGrpcSvcOpenApi extends default_service.org.hyperledger + .cacti.plugin.ledger.connector.chainlink.services.defaultservice + .UnimplementedDefaultServiceService { + // No choice but to disable the linter here because we need to be able to + // declare fields on the implementation class but the parent class forces to + // only have methods implementations not fields. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [field: string]: any; + + public static readonly CLASS_NAME = "ChainlinkGrpcSvcOpenApi"; + + public get className(): string { + return ChainlinkGrpcSvcOpenApi.CLASS_NAME; + } + + private readonly log: Logger; + + /** + * The log level that will be used throughout all the methods of this class. + */ + private readonly logLevel: LogLevelDesc; + constructor(public readonly opts: IChainlinkGrpcSvcOpenApiOptions) { + super(); + this.logLevel = opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + this.log.debug(`Created instance of ${this.className} OK`); + } + + public GetSubscriptionInfoV1( + call: ServerUnaryCall< + default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.GetSubscriptionInfoV1Request, + org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1ResponsePB + >, + callback: sendUnaryData, + ): void { + getSubscriptionInfoV1Grpc({ logLevel: this.logLevel }, call.request) + .then((res) => { + callback(null, res); + }) + .catch((cause: unknown) => { + const eMsg = "getSubscriptionInfoV1Grpc() crashed with"; + const ex = createRuntimeErrorWithCause(eMsg, cause); + const exJson = safeStringifyException(ex); + this.log.debug("%s %o", eMsg, cause); + callback({ + message: "status.INTERNAL - getSubscriptionInfoV1Grpc() call crashed", + code: status.INTERNAL, + stack: ex.stack, + name: ex.name, + details: exJson, + }); + }); + } + + public GetOpenApiSpecV1( + call: ServerUnaryCall< + google.protobuf.Empty, + default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.GetOpenApiSpecV1Response + >, + callback: sendUnaryData, + ): void { + return callback({ + message: "Status.UNIMPLEMENTED", + code: status.UNIMPLEMENTED, + details: "Service endpoint not yet implemented.", + }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-streams.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-streams.ts new file mode 100644 index 00000000000..37b96bcdf2b --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/chainlink-grpc-svc-streams.ts @@ -0,0 +1,65 @@ +// import { +// sendUnaryData, +// ServerDuplexStream, +// ServerUnaryCall, +// } from "@grpc/grpc-js"; + +import { + LogLevelDesc, + Logger, + LoggerProvider, +} from "@hyperledger/cactus-common"; + +// import * as watch_blocks_v1_progress_pb from "../generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb"; +// import * as watch_blocks_v1_request_pb from "../generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb"; +import * as chainlink_grpc_svc_streams from "../generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams"; +// import { google } from "../generated/proto/protoc-gen-ts/google/protobuf/empty"; + +export interface IChainlinkGrpcSvcStreamsOptions { + readonly logLevel?: LogLevelDesc; +} + +export class ChainlinkGrpcSvcStreams extends chainlink_grpc_svc_streams.org + .hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice + .UnimplementedChainlinkGrpcSvcStreamsService { + // No choice but to disable the linter here because we need to be able to + // declare fields on the implementation class but the parent class forces to + // only have methods implementations not fields. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [field: string]: any; + + public static readonly CLASS_NAME = "ChainlinkGrpcSvcStreams"; + + public get className(): string { + return ChainlinkGrpcSvcStreams.CLASS_NAME; + } + + private readonly log: Logger; + + /** + * The log level that will be used throughout all the methods of this class. + */ + private readonly logLevel: LogLevelDesc; + + constructor(public readonly opts: IChainlinkGrpcSvcStreamsOptions) { + super(); + this.logLevel = opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + this.log.debug(`Created instance of ${this.className} OK`); + } + + GetOpenApiV1() // call: ServerUnaryCall, + // callback: sendUnaryData, + : void { + throw new Error("Method not implemented."); + } + + WatchBlocksV1() // call: ServerDuplexStream< + // watch_blocks_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1RequestPB, + // watch_blocks_v1_progress_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1ProgressPB + // >, + : void { + this.log.debug("WatchBlocksV1::MAIN_FN="); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts new file mode 100644 index 00000000000..f587e182850 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-credentials-factory.ts @@ -0,0 +1,91 @@ +import * as grpc from "@grpc/grpc-js"; + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ServerCredentials} + */ +export function createGrpcInsecureServerCredentials(): grpc.ServerCredentials { + return grpc.ServerCredentials.createInsecure(); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ServerCredentials} + */ +export function createGrpcSslServerCredentials( + rootCerts: Buffer | null, + keyCertPairs: grpc.KeyCertPair[], + checkClientCertificate?: boolean, +): grpc.ServerCredentials { + return grpc.ServerCredentials.createSsl( + rootCerts, + keyCertPairs, + checkClientCertificate, + ); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ChannelCredentials} + */ +export function createGrpcInsecureChannelCredentials(): grpc.ChannelCredentials { + return grpc.ChannelCredentials.createInsecure(); +} + +/** + * Re-exports the underlying `grpc.ServerCredentials.createInsecure()` call + * verbatim. + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects with the same import of the `@grpc/grpc-js` library that the {ApiServer} + * of this package is using. + * + * @returns {grpc.ChannelCredentials} + */ +export function createGrpcSslChannelCredentials( + rootCerts?: Buffer | null, + privateKey?: Buffer | null, + certChain?: Buffer | null, + verifyOptions?: grpc.VerifyOptions, +): grpc.ChannelCredentials { + return grpc.ChannelCredentials.createSsl( + rootCerts, + privateKey, + certChain, + verifyOptions, + ); +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-server-factory.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-server-factory.ts new file mode 100644 index 00000000000..288bd7ea859 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/grpc-services/common/grpc-server-factory.ts @@ -0,0 +1,21 @@ +import * as grpc from "@grpc/grpc-js"; + +/** + * Re-exports the underlying `new grpc.Server()` call verbatim. + * + * Why though? This is necessary because the {grpc.Server} object does an `instanceof` + * validation on credential objects that are passed to it and this check comes back + * negative if you've constructed the credentials object with a different instance + * of the library, **even** if the versions of the library instances are the **same**. + * + * Therefore this is a workaround that allows callers to construct credentials + * objects/servers with the same import of the `@grpc/grpc-js` library that the + * {ApiServer} of this package is using internally. + * + * @returns {grpc.Server} + */ +export function createGrpcServer( + options?: grpc.ServerOptions | undefined, +): grpc.Server { + return new grpc.Server(options); +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-grpc.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-grpc.ts new file mode 100644 index 00000000000..8eef42d928c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-grpc.ts @@ -0,0 +1,47 @@ +import { LoggerProvider, LogLevelDesc } from "@hyperledger/cactus-common"; + +import * as subscription_info_pb from "../../generated/proto/protoc-gen-ts/models/subscription_info_pb"; +import * as get_subscription_info_v1_response_pb from "../../generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb"; +import * as default_service from "../../generated/proto/protoc-gen-ts/services/default_service"; +import { getSubscriptionInfoV1Impl } from "./get-subscription-info-v1-impl"; + +export async function getSubscriptionInfoV1Grpc( + ctx: { readonly logLevel: LogLevelDesc }, + reqPb: default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.GetSubscriptionInfoV1Request, +): Promise { + const log = LoggerProvider.getOrCreate({ + label: "getSubscriptionInfoV1Grpc()", + level: ctx.logLevel, + }); + + log.debug("reqPb=%o", reqPb); + log.debug( + "reqPb.getSubscriptionInfoV1RequestPB=%o", + reqPb.getSubscriptionInfoV1RequestPB, + ); + log.debug( + "reqPb.getSubscriptionInfoV1RequestPB.subscriptionId=%o", + reqPb.getSubscriptionInfoV1RequestPB.subscriptionId, + ); + + const req = { + subscriptionId: + reqPb.getSubscriptionInfoV1RequestPB.subscriptionId.toString(), + }; + + log.debug("GetSubscriptionInfoV1Request=%o", req); + const subscriptionInfo = await getSubscriptionInfoV1Impl(ctx, req); + log.debug("subscriptionInfo=%o", subscriptionInfo); + + const resPb = + new get_subscription_info_v1_response_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetSubscriptionInfoV1ResponsePB(); + + const subscriptionInfoPb = + subscription_info_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.SubscriptionInfoPB.fromObject( + subscriptionInfo as any, // FIXME + ); + + resPb.subscriptionInfo = subscriptionInfoPb; + + return resPb; +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-http.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-http.ts new file mode 100644 index 00000000000..426d8028ee4 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-http.ts @@ -0,0 +1,15 @@ +import { LogLevelDesc } from "@hyperledger/cactus-common"; + +import { + GetSubscriptionInfoV1Request, + GetSubscriptionInfoV1Response, +} from "../../generated/openapi/typescript-axios/api"; +import { getSubscriptionInfoV1Impl } from "./get-subscription-info-v1-impl"; + +export async function getSubscriptionInfoV1Http( + ctx: { readonly logLevel: LogLevelDesc }, + request: GetSubscriptionInfoV1Request, +): Promise { + const subscriptionInfo = await getSubscriptionInfoV1Impl(ctx, request); + return { subscriptionInfo }; +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-impl.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-impl.ts new file mode 100644 index 00000000000..25625c9adaf --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/impl/get-subscription-info-v1/get-subscription-info-v1-impl.ts @@ -0,0 +1,18 @@ +import { LoggerProvider, LogLevelDesc } from "@hyperledger/cactus-common"; + +import { SubscriptionInfo } from "../../generated/openapi/typescript-axios/api"; +import { GetSubscriptionInfoV1Request } from "../../generated/openapi/typescript-axios/api"; + +export async function getSubscriptionInfoV1Impl( + ctx: { readonly logLevel: LogLevelDesc }, + req: GetSubscriptionInfoV1Request, +): Promise { + const log = LoggerProvider.getOrCreate({ + label: "getSubscriptionInfoV1Impl", + level: ctx.logLevel, + }); + log.debug("req=%s", req); + log.debug("subscriptionId=%s", req.subscriptionId); + + throw new Error("Not yet implemented."); +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.ts new file mode 100755 index 00000000000..87cb558397c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts new file mode 100755 index 00000000000..cbf001e116c --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts @@ -0,0 +1,6 @@ +export { + ChainlinkApiClient, + ChainlinkApiClientOptions, +} from "./api-client/chainlink-api-client"; + +export * from "./generated/openapi/typescript-axios/api"; diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-factory-ledger-connector.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-factory-ledger-connector.ts new file mode 100644 index 00000000000..f0222878ff5 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-factory-ledger-connector.ts @@ -0,0 +1,20 @@ +import { + IPluginFactoryOptions, + PluginFactory, +} from "@hyperledger/cactus-core-api"; +import { + IPluginLedgerConnectorChainlinkOptions, + PluginLedgerConnectorChainlink, +} from "./plugin-ledger-connector-chainlink"; + +export class PluginFactoryLedgerConnector extends PluginFactory< + PluginLedgerConnectorChainlink, + IPluginLedgerConnectorChainlinkOptions, + IPluginFactoryOptions +> { + async create( + pluginOptions: IPluginLedgerConnectorChainlinkOptions, + ): Promise { + return new PluginLedgerConnectorChainlink(pluginOptions); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-ledger-connector-chainlink.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-ledger-connector-chainlink.ts new file mode 100644 index 00000000000..a5e2e780fe3 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/plugin-ledger-connector-chainlink.ts @@ -0,0 +1,258 @@ +import type { Server as SocketIoServer } from "socket.io"; +import type { Socket as SocketIoSocket } from "socket.io"; +import type { Express } from "express"; + +import { + ConsensusAlgorithmFamily, + IPluginLedgerConnector, + IWebServiceEndpoint, + IPluginWebService, + ICactusPlugin, + ICactusPluginOptions, + IPluginGrpcService, + IGrpcSvcDefAndImplPair, +} from "@hyperledger/cactus-core-api"; + +import { + PluginRegistry, + consensusHasTransactionFinality, +} from "@hyperledger/cactus-core"; + +import { + Checks, + Logger, + LoggerProvider, + LogLevelDesc, +} from "@hyperledger/cactus-common"; + +import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter"; +import { GetSubscriptionInfoEndpoint } from "./web-services/get-subscription-info-v1-endpoint-"; +import { + GetOpenApiSpecV1Endpoint, + IGetOpenApiSpecV1EndpointOptions, +} from "./web-services/get-open-api-spec-v1-endpoint"; +import * as grpc_default_service from "./generated/proto/protoc-gen-ts/services/default_service"; +import * as chainlink_grpc_svc_streams from "./generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams"; +import { ChainlinkGrpcSvcOpenApi } from "./grpc-services/chainlink-grpc-svc-open-api"; +import { ChainlinkGrpcSvcStreams } from "./grpc-services/chainlink-grpc-svc-streams"; +import { getSubscriptionInfoV1Http } from "./impl/get-subscription-info-v1/get-subscription-info-v1-http"; +import { WatchBlocksV1 } from "./generated/openapi/typescript-axios/api"; +import OAS from "../json/openapi.json"; + +export const E_KEYCHAIN_NOT_FOUND = + "cacti.connector.chainlink.keychain_not_found"; + +export interface IPluginLedgerConnectorChainlinkOptions + extends ICactusPluginOptions { + ledgerHttpPort: number; + ledgerHttpHost: string; + pluginRegistry: PluginRegistry; + prometheusExporter?: PrometheusExporter; + logLevel?: LogLevelDesc; +} + +export class PluginLedgerConnectorChainlink + implements + IPluginLedgerConnector, + ICactusPlugin, + IPluginGrpcService, + IPluginWebService +{ + private readonly instanceId: string; + public prometheusExporter: PrometheusExporter; + private readonly log: Logger; + private readonly logLevel: LogLevelDesc; + private readonly pluginRegistry: PluginRegistry; + private endpoints: IWebServiceEndpoint[] | undefined; + + public static readonly CLASS_NAME = "PluginLedgerConnectorChainlink"; + + public get className(): string { + return PluginLedgerConnectorChainlink.CLASS_NAME; + } + + constructor(public readonly options: IPluginLedgerConnectorChainlinkOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + Checks.truthy(options.ledgerHttpHost, `${fnTag} options.ledgerHttpHost`); + Checks.truthy(options.ledgerHttpPort, `${fnTag} options.ledgerHttpPort`); + Checks.truthy(options.pluginRegistry, `${fnTag} options.pluginRegistry`); + Checks.truthy(options.instanceId, `${fnTag} options.instanceId`); + + this.logLevel = this.options.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + + this.instanceId = options.instanceId; + this.pluginRegistry = options.pluginRegistry; + this.prometheusExporter = + options.prometheusExporter || + new PrometheusExporter({ pollingIntervalInMin: 1 }); + Checks.truthy( + this.prometheusExporter, + `${fnTag} options.prometheusExporter`, + ); + + this.prometheusExporter.startMetricsCollection(); + } + public async deployContract(): Promise { + throw new Error("Method not implemented."); + } + public async transact(): Promise { + throw new Error("Method not implemented."); + } + + public getOpenApiSpec(): unknown { + return OAS; + } + + public getPrometheusExporter(): PrometheusExporter { + return this.prometheusExporter; + } + + public async getPrometheusExporterMetrics(): Promise { + const res: string = await this.prometheusExporter.getPrometheusMetrics(); + this.log.debug(`getPrometheusExporterMetrics() response: %o`, res); + return res; + } + + public getInstanceId(): string { + return this.instanceId; + } + + public async onPluginInit(): Promise {} + + public async shutdown(): Promise { + this.log.info(`Shutting down ${this.className}...`); + } + + async registerWebServices( + app: Express, + wsApi: SocketIoServer, + ): Promise { + // FIXME + // const { logLevel } = this.options; + const webServices = await this.getOrCreateWebServices(); + await Promise.all(webServices.map((ws) => ws.registerExpress(app))); + + wsApi.on("connection", (socket: SocketIoSocket) => { + this.log.debug(`New Socket connected. ID=${socket.id}`); + + socket.on(WatchBlocksV1.Subscribe, () => { + // FIXME + // new WatchBlocksV1Endpoint({ socket, logLevel }).subscribe(); + }); + }); + return webServices; + } + public async createGrpcSvcDefAndImplPairs(): Promise< + IGrpcSvcDefAndImplPair[] + > { + const openApiSvc = await this.createGrpcOpenApiSvcDefAndImplPair(); + const streamsSvc = await this.createGrpcStreamsSvcDefAndImplPair(); + return [openApiSvc, streamsSvc]; + } + + public async createGrpcStreamsSvcDefAndImplPair(): Promise { + const definition = + chainlink_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector + .chainlink.services.chainlinkservice + .UnimplementedChainlinkGrpcSvcStreamsService.definition; + + const implementation = new ChainlinkGrpcSvcStreams({ + logLevel: this.logLevel, + }); + + return { definition, implementation }; + } + + /** + * Create a new instance of the service implementation. + * Note: This does not cache the returned objects internally. A new instance + * is created during every invocation. + * + * @returns The gRPC service definition+implementation pair that is backed + * by the code generated by the OpenAPI generator from the openapi.json spec + * of this package. Used by the API server to obtain the service objects dynamically + * at runtime so that the plugin's gRPC services can be exposed in a similar + * fashion how the HTTP REST endpoints are registered as well. + */ + public async createGrpcOpenApiSvcDefAndImplPair(): Promise { + const definition = + grpc_default_service.org.hyperledger.cacti.plugin.ledger.connector + .chainlink.services.defaultservice.DefaultServiceClient.service; + + const implementation = new ChainlinkGrpcSvcOpenApi({ + logLevel: this.logLevel, + }); + + return { definition, implementation }; + } + + public async getOrCreateWebServices(): Promise { + if (Array.isArray(this.endpoints)) { + return this.endpoints; + } + + const endpoints: IWebServiceEndpoint[] = []; + { + const endpoint = new GetSubscriptionInfoEndpoint({ + plugin: this, + logLevel: this.options.logLevel, + }); + endpoints.push(endpoint); + } + // { + // const opts: IGetPrometheusExporterMetricsEndpointV1Options = { + // connector: this, + // logLevel: this.options.logLevel, + // }; + // const endpoint = new GetPrometheusExporterMetricsEndpointV1(opts); + // endpoints.push(endpoint); + // } + { + const oasPath = + OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec" + ]; + + const operationId = oasPath.get.operationId; + const opts: IGetOpenApiSpecV1EndpointOptions = { + oas: OAS, + oasPath, + operationId, + path: oasPath.get["x-hyperledger-cacti"].http.path, + pluginRegistry: this.pluginRegistry, + verbLowerCase: oasPath.get["x-hyperledger-cacti"].http.verbLowerCase, + logLevel: this.options.logLevel, + }; + const endpoint = new GetOpenApiSpecV1Endpoint(opts); + endpoints.push(endpoint); + } + + this.endpoints = endpoints; + return endpoints; + } + + public getPackageName(): string { + return `@hyperledger/cacti-plugin-ledger-connector-chainlink`; + } + + public async getConsensusAlgorithmFamily(): Promise { + return ConsensusAlgorithmFamily.Authority; + } + public async hasTransactionFinality(): Promise { + const currentConsensusAlgorithmFamily = + await this.getConsensusAlgorithmFamily(); + + return consensusHasTransactionFinality(currentConsensusAlgorithmFamily); + } + + // FIXME + public async getSubscriptionInfoV1(request: any): Promise { + const ctx = { logLevel: this.logLevel }; + const res = await getSubscriptionInfoV1Http(ctx, request); + this.log.debug("res=%o", res); + return res; + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/data-fetcher.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/data-fetcher.ts new file mode 100644 index 00000000000..03b477363d6 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/data-fetcher.ts @@ -0,0 +1,12 @@ +import { Transactions } from "./response.type"; + +import { totalTxCount, K_CACTUS_CHAINLINK_TOTAL_TX_COUNT } from "./metrics"; + +export async function collectMetrics( + transactions: Transactions, +): Promise { + transactions.counter++; + totalTxCount + .labels(K_CACTUS_CHAINLINK_TOTAL_TX_COUNT) + .set(transactions.counter); +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/metrics.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/metrics.ts new file mode 100644 index 00000000000..1a69ac7821d --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/metrics.ts @@ -0,0 +1,11 @@ +import { Gauge } from "prom-client"; + +export const K_CACTUS_CHAINLINK_TOTAL_TX_COUNT = + "cactus_chainlink_total_tx_count"; + +export const totalTxCount = new Gauge({ + registers: [], + name: "cactus_chainlink_total_tx_count", + help: "Total transactions executed", + labelNames: ["type"], +}); diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/prometheus-exporter.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/prometheus-exporter.ts new file mode 100644 index 00000000000..c181c888c1e --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/prometheus-exporter.ts @@ -0,0 +1,39 @@ +import promClient, { Registry } from "prom-client"; +import { Transactions } from "./response.type"; +import { collectMetrics } from "./data-fetcher"; +import { K_CACTUS_CHAINLINK_TOTAL_TX_COUNT } from "./metrics"; +import { totalTxCount } from "./metrics"; + +export interface IPrometheusExporterOptions { + pollingIntervalInMin?: number; +} + +export class PrometheusExporter { + public readonly metricsPollingIntervalInMin: number; + public readonly transactions: Transactions = { counter: 0 }; + public readonly registry: Registry; + + constructor( + public readonly prometheusExporterOptions: IPrometheusExporterOptions, + ) { + this.metricsPollingIntervalInMin = + prometheusExporterOptions.pollingIntervalInMin || 1; + this.registry = new Registry(); + } + + public addCurrentTransaction(): void { + collectMetrics(this.transactions); + } + + public async getPrometheusMetrics(): Promise { + const result = await this.registry.getSingleMetricAsString( + K_CACTUS_CHAINLINK_TOTAL_TX_COUNT, + ); + return result; + } + + public startMetricsCollection(): void { + this.registry.registerMetric(totalTxCount); + promClient.collectDefaultMetrics({ register: this.registry }); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/response.type.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/response.type.ts new file mode 100644 index 00000000000..3f1bc7f4911 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/prometheus-exporter/response.type.ts @@ -0,0 +1,3 @@ +export type Transactions = { + counter: number; +}; diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts new file mode 100755 index 00000000000..31677827088 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts @@ -0,0 +1,68 @@ +export { + E_KEYCHAIN_NOT_FOUND, + IPluginLedgerConnectorChainlinkOptions, + PluginLedgerConnectorChainlink, +} from "./plugin-ledger-connector-chainlink"; +export { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector"; + +import { IPluginFactoryOptions } from "@hyperledger/cactus-core-api"; +import { PluginFactoryLedgerConnector } from "./plugin-factory-ledger-connector"; + +export { + ChainlinkApiClient, + ChainlinkApiClientOptions, +} from "./api-client/chainlink-api-client"; + +export { Configuration as OpenApiClientCfg } from "./generated/openapi/typescript-axios/index"; +export { DefaultApi as OpenApiClient } from "./generated/openapi/typescript-axios/index"; + +export { GetSubscriptionInfoV1Request } from "./generated/openapi/typescript-axios/api"; +export { GetSubscriptionInfoV1Response } from "./generated/openapi/typescript-axios/api"; +export { SubscriptionInfo } from "./generated/openapi/typescript-axios/api"; +export { WatchBlocksV1 } from "./generated/openapi/typescript-axios/api"; +export { WatchBlocksV1Progress } from "./generated/openapi/typescript-axios/api"; +export { WatchBlocksV1Request } from "./generated/openapi/typescript-axios/api"; + +export async function createPluginFactory( + pluginFactoryOptions: IPluginFactoryOptions, +): Promise { + return new PluginFactoryLedgerConnector(pluginFactoryOptions); +} + +export { + IChainlinkGrpcSvcOpenApiOptions, + ChainlinkGrpcSvcOpenApi, +} from "./grpc-services/chainlink-grpc-svc-open-api"; + +export { + ChainlinkGrpcSvcStreams, + IChainlinkGrpcSvcStreamsOptions, +} from "./grpc-services/chainlink-grpc-svc-streams"; + +export * as google_protobuf_any from "./generated/proto/protoc-gen-ts/google/protobuf/any"; +export * as google_protobuf_empty from "./generated/proto/protoc-gen-ts/google/protobuf/empty"; + +export * as get_subscription_info_v1_request_pb from "./generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_pb"; +export * as get_subscription_info_v1_request_subscription_id_pb from "./generated/proto/protoc-gen-ts/models/get_subscription_info_v1_request_subscription_id_pb"; +export * as get_subscription_info_v1_response_pb from "./generated/proto/protoc-gen-ts/models/get_subscription_info_v1_response_pb"; +export * as subscription_info_pb from "./generated/proto/protoc-gen-ts/models/subscription_info_pb"; + +export * as default_service from "./generated/proto/protoc-gen-ts/services/default_service"; + +export * as chainlink_grpc_svc_streams from "./generated/proto/protoc-gen-ts/services/chainlink-grpc-svc-streams"; +export * as watch_blocks_v1_progress_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_progress_pb"; +export * as watch_blocks_v1_request_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_request_pb"; +export * as watch_blocks_v1_pb from "./generated/proto/protoc-gen-ts/models/watch_blocks_v1_pb"; + +export { + createGrpcInsecureChannelCredentials, + createGrpcInsecureServerCredentials, + createGrpcSslChannelCredentials, + createGrpcSslServerCredentials, +} from "./grpc-services/common/grpc-credentials-factory"; + +export { createGrpcServer } from "./grpc-services/common/grpc-server-factory"; + +export { getSubscriptionInfoV1Grpc } from "./impl/get-subscription-info-v1/get-subscription-info-v1-grpc"; +export { getSubscriptionInfoV1Http } from "./impl/get-subscription-info-v1/get-subscription-info-v1-http"; +export { getSubscriptionInfoV1Impl } from "./impl/get-subscription-info-v1/get-subscription-info-v1-impl"; diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts new file mode 100644 index 00000000000..2185e29bde3 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-open-api-spec-v1-endpoint.ts @@ -0,0 +1,39 @@ +import { + GetOpenApiSpecV1EndpointBase, + IGetOpenApiSpecV1EndpointBaseOptions, +} from "@hyperledger/cactus-core"; + +import { Checks, LogLevelDesc } from "@hyperledger/cactus-common"; +import { IWebServiceEndpoint } from "@hyperledger/cactus-core-api"; + +import OAS from "../../json/openapi.json"; + +export const OasPathGetOpenApiSpecV1 = + OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-open-api-spec" + ]; + +export type OasPathTypeGetOpenApiSpecV1 = typeof OasPathGetOpenApiSpecV1; + +export interface IGetOpenApiSpecV1EndpointOptions + extends IGetOpenApiSpecV1EndpointBaseOptions< + typeof OAS, + OasPathTypeGetOpenApiSpecV1 + > { + readonly logLevel?: LogLevelDesc; +} + +export class GetOpenApiSpecV1Endpoint + extends GetOpenApiSpecV1EndpointBase + implements IWebServiceEndpoint +{ + public get className(): string { + return GetOpenApiSpecV1Endpoint.CLASS_NAME; + } + + constructor(public readonly options: IGetOpenApiSpecV1EndpointOptions) { + super(options); + const fnTag = `${this.className}#constructor()`; + Checks.truthy(options, `${fnTag} arg options`); + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-subscription-info-v1-endpoint-.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-subscription-info-v1-endpoint-.ts new file mode 100644 index 00000000000..a15f56e9425 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/main/typescript/web-services/get-subscription-info-v1-endpoint-.ts @@ -0,0 +1,100 @@ +import { Express, Request, Response } from "express"; + +import { + Logger, + Checks, + LogLevelDesc, + LoggerProvider, + IAsyncProvider, +} from "@hyperledger/cactus-common"; +import { + IEndpointAuthzOptions, + IExpressRequestHandler, + IWebServiceEndpoint, +} from "@hyperledger/cactus-core-api"; +import { + handleRestEndpointException, + registerWebServiceEndpoint, +} from "@hyperledger/cactus-core"; + +import { PluginLedgerConnectorChainlink } from "../plugin-ledger-connector-chainlink"; + +import OAS from "../../json/openapi.json"; + +export interface IGetSubscriptionInfoEndpointOptions { + logLevel?: LogLevelDesc; + plugin: PluginLedgerConnectorChainlink; +} + +export class GetSubscriptionInfoEndpoint implements IWebServiceEndpoint { + public static readonly CLASS_NAME = "GetSubscriptionInfoEndpoint"; + + private readonly log: Logger; + + public get className(): string { + return GetSubscriptionInfoEndpoint.CLASS_NAME; + } + + constructor(public readonly opts: IGetSubscriptionInfoEndpointOptions) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(opts, `${fnTag} arg options`); + Checks.truthy(opts.plugin, `${fnTag} arg options.connector`); + + const level = this.opts.logLevel || "INFO"; + const label = this.className; + this.log = LoggerProvider.getOrCreate({ level, label }); + } + + public get oasPath(): (typeof OAS.paths)["/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info"] { + return OAS.paths[ + "/api/v1/plugins/@hyperledger/cacti-plugin-ledger-connector-chainlink/get-subscription-info" + ]; + } + + public getPath(): string { + return this.oasPath.post["x-hyperledger-cacti"].http.path; + } + + public getVerbLowerCase(): string { + return this.oasPath.post["x-hyperledger-cacti"].http.verbLowerCase; + } + + public getOperationId(): string { + return this.oasPath.post.operationId; + } + + getAuthorizationOptionsProvider(): IAsyncProvider { + // TODO: make this an injectable dependency in the constructor + return { + get: async () => ({ + isProtected: true, + requiredRoles: [], + }), + }; + } + + public async registerExpress( + expressApp: Express, + ): Promise { + await registerWebServiceEndpoint(expressApp, this); + return this; + } + + public getExpressRequestHandler(): IExpressRequestHandler { + return this.handleRequest.bind(this); + } + + public async handleRequest(req: Request, res: Response): Promise { + const reqTag = `${this.getVerbLowerCase()} - ${this.getPath()}`; + this.log.debug(reqTag); + const { body } = req; + try { + const res = await this.opts.plugin.getSubscriptionInfoV1(body); + res.json(res); + } catch (ex) { + const { log } = this; + const errorMsg = "Failed to get Chainlink subscription info."; + await handleRestEndpointException({ log, error: ex, errorMsg, res }); + } + } +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.json b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.json new file mode 100644 index 00000000000..286294b9964 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.json @@ -0,0 +1,5619 @@ +{ + "contractName": "HelloWorld", + "abi": [ + { + "inputs": [], + "name": "sayHello", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getNameByIndex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.0+commit.c7dfd78e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getNameByIndex\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sayHello\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol\":\"HelloWorld\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol\":{\"keccak256\":\"0x1e97027d32e8c3433b793d7b2b45e30ea2d341c96a3943508ba068dea106efab\",\"urls\":[\"bzz-raw://96e37a0bb119b1fe14a4e71627c077b180f4deb9acc4284aa987a3ca1a6f45b1\",\"dweb:/ipfs/QmTAiGsxb38hMgDgbrtLLdYxc76CposiN9moBuJXAg2Mgk\"]}},\"version\":1}", + "bytecode": "60806040526040518060400160405280600d81526020017f4361707461696e436163747573000000000000000000000000000000000000008152506000908051906020019061004f929190610062565b5034801561005c57600080fd5b50610166565b82805461006e90610105565b90600052602060002090601f01602090048101928261009057600085556100d7565b82601f106100a957805160ff19168380011785556100d7565b828001600101855582156100d7579182015b828111156100d65782518255916020019190600101906100bb565b5b5090506100e491906100e8565b5090565b5b808211156101015760008160009055506001016100e9565b5090565b6000600282049050600182168061011d57607f821691505b6020821081141561013157610130610137565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b61082c806101756000396000f3fe60806040526004361061004a5760003560e01c806317d7de7c1461004f57806359c293f11461007a578063c47f0027146100b7578063d0e30db0146100e0578063ef5fb05b146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906105ae565b60405180910390f35b34801561008657600080fd5b506100a1600480360381019061009c919061050c565b6101a7565b6040516100ae91906105ae565b60405180910390f35b3480156100c357600080fd5b506100de60048036038101906100d991906104cb565b61027d565b005b6100e86102d3565b005b3480156100f657600080fd5b506100ff61036e565b60405161010c91906105ae565b60405180910390f35b6060600080546101249061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546101509061070f565b801561019d5780601f106101725761010080835404028352916020019161019d565b820191906000526020600020905b81548152906001019060200180831161018057829003601f168201915b5050505050905090565b6060600282815481106101e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200180546101f89061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546102249061070f565b80156102715780601f1061024657610100808354040283529160200191610271565b820191906000526020600020905b81548152906001019060200180831161025457829003601f168201915b50505050509050919050565b80600090805190602001906102939291906103ab565b506002819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906102cf9291906103ab565b5050565b60003411610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030d906105d0565b60405180910390fd5b34600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610365919061066d565b92505081905550565b60606040518060400160405280600c81526020017f48656c6c6f20576f726c64210000000000000000000000000000000000000000815250905090565b8280546103b79061070f565b90600052602060002090601f0160209004810192826103d95760008555610420565b82601f106103f257805160ff1916838001178555610420565b82800160010185558215610420579182015b8281111561041f578251825591602001919060010190610404565b5b50905061042d9190610431565b5090565b5b8082111561044a576000816000905550600101610432565b5090565b600061046161045c84610621565b6105f0565b90508281526020810184848401111561047957600080fd5b6104848482856106cd565b509392505050565b600082601f83011261049d57600080fd5b81356104ad84826020860161044e565b91505092915050565b6000813590506104c5816107df565b92915050565b6000602082840312156104dd57600080fd5b600082013567ffffffffffffffff8111156104f757600080fd5b6105038482850161048c565b91505092915050565b60006020828403121561051e57600080fd5b600061052c848285016104b6565b91505092915050565b600061054082610651565b61054a818561065c565b935061055a8185602086016106dc565b610563816107ce565b840191505092915050565b600061057b601b8361065c565b91507f56616c7565206d757374206265206469666572656e74206f66203000000000006000830152602082019050919050565b600060208201905081810360008301526105c88184610535565b905092915050565b600060208201905081810360008301526105e98161056e565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156106175761061661079f565b5b8060405250919050565b600067ffffffffffffffff82111561063c5761063b61079f565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000610678826106c3565b9150610683836106c3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106b8576106b7610741565b5b828201905092915050565b6000819050919050565b82818337600083830152505050565b60005b838110156106fa5780820151818401526020810190506106df565b83811115610709576000848401525b50505050565b6000600282049050600182168061072757607f821691505b6020821081141561073b5761073a610770565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6107e8816106c3565b81146107f357600080fd5b5056fea2646970667358221220450aa5d16069485df7d037ffe43b6593e232f4ac514d9169ba271384cc5d841964736f6c63430008000033", + "deployedBytecode": "60806040526004361061004a5760003560e01c806317d7de7c1461004f57806359c293f11461007a578063c47f0027146100b7578063d0e30db0146100e0578063ef5fb05b146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906105ae565b60405180910390f35b34801561008657600080fd5b506100a1600480360381019061009c919061050c565b6101a7565b6040516100ae91906105ae565b60405180910390f35b3480156100c357600080fd5b506100de60048036038101906100d991906104cb565b61027d565b005b6100e86102d3565b005b3480156100f657600080fd5b506100ff61036e565b60405161010c91906105ae565b60405180910390f35b6060600080546101249061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546101509061070f565b801561019d5780601f106101725761010080835404028352916020019161019d565b820191906000526020600020905b81548152906001019060200180831161018057829003601f168201915b5050505050905090565b6060600282815481106101e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200180546101f89061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546102249061070f565b80156102715780601f1061024657610100808354040283529160200191610271565b820191906000526020600020905b81548152906001019060200180831161025457829003601f168201915b50505050509050919050565b80600090805190602001906102939291906103ab565b506002819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906102cf9291906103ab565b5050565b60003411610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030d906105d0565b60405180910390fd5b34600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610365919061066d565b92505081905550565b60606040518060400160405280600c81526020017f48656c6c6f20576f726c64210000000000000000000000000000000000000000815250905090565b8280546103b79061070f565b90600052602060002090601f0160209004810192826103d95760008555610420565b82601f106103f257805160ff1916838001178555610420565b82800160010185558215610420579182015b8281111561041f578251825591602001919060010190610404565b5b50905061042d9190610431565b5090565b5b8082111561044a576000816000905550600101610432565b5090565b600061046161045c84610621565b6105f0565b90508281526020810184848401111561047957600080fd5b6104848482856106cd565b509392505050565b600082601f83011261049d57600080fd5b81356104ad84826020860161044e565b91505092915050565b6000813590506104c5816107df565b92915050565b6000602082840312156104dd57600080fd5b600082013567ffffffffffffffff8111156104f757600080fd5b6105038482850161048c565b91505092915050565b60006020828403121561051e57600080fd5b600061052c848285016104b6565b91505092915050565b600061054082610651565b61054a818561065c565b935061055a8185602086016106dc565b610563816107ce565b840191505092915050565b600061057b601b8361065c565b91507f56616c7565206d757374206265206469666572656e74206f66203000000000006000830152602082019050919050565b600060208201905081810360008301526105c88184610535565b905092915050565b600060208201905081810360008301526105e98161056e565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156106175761061661079f565b5b8060405250919050565b600067ffffffffffffffff82111561063c5761063b61079f565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000610678826106c3565b9150610683836106c3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106b8576106b7610741565b5b828201905092915050565b6000819050919050565b82818337600083830152505050565b60005b838110156106fa5780820151818401526020810190506106df565b83811115610709576000848401525b50505050565b6000600282049050600182168061072757607f821691505b6020821081141561073b5761073a610770565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6107e8816106c3565b81146107f357600080fd5b5056fea2646970667358221220450aa5d16069485df7d037ffe43b6593e232f4ac514d9169ba271384cc5d841964736f6c63430008000033", + "immutableReferences": {}, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:516:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "58:269:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "68:22:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "82:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "88:1:2", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "78:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "78:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "68:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "99:38:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "129:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "135:1:2", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "125:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "125:12:2" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "103:18:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "176:51:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "190:27:2", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "204:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "212:4:2", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "200:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "200:17:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "190:6:2" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "156:18:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "149:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "149:26:2" + }, + "nodeType": "YulIf", + "src": "146:2:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "279:42:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "293:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "293:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "293:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "243:18:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "266:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "274:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "263:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "263:14:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "240:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "240:38:2" + }, + "nodeType": "YulIf", + "src": "237:2:2" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "42:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "51:6:2", + "type": "" + } + ], + "src": "7:320:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "361:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "378:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "381:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "371:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "371:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "371:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "475:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "478:4:2", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "468:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "468:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "468:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "499:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "502:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "492:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "492:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "492:15:2" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "333:180:2" + } + ] + }, + "contents": "{\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n}\n", + "id": 2, + "language": "Yul", + "name": "#utility.yul" + } + ], + "deployedGeneratedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:5780:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "91:260:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "101:74:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "167:6:2" + } + ], + "functionName": { + "name": "array_allocation_size_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "125:41:2" + }, + "nodeType": "YulFunctionCall", + "src": "125:49:2" + } + ], + "functionName": { + "name": "allocateMemory", + "nodeType": "YulIdentifier", + "src": "110:14:2" + }, + "nodeType": "YulFunctionCall", + "src": "110:65:2" + }, + "variableNames": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "101:5:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "191:5:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "198:6:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "184:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "184:21:2" + }, + "nodeType": "YulExpressionStatement", + "src": "184:21:2" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "214:27:2", + "value": { + "arguments": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "229:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "236:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "225:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "225:16:2" + }, + "variables": [ + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "218:3:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "279:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "288:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "291:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "281:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "281:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "281:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "260:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "265:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "256:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "256:16:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "274:3:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "253:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "253:25:2" + }, + "nodeType": "YulIf", + "src": "250:2:2" + }, + { + "expression": { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "328:3:2" + }, + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "333:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "338:6:2" + } + ], + "functionName": { + "name": "copy_calldata_to_memory", + "nodeType": "YulIdentifier", + "src": "304:23:2" + }, + "nodeType": "YulFunctionCall", + "src": "304:41:2" + }, + "nodeType": "YulExpressionStatement", + "src": "304:41:2" + } + ] + }, + "name": "abi_decode_available_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "64:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "69:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "77:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "array", + "nodeType": "YulTypedName", + "src": "85:5:2", + "type": "" + } + ], + "src": "7:344:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "433:211:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "482:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "491:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "494:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "484:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "484:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "484:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "461:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "469:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "457:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "457:17:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "476:3:2" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "453:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "453:27:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "446:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "446:35:2" + }, + "nodeType": "YulIf", + "src": "443:2:2" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "507:34:2", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "534:6:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "521:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "521:20:2" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "511:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "550:88:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "611:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "619:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "607:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "607:17:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "626:6:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "634:3:2" + } + ], + "functionName": { + "name": "abi_decode_available_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "559:47:2" + }, + "nodeType": "YulFunctionCall", + "src": "559:79:2" + }, + "variableNames": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "550:5:2" + } + ] + } + ] + }, + "name": "abi_decode_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "411:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "419:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "array", + "nodeType": "YulTypedName", + "src": "427:5:2", + "type": "" + } + ], + "src": "371:273:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "702:87:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "712:29:2", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "734:6:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "721:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "721:20:2" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "712:5:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "777:5:2" + } + ], + "functionName": { + "name": "validator_revert_t_uint256", + "nodeType": "YulIdentifier", + "src": "750:26:2" + }, + "nodeType": "YulFunctionCall", + "src": "750:33:2" + }, + "nodeType": "YulExpressionStatement", + "src": "750:33:2" + } + ] + }, + "name": "abi_decode_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "680:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "688:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "696:5:2", + "type": "" + } + ], + "src": "650:139:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "871:299:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "917:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "926:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "929:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "919:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "919:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "919:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "892:7:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "901:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "888:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "888:23:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "913:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "884:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "884:32:2" + }, + "nodeType": "YulIf", + "src": "881:2:2" + }, + { + "nodeType": "YulBlock", + "src": "943:220:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "958:45:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "989:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1000:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "985:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "985:17:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "972:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "972:31:2" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "962:6:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1050:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1059:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1062:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1052:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "1052:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1052:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1022:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1030:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1019:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "1019:30:2" + }, + "nodeType": "YulIf", + "src": "1016:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "1080:73:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1125:9:2" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1136:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1121:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1121:22:2" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1145:7:2" + } + ], + "functionName": { + "name": "abi_decode_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "1090:30:2" + }, + "nodeType": "YulFunctionCall", + "src": "1090:63:2" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1080:6:2" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "841:9:2", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "852:7:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "864:6:2", + "type": "" + } + ], + "src": "795:375:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1242:196:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1288:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1297:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1300:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1290:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "1290:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1290:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1263:7:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1272:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1259:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1259:23:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1284:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1255:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1255:32:2" + }, + "nodeType": "YulIf", + "src": "1252:2:2" + }, + { + "nodeType": "YulBlock", + "src": "1314:117:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1329:15:2", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1343:1:2", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "1333:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1358:63:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1393:9:2" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1404:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1389:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1389:22:2" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1413:7:2" + } + ], + "functionName": { + "name": "abi_decode_t_uint256", + "nodeType": "YulIdentifier", + "src": "1368:20:2" + }, + "nodeType": "YulFunctionCall", + "src": "1368:53:2" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1358:6:2" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1212:9:2", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1223:7:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1235:6:2", + "type": "" + } + ], + "src": "1176:262:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1536:272:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1546:53:2", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1593:5:2" + } + ], + "functionName": { + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "1560:32:2" + }, + "nodeType": "YulFunctionCall", + "src": "1560:39:2" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "1550:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1608:78:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1674:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1679:6:2" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "1615:58:2" + }, + "nodeType": "YulFunctionCall", + "src": "1615:71:2" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1608:3:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1721:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1728:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1717:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1717:16:2" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1735:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1740:6:2" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "1695:21:2" + }, + "nodeType": "YulFunctionCall", + "src": "1695:52:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1695:52:2" + }, + { + "nodeType": "YulAssignment", + "src": "1756:46:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1767:3:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1794:6:2" + } + ], + "functionName": { + "name": "round_up_to_mul_of_32", + "nodeType": "YulIdentifier", + "src": "1772:21:2" + }, + "nodeType": "YulFunctionCall", + "src": "1772:29:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1763:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1763:39:2" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "1756:3:2" + } + ] + } + ] + }, + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1517:5:2", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "1524:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "1532:3:2", + "type": "" + } + ], + "src": "1444:364:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1960:179:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1970:74:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2036:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2041:2:2", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "1977:58:2" + }, + "nodeType": "YulFunctionCall", + "src": "1977:67:2" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1970:3:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2065:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2070:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2061:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2061:11:2" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "2074:29:2", + "type": "", + "value": "Value must be diferent of 0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2054:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2054:50:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2054:50:2" + }, + { + "nodeType": "YulAssignment", + "src": "2114:19:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2125:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2130:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2121:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2121:12:2" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "2114:3:2" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "1948:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "1956:3:2", + "type": "" + } + ], + "src": "1814:325:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2263:195:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2273:26:2", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2285:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2296:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2281:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2281:18:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2273:4:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2320:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2331:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2316:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2316:17:2" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2339:4:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2345:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2335:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2335:20:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2309:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2309:47:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2309:47:2" + }, + { + "nodeType": "YulAssignment", + "src": "2365:86:2", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2437:6:2" + }, + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2446:4:2" + } + ], + "functionName": { + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "2373:63:2" + }, + "nodeType": "YulFunctionCall", + "src": "2373:78:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2365:4:2" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2235:9:2", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2247:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "2258:4:2", + "type": "" + } + ], + "src": "2145:313:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2635:248:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2645:26:2", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2657:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2668:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2653:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2653:18:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2645:4:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2692:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2703:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2688:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2688:17:2" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2711:4:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2717:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2707:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2707:20:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2681:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2681:47:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2681:47:2" + }, + { + "nodeType": "YulAssignment", + "src": "2737:139:2", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2871:4:2" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "2745:124:2" + }, + "nodeType": "YulFunctionCall", + "src": "2745:131:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2737:4:2" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2615:9:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "2630:4:2", + "type": "" + } + ], + "src": "2464:419:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2929:243:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2939:19:2", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2955:2:2", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "2949:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "2949:9:2" + }, + "variableNames": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "2939:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2967:35:2", + "value": { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "2989:6:2" + }, + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "2997:4:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2985:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2985:17:2" + }, + "variables": [ + { + "name": "newFreePtr", + "nodeType": "YulTypedName", + "src": "2971:10:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3113:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "3115:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "3115:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3115:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3056:10:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3068:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3053:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3053:34:2" + }, + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3092:10:2" + }, + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "3104:6:2" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "3089:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3089:22:2" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "3050:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3050:62:2" + }, + "nodeType": "YulIf", + "src": "3047:2:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3151:2:2", + "type": "", + "value": "64" + }, + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3155:10:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3144:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "3144:22:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3144:22:2" + } + ] + }, + "name": "allocateMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "size", + "nodeType": "YulTypedName", + "src": "2913:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "2922:6:2", + "type": "" + } + ], + "src": "2889:283:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3245:265:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3350:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "3352:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "3352:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3352:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3322:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3330:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3319:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3319:30:2" + }, + "nodeType": "YulIf", + "src": "3316:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "3402:41:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3418:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3426:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3414:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3414:17:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3437:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "3433:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3433:9:2" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3410:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3410:33:2" + }, + "variableNames": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3402:4:2" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3480:23:2", + "value": { + "arguments": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3492:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3498:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3488:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3488:15:2" + }, + "variableNames": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3480:4:2" + } + ] + } + ] + }, + "name": "array_allocation_size_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3229:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "size", + "nodeType": "YulTypedName", + "src": "3240:4:2", + "type": "" + } + ], + "src": "3178:332:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3575:40:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3586:22:2", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3602:5:2" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3596:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "3596:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3586:6:2" + } + ] + } + ] + }, + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3558:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3568:6:2", + "type": "" + } + ], + "src": "3516:99:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3717:73:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3734:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3739:6:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3727:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "3727:19:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3727:19:2" + }, + { + "nodeType": "YulAssignment", + "src": "3755:29:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3774:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3779:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3770:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3770:14:2" + }, + "variableNames": [ + { + "name": "updated_pos", + "nodeType": "YulIdentifier", + "src": "3755:11:2" + } + ] + } + ] + }, + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3689:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3694:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "updated_pos", + "nodeType": "YulTypedName", + "src": "3705:11:2", + "type": "" + } + ], + "src": "3621:169:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3840:261:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3850:25:2", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3873:1:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "3855:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "3855:20:2" + }, + "variableNames": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3850:1:2" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3884:25:2", + "value": { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "3907:1:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "3889:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "3889:20:2" + }, + "variableNames": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "3884:1:2" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4047:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "4049:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "4049:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4049:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3968:1:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3975:66:2", + "type": "", + "value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "4043:1:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3971:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3971:74:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3965:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3965:81:2" + }, + "nodeType": "YulIf", + "src": "3962:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "4079:16:2", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "4090:1:2" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "4093:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4086:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4086:9:2" + }, + "variableNames": [ + { + "name": "sum", + "nodeType": "YulIdentifier", + "src": "4079:3:2" + } + ] + } + ] + }, + "name": "checked_add_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "3827:1:2", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "3830:1:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "sum", + "nodeType": "YulTypedName", + "src": "3836:3:2", + "type": "" + } + ], + "src": "3796:305:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4152:32:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4162:16:2", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "4173:5:2" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "4162:7:2" + } + ] + } + ] + }, + "name": "cleanup_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "4134:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "4144:7:2", + "type": "" + } + ], + "src": "4107:77:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4241:103:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4264:3:2" + }, + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4269:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4274:6:2" + } + ], + "functionName": { + "name": "calldatacopy", + "nodeType": "YulIdentifier", + "src": "4251:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "4251:30:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4251:30:2" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4322:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4327:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4318:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4318:16:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4336:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4311:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4311:27:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4311:27:2" + } + ] + }, + "name": "copy_calldata_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "4223:3:2", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "4228:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4233:6:2", + "type": "" + } + ], + "src": "4190:154:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4399:258:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4409:10:2", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4418:1:2", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "4413:1:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4478:63:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4503:3:2" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4508:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4499:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4499:11:2" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4522:3:2" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4527:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4518:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4518:11:2" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4512:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "4512:18:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4492:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4492:39:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4492:39:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4439:1:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4442:6:2" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4436:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4436:13:2" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "4450:19:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4452:15:2", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4461:1:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4464:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4457:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4457:10:2" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4452:1:2" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "4432:3:2", + "statements": [] + }, + "src": "4428:113:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4575:76:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4625:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4630:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4621:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4621:16:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4639:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4614:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4614:27:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4614:27:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4556:1:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4559:6:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "4553:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4553:13:2" + }, + "nodeType": "YulIf", + "src": "4550:2:2" + } + ] + }, + "name": "copy_memory_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "4381:3:2", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "4386:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4391:6:2", + "type": "" + } + ], + "src": "4350:307:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4714:269:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4724:22:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "4738:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4744:1:2", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "4734:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4734:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4724:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4755:38:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "4785:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4791:1:2", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4781:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4781:12:2" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "4759:18:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4832:51:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4846:27:2", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4860:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4868:4:2", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4856:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4856:17:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4846:6:2" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "4812:18:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "4805:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4805:26:2" + }, + "nodeType": "YulIf", + "src": "4802:2:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4935:42:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "4949:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "4949:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4949:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "4899:18:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4922:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4930:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4919:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4919:14:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "4896:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4896:38:2" + }, + "nodeType": "YulIf", + "src": "4893:2:2" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "4698:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4707:6:2", + "type": "" + } + ], + "src": "4663:320:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5017:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5034:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5037:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5027:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5027:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5027:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5131:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5134:4:2", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5124:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5124:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5124:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5155:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5158:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5148:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5148:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5148:15:2" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "4989:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5203:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5220:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5223:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5213:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5213:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5213:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5317:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5320:4:2", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5310:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5310:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5310:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5341:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5344:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5334:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5334:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5334:15:2" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "5175:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5389:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5406:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5409:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5399:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5399:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5399:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5503:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5506:4:2", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5496:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5496:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5496:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5527:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5530:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5520:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5520:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5520:15:2" + } + ] + }, + "name": "panic_error_0x41", + "nodeType": "YulFunctionDefinition", + "src": "5361:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5595:54:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5605:38:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5623:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5630:2:2", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5619:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5619:14:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5639:2:2", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "5635:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5635:7:2" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "5615:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5615:28:2" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "5605:6:2" + } + ] + } + ] + }, + "name": "round_up_to_mul_of_32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5578:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "5588:6:2", + "type": "" + } + ], + "src": "5547:102:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5698:79:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5755:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5764:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5767:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5757:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5757:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5757:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5721:5:2" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5746:5:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "5728:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "5728:24:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "5718:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "5718:35:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "5711:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5711:43:2" + }, + "nodeType": "YulIf", + "src": "5708:2:2" + } + ] + }, + "name": "validator_revert_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5691:5:2", + "type": "" + } + ], + "src": "5655:122:2" + } + ] + }, + "contents": "{\n\n function abi_decode_available_length_t_string_memory_ptr(src, length, end) -> array {\n array := allocateMemory(array_allocation_size_t_string_memory_ptr(length))\n mstore(array, length)\n let dst := add(array, 0x20)\n if gt(add(src, length), end) { revert(0, 0) }\n copy_calldata_to_memory(src, dst, length)\n }\n\n // string\n function abi_decode_t_string_memory_ptr(offset, end) -> array {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n let length := calldataload(offset)\n array := abi_decode_available_length_t_string_memory_ptr(add(offset, 0x20), length, end)\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_string_memory_ptr(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n\n value0 := abi_decode_t_string_memory_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 27)\n\n mstore(add(pos, 0), \"Value must be diferent of 0\")\n\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n }\n\n function abi_encode_tuple_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function allocateMemory(size) -> memPtr {\n memPtr := mload(64)\n let newFreePtr := add(memPtr, size)\n // protect against overflow\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n\n function array_allocation_size_t_string_memory_ptr(length) -> size {\n // Make sure we can allocate memory without overflow\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n\n // round up\n size := and(add(length, 0x1f), not(0x1f))\n\n // add length slot\n size := add(size, 0x20)\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function checked_add_t_uint256(x, y) -> sum {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n\n // overflow, if x > (maxValue - y)\n if gt(x, sub(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, y)) { panic_error_0x11() }\n\n sum := add(x, y)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function copy_calldata_to_memory(src, dst, length) {\n calldatacopy(dst, src, length)\n // clear end\n mstore(add(dst, length), 0)\n }\n\n function copy_memory_to_memory(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length)\n {\n // clear end\n mstore(add(dst, length), 0)\n }\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n}\n", + "id": 2, + "language": "Yul", + "name": "#utility.yul" + } + ], + "sourceMap": "439:671:0:-:0;;;463:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;439:671;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:320:2:-;;88:1;82:4;78:12;68:22;;135:1;129:4;125:12;156:18;146:2;;212:4;204:6;200:17;190:27;;146:2;274;266:6;263:14;243:18;240:38;237:2;;;293:18;;:::i;:::-;237:2;58:269;;;;:::o;333:180::-;381:77;378:1;371:88;478:4;475:1;468:15;502:4;499:1;492:15;439:671:0;;;;;;;", + "deployedSourceMap": "439:671:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;666:81;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;751:109;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;864:103;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;971:137;;;:::i;:::-;;573:89;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;666:81;706:13;738:4;731:11;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;666:81;:::o;751:109::-;811:13;843:5;849;843:12;;;;;;;;;;;;;;;;;;;;;;;836:19;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;751:109;;;:::o;864:103::-;928:7;921:4;:14;;;;;;;;;;;;:::i;:::-;;943:5;954:7;943:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;864:103;:::o;971:137::-;1031:1;1019:9;:13;1011:53;;;;;;;;;;;;:::i;:::-;;;;;;;;;1094:9;1070:8;:20;1079:10;1070:20;;;;;;;;;;;;;;;;:33;;;;;;;:::i;:::-;;;;;;;;971:137::o;573:89::-;615:13;636:21;;;;;;;;;;;;;;;;;;;573:89;:::o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:344:2:-;;110:65;125:49;167:6;125:49;:::i;:::-;110:65;:::i;:::-;101:74;;198:6;191:5;184:21;236:4;229:5;225:16;274:3;265:6;260:3;256:16;253:25;250:2;;;291:1;288;281:12;250:2;304:41;338:6;333:3;328;304:41;:::i;:::-;91:260;;;;;;:::o;371:273::-;;476:3;469:4;461:6;457:17;453:27;443:2;;494:1;491;484:12;443:2;534:6;521:20;559:79;634:3;626:6;619:4;611:6;607:17;559:79;:::i;:::-;550:88;;433:211;;;;;:::o;650:139::-;;734:6;721:20;712:29;;750:33;777:5;750:33;:::i;:::-;702:87;;;;:::o;795:375::-;;913:2;901:9;892:7;888:23;884:32;881:2;;;929:1;926;919:12;881:2;1000:1;989:9;985:17;972:31;1030:18;1022:6;1019:30;1016:2;;;1062:1;1059;1052:12;1016:2;1090:63;1145:7;1136:6;1125:9;1121:22;1090:63;:::i;:::-;1080:73;;943:220;871:299;;;;:::o;1176:262::-;;1284:2;1272:9;1263:7;1259:23;1255:32;1252:2;;;1300:1;1297;1290:12;1252:2;1343:1;1368:53;1413:7;1404:6;1393:9;1389:22;1368:53;:::i;:::-;1358:63;;1314:117;1242:196;;;;:::o;1444:364::-;;1560:39;1593:5;1560:39;:::i;:::-;1615:71;1679:6;1674:3;1615:71;:::i;:::-;1608:78;;1695:52;1740:6;1735:3;1728:4;1721:5;1717:16;1695:52;:::i;:::-;1772:29;1794:6;1772:29;:::i;:::-;1767:3;1763:39;1756:46;;1536:272;;;;;:::o;1814:325::-;;1977:67;2041:2;2036:3;1977:67;:::i;:::-;1970:74;;2074:29;2070:1;2065:3;2061:11;2054:50;2130:2;2125:3;2121:12;2114:19;;1960:179;;;:::o;2145:313::-;;2296:2;2285:9;2281:18;2273:26;;2345:9;2339:4;2335:20;2331:1;2320:9;2316:17;2309:47;2373:78;2446:4;2437:6;2373:78;:::i;:::-;2365:86;;2263:195;;;;:::o;2464:419::-;;2668:2;2657:9;2653:18;2645:26;;2717:9;2711:4;2707:20;2703:1;2692:9;2688:17;2681:47;2745:131;2871:4;2745:131;:::i;:::-;2737:139;;2635:248;;;:::o;2889:283::-;;2955:2;2949:9;2939:19;;2997:4;2989:6;2985:17;3104:6;3092:10;3089:22;3068:18;3056:10;3053:34;3050:62;3047:2;;;3115:18;;:::i;:::-;3047:2;3155:10;3151:2;3144:22;2929:243;;;;:::o;3178:332::-;;3330:18;3322:6;3319:30;3316:2;;;3352:18;;:::i;:::-;3316:2;3437:4;3433:9;3426:4;3418:6;3414:17;3410:33;3402:41;;3498:4;3492;3488:15;3480:23;;3245:265;;;:::o;3516:99::-;;3602:5;3596:12;3586:22;;3575:40;;;:::o;3621:169::-;;3739:6;3734:3;3727:19;3779:4;3774:3;3770:14;3755:29;;3717:73;;;;:::o;3796:305::-;;3855:20;3873:1;3855:20;:::i;:::-;3850:25;;3889:20;3907:1;3889:20;:::i;:::-;3884:25;;4043:1;3975:66;3971:74;3968:1;3965:81;3962:2;;;4049:18;;:::i;:::-;3962:2;4093:1;4090;4086:9;4079:16;;3840:261;;;;:::o;4107:77::-;;4173:5;4162:16;;4152:32;;;:::o;4190:154::-;4274:6;4269:3;4264;4251:30;4336:1;4327:6;4322:3;4318:16;4311:27;4241:103;;;:::o;4350:307::-;4418:1;4428:113;4442:6;4439:1;4436:13;4428:113;;;4527:1;4522:3;4518:11;4512:18;4508:1;4503:3;4499:11;4492:39;4464:2;4461:1;4457:10;4452:15;;4428:113;;;4559:6;4556:1;4553:13;4550:2;;;4639:1;4630:6;4625:3;4621:16;4614:27;4550:2;4399:258;;;;:::o;4663:320::-;;4744:1;4738:4;4734:12;4724:22;;4791:1;4785:4;4781:12;4812:18;4802:2;;4868:4;4860:6;4856:17;4846:27;;4802:2;4930;4922:6;4919:14;4899:18;4896:38;4893:2;;;4949:18;;:::i;:::-;4893:2;4714:269;;;;:::o;4989:180::-;5037:77;5034:1;5027:88;5134:4;5131:1;5124:15;5158:4;5155:1;5148:15;5175:180;5223:77;5220:1;5213:88;5320:4;5317:1;5310:15;5344:4;5341:1;5334:15;5361:180;5409:77;5406:1;5399:88;5506:4;5503:1;5496:15;5530:4;5527:1;5520:15;5547:102;;5639:2;5635:7;5630:2;5623:5;5619:14;5615:28;5605:38;;5595:54;;;:::o;5655:122::-;5728:24;5746:5;5728:24;:::i;:::-;5721:5;5718:35;5708:2;;5767:1;5764;5757:12;5708:2;5698:79;:::o", + "source": "// *****************************************************************************\n// IMPORTANT: If you update this code then make sure to recompile\n// it and update the .json file as well so that they\n// remain in sync for consistent test executions.\n// With that said, there shouldn't be any reason to recompile this, like ever...\n// *****************************************************************************\n\npragma solidity >=0.7.0;\n\ncontract HelloWorld {\n string private name = \"CaptainCactus\";\n mapping (address => uint256) deposits;\n string[] private names; \n\n function sayHello () public pure returns (string memory) {\n return 'Hello World!';\n }\n\n function getName() public view returns (string memory)\n {\n return name;\n }\n\n function getNameByIndex(uint256 index) public view returns (string memory)\n {\n return names[index];\n }\n\n function setName(string memory newName) public\n {\n name = newName;\n names.push(newName);\n }\n\n function deposit() public payable {\n require(msg.value > 0, \"Value must be diferent of 0\");\n deposits[msg.sender] += msg.value;\n }\n}\n", + "sourcePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "ast": { + "absolutePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "exportedSymbols": { + "HelloWorld": [ + 76 + ] + }, + "id": 77, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.7", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "413:24:0" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 76, + "linearizedBaseContracts": [ + 76 + ], + "name": "HelloWorld", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "name", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "463:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 2, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "463:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": { + "hexValue": "4361707461696e436163747573", + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "485:15:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bdd2f21877c99489ddcc32737686677f40d460368c7982ce22ce4f72b41b0312", + "typeString": "literal_string \"CaptainCactus\"" + }, + "value": "CaptainCactus" + }, + "visibility": "private" + }, + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "deposits", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "504:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "typeName": { + "id": 7, + "keyType": { + "id": 5, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "513:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "504:28:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "valueType": { + "id": 6, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "524:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "names", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "545:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string[]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "545:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "id": 10, + "nodeType": "ArrayTypeName", + "src": "545:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage_ptr", + "typeString": "string[]" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 18, + "nodeType": "Block", + "src": "630:32:0", + "statements": [ + { + "expression": { + "hexValue": "48656c6c6f20576f726c6421", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "643:14:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0", + "typeString": "literal_string \"Hello World!\"" + }, + "value": "Hello World!" + }, + "functionReturnParameters": 15, + "id": 17, + "nodeType": "Return", + "src": "636:21:0" + } + ] + }, + "functionSelector": "ef5fb05b", + "id": 19, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sayHello", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [], + "src": "591:2:0" + }, + "returnParameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 14, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "615:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 13, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "614:15:0" + }, + "scope": 76, + "src": "573:89:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 26, + "nodeType": "Block", + "src": "723:24:0", + "statements": [ + { + "expression": { + "id": 24, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "738:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 23, + "id": 25, + "nodeType": "Return", + "src": "731:11:0" + } + ] + }, + "functionSelector": "17d7de7c", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 20, + "nodeType": "ParameterList", + "parameters": [], + "src": "682:2:0" + }, + "returnParameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 22, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "706:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 21, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "706:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "705:15:0" + }, + "scope": 76, + "src": "666:81:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 38, + "nodeType": "Block", + "src": "828:32:0", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 34, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "843:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 36, + "indexExpression": { + "id": 35, + "name": "index", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "849:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "843:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 33, + "id": 37, + "nodeType": "Return", + "src": "836:19:0" + } + ] + }, + "functionSelector": "59c293f1", + "id": 39, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getNameByIndex", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 29, + "mutability": "mutable", + "name": "index", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "775:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "775:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "774:15:0" + }, + "returnParameters": { + "id": 33, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "811:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 31, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "811:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "810:15:0" + }, + "scope": 76, + "src": "751:109:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "913:54:0", + "statements": [ + { + "expression": { + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "928:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "921:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 47, + "nodeType": "ExpressionStatement", + "src": "921:14:0" + }, + { + "expression": { + "arguments": [ + { + "id": 51, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "954:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 48, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "943:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "src": "943:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_string_storage_$returns$__$", + "typeString": "function (string storage ref)" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "943:19:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "943:19:0" + } + ] + }, + "functionSelector": "c47f0027", + "id": 55, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 41, + "mutability": "mutable", + "name": "newName", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "881:21:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "881:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "880:23:0" + }, + "returnParameters": { + "id": 43, + "nodeType": "ParameterList", + "parameters": [], + "src": "913:0:0" + }, + "scope": 76, + "src": "864:103:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 74, + "nodeType": "Block", + "src": "1005:103:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 59, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1019:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1019:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1019:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "56616c7565206d757374206265206469666572656e74206f662030", + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1034:29:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + }, + "value": "Value must be diferent of 0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + } + ], + "id": 58, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1011:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 64, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1011:53:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 65, + "nodeType": "ExpressionStatement", + "src": "1011:53:0" + }, + { + "expression": { + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 66, + "name": "deposits", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1070:8:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 69, + "indexExpression": { + "expression": { + "id": 67, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1079:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "1079:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1070:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 70, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1094:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1094:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1070:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "1070:33:0" + } + ] + }, + "functionSelector": "d0e30db0", + "id": 75, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deposit", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 56, + "nodeType": "ParameterList", + "parameters": [], + "src": "987:2:0" + }, + "returnParameters": { + "id": 57, + "nodeType": "ParameterList", + "parameters": [], + "src": "1005:0:0" + }, + "scope": 76, + "src": "971:137:0", + "stateMutability": "payable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 77, + "src": "439:671:0" + } + ], + "src": "413:698:0" + }, + "legacyAST": { + "absolutePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "exportedSymbols": { + "HelloWorld": [ + 76 + ] + }, + "id": 77, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.7", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "413:24:0" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 76, + "linearizedBaseContracts": [ + 76 + ], + "name": "HelloWorld", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "name", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "463:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 2, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "463:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": { + "hexValue": "4361707461696e436163747573", + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "485:15:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bdd2f21877c99489ddcc32737686677f40d460368c7982ce22ce4f72b41b0312", + "typeString": "literal_string \"CaptainCactus\"" + }, + "value": "CaptainCactus" + }, + "visibility": "private" + }, + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "deposits", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "504:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "typeName": { + "id": 7, + "keyType": { + "id": 5, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "513:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "504:28:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "valueType": { + "id": 6, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "524:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "names", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "545:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string[]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "545:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "id": 10, + "nodeType": "ArrayTypeName", + "src": "545:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage_ptr", + "typeString": "string[]" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 18, + "nodeType": "Block", + "src": "630:32:0", + "statements": [ + { + "expression": { + "hexValue": "48656c6c6f20576f726c6421", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "643:14:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0", + "typeString": "literal_string \"Hello World!\"" + }, + "value": "Hello World!" + }, + "functionReturnParameters": 15, + "id": 17, + "nodeType": "Return", + "src": "636:21:0" + } + ] + }, + "functionSelector": "ef5fb05b", + "id": 19, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sayHello", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [], + "src": "591:2:0" + }, + "returnParameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 14, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "615:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 13, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "614:15:0" + }, + "scope": 76, + "src": "573:89:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 26, + "nodeType": "Block", + "src": "723:24:0", + "statements": [ + { + "expression": { + "id": 24, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "738:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 23, + "id": 25, + "nodeType": "Return", + "src": "731:11:0" + } + ] + }, + "functionSelector": "17d7de7c", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 20, + "nodeType": "ParameterList", + "parameters": [], + "src": "682:2:0" + }, + "returnParameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 22, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "706:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 21, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "706:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "705:15:0" + }, + "scope": 76, + "src": "666:81:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 38, + "nodeType": "Block", + "src": "828:32:0", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 34, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "843:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 36, + "indexExpression": { + "id": 35, + "name": "index", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "849:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "843:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 33, + "id": 37, + "nodeType": "Return", + "src": "836:19:0" + } + ] + }, + "functionSelector": "59c293f1", + "id": 39, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getNameByIndex", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 29, + "mutability": "mutable", + "name": "index", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "775:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "775:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "774:15:0" + }, + "returnParameters": { + "id": 33, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "811:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 31, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "811:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "810:15:0" + }, + "scope": 76, + "src": "751:109:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "913:54:0", + "statements": [ + { + "expression": { + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "928:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "921:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 47, + "nodeType": "ExpressionStatement", + "src": "921:14:0" + }, + { + "expression": { + "arguments": [ + { + "id": 51, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "954:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 48, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "943:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "src": "943:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_string_storage_$returns$__$", + "typeString": "function (string storage ref)" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "943:19:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "943:19:0" + } + ] + }, + "functionSelector": "c47f0027", + "id": 55, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 41, + "mutability": "mutable", + "name": "newName", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "881:21:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "881:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "880:23:0" + }, + "returnParameters": { + "id": 43, + "nodeType": "ParameterList", + "parameters": [], + "src": "913:0:0" + }, + "scope": 76, + "src": "864:103:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 74, + "nodeType": "Block", + "src": "1005:103:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 59, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1019:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1019:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1019:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "56616c7565206d757374206265206469666572656e74206f662030", + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1034:29:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + }, + "value": "Value must be diferent of 0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + } + ], + "id": 58, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1011:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 64, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1011:53:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 65, + "nodeType": "ExpressionStatement", + "src": "1011:53:0" + }, + { + "expression": { + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 66, + "name": "deposits", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1070:8:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 69, + "indexExpression": { + "expression": { + "id": 67, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1079:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "1079:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1070:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 70, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1094:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1094:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1070:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "1070:33:0" + } + ] + }, + "functionSelector": "d0e30db0", + "id": 75, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deposit", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 56, + "nodeType": "ParameterList", + "parameters": [], + "src": "987:2:0" + }, + "returnParameters": { + "id": 57, + "nodeType": "ParameterList", + "parameters": [], + "src": "1005:0:0" + }, + "scope": 76, + "src": "971:137:0", + "stateMutability": "payable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 77, + "src": "439:671:0" + } + ], + "src": "413:698:0" + }, + "compiler": { + "name": "solc", + "version": "0.8.0+commit.c7dfd78e.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.3.3", + "updatedAt": "2021-02-12T11:15:58.676Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.sol b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.sol new file mode 100644 index 00000000000..30bc8f71346 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/HelloWorld.sol @@ -0,0 +1,40 @@ +// ***************************************************************************** +// IMPORTANT: If you update this code then make sure to recompile +// it and update the .json file as well so that they +// remain in sync for consistent test executions. +// With that said, there shouldn't be any reason to recompile this, like ever... +// ***************************************************************************** + +pragma solidity >=0.7.0; + +contract HelloWorld { + string private name = "CaptainCactus"; + mapping (address => uint256) deposits; + string[] private names; + + function sayHello () public pure returns (string memory) { + return 'Hello World!'; + } + + function getName() public view returns (string memory) + { + return name; + } + + function getNameByIndex(uint256 index) public view returns (string memory) + { + return names[index]; + } + + function setName(string memory newName) public + { + name = newName; + names.push(newName); + } + + function deposit() public payable { + require(msg.value > 0, "Value must be diferent of 0"); + deposits[msg.sender] += msg.value; + } + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/LockAsset.json b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/LockAsset.json new file mode 100644 index 00000000000..214b7159aa0 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/LockAsset.json @@ -0,0 +1,2007 @@ +{ + "contractName": "LockAsset", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "id", + "type": "string" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "name": "createAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "deleteAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "getAsset", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "creator", + "type": "address" + }, + { + "internalType": "bool", + "name": "isLock", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "size", + "type": "uint256" + } + ], + "internalType": "struct Asset", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "lockAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "id", + "type": "string" + } + ], + "name": "unLockAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.7+commit.e28d00a7\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"id\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"}],\"name\":\"createAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"id\",\"type\":\"string\"}],\"name\":\"deleteAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"id\",\"type\":\"string\"}],\"name\":\"getAsset\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isLock\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"size\",\"type\":\"uint256\"}],\"internalType\":\"struct Asset\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"id\",\"type\":\"string\"}],\"name\":\"lockAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"id\",\"type\":\"string\"}],\"name\":\"unLockAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/jasonwang/cactus-satp-merge/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol\":\"LockAsset\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jasonwang/cactus-satp-merge/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol\":{\"keccak256\":\"0x878fc27f22785593c1b35005ecf333e1f93e6dcf932b3d6e2b24d6be790b996a\",\"urls\":[\"bzz-raw://d8be1567f5e11fb718d8849f4dc9b8a8e467135ecd04c5f796c938b7363daaf2\",\"dweb:/ipfs/QmQuteuiTygZxjDnLiq3GNgJNFmPSRqbE2Q9vm85WgVbox\"]}},\"version\":1}", + "bytecode": "608060405234801561001057600080fd5b50610475806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80635e82d0a61461005c578063cd5286d014610071578063db9cc410146100b5578063def60e0d146100c8578063e24aa37c146100db575b600080fd5b61006f61006a3660046103a1565b6100ee565b005b61008461007f3660046103a1565b610164565b6040805182516001600160a01b03168152602080840151151590820152918101519082015260600160405180910390f35b61006f6100c33660046103e3565b6101dc565b61006f6100d63660046103a1565b610266565b61006f6100e93660046103a1565b6102ad565b6000806000848460405161010392919061042f565b9081526020016040518091039020600101541190508061012257600080fd5b60016000848460405161013692919061042f565b9081526040519081900360200190208054911515600160a01b0260ff60a01b19909216919091179055505050565b60408051606081018252600080825260208201819052918101919091526000838360405161019392919061042f565b908152604080516020928190038301812060608201835280546001600160a01b0381168352600160a01b900460ff16151593820193909352600190920154908201529392505050565b600081116101e957600080fd5b80600084846040516101fc92919061042f565b908152602001604051809103902060010181905550336000848460405161022492919061042f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091556000908190610136908690869061042f565b6000806000848460405161027b92919061042f565b9081526020016040518091039020600101541190508061029a57600080fd5b600080848460405161013692919061042f565b600080600084846040516102c292919061042f565b908152602001604051809103902060010154119050806102e157600080fd5b60008084846040516102f492919061042f565b9081526040519081900360200190205460ff600160a01b9091041690508061031b57600080fd5b6000848460405161032d92919061042f565b90815260405190819003602001902080546001600160a81b0319168155600060019091015550505050565b60008083601f84011261036a57600080fd5b50813567ffffffffffffffff81111561038257600080fd5b60208301915083602082850101111561039a57600080fd5b9250929050565b600080602083850312156103b457600080fd5b823567ffffffffffffffff8111156103cb57600080fd5b6103d785828601610358565b90969095509350505050565b6000806000604084860312156103f857600080fd5b833567ffffffffffffffff81111561040f57600080fd5b61041b86828701610358565b909790965060209590950135949350505050565b818382376000910190815291905056fea26469706673582212203e656ee2af105d66466451b5ca09a2a5780b62c439dd43befb63a10687d2423b64736f6c63430008070033", + "deployedBytecode": "608060405234801561001057600080fd5b50600436106100575760003560e01c80635e82d0a61461005c578063cd5286d014610071578063db9cc410146100b5578063def60e0d146100c8578063e24aa37c146100db575b600080fd5b61006f61006a3660046103a1565b6100ee565b005b61008461007f3660046103a1565b610164565b6040805182516001600160a01b03168152602080840151151590820152918101519082015260600160405180910390f35b61006f6100c33660046103e3565b6101dc565b61006f6100d63660046103a1565b610266565b61006f6100e93660046103a1565b6102ad565b6000806000848460405161010392919061042f565b9081526020016040518091039020600101541190508061012257600080fd5b60016000848460405161013692919061042f565b9081526040519081900360200190208054911515600160a01b0260ff60a01b19909216919091179055505050565b60408051606081018252600080825260208201819052918101919091526000838360405161019392919061042f565b908152604080516020928190038301812060608201835280546001600160a01b0381168352600160a01b900460ff16151593820193909352600190920154908201529392505050565b600081116101e957600080fd5b80600084846040516101fc92919061042f565b908152602001604051809103902060010181905550336000848460405161022492919061042f565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316929092179091556000908190610136908690869061042f565b6000806000848460405161027b92919061042f565b9081526020016040518091039020600101541190508061029a57600080fd5b600080848460405161013692919061042f565b600080600084846040516102c292919061042f565b908152602001604051809103902060010154119050806102e157600080fd5b60008084846040516102f492919061042f565b9081526040519081900360200190205460ff600160a01b9091041690508061031b57600080fd5b6000848460405161032d92919061042f565b90815260405190819003602001902080546001600160a81b0319168155600060019091015550505050565b60008083601f84011261036a57600080fd5b50813567ffffffffffffffff81111561038257600080fd5b60208301915083602082850101111561039a57600080fd5b9250929050565b600080602083850312156103b457600080fd5b823567ffffffffffffffff8111156103cb57600080fd5b6103d785828601610358565b90969095509350505050565b6000806000604084860312156103f857600080fd5b833567ffffffffffffffff81111561040f57600080fd5b61041b86828701610358565b909790965060209590950135949350505050565b818382376000910190815291905056fea26469706673582212203e656ee2af105d66466451b5ca09a2a5780b62c439dd43befb63a10687d2423b64736f6c63430008070033", + "sourceMap": "543:1053:0:-:0;;;;;;;;;;;;;;;;;;;", + "deployedSourceMap": "543:1053:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;946:154;;;;;;:::i;:::-;;:::i;:::-;;798:105;;;;;;:::i;:::-;;:::i;:::-;;;;1753:13:1;;-1:-1:-1;;;;;1749:39:1;1731:58;;1859:4;1847:17;;;1841:24;1834:32;1827:40;1805:20;;;1798:70;1912:17;;;1906:24;1884:20;;;1877:54;1719:2;1704:18;798:105:0;;;;;;;607:188;;;;;;:::i;:::-;;:::i;1144:157::-;;;;;;:::i;:::-;;:::i;1304:289::-;;;;;;:::i;:::-;;:::i;946:154::-;999:16;1034:1;1018:6;1025:2;;1018:10;;;;;;;:::i;:::-;;;;;;;;;;;;;:15;;;:17;999:36;;1051:11;1043:20;;;;;;1091:4;1071:6;1078:2;;1071:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;:24;;;;;-1:-1:-1;;;1071:24:0;-1:-1:-1;;;;1071:24:0;;;;;;;;;-1:-1:-1;;;946:154:0:o;798:105::-;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;888:6:0;895:2;;888:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;881:17;;;;;;;-1:-1:-1;;;;;881:17:0;;;;-1:-1:-1;;;881:17:0;;;;;;;;;;;;;;;;;;;;;;888:10;798:105;-1:-1:-1;;;798:105:0:o;607:188::-;687:1;682:4;:6;674:15;;;;;;714:4;697:6;704:2;;697:10;;;;;;;:::i;:::-;;;;;;;;;;;;;:15;;:21;;;;747:10;726:6;733:2;;726:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;:31;;-1:-1:-1;;;;;726:31:0;;;;-1:-1:-1;;;;;;726:31:0;;;;;;;;;;:18;;;;765:10;;772:2;;;;765:10;:::i;1144:157::-;1199:16;1234:1;1218:6;1225:2;;1218:10;;;;;;;:::i;:::-;;;;;;;;;;;;;:15;;;:17;1199:36;;1251:11;1243:20;;;;;;1291:5;1271:6;1278:2;;1271:10;;;;;;;:::i;1304:289::-;1360:16;1395:1;1379:6;1386:2;;1379:10;;;;;;;:::i;:::-;;;;;;;;;;;;;:15;;;:17;1360:36;;1412:11;1404:20;;;;;;1495:18;1516:6;1523:2;;1516:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;:17;;-1:-1:-1;;;1516:17:0;;;;;-1:-1:-1;1516:17:0;1541:22;;;;;;1578:6;1585:2;;1578:10;;;;;;;:::i;:::-;;;;;;;;;;;;;;1571:17;;-1:-1:-1;;;;;;1571:17:0;;;1578:10;1571:17;;;;;-1:-1:-1;;;;1304:289:0:o;14:348:1:-;66:8;76:6;130:3;123:4;115:6;111:17;107:27;97:55;;148:1;145;138:12;97:55;-1:-1:-1;171:20:1;;214:18;203:30;;200:50;;;246:1;243;236:12;200:50;283:4;275:6;271:17;259:29;;335:3;328:4;319:6;311;307:19;303:30;300:39;297:59;;;352:1;349;342:12;297:59;14:348;;;;;:::o;367:411::-;438:6;446;499:2;487:9;478:7;474:23;470:32;467:52;;;515:1;512;505:12;467:52;555:9;542:23;588:18;580:6;577:30;574:50;;;620:1;617;610:12;574:50;659:59;710:7;701:6;690:9;686:22;659:59;:::i;:::-;737:8;;633:85;;-1:-1:-1;367:411:1;-1:-1:-1;;;;367:411:1:o;783:479::-;863:6;871;879;932:2;920:9;911:7;907:23;903:32;900:52;;;948:1;945;938:12;900:52;988:9;975:23;1021:18;1013:6;1010:30;1007:50;;;1053:1;1050;1043:12;1007:50;1092:59;1143:7;1134:6;1123:9;1119:22;1092:59;:::i;:::-;1170:8;;1066:85;;-1:-1:-1;1252:2:1;1237:18;;;;1224:32;;783:479;-1:-1:-1;;;;783:479:1:o;1267:273::-;1452:6;1444;1439:3;1426:33;1408:3;1478:16;;1503:13;;;1478:16;1267:273;-1:-1:-1;1267:273:1:o", + "sourcePath": "/Users/jasonwang/cactus-satp-merge/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol", + "compiler": { + "name": "solc", + "version": "0.8.7+commit.e28d00a7" + }, + "ast": { + "absolutePath": "/Users/jasonwang/cactus-satp-merge/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol", + "exportedSymbols": { + "Asset": [ + 8 + ], + "LockAsset": [ + 150 + ] + }, + "id": 151, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.7", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "413:24:0" + }, + { + "canonicalName": "Asset", + "id": 8, + "members": [ + { + "constant": false, + "id": 3, + "mutability": "mutable", + "name": "creator", + "nameLocation": "464:7:0", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "456:15:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "456:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 5, + "mutability": "mutable", + "name": "isLock", + "nameLocation": "482:6:0", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "477:11:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 4, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "477:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "mutability": "mutable", + "name": "size", + "nameLocation": "499:4:0", + "nodeType": "VariableDeclaration", + "scope": 8, + "src": "494:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 6, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "494:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "name": "Asset", + "nameLocation": "445:5:0", + "nodeType": "StructDefinition", + "scope": 151, + "src": "438:68:0", + "visibility": "public" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 150, + "linearizedBaseContracts": [ + 150 + ], + "name": "LockAsset", + "nameLocation": "552:9:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 13, + "mutability": "mutable", + "name": "assets", + "nameLocation": "597:6:0", + "nodeType": "VariableDeclaration", + "scope": 150, + "src": "571:32:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string => struct Asset)" + }, + "typeName": { + "id": 12, + "keyType": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "580:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "nodeType": "Mapping", + "src": "571:25:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string => struct Asset)" + }, + "valueType": { + "id": 11, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 10, + "name": "Asset", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8, + "src": "590:5:0" + }, + "referencedDeclaration": 8, + "src": "590:5:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage_ptr", + "typeString": "struct Asset" + } + } + }, + "visibility": "internal" + }, + { + "body": { + "id": 48, + "nodeType": "Block", + "src": "666:129:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 23, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 21, + "name": "size", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "682:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "687:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "682:6:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 20, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "674:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "674:15:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 25, + "nodeType": "ExpressionStatement", + "src": "674:15:0" + }, + { + "expression": { + "id": 31, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "baseExpression": { + "id": 26, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "697:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 28, + "indexExpression": { + "id": 27, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "704:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "697:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 29, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "size", + "nodeType": "MemberAccess", + "referencedDeclaration": 7, + "src": "697:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 30, + "name": "size", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 17, + "src": "714:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "697:21:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 32, + "nodeType": "ExpressionStatement", + "src": "697:21:0" + }, + { + "expression": { + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "baseExpression": { + "id": 33, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "726:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 35, + "indexExpression": { + "id": 34, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "733:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "726:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 36, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "creator", + "nodeType": "MemberAccess", + "referencedDeclaration": 3, + "src": "726:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "expression": { + "id": 37, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "747:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 38, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "747:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "726:31:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 40, + "nodeType": "ExpressionStatement", + "src": "726:31:0" + }, + { + "expression": { + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "baseExpression": { + "id": 41, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "765:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 43, + "indexExpression": { + "id": 42, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "772:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "765:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 44, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "isLock", + "nodeType": "MemberAccess", + "referencedDeclaration": 5, + "src": "765:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "66616c7365", + "id": 45, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "785:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "src": "765:25:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 47, + "nodeType": "ExpressionStatement", + "src": "765:25:0" + } + ] + }, + "functionSelector": "db9cc410", + "id": 49, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "createAsset", + "nameLocation": "616:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 18, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 15, + "mutability": "mutable", + "name": "id", + "nameLocation": "645:2:0", + "nodeType": "VariableDeclaration", + "scope": 49, + "src": "629:18:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string" + }, + "typeName": { + "id": 14, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "629:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 17, + "mutability": "mutable", + "name": "size", + "nameLocation": "654:4:0", + "nodeType": "VariableDeclaration", + "scope": 49, + "src": "649:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 16, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "649:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "627:32:0" + }, + "returnParameters": { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "666:0:0" + }, + "scope": 150, + "src": "607:188:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 61, + "nodeType": "Block", + "src": "873:30:0", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 57, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "888:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 59, + "indexExpression": { + "id": 58, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 51, + "src": "895:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "888:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "functionReturnParameters": 56, + "id": 60, + "nodeType": "Return", + "src": "881:17:0" + } + ] + }, + "functionSelector": "cd5286d0", + "id": 62, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAsset", + "nameLocation": "807:8:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 52, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 51, + "mutability": "mutable", + "name": "id", + "nameLocation": "832:2:0", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "816:18:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string" + }, + "typeName": { + "id": 50, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "816:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "815:20:0" + }, + "returnParameters": { + "id": 56, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 55, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 62, + "src": "857:12:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_memory_ptr", + "typeString": "struct Asset" + }, + "typeName": { + "id": 54, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 53, + "name": "Asset", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8, + "src": "857:5:0" + }, + "referencedDeclaration": 8, + "src": "857:5:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage_ptr", + "typeString": "struct Asset" + } + }, + "visibility": "internal" + } + ], + "src": "856:14:0" + }, + "scope": 150, + "src": "798:105:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 87, + "nodeType": "Block", + "src": "991:109:0", + "statements": [ + { + "assignments": [ + 68 + ], + "declarations": [ + { + "constant": false, + "id": 68, + "mutability": "mutable", + "name": "assetExsist", + "nameLocation": "1004:11:0", + "nodeType": "VariableDeclaration", + "scope": 87, + "src": "999:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 67, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "999:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 75, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "baseExpression": { + "id": 69, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1018:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 71, + "indexExpression": { + "id": 70, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "1025:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1018:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 72, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "size", + "nodeType": "MemberAccess", + "referencedDeclaration": 7, + "src": "1018:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 73, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1034:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1018:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "999:36:0" + }, + { + "expression": { + "arguments": [ + { + "id": 77, + "name": "assetExsist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 68, + "src": "1051:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 76, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1043:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1043:20:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 79, + "nodeType": "ExpressionStatement", + "src": "1043:20:0" + }, + { + "expression": { + "id": 85, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "baseExpression": { + "id": 80, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1071:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 82, + "indexExpression": { + "id": 81, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 64, + "src": "1078:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1071:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 83, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "isLock", + "nodeType": "MemberAccess", + "referencedDeclaration": 5, + "src": "1071:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "74727565", + "id": 84, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1091:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "1071:24:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 86, + "nodeType": "ExpressionStatement", + "src": "1071:24:0" + } + ] + }, + "functionSelector": "5e82d0a6", + "id": 88, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "lockAsset", + "nameLocation": "955:9:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 65, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 64, + "mutability": "mutable", + "name": "id", + "nameLocation": "981:2:0", + "nodeType": "VariableDeclaration", + "scope": 88, + "src": "965:18:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string" + }, + "typeName": { + "id": 63, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "965:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "964:20:0" + }, + "returnParameters": { + "id": 66, + "nodeType": "ParameterList", + "parameters": [], + "src": "991:0:0" + }, + "scope": 150, + "src": "946:154:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 113, + "nodeType": "Block", + "src": "1191:110:0", + "statements": [ + { + "assignments": [ + 94 + ], + "declarations": [ + { + "constant": false, + "id": 94, + "mutability": "mutable", + "name": "assetExsist", + "nameLocation": "1204:11:0", + "nodeType": "VariableDeclaration", + "scope": 113, + "src": "1199:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 93, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1199:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 101, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 100, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "baseExpression": { + "id": 95, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1218:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 97, + "indexExpression": { + "id": 96, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1225:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1218:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 98, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "size", + "nodeType": "MemberAccess", + "referencedDeclaration": 7, + "src": "1218:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 99, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1234:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1218:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1199:36:0" + }, + { + "expression": { + "arguments": [ + { + "id": 103, + "name": "assetExsist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1251:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 102, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1243:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1243:20:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 105, + "nodeType": "ExpressionStatement", + "src": "1243:20:0" + }, + { + "expression": { + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "expression": { + "baseExpression": { + "id": 106, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1271:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 108, + "indexExpression": { + "id": 107, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 90, + "src": "1278:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1271:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 109, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "isLock", + "nodeType": "MemberAccess", + "referencedDeclaration": 5, + "src": "1271:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "hexValue": "66616c7365", + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1291:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "false" + }, + "src": "1271:25:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 112, + "nodeType": "ExpressionStatement", + "src": "1271:25:0" + } + ] + }, + "functionSelector": "def60e0d", + "id": 114, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "unLockAsset", + "nameLocation": "1153:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 90, + "mutability": "mutable", + "name": "id", + "nameLocation": "1181:2:0", + "nodeType": "VariableDeclaration", + "scope": 114, + "src": "1165:18:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string" + }, + "typeName": { + "id": 89, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1165:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1164:20:0" + }, + "returnParameters": { + "id": 92, + "nodeType": "ParameterList", + "parameters": [], + "src": "1191:0:0" + }, + "scope": 150, + "src": "1144:157:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 148, + "nodeType": "Block", + "src": "1352:241:0", + "statements": [ + { + "assignments": [ + 120 + ], + "declarations": [ + { + "constant": false, + "id": 120, + "mutability": "mutable", + "name": "assetExsist", + "nameLocation": "1365:11:0", + "nodeType": "VariableDeclaration", + "scope": 148, + "src": "1360:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 119, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1360:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 127, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "baseExpression": { + "id": 121, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1379:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 123, + "indexExpression": { + "id": 122, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 116, + "src": "1386:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1379:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 124, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "size", + "nodeType": "MemberAccess", + "referencedDeclaration": 7, + "src": "1379:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 125, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1395:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1379:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1360:36:0" + }, + { + "expression": { + "arguments": [ + { + "id": 129, + "name": "assetExsist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 120, + "src": "1412:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 128, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1404:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1404:20:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 131, + "nodeType": "ExpressionStatement", + "src": "1404:20:0" + }, + { + "assignments": [ + 133 + ], + "declarations": [ + { + "constant": false, + "id": 133, + "mutability": "mutable", + "name": "assetIsLocked", + "nameLocation": "1500:13:0", + "nodeType": "VariableDeclaration", + "scope": 148, + "src": "1495:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 132, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1495:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "id": 138, + "initialValue": { + "expression": { + "baseExpression": { + "id": 134, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1516:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 136, + "indexExpression": { + "id": 135, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 116, + "src": "1523:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1516:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "id": 137, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "isLock", + "nodeType": "MemberAccess", + "referencedDeclaration": 5, + "src": "1516:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1495:38:0" + }, + { + "expression": { + "arguments": [ + { + "id": 140, + "name": "assetIsLocked", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 133, + "src": "1549:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 139, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1541:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1541:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 142, + "nodeType": "ExpressionStatement", + "src": "1541:22:0" + }, + { + "expression": { + "id": 146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "delete", + "prefix": true, + "src": "1571:17:0", + "subExpression": { + "baseExpression": { + "id": 143, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 13, + "src": "1578:6:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_string_memory_ptr_$_t_struct$_Asset_$8_storage_$", + "typeString": "mapping(string memory => struct Asset storage ref)" + } + }, + "id": 145, + "indexExpression": { + "id": 144, + "name": "id", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 116, + "src": "1585:2:0", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string calldata" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1578:10:0", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Asset_$8_storage", + "typeString": "struct Asset storage ref" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 147, + "nodeType": "ExpressionStatement", + "src": "1571:17:0" + } + ] + }, + "functionSelector": "e24aa37c", + "id": 149, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deleteAsset", + "nameLocation": "1313:11:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 117, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 116, + "mutability": "mutable", + "name": "id", + "nameLocation": "1341:2:0", + "nodeType": "VariableDeclaration", + "scope": 149, + "src": "1325:18:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_string_calldata_ptr", + "typeString": "string" + }, + "typeName": { + "id": 115, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1325:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "1324:20:0" + }, + "returnParameters": { + "id": 118, + "nodeType": "ParameterList", + "parameters": [], + "src": "1352:0:0" + }, + "scope": 150, + "src": "1304:289:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 151, + "src": "543:1053:0", + "usedErrors": [] + } + ], + "src": "413:1184:0" + }, + "functionHashes": { + "createAsset(string,uint256)": "db9cc410", + "deleteAsset(string)": "e24aa37c", + "getAsset(string)": "cd5286d0", + "lockAsset(string)": "5e82d0a6", + "unLockAsset(string)": "def60e0d" + }, + "gasEstimates": { + "creation": { + "codeDepositCost": "228200", + "executionCost": "269", + "totalCost": "228469" + }, + "external": { + "createAsset(string,uint256)": "infinite", + "deleteAsset(string)": "infinite", + "getAsset(string)": "infinite", + "lockAsset(string)": "infinite", + "unLockAsset(string)": "infinite" + } + } +} \ No newline at end of file diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol new file mode 100644 index 00000000000..4f6ef873869 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/solidity/hello-world-contract/lock-asset.sol @@ -0,0 +1,50 @@ +// ***************************************************************************** +// IMPORTANT: If you update this code then make sure to recompile +// it and update the .json file as well so that they +// remain in sync for consistent test executions. +// With that said, there shouldn't be any reason to recompile this, like ever... +// ***************************************************************************** + +pragma solidity >=0.7.0; +struct Asset{ + address creator; + bool isLock; + uint size; +} +//TODO: DETEMINE CALLDATA VS MEMORY +contract LockAsset { + // + mapping (string => Asset) assets; + function createAsset( string calldata id, uint size) public{ + require(size>0); + assets[id].size= size; + assets[id].creator = msg.sender; + assets[id].isLock = false; + } + function getAsset(string calldata id) public view returns (Asset memory) + { + return assets[id]; + } + + //Don't care if it is already locked + function lockAsset(string calldata id) public{ + bool assetExsist = assets[id].size>0; + require(assetExsist); + assets[id].isLock = true; + } + //Don't care if it is already unlocked + function unLockAsset(string calldata id) public{ + bool assetExsist = assets[id].size>0; + require(assetExsist); + assets[id].isLock = false; + } + function deleteAsset(string calldata id) public { + bool assetExsist = assets[id].size>0; + require(assetExsist); + //an asset could only be deleted if it is already locked + bool assetIsLocked = assets[id].isLock; + require(assetIsLocked); + delete assets[id]; + } + +} diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/benchmark/run-plugin-ledger-connector-besu-benchmark.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/benchmark/run-plugin-ledger-connector-besu-benchmark.ts new file mode 100644 index 00000000000..6737b56ada9 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/benchmark/run-plugin-ledger-connector-besu-benchmark.ts @@ -0,0 +1,238 @@ +// FIXME +// import path from "path"; +// import { EOL } from "os"; +// import * as Benchmark from "benchmark"; + +// import { v4 as uuidv4 } from "uuid"; +// import { Server as SocketIoServer } from "socket.io"; +// import fse from "fs-extra"; +// import express from "express"; +// import bodyParser from "body-parser"; +// import http from "http"; +// import { AddressInfo } from "net"; + +// import { +// PluginLedgerConnectorChainlink, +// ChainlinkApiClient, +// IPluginLedgerConnectorChainlinkOptions, +// } from "../../../main/typescript/public-api"; +// import HelloWorldContractJson from "../../solidity/hello-world-contract/HelloWorld.json"; +// import { ChainlinkApiClientOptions } from "../../../main/typescript/api-client/chainlink-api-client"; +// import OAS from "../../../main/json/openapi.json"; + +// import { +// IListenOptions, +// KeyFormat, +// LogLevelDesc, +// Logger, +// LoggerProvider, +// Secp256k1Keys, +// Servers, +// } from "@hyperledger/cactus-common"; +// import { Constants } from "@hyperledger/cactus-core-api"; +// import { PluginRegistry } from "@hyperledger/cactus-core"; +// import { installOpenapiValidationMiddleware } from "@hyperledger/cactus-core"; +// import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +// import { ChainlinkTestLedger } from "@hyperledger/cactus-test-tooling"; + +// const LOG_TAG = +// "[packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/benchmark/run-plugin-ledger-connector-chainlink-benchmark.ts]"; + +// const createTestInfrastructure = async (opts: { +// readonly logLevel: LogLevelDesc; +// }) => { +// const logLevel = opts.logLevel || "DEBUG"; +// const keychainIdForSigned = uuidv4(); +// const keychainIdForUnsigned = uuidv4(); +// const keychainRefForSigned = uuidv4(); +// const keychainRefForUnsigned = uuidv4(); + +// const ledger = new ChainlinkTestLedger(); +// await ledger.start(); +// const rpcApiHttpHost = await ledger.getRpcApiHttpHost(); +// const rpcApiWsHost = await ledger.getRpcApiWsHost(); + +// const testEthAccount1 = await ledger.createEthTestAccount(); + +// // keychainPlugin for signed transactions +// const { privateKey } = Secp256k1Keys.generateKeyPairsBuffer(); +// const keyHex = privateKey.toString("hex"); +// const pem = keyEncoder.encodePrivate(keyHex, KeyFormat.Raw, KeyFormat.PEM); +// const signedKeychainPlugin = new PluginKeychainMemory({ +// instanceId: uuidv4(), +// keychainId: keychainIdForSigned, +// backend: new Map([[keychainRefForSigned, pem]]), +// logLevel, +// }); + +// // keychainPlugin for unsigned transactions +// const keychainEntryValue = testEthAccount1.privateKey; +// const unsignedKeychainPlugin = new PluginKeychainMemory({ +// instanceId: uuidv4(), +// keychainId: keychainIdForUnsigned, +// backend: new Map([[keychainRefForUnsigned, keychainEntryValue]]), +// logLevel, +// }); +// unsignedKeychainPlugin.set( +// HelloWorldContractJson.contractName, +// JSON.stringify(HelloWorldContractJson), +// ); + +// const pluginRegistry = new PluginRegistry({ +// plugins: [signedKeychainPlugin, unsignedKeychainPlugin], +// }); + +// const options: IPluginLedgerConnectorChainlinkOptions = { +// instanceId: uuidv4(), +// rpcApiHttpHost, +// rpcApiWsHost, +// pluginRegistry, +// logLevel, +// }; +// const connector = new PluginLedgerConnectorChainlink(options); +// pluginRegistry.add(connector); + +// const expressApp = express(); +// expressApp.use(bodyParser.json({ limit: "250mb" })); +// const server = http.createServer(expressApp); + +// const wsApi = new SocketIoServer(server, { +// path: Constants.SocketIoConnectionPathV1, +// }); + +// const listenOptions: IListenOptions = { +// hostname: "127.0.0.1", +// port: 0, +// server, +// }; +// const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; +// const { address, port } = addressInfo; +// const apiHost = `http://${address}:${port}`; + +// const chainlinkApiClientOptions = new ChainlinkApiClientOptions({ +// basePath: apiHost, +// }); +// const apiClient = new ChainlinkApiClient(chainlinkApiClientOptions); + +// await installOpenapiValidationMiddleware({ +// logLevel, +// app: expressApp, +// apiSpec: OAS, +// }); + +// await connector.getOrCreateWebServices(); +// await connector.registerWebServices(expressApp, wsApi); + +// return { +// httpApi: apiClient, +// apiServer: connector, +// chainlinkTestLedger: ledger, +// }; +// }; + +// const main = async (opts: { readonly argv: Readonly> }) => { +// const logLevel: LogLevelDesc = "INFO"; + +// const { apiServer, httpApi, chainlinkTestLedger } = await createTestInfrastructure( +// { logLevel }, +// ); + +// const level = apiServer.options.logLevel || "INFO"; +// const label = apiServer.className; +// const log: Logger = LoggerProvider.getOrCreate({ level, label }); + +// try { +// const gitRootPath = path.join( +// __dirname, +// "../../../../../../", // walk back up to the project root +// ); + +// log.info("%s gitRootPath=%s", LOG_TAG, gitRootPath); + +// const DEFAULT_OUTPUT_FILE_RELATIVE_PATH = +// ".tmp/benchmark-results/plugin-ledger-connector-chainlink/run-plugin-ledger-connector-chainlink-benchmark.ts.log"; + +// const relativeOutputFilePath = +// opts.argv[2] === undefined +// ? DEFAULT_OUTPUT_FILE_RELATIVE_PATH +// : opts.argv[2]; + +// log.info( +// "%s DEFAULT_OUTPUT_FILE_RELATIVE_PATH=%s", +// LOG_TAG, +// DEFAULT_OUTPUT_FILE_RELATIVE_PATH, +// ); + +// log.info("%s opts.argv[2]=%s", LOG_TAG, opts.argv[2]); + +// log.info("%s relativeOutputFilePath=%s", LOG_TAG, relativeOutputFilePath); + +// const absoluteOutputFilePath = path.join( +// gitRootPath, +// relativeOutputFilePath, +// ); + +// log.info("%s absoluteOutputFilePath=%s", LOG_TAG, absoluteOutputFilePath); + +// const absoluteOutputDirPath = path.dirname(absoluteOutputFilePath); +// log.info("%s absoluteOutputDirPath=%s", LOG_TAG, absoluteOutputDirPath); + +// await fse.mkdirp(absoluteOutputDirPath); +// log.info("%s mkdir -p OK: %s", LOG_TAG, absoluteOutputDirPath); + +// const minSamples = 100; +// const suite = new Benchmark.Suite({}); + +// const cycles: string[] = []; + +// await new Promise((resolve, reject) => { +// suite +// .add("plugin-ledger-connector-chainlink_HTTP_GET_getOpenApiSpecV1", { +// defer: true, +// minSamples, +// fn: async function (deferred: Benchmark.Deferred) { +// await httpApi.getOpenApiSpecV1(); +// deferred.resolve(); +// }, +// }) +// .on("cycle", (event: { target: unknown }) => { +// // Output benchmark result by converting benchmark result to string +// // Example line on stdout: +// // plugin-ledger-connector-chainlink_HTTP_GET_getOpenApiSpecV1 x 1,020 ops/sec ±2.25% (177 runs sampled) +// const cycle = String(event.target); +// log.info("%s Benchmark.js CYCLE: %s", LOG_TAG, cycle); +// cycles.push(cycle); +// }) +// .on("complete", function () { +// log.info("%s Benchmark.js COMPLETE.", LOG_TAG); +// resolve(suite); +// }) +// .on("error", async (ex: unknown) => { +// log.info("%s Benchmark.js ERROR: %o", LOG_TAG, ex); +// reject(ex); +// }) +// .run(); +// }); + +// const data = cycles.join(EOL); +// log.info("%s Writing results...", LOG_TAG); +// await fse.writeFile(absoluteOutputFilePath, data, { encoding: "utf-8" }); +// log.info("%s Wrote results to %s", LOG_TAG, absoluteOutputFilePath); +// } finally { +// await apiServer.shutdown(); +// log.info("%s Shut down API server OK", LOG_TAG); + +// await chainlinkTestLedger.stop(); +// await chainlinkTestLedger.destroy(); +// } +// }; + +// main({ argv: process.argv }) +// .then(async () => { +// console.log("%s Script execution completed successfully", LOG_TAG); +// process.exit(0); +// }) +// .catch((ex) => { +// console.error("%s process crashed with:", LOG_TAG, ex); +// process.exit(1); +// }); diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts new file mode 100644 index 00000000000..34aba3a0aea --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts @@ -0,0 +1,6 @@ +import * as apiSurface from "../../../main/typescript/public-api"; +import "jest-extended"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/api-surface.test.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/api-surface.test.ts new file mode 100644 index 00000000000..34aba3a0aea --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/api-surface.test.ts @@ -0,0 +1,6 @@ +import * as apiSurface from "../../../main/typescript/public-api"; +import "jest-extended"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/get-open-api-spec-v1-connector-chainlink.test.ts b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/get-open-api-spec-v1-connector-chainlink.test.ts new file mode 100644 index 00000000000..c6c78ef7b69 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/src/test/typescript/unit/get-open-api-spec-v1-connector-chainlink.test.ts @@ -0,0 +1,101 @@ +import { randomUUID as uuidv4 } from "node:crypto"; +import bodyParser from "body-parser"; +import express from "express"; +import http from "http"; +import "jest-extended"; +import { AddressInfo } from "net"; +import { Server as SocketIoServer } from "socket.io"; + +import { + IListenOptions, + LogLevelDesc, + LoggerProvider, + Servers, +} from "@hyperledger/cactus-common"; +import { PluginRegistry } from "@hyperledger/cactus-core"; +import { Constants, PluginImportType } from "@hyperledger/cactus-core-api"; + +import { + ChainlinkApiClient, + ChainlinkApiClientOptions, + PluginFactoryLedgerConnector, + PluginLedgerConnectorChainlink, +} from "../../../main/typescript/public-api"; + +import { SubscriptionManager } from "@chainlink/functions-toolkit"; + +describe("PluginLedgerConnectorChainlink", () => { + const logLevel: LogLevelDesc = "INFO"; + + const log = LoggerProvider.getOrCreate({ + label: __filename, + level: logLevel, + }); + + const subM = new SubscriptionManager({ + functionsRouterAddress: "FIXME", + linkTokenAddress: "FIXME", + signer: "FIXME" as any, + }); + + log.debug("subscriptionManager created OK: ", subM); + + const expressApp = express(); + expressApp.use(bodyParser.json({ limit: "250mb" })); + const server = http.createServer(expressApp); + let apiClient: ChainlinkApiClient; + + afterAll(async () => { + await Servers.shutdown(server); + }); + + beforeAll(async () => { + const factory = new PluginFactoryLedgerConnector({ + pluginImportType: PluginImportType.Local, + }); + + const ledgerHttpHost = "127.0.0.1"; + const ledgerHttpPort = 123; // FIXME + + const connector: PluginLedgerConnectorChainlink = await factory.create({ + ledgerHttpHost, + ledgerHttpPort, + logLevel, + instanceId: uuidv4(), + pluginRegistry: new PluginRegistry({ plugins: [] }), + }); + + const wsApi = new SocketIoServer(server, { + path: Constants.SocketIoConnectionPathV1, + }); + + await connector.registerWebServices(expressApp, wsApi); + + const listenOptions: IListenOptions = { + hostname: "127.0.0.1", + port: 0, + server, + }; + const addressInfo = (await Servers.listen(listenOptions)) as AddressInfo; + const { address, port } = addressInfo; + const apiHost = `http://${address}:${port}`; + + const chainlinkApiClientOptions = new ChainlinkApiClientOptions({ + basePath: apiHost, + }); + apiClient = new ChainlinkApiClient(chainlinkApiClientOptions); + log.debug("Instantiated ChainlinkApiClient OK"); + }); + + it("Returns a JSON document containing the Open API specification of the plugin.", async () => { + const res1Promise = apiClient.getOpenApiSpecV1(); + await expect(res1Promise).resolves.not.toThrow(); + const res1 = await res1Promise; + expect(res1.status).toEqual(200); + expect(res1.data).toBeTruthy(); + expect(res1.config).toBeTruthy(); + expect(res1.config.url).toBeString(); + log.debug("Fetched URL OK=%s", res1.config.url); + expect(res1.data).toBeObject(); + }); +}); diff --git a/packages/cacti-plugin-ledger-connector-chainlink/tsconfig.json b/packages/cacti-plugin-ledger-connector-chainlink/tsconfig.json new file mode 100644 index 00000000000..4e7f710f1d0 --- /dev/null +++ b/packages/cacti-plugin-ledger-connector-chainlink/tsconfig.json @@ -0,0 +1,32 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/lib/", + "declarationDir": "dist/lib", + "resolveJsonModule": true, + "rootDir": "./src", + "tsBuildInfoFile": "../../.build-cache/cacti-plugin-ledger-connector-chainlink.tsbuildinfo" + }, + "include": [ + "./src", + "src/**/*.json" + ], + "references": [ + { + "path": "../cactus-common/tsconfig.json" + }, + { + "path": "../cactus-core/tsconfig.json" + }, + { + "path": "../cactus-core-api/tsconfig.json" + }, + { + "path": "../cactus-plugin-keychain-memory/tsconfig.json" + }, + { + "path": "../cactus-test-tooling/tsconfig.json" + } + ] +} \ No newline at end of file diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/README.md b/packages/cacti-test-plugin-ledger-connector-avalanche/README.md new file mode 100644 index 00000000000..ced33617fde --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/README.md @@ -0,0 +1,6 @@ +# @hyperledger/cactus-test-plugin-ledger-connector-avalanche + +This package is designed to hold test cases verifying the correct operation of +the code in the package of similar name: `@hyperledger/cacti-plugin-ledger-connector-avalanche`. + +It contains no code that you would find useful in a production deployment. diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/package.json b/packages/cacti-test-plugin-ledger-connector-avalanche/package.json new file mode 100644 index 00000000000..e16825554b7 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/package.json @@ -0,0 +1,86 @@ +{ + "name": "@hyperledger/cactus-test-plugin-ledger-connector-avalanche", + "version": "2.0.0-rc.4", + "description": "Integration tests for the Avalanche ledger and the API server.", + "keywords": [ + "Hyperledger", + "Cactus", + "Integration", + "Blockchain", + "Distributed Ledger Technology" + ], + "homepage": "https://github.com/hyperledger/cacti#readme", + "bugs": { + "url": "https://github.com/hyperledger/cacti/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/cacti.git" + }, + "license": "Apache-2.0", + "author": { + "name": "Hyperledger Cactus Contributors", + "email": "cactus@lists.hyperledger.org", + "url": "https://www.hyperledger.org/use/cacti" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + }, + { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + } + ], + "main": "dist/lib/main/typescript/index.js", + "module": "dist/lib/main/typescript/index.js", + "browser": "dist/cactus-test-plugin-ledger-connector-avalanche.web.umd.js", + "types": "dist/lib/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "watch": "npm-watch", + "webpack": "npm-run-all webpack:dev", + "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", + "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", + "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" + }, + "dependencies": { + "@grpc/grpc-js": "1.11.2", + "@hyperledger/cacti-plugin-ledger-connector-avalanche": "2.0.0-rc.4", + "@hyperledger/cactus-cmd-api-server": "2.0.0-rc.4", + "@hyperledger/cactus-common": "2.0.0-rc.4", + "@hyperledger/cactus-core": "2.0.0-rc.4", + "@hyperledger/cactus-core-api": "2.0.0-rc.4", + "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.4", + "@hyperledger/cactus-test-tooling": "2.0.0-rc.4", + "@hyperledger/cactus-verifier-client": "2.0.0-rc.4", + "key-encoder": "2.0.3", + "socket.io": "4.6.2", + "web3": "1.6.1", + "web3js-quorum": "22.4.0" + }, + "devDependencies": { + "@types/express": "4.17.21", + "@types/uuid": "10.0.0", + "axios": "1.7.7", + "express": "4.19.2", + "http-status-codes": "2.3.0", + "uuid": "10.0.0", + "web3-core": "1.6.1" + }, + "engines": { + "node": ">=18", + "npm": ">=8" + }, + "publishConfig": { + "access": "public" + }, + "browserMinified": "dist/cactus-test-plugin-ledger-connector-avalanche.web.umd.min.js", + "mainMinified": "dist/cactus-test-plugin-ledger-connector-avalanche.node.umd.min.js", + "watch": {} +} diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.ts b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.ts new file mode 100644 index 00000000000..87cb558397c --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/main/typescript/public-api.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.json b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.json new file mode 100644 index 00000000000..286294b9964 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.json @@ -0,0 +1,5619 @@ +{ + "contractName": "HelloWorld", + "abi": [ + { + "inputs": [], + "name": "sayHello", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "getName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getNameByIndex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "newName", + "type": "string" + } + ], + "name": "setName", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.0+commit.c7dfd78e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getNameByIndex\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sayHello\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"newName\",\"type\":\"string\"}],\"name\":\"setName\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol\":\"HelloWorld\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol\":{\"keccak256\":\"0x1e97027d32e8c3433b793d7b2b45e30ea2d341c96a3943508ba068dea106efab\",\"urls\":[\"bzz-raw://96e37a0bb119b1fe14a4e71627c077b180f4deb9acc4284aa987a3ca1a6f45b1\",\"dweb:/ipfs/QmTAiGsxb38hMgDgbrtLLdYxc76CposiN9moBuJXAg2Mgk\"]}},\"version\":1}", + "bytecode": "60806040526040518060400160405280600d81526020017f4361707461696e436163747573000000000000000000000000000000000000008152506000908051906020019061004f929190610062565b5034801561005c57600080fd5b50610166565b82805461006e90610105565b90600052602060002090601f01602090048101928261009057600085556100d7565b82601f106100a957805160ff19168380011785556100d7565b828001600101855582156100d7579182015b828111156100d65782518255916020019190600101906100bb565b5b5090506100e491906100e8565b5090565b5b808211156101015760008160009055506001016100e9565b5090565b6000600282049050600182168061011d57607f821691505b6020821081141561013157610130610137565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b61082c806101756000396000f3fe60806040526004361061004a5760003560e01c806317d7de7c1461004f57806359c293f11461007a578063c47f0027146100b7578063d0e30db0146100e0578063ef5fb05b146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906105ae565b60405180910390f35b34801561008657600080fd5b506100a1600480360381019061009c919061050c565b6101a7565b6040516100ae91906105ae565b60405180910390f35b3480156100c357600080fd5b506100de60048036038101906100d991906104cb565b61027d565b005b6100e86102d3565b005b3480156100f657600080fd5b506100ff61036e565b60405161010c91906105ae565b60405180910390f35b6060600080546101249061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546101509061070f565b801561019d5780601f106101725761010080835404028352916020019161019d565b820191906000526020600020905b81548152906001019060200180831161018057829003601f168201915b5050505050905090565b6060600282815481106101e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200180546101f89061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546102249061070f565b80156102715780601f1061024657610100808354040283529160200191610271565b820191906000526020600020905b81548152906001019060200180831161025457829003601f168201915b50505050509050919050565b80600090805190602001906102939291906103ab565b506002819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906102cf9291906103ab565b5050565b60003411610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030d906105d0565b60405180910390fd5b34600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610365919061066d565b92505081905550565b60606040518060400160405280600c81526020017f48656c6c6f20576f726c64210000000000000000000000000000000000000000815250905090565b8280546103b79061070f565b90600052602060002090601f0160209004810192826103d95760008555610420565b82601f106103f257805160ff1916838001178555610420565b82800160010185558215610420579182015b8281111561041f578251825591602001919060010190610404565b5b50905061042d9190610431565b5090565b5b8082111561044a576000816000905550600101610432565b5090565b600061046161045c84610621565b6105f0565b90508281526020810184848401111561047957600080fd5b6104848482856106cd565b509392505050565b600082601f83011261049d57600080fd5b81356104ad84826020860161044e565b91505092915050565b6000813590506104c5816107df565b92915050565b6000602082840312156104dd57600080fd5b600082013567ffffffffffffffff8111156104f757600080fd5b6105038482850161048c565b91505092915050565b60006020828403121561051e57600080fd5b600061052c848285016104b6565b91505092915050565b600061054082610651565b61054a818561065c565b935061055a8185602086016106dc565b610563816107ce565b840191505092915050565b600061057b601b8361065c565b91507f56616c7565206d757374206265206469666572656e74206f66203000000000006000830152602082019050919050565b600060208201905081810360008301526105c88184610535565b905092915050565b600060208201905081810360008301526105e98161056e565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156106175761061661079f565b5b8060405250919050565b600067ffffffffffffffff82111561063c5761063b61079f565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000610678826106c3565b9150610683836106c3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106b8576106b7610741565b5b828201905092915050565b6000819050919050565b82818337600083830152505050565b60005b838110156106fa5780820151818401526020810190506106df565b83811115610709576000848401525b50505050565b6000600282049050600182168061072757607f821691505b6020821081141561073b5761073a610770565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6107e8816106c3565b81146107f357600080fd5b5056fea2646970667358221220450aa5d16069485df7d037ffe43b6593e232f4ac514d9169ba271384cc5d841964736f6c63430008000033", + "deployedBytecode": "60806040526004361061004a5760003560e01c806317d7de7c1461004f57806359c293f11461007a578063c47f0027146100b7578063d0e30db0146100e0578063ef5fb05b146100ea575b600080fd5b34801561005b57600080fd5b50610064610115565b60405161007191906105ae565b60405180910390f35b34801561008657600080fd5b506100a1600480360381019061009c919061050c565b6101a7565b6040516100ae91906105ae565b60405180910390f35b3480156100c357600080fd5b506100de60048036038101906100d991906104cb565b61027d565b005b6100e86102d3565b005b3480156100f657600080fd5b506100ff61036e565b60405161010c91906105ae565b60405180910390f35b6060600080546101249061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546101509061070f565b801561019d5780601f106101725761010080835404028352916020019161019d565b820191906000526020600020905b81548152906001019060200180831161018057829003601f168201915b5050505050905090565b6060600282815481106101e3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200180546101f89061070f565b80601f01602080910402602001604051908101604052809291908181526020018280546102249061070f565b80156102715780601f1061024657610100808354040283529160200191610271565b820191906000526020600020905b81548152906001019060200180831161025457829003601f168201915b50505050509050919050565b80600090805190602001906102939291906103ab565b506002819080600181540180825580915050600190039060005260206000200160009091909190915090805190602001906102cf9291906103ab565b5050565b60003411610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161030d906105d0565b60405180910390fd5b34600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610365919061066d565b92505081905550565b60606040518060400160405280600c81526020017f48656c6c6f20576f726c64210000000000000000000000000000000000000000815250905090565b8280546103b79061070f565b90600052602060002090601f0160209004810192826103d95760008555610420565b82601f106103f257805160ff1916838001178555610420565b82800160010185558215610420579182015b8281111561041f578251825591602001919060010190610404565b5b50905061042d9190610431565b5090565b5b8082111561044a576000816000905550600101610432565b5090565b600061046161045c84610621565b6105f0565b90508281526020810184848401111561047957600080fd5b6104848482856106cd565b509392505050565b600082601f83011261049d57600080fd5b81356104ad84826020860161044e565b91505092915050565b6000813590506104c5816107df565b92915050565b6000602082840312156104dd57600080fd5b600082013567ffffffffffffffff8111156104f757600080fd5b6105038482850161048c565b91505092915050565b60006020828403121561051e57600080fd5b600061052c848285016104b6565b91505092915050565b600061054082610651565b61054a818561065c565b935061055a8185602086016106dc565b610563816107ce565b840191505092915050565b600061057b601b8361065c565b91507f56616c7565206d757374206265206469666572656e74206f66203000000000006000830152602082019050919050565b600060208201905081810360008301526105c88184610535565b905092915050565b600060208201905081810360008301526105e98161056e565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156106175761061661079f565b5b8060405250919050565b600067ffffffffffffffff82111561063c5761063b61079f565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b6000610678826106c3565b9150610683836106c3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156106b8576106b7610741565b5b828201905092915050565b6000819050919050565b82818337600083830152505050565b60005b838110156106fa5780820151818401526020810190506106df565b83811115610709576000848401525b50505050565b6000600282049050600182168061072757607f821691505b6020821081141561073b5761073a610770565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6107e8816106c3565b81146107f357600080fd5b5056fea2646970667358221220450aa5d16069485df7d037ffe43b6593e232f4ac514d9169ba271384cc5d841964736f6c63430008000033", + "immutableReferences": {}, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:516:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "58:269:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "68:22:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "82:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "88:1:2", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "78:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "78:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "68:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "99:38:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "129:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "135:1:2", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "125:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "125:12:2" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "103:18:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "176:51:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "190:27:2", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "204:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "212:4:2", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "200:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "200:17:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "190:6:2" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "156:18:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "149:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "149:26:2" + }, + "nodeType": "YulIf", + "src": "146:2:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "279:42:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "293:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "293:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "293:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "243:18:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "266:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "274:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "263:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "263:14:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "240:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "240:38:2" + }, + "nodeType": "YulIf", + "src": "237:2:2" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "42:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "51:6:2", + "type": "" + } + ], + "src": "7:320:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "361:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "378:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "381:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "371:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "371:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "371:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "475:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "478:4:2", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "468:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "468:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "468:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "499:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "502:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "492:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "492:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "492:15:2" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "333:180:2" + } + ] + }, + "contents": "{\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n}\n", + "id": 2, + "language": "Yul", + "name": "#utility.yul" + } + ], + "deployedGeneratedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:5780:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "91:260:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "101:74:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "167:6:2" + } + ], + "functionName": { + "name": "array_allocation_size_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "125:41:2" + }, + "nodeType": "YulFunctionCall", + "src": "125:49:2" + } + ], + "functionName": { + "name": "allocateMemory", + "nodeType": "YulIdentifier", + "src": "110:14:2" + }, + "nodeType": "YulFunctionCall", + "src": "110:65:2" + }, + "variableNames": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "101:5:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "191:5:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "198:6:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "184:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "184:21:2" + }, + "nodeType": "YulExpressionStatement", + "src": "184:21:2" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "214:27:2", + "value": { + "arguments": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "229:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "236:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "225:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "225:16:2" + }, + "variables": [ + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "218:3:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "279:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "288:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "291:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "281:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "281:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "281:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "260:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "265:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "256:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "256:16:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "274:3:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "253:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "253:25:2" + }, + "nodeType": "YulIf", + "src": "250:2:2" + }, + { + "expression": { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "328:3:2" + }, + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "333:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "338:6:2" + } + ], + "functionName": { + "name": "copy_calldata_to_memory", + "nodeType": "YulIdentifier", + "src": "304:23:2" + }, + "nodeType": "YulFunctionCall", + "src": "304:41:2" + }, + "nodeType": "YulExpressionStatement", + "src": "304:41:2" + } + ] + }, + "name": "abi_decode_available_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "64:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "69:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "77:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "array", + "nodeType": "YulTypedName", + "src": "85:5:2", + "type": "" + } + ], + "src": "7:344:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "433:211:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "482:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "491:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "494:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "484:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "484:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "484:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "461:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "469:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "457:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "457:17:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "476:3:2" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "453:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "453:27:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "446:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "446:35:2" + }, + "nodeType": "YulIf", + "src": "443:2:2" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "507:34:2", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "534:6:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "521:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "521:20:2" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "511:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "550:88:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "611:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "619:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "607:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "607:17:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "626:6:2" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "634:3:2" + } + ], + "functionName": { + "name": "abi_decode_available_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "559:47:2" + }, + "nodeType": "YulFunctionCall", + "src": "559:79:2" + }, + "variableNames": [ + { + "name": "array", + "nodeType": "YulIdentifier", + "src": "550:5:2" + } + ] + } + ] + }, + "name": "abi_decode_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "411:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "419:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "array", + "nodeType": "YulTypedName", + "src": "427:5:2", + "type": "" + } + ], + "src": "371:273:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "702:87:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "712:29:2", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "734:6:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "721:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "721:20:2" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "712:5:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "777:5:2" + } + ], + "functionName": { + "name": "validator_revert_t_uint256", + "nodeType": "YulIdentifier", + "src": "750:26:2" + }, + "nodeType": "YulFunctionCall", + "src": "750:33:2" + }, + "nodeType": "YulExpressionStatement", + "src": "750:33:2" + } + ] + }, + "name": "abi_decode_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "680:6:2", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "688:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "696:5:2", + "type": "" + } + ], + "src": "650:139:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "871:299:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "917:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "926:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "929:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "919:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "919:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "919:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "892:7:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "901:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "888:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "888:23:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "913:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "884:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "884:32:2" + }, + "nodeType": "YulIf", + "src": "881:2:2" + }, + { + "nodeType": "YulBlock", + "src": "943:220:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "958:45:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "989:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1000:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "985:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "985:17:2" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "972:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "972:31:2" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "962:6:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1050:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1059:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1062:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1052:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "1052:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1052:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1022:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1030:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1019:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "1019:30:2" + }, + "nodeType": "YulIf", + "src": "1016:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "1080:73:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1125:9:2" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1136:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1121:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1121:22:2" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1145:7:2" + } + ], + "functionName": { + "name": "abi_decode_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "1090:30:2" + }, + "nodeType": "YulFunctionCall", + "src": "1090:63:2" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1080:6:2" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "841:9:2", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "852:7:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "864:6:2", + "type": "" + } + ], + "src": "795:375:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1242:196:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1288:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1297:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1300:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1290:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "1290:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1290:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1263:7:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1272:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1259:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1259:23:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1284:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1255:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1255:32:2" + }, + "nodeType": "YulIf", + "src": "1252:2:2" + }, + { + "nodeType": "YulBlock", + "src": "1314:117:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1329:15:2", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1343:1:2", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "1333:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1358:63:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1393:9:2" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1404:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1389:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1389:22:2" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1413:7:2" + } + ], + "functionName": { + "name": "abi_decode_t_uint256", + "nodeType": "YulIdentifier", + "src": "1368:20:2" + }, + "nodeType": "YulFunctionCall", + "src": "1368:53:2" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1358:6:2" + } + ] + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1212:9:2", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1223:7:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1235:6:2", + "type": "" + } + ], + "src": "1176:262:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1536:272:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1546:53:2", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1593:5:2" + } + ], + "functionName": { + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulIdentifier", + "src": "1560:32:2" + }, + "nodeType": "YulFunctionCall", + "src": "1560:39:2" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "1550:6:2", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1608:78:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1674:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1679:6:2" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "1615:58:2" + }, + "nodeType": "YulFunctionCall", + "src": "1615:71:2" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1608:3:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1721:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1728:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1717:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1717:16:2" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1735:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1740:6:2" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "1695:21:2" + }, + "nodeType": "YulFunctionCall", + "src": "1695:52:2" + }, + "nodeType": "YulExpressionStatement", + "src": "1695:52:2" + }, + { + "nodeType": "YulAssignment", + "src": "1756:46:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1767:3:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1794:6:2" + } + ], + "functionName": { + "name": "round_up_to_mul_of_32", + "nodeType": "YulIdentifier", + "src": "1772:21:2" + }, + "nodeType": "YulFunctionCall", + "src": "1772:29:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1763:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "1763:39:2" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "1756:3:2" + } + ] + } + ] + }, + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1517:5:2", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "1524:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "1532:3:2", + "type": "" + } + ], + "src": "1444:364:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1960:179:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "1970:74:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2036:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2041:2:2", + "type": "", + "value": "27" + } + ], + "functionName": { + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "1977:58:2" + }, + "nodeType": "YulFunctionCall", + "src": "1977:67:2" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "1970:3:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2065:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2070:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2061:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2061:11:2" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "2074:29:2", + "type": "", + "value": "Value must be diferent of 0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2054:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2054:50:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2054:50:2" + }, + { + "nodeType": "YulAssignment", + "src": "2114:19:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "2125:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2130:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2121:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2121:12:2" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "2114:3:2" + } + ] + } + ] + }, + "name": "abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "1948:3:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "1956:3:2", + "type": "" + } + ], + "src": "1814:325:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2263:195:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2273:26:2", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2285:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2296:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2281:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2281:18:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2273:4:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2320:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2331:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2316:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2316:17:2" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2339:4:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2345:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2335:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2335:20:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2309:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2309:47:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2309:47:2" + }, + { + "nodeType": "YulAssignment", + "src": "2365:86:2", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2437:6:2" + }, + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2446:4:2" + } + ], + "functionName": { + "name": "abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "2373:63:2" + }, + "nodeType": "YulFunctionCall", + "src": "2373:78:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2365:4:2" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2235:9:2", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2247:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "2258:4:2", + "type": "" + } + ], + "src": "2145:313:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2635:248:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2645:26:2", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2657:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2668:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2653:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2653:18:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2645:4:2" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2692:9:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2703:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2688:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2688:17:2" + }, + { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2711:4:2" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2717:9:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2707:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2707:20:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2681:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "2681:47:2" + }, + "nodeType": "YulExpressionStatement", + "src": "2681:47:2" + }, + { + "nodeType": "YulAssignment", + "src": "2737:139:2", + "value": { + "arguments": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2871:4:2" + } + ], + "functionName": { + "name": "abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack", + "nodeType": "YulIdentifier", + "src": "2745:124:2" + }, + "nodeType": "YulFunctionCall", + "src": "2745:131:2" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "2737:4:2" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2615:9:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "2630:4:2", + "type": "" + } + ], + "src": "2464:419:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2929:243:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2939:19:2", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2955:2:2", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "2949:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "2949:9:2" + }, + "variableNames": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "2939:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2967:35:2", + "value": { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "2989:6:2" + }, + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "2997:4:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2985:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "2985:17:2" + }, + "variables": [ + { + "name": "newFreePtr", + "nodeType": "YulTypedName", + "src": "2971:10:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3113:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "3115:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "3115:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3115:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3056:10:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3068:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3053:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3053:34:2" + }, + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3092:10:2" + }, + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "3104:6:2" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "3089:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3089:22:2" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "3050:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3050:62:2" + }, + "nodeType": "YulIf", + "src": "3047:2:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3151:2:2", + "type": "", + "value": "64" + }, + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "3155:10:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3144:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "3144:22:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3144:22:2" + } + ] + }, + "name": "allocateMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "size", + "nodeType": "YulTypedName", + "src": "2913:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "2922:6:2", + "type": "" + } + ], + "src": "2889:283:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3245:265:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3350:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "3352:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "3352:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3352:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3322:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3330:18:2", + "type": "", + "value": "0xffffffffffffffff" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3319:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3319:30:2" + }, + "nodeType": "YulIf", + "src": "3316:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "3402:41:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3418:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3426:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3414:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3414:17:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3437:4:2", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "3433:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3433:9:2" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3410:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3410:33:2" + }, + "variableNames": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3402:4:2" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3480:23:2", + "value": { + "arguments": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3492:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3498:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3488:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3488:15:2" + }, + "variableNames": [ + { + "name": "size", + "nodeType": "YulIdentifier", + "src": "3480:4:2" + } + ] + } + ] + }, + "name": "array_allocation_size_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3229:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "size", + "nodeType": "YulTypedName", + "src": "3240:4:2", + "type": "" + } + ], + "src": "3178:332:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3575:40:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3586:22:2", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3602:5:2" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3596:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "3596:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3586:6:2" + } + ] + } + ] + }, + "name": "array_length_t_string_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3558:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3568:6:2", + "type": "" + } + ], + "src": "3516:99:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3717:73:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3734:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3739:6:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3727:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "3727:19:2" + }, + "nodeType": "YulExpressionStatement", + "src": "3727:19:2" + }, + { + "nodeType": "YulAssignment", + "src": "3755:29:2", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3774:3:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3779:4:2", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3770:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3770:14:2" + }, + "variableNames": [ + { + "name": "updated_pos", + "nodeType": "YulIdentifier", + "src": "3755:11:2" + } + ] + } + ] + }, + "name": "array_storeLengthForEncoding_t_string_memory_ptr_fromStack", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3689:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3694:6:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "updated_pos", + "nodeType": "YulTypedName", + "src": "3705:11:2", + "type": "" + } + ], + "src": "3621:169:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3840:261:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3850:25:2", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3873:1:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "3855:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "3855:20:2" + }, + "variableNames": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3850:1:2" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3884:25:2", + "value": { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "3907:1:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "3889:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "3889:20:2" + }, + "variableNames": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "3884:1:2" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4047:22:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "4049:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "4049:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4049:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "3968:1:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3975:66:2", + "type": "", + "value": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "4043:1:2" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3971:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "3971:74:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "3965:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "3965:81:2" + }, + "nodeType": "YulIf", + "src": "3962:2:2" + }, + { + "nodeType": "YulAssignment", + "src": "4079:16:2", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "4090:1:2" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "4093:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4086:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4086:9:2" + }, + "variableNames": [ + { + "name": "sum", + "nodeType": "YulIdentifier", + "src": "4079:3:2" + } + ] + } + ] + }, + "name": "checked_add_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "3827:1:2", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "3830:1:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "sum", + "nodeType": "YulTypedName", + "src": "3836:3:2", + "type": "" + } + ], + "src": "3796:305:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4152:32:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4162:16:2", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "4173:5:2" + }, + "variableNames": [ + { + "name": "cleaned", + "nodeType": "YulIdentifier", + "src": "4162:7:2" + } + ] + } + ] + }, + "name": "cleanup_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "4134:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "cleaned", + "nodeType": "YulTypedName", + "src": "4144:7:2", + "type": "" + } + ], + "src": "4107:77:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4241:103:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4264:3:2" + }, + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4269:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4274:6:2" + } + ], + "functionName": { + "name": "calldatacopy", + "nodeType": "YulIdentifier", + "src": "4251:12:2" + }, + "nodeType": "YulFunctionCall", + "src": "4251:30:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4251:30:2" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4322:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4327:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4318:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4318:16:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4336:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4311:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4311:27:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4311:27:2" + } + ] + }, + "name": "copy_calldata_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "4223:3:2", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "4228:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4233:6:2", + "type": "" + } + ], + "src": "4190:154:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4399:258:2", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4409:10:2", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4418:1:2", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "4413:1:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4478:63:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4503:3:2" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4508:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4499:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4499:11:2" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "4522:3:2" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4527:1:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4518:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4518:11:2" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4512:5:2" + }, + "nodeType": "YulFunctionCall", + "src": "4512:18:2" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4492:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4492:39:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4492:39:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4439:1:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4442:6:2" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4436:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4436:13:2" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "4450:19:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4452:15:2", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4461:1:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4464:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4457:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4457:10:2" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4452:1:2" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "4432:3:2", + "statements": [] + }, + "src": "4428:113:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4575:76:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "4625:3:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4630:6:2" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4621:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4621:16:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4639:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4614:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4614:27:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4614:27:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4556:1:2" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4559:6:2" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "4553:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4553:13:2" + }, + "nodeType": "YulIf", + "src": "4550:2:2" + } + ] + }, + "name": "copy_memory_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "4381:3:2", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "4386:3:2", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4391:6:2", + "type": "" + } + ], + "src": "4350:307:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4714:269:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4724:22:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "4738:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4744:1:2", + "type": "", + "value": "2" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "4734:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4734:12:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4724:6:2" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4755:38:2", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "4785:4:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4791:1:2", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4781:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4781:12:2" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "4759:18:2", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4832:51:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4846:27:2", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4860:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4868:4:2", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4856:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "4856:17:2" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4846:6:2" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "4812:18:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "4805:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "4805:26:2" + }, + "nodeType": "YulIf", + "src": "4802:2:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4935:42:2", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x22", + "nodeType": "YulIdentifier", + "src": "4949:16:2" + }, + "nodeType": "YulFunctionCall", + "src": "4949:18:2" + }, + "nodeType": "YulExpressionStatement", + "src": "4949:18:2" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "4899:18:2" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4922:6:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4930:2:2", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4919:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4919:14:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "4896:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "4896:38:2" + }, + "nodeType": "YulIf", + "src": "4893:2:2" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "4698:4:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4707:6:2", + "type": "" + } + ], + "src": "4663:320:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5017:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5034:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5037:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5027:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5027:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5027:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5131:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5134:4:2", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5124:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5124:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5124:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5155:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5158:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5148:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5148:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5148:15:2" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "4989:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5203:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5220:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5223:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5213:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5213:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5213:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5317:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5320:4:2", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5310:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5310:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5310:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5341:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5344:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5334:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5334:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5334:15:2" + } + ] + }, + "name": "panic_error_0x22", + "nodeType": "YulFunctionDefinition", + "src": "5175:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5389:152:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5406:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5409:77:2", + "type": "", + "value": "35408467139433450592217433187231851964531694900788300625387963629091585785856" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5399:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5399:88:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5399:88:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5503:1:2", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5506:4:2", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5496:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5496:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5496:15:2" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5527:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5530:4:2", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5520:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5520:15:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5520:15:2" + } + ] + }, + "name": "panic_error_0x41", + "nodeType": "YulFunctionDefinition", + "src": "5361:180:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5595:54:2", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5605:38:2", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5623:5:2" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5630:2:2", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5619:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5619:14:2" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5639:2:2", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "5635:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5635:7:2" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "5615:3:2" + }, + "nodeType": "YulFunctionCall", + "src": "5615:28:2" + }, + "variableNames": [ + { + "name": "result", + "nodeType": "YulIdentifier", + "src": "5605:6:2" + } + ] + } + ] + }, + "name": "round_up_to_mul_of_32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5578:5:2", + "type": "" + } + ], + "returnVariables": [ + { + "name": "result", + "nodeType": "YulTypedName", + "src": "5588:6:2", + "type": "" + } + ], + "src": "5547:102:2" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5698:79:2", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5755:16:2", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5764:1:2", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5767:1:2", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5757:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5757:12:2" + }, + "nodeType": "YulExpressionStatement", + "src": "5757:12:2" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5721:5:2" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5746:5:2" + } + ], + "functionName": { + "name": "cleanup_t_uint256", + "nodeType": "YulIdentifier", + "src": "5728:17:2" + }, + "nodeType": "YulFunctionCall", + "src": "5728:24:2" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "5718:2:2" + }, + "nodeType": "YulFunctionCall", + "src": "5718:35:2" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "5711:6:2" + }, + "nodeType": "YulFunctionCall", + "src": "5711:43:2" + }, + "nodeType": "YulIf", + "src": "5708:2:2" + } + ] + }, + "name": "validator_revert_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5691:5:2", + "type": "" + } + ], + "src": "5655:122:2" + } + ] + }, + "contents": "{\n\n function abi_decode_available_length_t_string_memory_ptr(src, length, end) -> array {\n array := allocateMemory(array_allocation_size_t_string_memory_ptr(length))\n mstore(array, length)\n let dst := add(array, 0x20)\n if gt(add(src, length), end) { revert(0, 0) }\n copy_calldata_to_memory(src, dst, length)\n }\n\n // string\n function abi_decode_t_string_memory_ptr(offset, end) -> array {\n if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }\n let length := calldataload(offset)\n array := abi_decode_available_length_t_string_memory_ptr(add(offset, 0x20), length, end)\n }\n\n function abi_decode_t_uint256(offset, end) -> value {\n value := calldataload(offset)\n validator_revert_t_uint256(value)\n }\n\n function abi_decode_tuple_t_string_memory_ptr(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := calldataload(add(headStart, 0))\n if gt(offset, 0xffffffffffffffff) { revert(0, 0) }\n\n value0 := abi_decode_t_string_memory_ptr(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0 {\n if slt(sub(dataEnd, headStart), 32) { revert(0, 0) }\n\n {\n\n let offset := 0\n\n value0 := abi_decode_t_uint256(add(headStart, offset), dataEnd)\n }\n\n }\n\n function abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value, pos) -> end {\n let length := array_length_t_string_memory_ptr(value)\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length)\n copy_memory_to_memory(add(value, 0x20), pos, length)\n end := add(pos, round_up_to_mul_of_32(length))\n }\n\n function abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack(pos) -> end {\n pos := array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, 27)\n\n mstore(add(pos, 0), \"Value must be diferent of 0\")\n\n end := add(pos, 32)\n }\n\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart , value0) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_string_memory_ptr_to_t_string_memory_ptr_fromStack(value0, tail)\n\n }\n\n function abi_encode_tuple_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e__to_t_string_memory_ptr__fromStack_reversed(headStart ) -> tail {\n tail := add(headStart, 32)\n\n mstore(add(headStart, 0), sub(tail, headStart))\n tail := abi_encode_t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e_to_t_string_memory_ptr_fromStack( tail)\n\n }\n\n function allocateMemory(size) -> memPtr {\n memPtr := mload(64)\n let newFreePtr := add(memPtr, size)\n // protect against overflow\n if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n }\n\n function array_allocation_size_t_string_memory_ptr(length) -> size {\n // Make sure we can allocate memory without overflow\n if gt(length, 0xffffffffffffffff) { panic_error_0x41() }\n\n // round up\n size := and(add(length, 0x1f), not(0x1f))\n\n // add length slot\n size := add(size, 0x20)\n\n }\n\n function array_length_t_string_memory_ptr(value) -> length {\n\n length := mload(value)\n\n }\n\n function array_storeLengthForEncoding_t_string_memory_ptr_fromStack(pos, length) -> updated_pos {\n mstore(pos, length)\n updated_pos := add(pos, 0x20)\n }\n\n function checked_add_t_uint256(x, y) -> sum {\n x := cleanup_t_uint256(x)\n y := cleanup_t_uint256(y)\n\n // overflow, if x > (maxValue - y)\n if gt(x, sub(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff, y)) { panic_error_0x11() }\n\n sum := add(x, y)\n }\n\n function cleanup_t_uint256(value) -> cleaned {\n cleaned := value\n }\n\n function copy_calldata_to_memory(src, dst, length) {\n calldatacopy(dst, src, length)\n // clear end\n mstore(add(dst, length), 0)\n }\n\n function copy_memory_to_memory(src, dst, length) {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length)\n {\n // clear end\n mstore(add(dst, length), 0)\n }\n }\n\n function extract_byte_array_length(data) -> length {\n length := div(data, 2)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) {\n length := and(length, 0x7f)\n }\n\n if eq(outOfPlaceEncoding, lt(length, 32)) {\n panic_error_0x22()\n }\n }\n\n function panic_error_0x11() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n\n function panic_error_0x22() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n\n function panic_error_0x41() {\n mstore(0, 35408467139433450592217433187231851964531694900788300625387963629091585785856)\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n\n function round_up_to_mul_of_32(value) -> result {\n result := and(add(value, 31), not(31))\n }\n\n function validator_revert_t_uint256(value) {\n if iszero(eq(value, cleanup_t_uint256(value))) { revert(0, 0) }\n }\n\n}\n", + "id": 2, + "language": "Yul", + "name": "#utility.yul" + } + ], + "sourceMap": "439:671:0:-:0;;;463:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;439:671;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:320:2:-;;88:1;82:4;78:12;68:22;;135:1;129:4;125:12;156:18;146:2;;212:4;204:6;200:17;190:27;;146:2;274;266:6;263:14;243:18;240:38;237:2;;;293:18;;:::i;:::-;237:2;58:269;;;;:::o;333:180::-;381:77;378:1;371:88;478:4;475:1;468:15;502:4;499:1;492:15;439:671:0;;;;;;;", + "deployedSourceMap": "439:671:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;666:81;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;751:109;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;864:103;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;971:137;;;:::i;:::-;;573:89;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;666:81;706:13;738:4;731:11;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;666:81;:::o;751:109::-;811:13;843:5;849;843:12;;;;;;;;;;;;;;;;;;;;;;;836:19;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;751:109;;;:::o;864:103::-;928:7;921:4;:14;;;;;;;;;;;;:::i;:::-;;943:5;954:7;943:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;864:103;:::o;971:137::-;1031:1;1019:9;:13;1011:53;;;;;;;;;;;;:::i;:::-;;;;;;;;;1094:9;1070:8;:20;1079:10;1070:20;;;;;;;;;;;;;;;;:33;;;;;;;:::i;:::-;;;;;;;;971:137::o;573:89::-;615:13;636:21;;;;;;;;;;;;;;;;;;;573:89;:::o;-1:-1:-1:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;:::o;7:344:2:-;;110:65;125:49;167:6;125:49;:::i;:::-;110:65;:::i;:::-;101:74;;198:6;191:5;184:21;236:4;229:5;225:16;274:3;265:6;260:3;256:16;253:25;250:2;;;291:1;288;281:12;250:2;304:41;338:6;333:3;328;304:41;:::i;:::-;91:260;;;;;;:::o;371:273::-;;476:3;469:4;461:6;457:17;453:27;443:2;;494:1;491;484:12;443:2;534:6;521:20;559:79;634:3;626:6;619:4;611:6;607:17;559:79;:::i;:::-;550:88;;433:211;;;;;:::o;650:139::-;;734:6;721:20;712:29;;750:33;777:5;750:33;:::i;:::-;702:87;;;;:::o;795:375::-;;913:2;901:9;892:7;888:23;884:32;881:2;;;929:1;926;919:12;881:2;1000:1;989:9;985:17;972:31;1030:18;1022:6;1019:30;1016:2;;;1062:1;1059;1052:12;1016:2;1090:63;1145:7;1136:6;1125:9;1121:22;1090:63;:::i;:::-;1080:73;;943:220;871:299;;;;:::o;1176:262::-;;1284:2;1272:9;1263:7;1259:23;1255:32;1252:2;;;1300:1;1297;1290:12;1252:2;1343:1;1368:53;1413:7;1404:6;1393:9;1389:22;1368:53;:::i;:::-;1358:63;;1314:117;1242:196;;;;:::o;1444:364::-;;1560:39;1593:5;1560:39;:::i;:::-;1615:71;1679:6;1674:3;1615:71;:::i;:::-;1608:78;;1695:52;1740:6;1735:3;1728:4;1721:5;1717:16;1695:52;:::i;:::-;1772:29;1794:6;1772:29;:::i;:::-;1767:3;1763:39;1756:46;;1536:272;;;;;:::o;1814:325::-;;1977:67;2041:2;2036:3;1977:67;:::i;:::-;1970:74;;2074:29;2070:1;2065:3;2061:11;2054:50;2130:2;2125:3;2121:12;2114:19;;1960:179;;;:::o;2145:313::-;;2296:2;2285:9;2281:18;2273:26;;2345:9;2339:4;2335:20;2331:1;2320:9;2316:17;2309:47;2373:78;2446:4;2437:6;2373:78;:::i;:::-;2365:86;;2263:195;;;;:::o;2464:419::-;;2668:2;2657:9;2653:18;2645:26;;2717:9;2711:4;2707:20;2703:1;2692:9;2688:17;2681:47;2745:131;2871:4;2745:131;:::i;:::-;2737:139;;2635:248;;;:::o;2889:283::-;;2955:2;2949:9;2939:19;;2997:4;2989:6;2985:17;3104:6;3092:10;3089:22;3068:18;3056:10;3053:34;3050:62;3047:2;;;3115:18;;:::i;:::-;3047:2;3155:10;3151:2;3144:22;2929:243;;;;:::o;3178:332::-;;3330:18;3322:6;3319:30;3316:2;;;3352:18;;:::i;:::-;3316:2;3437:4;3433:9;3426:4;3418:6;3414:17;3410:33;3402:41;;3498:4;3492;3488:15;3480:23;;3245:265;;;:::o;3516:99::-;;3602:5;3596:12;3586:22;;3575:40;;;:::o;3621:169::-;;3739:6;3734:3;3727:19;3779:4;3774:3;3770:14;3755:29;;3717:73;;;;:::o;3796:305::-;;3855:20;3873:1;3855:20;:::i;:::-;3850:25;;3889:20;3907:1;3889:20;:::i;:::-;3884:25;;4043:1;3975:66;3971:74;3968:1;3965:81;3962:2;;;4049:18;;:::i;:::-;3962:2;4093:1;4090;4086:9;4079:16;;3840:261;;;;:::o;4107:77::-;;4173:5;4162:16;;4152:32;;;:::o;4190:154::-;4274:6;4269:3;4264;4251:30;4336:1;4327:6;4322:3;4318:16;4311:27;4241:103;;;:::o;4350:307::-;4418:1;4428:113;4442:6;4439:1;4436:13;4428:113;;;4527:1;4522:3;4518:11;4512:18;4508:1;4503:3;4499:11;4492:39;4464:2;4461:1;4457:10;4452:15;;4428:113;;;4559:6;4556:1;4553:13;4550:2;;;4639:1;4630:6;4625:3;4621:16;4614:27;4550:2;4399:258;;;;:::o;4663:320::-;;4744:1;4738:4;4734:12;4724:22;;4791:1;4785:4;4781:12;4812:18;4802:2;;4868:4;4860:6;4856:17;4846:27;;4802:2;4930;4922:6;4919:14;4899:18;4896:38;4893:2;;;4949:18;;:::i;:::-;4893:2;4714:269;;;;:::o;4989:180::-;5037:77;5034:1;5027:88;5134:4;5131:1;5124:15;5158:4;5155:1;5148:15;5175:180;5223:77;5220:1;5213:88;5320:4;5317:1;5310:15;5344:4;5341:1;5334:15;5361:180;5409:77;5406:1;5399:88;5506:4;5503:1;5496:15;5530:4;5527:1;5520:15;5547:102;;5639:2;5635:7;5630:2;5623:5;5619:14;5615:28;5605:38;;5595:54;;;:::o;5655:122::-;5728:24;5746:5;5728:24;:::i;:::-;5721:5;5718:35;5708:2;;5767:1;5764;5757:12;5708:2;5698:79;:::o", + "source": "// *****************************************************************************\n// IMPORTANT: If you update this code then make sure to recompile\n// it and update the .json file as well so that they\n// remain in sync for consistent test executions.\n// With that said, there shouldn't be any reason to recompile this, like ever...\n// *****************************************************************************\n\npragma solidity >=0.7.0;\n\ncontract HelloWorld {\n string private name = \"CaptainCactus\";\n mapping (address => uint256) deposits;\n string[] private names; \n\n function sayHello () public pure returns (string memory) {\n return 'Hello World!';\n }\n\n function getName() public view returns (string memory)\n {\n return name;\n }\n\n function getNameByIndex(uint256 index) public view returns (string memory)\n {\n return names[index];\n }\n\n function setName(string memory newName) public\n {\n name = newName;\n names.push(newName);\n }\n\n function deposit() public payable {\n require(msg.value > 0, \"Value must be diferent of 0\");\n deposits[msg.sender] += msg.value;\n }\n}\n", + "sourcePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "ast": { + "absolutePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "exportedSymbols": { + "HelloWorld": [ + 76 + ] + }, + "id": 77, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.7", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "413:24:0" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 76, + "linearizedBaseContracts": [ + 76 + ], + "name": "HelloWorld", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "name", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "463:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 2, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "463:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": { + "hexValue": "4361707461696e436163747573", + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "485:15:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bdd2f21877c99489ddcc32737686677f40d460368c7982ce22ce4f72b41b0312", + "typeString": "literal_string \"CaptainCactus\"" + }, + "value": "CaptainCactus" + }, + "visibility": "private" + }, + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "deposits", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "504:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "typeName": { + "id": 7, + "keyType": { + "id": 5, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "513:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "504:28:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "valueType": { + "id": 6, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "524:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "names", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "545:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string[]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "545:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "id": 10, + "nodeType": "ArrayTypeName", + "src": "545:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage_ptr", + "typeString": "string[]" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 18, + "nodeType": "Block", + "src": "630:32:0", + "statements": [ + { + "expression": { + "hexValue": "48656c6c6f20576f726c6421", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "643:14:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0", + "typeString": "literal_string \"Hello World!\"" + }, + "value": "Hello World!" + }, + "functionReturnParameters": 15, + "id": 17, + "nodeType": "Return", + "src": "636:21:0" + } + ] + }, + "functionSelector": "ef5fb05b", + "id": 19, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sayHello", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [], + "src": "591:2:0" + }, + "returnParameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 14, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "615:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 13, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "614:15:0" + }, + "scope": 76, + "src": "573:89:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 26, + "nodeType": "Block", + "src": "723:24:0", + "statements": [ + { + "expression": { + "id": 24, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "738:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 23, + "id": 25, + "nodeType": "Return", + "src": "731:11:0" + } + ] + }, + "functionSelector": "17d7de7c", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 20, + "nodeType": "ParameterList", + "parameters": [], + "src": "682:2:0" + }, + "returnParameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 22, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "706:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 21, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "706:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "705:15:0" + }, + "scope": 76, + "src": "666:81:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 38, + "nodeType": "Block", + "src": "828:32:0", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 34, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "843:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 36, + "indexExpression": { + "id": 35, + "name": "index", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "849:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "843:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 33, + "id": 37, + "nodeType": "Return", + "src": "836:19:0" + } + ] + }, + "functionSelector": "59c293f1", + "id": 39, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getNameByIndex", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 29, + "mutability": "mutable", + "name": "index", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "775:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "775:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "774:15:0" + }, + "returnParameters": { + "id": 33, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "811:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 31, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "811:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "810:15:0" + }, + "scope": 76, + "src": "751:109:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "913:54:0", + "statements": [ + { + "expression": { + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "928:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "921:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 47, + "nodeType": "ExpressionStatement", + "src": "921:14:0" + }, + { + "expression": { + "arguments": [ + { + "id": 51, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "954:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 48, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "943:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "src": "943:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_string_storage_$returns$__$", + "typeString": "function (string storage ref)" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "943:19:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "943:19:0" + } + ] + }, + "functionSelector": "c47f0027", + "id": 55, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 41, + "mutability": "mutable", + "name": "newName", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "881:21:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "881:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "880:23:0" + }, + "returnParameters": { + "id": 43, + "nodeType": "ParameterList", + "parameters": [], + "src": "913:0:0" + }, + "scope": 76, + "src": "864:103:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 74, + "nodeType": "Block", + "src": "1005:103:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 59, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1019:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1019:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1019:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "56616c7565206d757374206265206469666572656e74206f662030", + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1034:29:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + }, + "value": "Value must be diferent of 0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + } + ], + "id": 58, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1011:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 64, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1011:53:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 65, + "nodeType": "ExpressionStatement", + "src": "1011:53:0" + }, + { + "expression": { + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 66, + "name": "deposits", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1070:8:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 69, + "indexExpression": { + "expression": { + "id": 67, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1079:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "1079:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1070:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 70, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1094:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1094:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1070:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "1070:33:0" + } + ] + }, + "functionSelector": "d0e30db0", + "id": 75, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deposit", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 56, + "nodeType": "ParameterList", + "parameters": [], + "src": "987:2:0" + }, + "returnParameters": { + "id": 57, + "nodeType": "ParameterList", + "parameters": [], + "src": "1005:0:0" + }, + "scope": 76, + "src": "971:137:0", + "stateMutability": "payable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 77, + "src": "439:671:0" + } + ], + "src": "413:698:0" + }, + "legacyAST": { + "absolutePath": "/Users/jordigironamezcua/pruebas/contracts/HelloWorld.sol", + "exportedSymbols": { + "HelloWorld": [ + 76 + ] + }, + "id": 77, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + ">=", + "0.7", + ".0" + ], + "nodeType": "PragmaDirective", + "src": "413:24:0" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 76, + "linearizedBaseContracts": [ + 76 + ], + "name": "HelloWorld", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 4, + "mutability": "mutable", + "name": "name", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "463:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string" + }, + "typeName": { + "id": 2, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "463:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "value": { + "hexValue": "4361707461696e436163747573", + "id": 3, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "485:15:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_bdd2f21877c99489ddcc32737686677f40d460368c7982ce22ce4f72b41b0312", + "typeString": "literal_string \"CaptainCactus\"" + }, + "value": "CaptainCactus" + }, + "visibility": "private" + }, + { + "constant": false, + "id": 8, + "mutability": "mutable", + "name": "deposits", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "504:37:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "typeName": { + "id": 7, + "keyType": { + "id": 5, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "513:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "504:28:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + }, + "valueType": { + "id": 6, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "524:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 11, + "mutability": "mutable", + "name": "names", + "nodeType": "VariableDeclaration", + "scope": 76, + "src": "545:22:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string[]" + }, + "typeName": { + "baseType": { + "id": 9, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "545:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "id": 10, + "nodeType": "ArrayTypeName", + "src": "545:8:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage_ptr", + "typeString": "string[]" + } + }, + "visibility": "private" + }, + { + "body": { + "id": 18, + "nodeType": "Block", + "src": "630:32:0", + "statements": [ + { + "expression": { + "hexValue": "48656c6c6f20576f726c6421", + "id": 16, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "643:14:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0", + "typeString": "literal_string \"Hello World!\"" + }, + "value": "Hello World!" + }, + "functionReturnParameters": 15, + "id": 17, + "nodeType": "Return", + "src": "636:21:0" + } + ] + }, + "functionSelector": "ef5fb05b", + "id": 19, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "sayHello", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 12, + "nodeType": "ParameterList", + "parameters": [], + "src": "591:2:0" + }, + "returnParameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 14, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 19, + "src": "615:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 13, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "614:15:0" + }, + "scope": 76, + "src": "573:89:0", + "stateMutability": "pure", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 26, + "nodeType": "Block", + "src": "723:24:0", + "statements": [ + { + "expression": { + "id": 24, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "738:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 23, + "id": 25, + "nodeType": "Return", + "src": "731:11:0" + } + ] + }, + "functionSelector": "17d7de7c", + "id": 27, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 20, + "nodeType": "ParameterList", + "parameters": [], + "src": "682:2:0" + }, + "returnParameters": { + "id": 23, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 22, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "706:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 21, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "706:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "705:15:0" + }, + "scope": 76, + "src": "666:81:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 38, + "nodeType": "Block", + "src": "828:32:0", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 34, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "843:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 36, + "indexExpression": { + "id": 35, + "name": "index", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "849:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "843:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "functionReturnParameters": 33, + "id": 37, + "nodeType": "Return", + "src": "836:19:0" + } + ] + }, + "functionSelector": "59c293f1", + "id": 39, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getNameByIndex", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 29, + "mutability": "mutable", + "name": "index", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "775:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 28, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "775:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "774:15:0" + }, + "returnParameters": { + "id": 33, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "mutability": "mutable", + "name": "", + "nodeType": "VariableDeclaration", + "scope": 39, + "src": "811:13:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 31, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "811:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "810:15:0" + }, + "scope": 76, + "src": "751:109:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "913:54:0", + "statements": [ + { + "expression": { + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 44, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4, + "src": "921:4:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 45, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "928:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "src": "921:14:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 47, + "nodeType": "ExpressionStatement", + "src": "921:14:0" + }, + { + "expression": { + "arguments": [ + { + "id": 51, + "name": "newName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 41, + "src": "954:7:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "expression": { + "id": 48, + "name": "names", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11, + "src": "943:5:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_string_storage_$dyn_storage", + "typeString": "string storage ref[] storage ref" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "src": "943:10:0", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_string_storage_$returns$__$", + "typeString": "function (string storage ref)" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "943:19:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "943:19:0" + } + ] + }, + "functionSelector": "c47f0027", + "id": 55, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "setName", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 42, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 41, + "mutability": "mutable", + "name": "newName", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "881:21:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 40, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "881:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "880:23:0" + }, + "returnParameters": { + "id": 43, + "nodeType": "ParameterList", + "parameters": [], + "src": "913:0:0" + }, + "scope": 76, + "src": "864:103:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 74, + "nodeType": "Block", + "src": "1005:103:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 62, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 59, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1019:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1019:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1031:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1019:13:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "56616c7565206d757374206265206469666572656e74206f662030", + "id": 63, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1034:29:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + }, + "value": "Value must be diferent of 0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e2e49ac39a44b46c7e6b37baa540d6e7db7dbdc5b2c6632b03592f4b15517e5e", + "typeString": "literal_string \"Value must be diferent of 0\"" + } + ], + "id": 58, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1011:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 64, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1011:53:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 65, + "nodeType": "ExpressionStatement", + "src": "1011:53:0" + }, + { + "expression": { + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "baseExpression": { + "id": 66, + "name": "deposits", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8, + "src": "1070:8:0", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_uint256_$", + "typeString": "mapping(address => uint256)" + } + }, + "id": 69, + "indexExpression": { + "expression": { + "id": 67, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1079:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 68, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "1079:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1070:20:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "expression": { + "id": 70, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "1094:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "1094:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1070:33:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "1070:33:0" + } + ] + }, + "functionSelector": "d0e30db0", + "id": 75, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "deposit", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 56, + "nodeType": "ParameterList", + "parameters": [], + "src": "987:2:0" + }, + "returnParameters": { + "id": 57, + "nodeType": "ParameterList", + "parameters": [], + "src": "1005:0:0" + }, + "scope": 76, + "src": "971:137:0", + "stateMutability": "payable", + "virtual": false, + "visibility": "public" + } + ], + "scope": 77, + "src": "439:671:0" + } + ], + "src": "413:698:0" + }, + "compiler": { + "name": "solc", + "version": "0.8.0+commit.c7dfd78e.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.3.3", + "updatedAt": "2021-02-12T11:15:58.676Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.sol b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.sol new file mode 100644 index 00000000000..30bc8f71346 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/solidity/hello-world-contract/HelloWorld.sol @@ -0,0 +1,40 @@ +// ***************************************************************************** +// IMPORTANT: If you update this code then make sure to recompile +// it and update the .json file as well so that they +// remain in sync for consistent test executions. +// With that said, there shouldn't be any reason to recompile this, like ever... +// ***************************************************************************** + +pragma solidity >=0.7.0; + +contract HelloWorld { + string private name = "CaptainCactus"; + mapping (address => uint256) deposits; + string[] private names; + + function sayHello () public pure returns (string memory) { + return 'Hello World!'; + } + + function getName() public view returns (string memory) + { + return name; + } + + function getNameByIndex(uint256 index) public view returns (string memory) + { + return names[index]; + } + + function setName(string memory newName) public + { + name = newName; + names.push(newName); + } + + function deposit() public payable { + require(msg.value > 0, "Value must be diferent of 0"); + deposits[msg.sender] += msg.value; + } + +} diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts new file mode 100644 index 00000000000..a65ea582473 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/api-surface.test.ts @@ -0,0 +1,5 @@ +import * as apiSurface from "../../../main/typescript/public-api"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/grpc-services/connector-avalanche-grpc-services.test.ts b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/grpc-services/connector-avalanche-grpc-services.test.ts new file mode 100644 index 00000000000..adb763f0ded --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/src/test/typescript/integration/grpc-services/connector-avalanche-grpc-services.test.ts @@ -0,0 +1,279 @@ +// import http from "http"; +// import { AddressInfo } from "node:net"; + +// import "jest-extended"; +// import * as grpc from "@grpc/grpc-js"; +// import { v4 as uuidv4 } from "uuid"; +// import Web3 from "web3"; +// import { Account } from "web3-core"; + +// import { +// LogLevelDesc, +// Logger, +// LoggerProvider, +// Servers, +// isGrpcStatusObjectWithCode, +// } from "@hyperledger/cactus-common"; +// import { +// AvalancheTestLedger, +// pruneDockerAllIfGithubAction, +// } from "@hyperledger/cactus-test-tooling"; +// import { +// PluginLedgerConnectorAvalanche, +// createGrpcInsecureChannelCredentials, +// avalanche_grpc_svc_streams, +// default_service, +// get_block_v1_request_pb, +// get_block_v1_response_pb, +// google_protobuf_any, +// watch_blocks_v1_progress_pb, +// watch_blocks_v1_request_pb, +// watch_blocks_v1_pb, +// } from "@hyperledger/cacti-plugin-ledger-connector-avalanche"; +// import { PluginRegistry } from "@hyperledger/cactus-core"; +// import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +// import { +// ApiServer, +// AuthorizationProtocol, +// ConfigService, +// createGrpcServer, +// } from "@hyperledger/cactus-cmd-api-server"; + +// const logLevel: LogLevelDesc = "INFO"; + +// type WatchBlocksV1ProgressPB = +// watch_blocks_v1_progress_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1ProgressPB; + +// describe("AvalancheGrpcSvcOpenApi", () => { +// const log: Logger = LoggerProvider.getOrCreate({ +// label: "plugin-ledger-connector-avalanche-grpc-service-test", +// level: logLevel, +// }); + +// let ledger: AvalancheTestLedger; +// let httpServer: http.Server; +// let grpcServer: grpc.Server; +// let connector: PluginLedgerConnectorAvalanche; +// let grpcClientDefaultSvc: default_service.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.DefaultServiceClient; +// let grpcClientAvalancheSvc: avalanche_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice.AvalancheGrpcSvcStreamsClient; +// let targetEthAccount: Account; +// let apiServer: ApiServer; +// let addressInfo: AddressInfo; + +// beforeAll(async () => { +// log.info("Prune Docker..."); +// await pruneDockerAllIfGithubAction({ logLevel }); + +// log.info("Start AvalancheTestLedger..."); +// ledger = new AvalancheTestLedger({}); +// await ledger.start(); + +// grpcServer = createGrpcServer(); + +// httpServer = await Servers.startOnPreferredPort(4050); +// addressInfo = httpServer.address() as AddressInfo; +// const apiHttpHost = `http://${addressInfo.address}:${addressInfo.port}`; +// log.debug("HTTP API host: %s", apiHttpHost); + +// const rpcApiHttpHost = await ledger.getRpcApiHttpHost(); +// const rpcApiWsHost = await ledger.getRpcApiWsHost(); +// log.debug("rpcApiHttpHost:", rpcApiHttpHost); +// log.debug("rpcApiWsHost:", rpcApiWsHost); + +// // Target account - create new +// const web3 = new Web3(rpcApiHttpHost); +// targetEthAccount = web3.eth.accounts.create(uuidv4()); + +// const keychainEntryKey = uuidv4(); +// const keychainEntryValue = targetEthAccount.privateKey; +// const keychainPlugin = new PluginKeychainMemory({ +// instanceId: uuidv4(), +// keychainId: uuidv4(), +// // pre-provision keychain with mock backend holding the private key of the +// // test account that we'll reference while sending requests with the +// // signing credential pointing to this keychain entry. +// backend: new Map([[keychainEntryKey, keychainEntryValue]]), +// logLevel, +// }); + +// log.debug("Instantiating PluginLedgerConnectorAvalanche..."); + +// connector = new PluginLedgerConnectorAvalanche({ +// rpcApiHttpHost, +// rpcApiWsHost, +// logLevel, +// instanceId: uuidv4(), +// pluginRegistry: new PluginRegistry({ plugins: [keychainPlugin] }), +// }); + +// const pluginRegistry = new PluginRegistry({ plugins: [] }); + +// const cfgSrv = new ConfigService(); +// const apiSrvOpts = await cfgSrv.newExampleConfig(); +// apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; +// apiSrvOpts.logLevel = logLevel; +// apiSrvOpts.configFile = ""; +// apiSrvOpts.apiCorsDomainCsv = "*"; +// apiSrvOpts.apiPort = addressInfo.port; +// apiSrvOpts.cockpitPort = 0; +// apiSrvOpts.grpcPort = 0; +// apiSrvOpts.crpcPort = 0; +// apiSrvOpts.grpcMtlsEnabled = false; +// apiSrvOpts.apiTlsEnabled = false; +// const cfg = await cfgSrv.newExampleConfigConvict(apiSrvOpts); + +// pluginRegistry.add(keychainPlugin); +// pluginRegistry.add(connector); + +// apiServer = new ApiServer({ +// httpServerApi: httpServer, +// grpcServer, +// config: cfg.getProperties(), +// pluginRegistry, +// }); + +// const { addressInfoGrpc } = await apiServer.start(); +// const grpcPort = addressInfoGrpc.port; +// const grpcHost = addressInfoGrpc.address; +// const grpcFamily = addressInfo.family; +// log.info("gRPC family=%s host=%s port=%s", grpcFamily, grpcHost, grpcPort); + +// const grpcChannelCredentials = createGrpcInsecureChannelCredentials(); +// const grpcUrl = `${grpcHost}:${grpcPort}`; +// grpcClientDefaultSvc = +// new default_service.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.DefaultServiceClient( +// grpcUrl, +// grpcChannelCredentials, +// { +// "grpc-node.tls_enable_trace": 1, +// }, +// ); + +// grpcClientAvalancheSvc = +// new avalanche_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.avalancheservice.AvalancheGrpcSvcStreamsClient( +// grpcUrl, +// grpcChannelCredentials, +// { +// "grpc-node.tls_enable_trace": 1, +// }, +// ); + +// log.debug("Created gRPC client OK."); +// }); + +// test("gRPC - getBlockV1() returns arbitrary ledger block", async () => { +// const blockHashOrBlockNumberData = Buffer.from("latest", "utf-8"); +// const blockHashOrBlockNumber = +// new google_protobuf_any.google.protobuf.Any(); + +// blockHashOrBlockNumber.value = blockHashOrBlockNumberData; + +// const getBlockV1RequestPB = +// new get_block_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.GetBlockV1RequestPB( +// { blockHashOrBlockNumber }, +// ); + +// const req1 = +// new default_service.org.hyperledger.cacti.plugin.ledger.connector.avalanche.services.defaultservice.GetBlockV1Request( +// { getBlockV1RequestPB }, +// ); + +// const metadata1 = new grpc.Metadata(); + +// const res1Promise = +// new Promise( +// (resolve, reject) => { +// const call = grpcClientDefaultSvc.GetBlockV1( +// req1, +// metadata1, +// ( +// err: grpc.ServiceError | null, +// value?: get_block_v1_response_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.GetBlockV1ResponsePB, +// ) => { +// log.debug("Received callback from gRPC service: ", err, value); +// if (err) { +// reject(err); +// } else if (value) { +// resolve(value); +// } else { +// reject(new Error("Received no gRPC error nor response value.")); +// } +// }, +// ); +// log.debug("gRPC call object: ", call); +// expect(call).toBeTruthy(); +// }, +// ); + +// expect(res1Promise).toResolve(); +// const res1 = await res1Promise; +// expect(res1).toBeTruthy(); +// expect(res1).toBeObject(); + +// const block = res1.block.toObject(); +// expect(block).toBeTruthy(); +// expect(block).toBeObject(); +// expect(block).not.toBeEmptyObject(); +// expect(block.number).toBeTruthy(); +// expect(block.hash).toBeTruthy(); +// expect(block.transactions).toBeArray(); +// }); + +// test("gRPC - watchBlocksV1() streams ledger blocks as they are created", async () => { +// const reqMetadata = new grpc.Metadata(); +// const stream = grpcClientAvalancheSvc.WatchBlocksV1(reqMetadata); + +// const msgs: Array = []; +// const MSG_COUNT_SUCCESS = 3; + +// const streamDoneAsync = new Promise((resolve, reject) => { +// stream.on("data", (chunk: WatchBlocksV1ProgressPB) => { +// msgs.push(chunk); +// log.debug("WatchBlocksV1::data=%o, msg.length=%o", chunk, msgs.length); +// if (msgs.length >= MSG_COUNT_SUCCESS) { +// const reqUnsubscribe = +// new watch_blocks_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1RequestPB(); + +// reqUnsubscribe.event = +// watch_blocks_v1_pb.org.hyperledger.cacti.plugin.ledger.connector.avalanche.WatchBlocksV1PB.WatchBlocksV1PB_Unsubscribe; + +// stream.write(reqUnsubscribe); +// } +// }); + +// stream.on("status", (status: unknown) => { +// log.debug("WatchBlocksV1::status=%o", status); +// if ( +// isGrpcStatusObjectWithCode(status) && +// status.code === grpc.status.OK +// ) { +// resolve(); +// } else { +// const statusJson = JSON.stringify(status); +// reject(new Error(`Received non-OK grpc status code: ${statusJson}`)); +// } +// }); + +// stream.on("error", (error: unknown) => { +// log.debug("WatchBlocksV1::error=%o", error); +// reject(error); +// }); + +// stream.on("close", () => { +// log.debug("WatchBlocksV1::close="); +// resolve(); +// }); +// }); + +// await expect(streamDoneAsync).toResolve(); +// }, 15000); + +// afterAll(async () => { +// if (apiServer) { +// await apiServer.shutdown(); +// } +// await ledger.stop(); +// await ledger.destroy(); +// await pruneDockerAllIfGithubAction({ logLevel }); +// }); +// }); diff --git a/packages/cacti-test-plugin-ledger-connector-avalanche/tsconfig.json b/packages/cacti-test-plugin-ledger-connector-avalanche/tsconfig.json new file mode 100644 index 00000000000..7677d0b1737 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-avalanche/tsconfig.json @@ -0,0 +1,38 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/lib/", + "declarationDir": "dist/lib", + "resolveJsonModule": true, + "rootDir": "./src", + "tsBuildInfoFile": "../../.build-cache/cactus-test-plugin-ledger-connector-avalanche.tsbuildinfo" + }, + "include": [ + "./src", + "src/**/*.json" + ], + "references": [ + { + "path": "../cactus-cmd-api-server/tsconfig.json" + }, + { + "path": "../cactus-common/tsconfig.json" + }, + { + "path": "../cactus-core/tsconfig.json" + }, + { + "path": "../cactus-core-api/tsconfig.json" + }, + { + "path": "../cactus-plugin-keychain-memory/tsconfig.json" + }, + { + "path": "../cacti-plugin-ledger-connector-avalanche/tsconfig.json" + }, + { + "path": "../cactus-test-tooling/tsconfig.json" + } + ] +} diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/README.md b/packages/cacti-test-plugin-ledger-connector-chainlink/README.md new file mode 100644 index 00000000000..b12e3b6c542 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/README.md @@ -0,0 +1,6 @@ +# @hyperledger/cactus-test-plugin-ledger-connector-besu + +This package is designed to hold test cases verifying the correct operation of +the code in the package of similar name: `@hyperledger/cactus-plugin-ledger-connector-besu`. + +It contains no code that you would find useful in a production deployment. diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/package.json b/packages/cacti-test-plugin-ledger-connector-chainlink/package.json new file mode 100644 index 00000000000..b91d40eaa3f --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/package.json @@ -0,0 +1,78 @@ +{ + "name": "@hyperledger/cacti-test-plugin-ledger-connector-chainlink", + "version": "2.0.0-rc.4", + "description": "Integration tests for the Chainlink ledger and the API server.", + "keywords": [ + "Hyperledger", + "Cacti", + "Integration", + "Blockchain", + "Distributed Ledger Technology" + ], + "homepage": "https://github.com/hyperledger/cacti#readme", + "bugs": { + "url": "https://github.com/hyperledger/cacti/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger/cacti.git" + }, + "license": "Apache-2.0", + "author": { + "name": "Hyperledger Cacti Contributors", + "email": "cacti@lists.hyperledger.org", + "url": "https://www.hyperledger.org/use/cacti" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + }, + { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + } + ], + "main": "dist/lib/main/typescript/index.js", + "module": "dist/lib/main/typescript/index.js", + "browser": "dist/cacti-test-plugin-ledger-connector-besu.web.umd.js", + "types": "dist/lib/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "scripts": { + "watch": "npm-watch", + "webpack": "npm-run-all webpack:dev", + "webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web", + "webpack:dev:node": "webpack --env=dev --target=node --config ../../webpack.config.js", + "webpack:dev:web": "webpack --env=dev --target=web --config ../../webpack.config.js" + }, + "dependencies": { + "@grpc/grpc-js": "1.11.1", + "@hyperledger/cacti-plugin-ledger-connector-chainlink": "2.0.0-rc.4", + "@hyperledger/cactus-cmd-api-server": "2.0.0-rc.4", + "@hyperledger/cactus-common": "2.0.0-rc.4", + "@hyperledger/cactus-core": "2.0.0-rc.4", + "@hyperledger/cactus-core-api": "2.0.0-rc.4", + "@hyperledger/cactus-plugin-keychain-memory": "2.0.0-rc.4", + "@hyperledger/cactus-test-tooling": "2.0.0-rc.4", + "http-status-codes": "2.3.0" + }, + "devDependencies": { + "@types/express": "4.17.21", + "axios": "1.7.7", + "express": "4.19.2" + }, + "engines": { + "node": ">=18", + "npm": ">=8" + }, + "publishConfig": { + "access": "public" + }, + "browserMinified": "dist/cacti-test-plugin-ledger-connector-besu.web.umd.min.js", + "mainMinified": "dist/cacti-test-plugin-ledger-connector-besu.node.umd.min.js", + "watch": {} +} diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.ts new file mode 100644 index 00000000000..87cb558397c --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/main/typescript/public-api.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts new file mode 100644 index 00000000000..b156844f94a --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/api-surface.test.ts @@ -0,0 +1,5 @@ +import * as apiSurface from "@hyperledger/cacti-plugin-ledger-connector-chainlink"; + +test("Library can be loaded", async () => { + expect(apiSurface).toBeTruthy(); +}); diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/grpc-services/connector-chainlink-grpc-services.test.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/grpc-services/connector-chainlink-grpc-services.test.ts new file mode 100644 index 00000000000..de622d2e8bd --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/grpc-services/connector-chainlink-grpc-services.test.ts @@ -0,0 +1,267 @@ +// import http from "node:http"; +// import { AddressInfo } from "node:net"; +// import { randomUUID } from "node:crypto"; + +// import "jest-extended"; +// import * as grpc from "@grpc/grpc-js"; + +// import { +// LogLevelDesc, +// Logger, +// LoggerProvider, +// Servers, +// isGrpcStatusObjectWithCode, +// } from "@hyperledger/cactus-common"; +// import { +// ChainlinkTestLedger, +// pruneDockerAllIfGithubAction, +// } from "@hyperledger/cactus-test-tooling"; +// import { +// PluginLedgerConnectorChainlink, +// createGrpcInsecureChannelCredentials, +// chainlink_grpc_svc_streams, +// default_service, +// get_block_v1_request_pb, +// get_block_v1_response_pb, +// google_protobuf_any, +// watch_blocks_v1_progress_pb, +// watch_blocks_v1_request_pb, +// watch_blocks_v1_pb, +// } from "@hyperledger/cacti-plugin-ledger-connector-chainlink"; + +// import { PluginRegistry } from "@hyperledger/cactus-core"; +// import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +// import { +// ApiServer, +// AuthorizationProtocol, +// ConfigService, +// createGrpcServer, +// } from "@hyperledger/cactus-cmd-api-server"; + +// type WatchBlocksV1ProgressPB = +// watch_blocks_v1_progress_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1ProgressPB; + +// describe("ChainlinkGrpcSvcOpenApi", () => { +// const logLevel: LogLevelDesc = "INFO"; +// const log: Logger = LoggerProvider.getOrCreate({ +// label: "plugin-ledger-connector-chainlink-grpc-service-test", +// level: logLevel, +// }); +// const keychainId = randomUUID(); +// const keychainInstanceId = randomUUID(); + +// let ledger: ChainlinkTestLedger; +// let httpServer: http.Server; +// let grpcServer: grpc.Server; +// let connector: PluginLedgerConnectorChainlink; +// let grpcClientDefaultSvc: default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.DefaultServiceClient; +// let grpcClientChainlinkSvc: chainlink_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice.ChainlinkGrpcSvcStreamsClient; +// let apiServer: ApiServer; +// let addressInfo: AddressInfo; + +// beforeAll(async () => { +// log.info("Prune Docker..."); +// await pruneDockerAllIfGithubAction({ logLevel }); + +// log.info("Start ChainlinkTestLedger..."); +// ledger = new ChainlinkTestLedger({}); +// await ledger.start(); + +// grpcServer = createGrpcServer(); + +// httpServer = await Servers.startOnPreferredPort(4050); +// addressInfo = httpServer.address() as AddressInfo; +// const apiHttpHost = `http://${addressInfo.address}:${addressInfo.port}`; +// log.debug("HTTP API host: %s", apiHttpHost); + +// const keychainEntryKey = randomUUID(); +// const keychainEntryValue = "privateKey--FIXME"; +// const keychainPlugin = new PluginKeychainMemory({ +// instanceId: keychainInstanceId, +// keychainId, +// // pre-provision keychain with mock backend holding the private key of the +// // test account that we'll reference while sending requests with the +// // signing credential pointing to this keychain entry. +// backend: new Map([[keychainEntryKey, keychainEntryValue]]), +// logLevel, +// }); + +// log.debug("Instantiating PluginLedgerConnectorChainlink..."); + +// connector = new PluginLedgerConnectorChainlink({ +// logLevel, +// instanceId: randomUUID(), +// pluginRegistry: new PluginRegistry({ plugins: [keychainPlugin] }), +// }); + +// const pluginRegistry = new PluginRegistry({ plugins: [] }); + +// const cfgSrv = new ConfigService(); +// const apiSrvOpts = await cfgSrv.newExampleConfig(); +// apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; +// apiSrvOpts.logLevel = logLevel; +// apiSrvOpts.configFile = ""; +// apiSrvOpts.apiCorsDomainCsv = "*"; +// apiSrvOpts.apiPort = addressInfo.port; +// apiSrvOpts.cockpitPort = 0; +// apiSrvOpts.grpcPort = 0; +// apiSrvOpts.crpcPort = 0; +// apiSrvOpts.grpcMtlsEnabled = false; +// apiSrvOpts.apiTlsEnabled = false; +// const cfg = await cfgSrv.newExampleConfigConvict(apiSrvOpts); + +// pluginRegistry.add(keychainPlugin); +// pluginRegistry.add(connector); + +// apiServer = new ApiServer({ +// httpServerApi: httpServer, +// grpcServer, +// config: cfg.getProperties(), +// pluginRegistry, +// }); + +// const { addressInfoGrpc } = await apiServer.start(); +// const grpcPort = addressInfoGrpc.port; +// const grpcHost = addressInfoGrpc.address; +// const grpcFamily = addressInfo.family; +// log.info("gRPC family=%s host=%s port=%s", grpcFamily, grpcHost, grpcPort); + +// const grpcChannelCredentials = createGrpcInsecureChannelCredentials(); +// const grpcUrl = `${grpcHost}:${grpcPort}`; +// grpcClientDefaultSvc = +// new default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.DefaultServiceClient( +// grpcUrl, +// grpcChannelCredentials, +// { +// "grpc-node.tls_enable_trace": 1, +// }, +// ); + +// grpcClientChainlinkSvc = +// new chainlink_grpc_svc_streams.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.chainlinkservice.ChainlinkGrpcSvcStreamsClient( +// grpcUrl, +// grpcChannelCredentials, +// { +// "grpc-node.tls_enable_trace": 1, +// }, +// ); + +// log.debug("Created gRPC client OK."); +// }); + +// test("gRPC - getBlockV1() returns arbitrary ledger block", async () => { +// const blockHashOrBlockNumberData = Buffer.from("latest", "utf-8"); +// const blockHashOrBlockNumber = +// new google_protobuf_any.google.protobuf.Any(); + +// blockHashOrBlockNumber.value = blockHashOrBlockNumberData; + +// const getBlockV1RequestPB = +// new get_block_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetBlockV1RequestPB( +// { blockHashOrBlockNumber }, +// ); + +// const req1 = +// new default_service.org.hyperledger.cacti.plugin.ledger.connector.chainlink.services.defaultservice.GetBlockV1Request( +// { getBlockV1RequestPB }, +// ); + +// const metadata1 = new grpc.Metadata(); + +// const res1Promise = +// new Promise( +// (resolve, reject) => { +// const call = grpcClientDefaultSvc.GetBlockV1( +// req1, +// metadata1, +// ( +// err: grpc.ServiceError | null, +// value?: get_block_v1_response_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.GetBlockV1ResponsePB, +// ) => { +// log.debug("Received callback from gRPC service: ", err, value); +// if (err) { +// reject(err); +// } else if (value) { +// resolve(value); +// } else { +// reject(new Error("Received no gRPC error nor response value.")); +// } +// }, +// ); +// log.debug("gRPC call object: ", call); +// expect(call).toBeTruthy(); +// }, +// ); + +// expect(res1Promise).toResolve(); +// const res1 = await res1Promise; +// expect(res1).toBeTruthy(); +// expect(res1).toBeObject(); + +// const block = res1.block.toObject(); +// expect(block).toBeTruthy(); +// expect(block).toBeObject(); +// expect(block).not.toBeEmptyObject(); +// expect(block.number).toBeTruthy(); +// expect(block.hash).toBeTruthy(); +// expect(block.transactions).toBeArray(); +// }); + +// test("gRPC - watchBlocksV1() streams ledger blocks as they are created", async () => { +// const reqMetadata = new grpc.Metadata(); +// const stream = grpcClientChainlinkSvc.WatchBlocksV1(reqMetadata); + +// const msgs: Array = []; +// const MSG_COUNT_SUCCESS = 3; + +// const streamDoneAsync = new Promise((resolve, reject) => { +// stream.on("data", (chunk: WatchBlocksV1ProgressPB) => { +// msgs.push(chunk); +// log.debug("WatchBlocksV1::data=%o, msg.length=%o", chunk, msgs.length); +// if (msgs.length >= MSG_COUNT_SUCCESS) { +// const reqUnsubscribe = +// new watch_blocks_v1_request_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1RequestPB(); + +// reqUnsubscribe.event = +// watch_blocks_v1_pb.org.hyperledger.cacti.plugin.ledger.connector.chainlink.WatchBlocksV1PB.WatchBlocksV1PB_Unsubscribe; + +// stream.write(reqUnsubscribe); +// } +// }); + +// stream.on("status", (status: unknown) => { +// log.debug("WatchBlocksV1::status=%o", status); +// if ( +// isGrpcStatusObjectWithCode(status) && +// status.code === grpc.status.OK +// ) { +// resolve(); +// } else { +// const statusJson = JSON.stringify(status); +// reject(new Error(`Received non-OK grpc status code: ${statusJson}`)); +// } +// }); + +// stream.on("error", (error: unknown) => { +// log.debug("WatchBlocksV1::error=%o", error); +// reject(error); +// }); + +// stream.on("close", () => { +// log.debug("WatchBlocksV1::close="); +// resolve(); +// }); +// }); + +// await expect(streamDoneAsync).toResolve(); +// }, 15000); + +// afterAll(async () => { +// if (apiServer) { +// await apiServer.shutdown(); +// } +// await ledger.stop(); +// await ledger.destroy(); +// await pruneDockerAllIfGithubAction({ logLevel }); +// }); +// }); diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-balance-endpoint.test.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-balance-endpoint.test.ts new file mode 100644 index 00000000000..0c63fe7f739 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-balance-endpoint.test.ts @@ -0,0 +1,167 @@ +// import { createServer } from "node:http"; +// import { AddressInfo } from "node:net"; + +// Error.stackTraceLimit = 100; + +// import "jest-extended"; + +// import { StatusCodes } from "http-status-codes"; +// import { v4 as uuidv4 } from "uuid"; +// import KeyEncoder from "key-encoder"; +// import { Account } from "web3-core"; + +// import { +// ApiServer, +// AuthorizationProtocol, +// ConfigService, +// } from "@hyperledger/cactus-cmd-api-server"; +// import { +// Secp256k1Keys, +// KeyFormat, +// LogLevelDesc, +// LoggerProvider, +// } from "@hyperledger/cactus-common"; +// import { +// ChainlinkTestLedger, +// buildImageChainlinkAllInOneLatest, +// pruneDockerAllIfGithubAction, +// } from "@hyperledger/cactus-test-tooling"; +// import { +// ChainlinkApiClientOptions, +// ChainlinkApiClient, +// IPluginLedgerConnectorChainlinkOptions, +// PluginLedgerConnectorChainlink, +// GetBalanceV1Request, +// } from "@hyperledger/cacti-plugin-ledger-connector-chainlink"; +// import { PluginRegistry } from "@hyperledger/cactus-core"; +// import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; + +// describe("PluginLedgerConnectorChainlink", () => { +// const logLevel: LogLevelDesc = "INFO"; +// const log = LoggerProvider.getOrCreate({ +// label: "get-balance-endpoint.test.ts", +// level: logLevel, +// }); + +// const keyEncoder: KeyEncoder = new KeyEncoder("secp256k1"); +// const keychainId = uuidv4(); +// const keychainRef = uuidv4(); +// const { privateKey } = Secp256k1Keys.generateKeyPairsBuffer(); +// const keyHex = privateKey.toString("hex"); +// const pem = keyEncoder.encodePrivate(keyHex, KeyFormat.Raw, KeyFormat.PEM); +// const keychain = new PluginKeychainMemory({ +// backend: new Map([[keychainRef, pem]]), +// keychainId, +// logLevel, +// instanceId: uuidv4(), +// }); +// const pluginRegistry = new PluginRegistry({ plugins: [keychain] }); +// const httpServer1 = createServer(); + +// const expectedBalance = Math.ceil(Math.random() * Math.pow(10, 6)); + +// let ledger: ChainlinkTestLedger; +// let apiServer: ApiServer; +// let testAccount: Account; +// let node1Host: string; + +// beforeAll(async () => { +// const pruning = pruneDockerAllIfGithubAction({ logLevel }); +// await expect(pruning).toResolve(); +// }); + +// beforeAll(async () => { +// const ledgerImg = await buildImageChainlinkAllInOneLatest({ logLevel }); +// const { imageName, imageVersion } = ledgerImg; +// ledger = new ChainlinkTestLedger({ +// containerImageName: imageName, +// containerImageVersion: imageVersion, +// logLevel, +// }); +// // we've built the image locally so trying to pull it would fail +// const omitImagePullFromNetwork = true; +// await ledger.start(omitImagePullFromNetwork); +// }); + +// beforeAll(async () => { +// await new Promise((resolve, reject) => { +// httpServer1.once("error", reject); +// httpServer1.once("listening", resolve); +// httpServer1.listen(0, "127.0.0.1"); +// }); + +// const addressInfo1 = httpServer1.address() as AddressInfo; +// log.debug(`HttpServer1 AddressInfo: ${JSON.stringify(addressInfo1)}`); + +// node1Host = `http://${addressInfo1.address}:${addressInfo1.port}`; +// log.debug(`Cactus Node 1 Host: ${node1Host}`); + +// testAccount = await ledger.createEthTestAccount(expectedBalance); +// const rpcApiHttpHost = await ledger.getRpcApiHttpHost(); +// const rpcApiWsHost = await ledger.getRpcApiWsHost(); + +// // 3. Instantiate the web service consortium plugin +// const options: IPluginLedgerConnectorChainlinkOptions = { +// instanceId: uuidv4(), +// rpcApiHttpHost, +// rpcApiWsHost, +// pluginRegistry, +// logLevel, +// }; +// const pluginValidatorChainlink = new PluginLedgerConnectorChainlink(options); + +// // 4. Create the API Server object that we embed in this test +// const cfgSvc = new ConfigService(); +// const apiSrvOpts = await cfgSvc.newExampleConfig(); +// apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; +// apiSrvOpts.configFile = ""; +// apiSrvOpts.apiCorsDomainCsv = "*"; +// apiSrvOpts.apiPort = addressInfo1.port; +// apiSrvOpts.cockpitPort = 0; +// apiSrvOpts.grpcPort = 0; +// apiSrvOpts.crpcPort = 0; +// apiSrvOpts.apiTlsEnabled = false; +// const config = await cfgSvc.newExampleConfigConvict(apiSrvOpts); + +// pluginRegistry.add(pluginValidatorChainlink); + +// apiServer = new ApiServer({ +// httpServerApi: httpServer1, +// config: config.getProperties(), +// pluginRegistry, +// }); + +// await apiServer.start(); +// log.debug(`AddressInfo: ${JSON.stringify(addressInfo1)}`); +// }); + +// afterAll(async () => { +// const pruning = pruneDockerAllIfGithubAction({ logLevel }); +// await expect(pruning).toResolve(); +// }); + +// afterAll(async () => { +// await ledger.stop(); +// await ledger.destroy(); +// }); + +// afterAll(async () => await apiServer.shutdown()); + +// it("getBalanceV1() - retrieves ETH account balance", async () => { +// const request: GetBalanceV1Request = { +// address: testAccount.address, +// }; + +// const configuration = new ChainlinkApiClientOptions({ basePath: node1Host }); +// const api = new ChainlinkApiClient(configuration); + +// // Test for 200 valid response test case +// const getBalanceExchange = api.getBalanceV1(request); +// await expect(getBalanceExchange).resolves.toMatchObject({ +// status: StatusCodes.OK, +// data: expect.objectContaining({ +// balance: expect.stringMatching(expectedBalance.toFixed(0)), +// }), +// }); +// }); +// }); diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-subscription-info-v1-endpoint.test.ts b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-subscription-info-v1-endpoint.test.ts new file mode 100644 index 00000000000..ccaf002e1cd --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/src/test/typescript/integration/http-services/get-subscription-info-v1-endpoint.test.ts @@ -0,0 +1,154 @@ +import { createServer } from "node:http"; +import { AddressInfo } from "node:net"; +import { randomUUID as uuidv4 } from "node:crypto"; + +Error.stackTraceLimit = 100; + +import "jest-extended"; +import { StatusCodes } from "http-status-codes"; + +import { + ApiServer, + AuthorizationProtocol, + ConfigService, +} from "@hyperledger/cactus-cmd-api-server"; +import { LogLevelDesc, LoggerProvider } from "@hyperledger/cactus-common"; +import { + ChainlinkTestLedger, + pruneDockerAllIfGithubAction, +} from "@hyperledger/cactus-test-tooling"; +import { PluginRegistry } from "@hyperledger/cactus-core"; +import { PluginImportType } from "@hyperledger/cactus-core-api"; +import { PluginKeychainMemory } from "@hyperledger/cactus-plugin-keychain-memory"; +import { + ChainlinkApiClientOptions, + ChainlinkApiClient, + IPluginLedgerConnectorChainlinkOptions, + GetSubscriptionInfoV1Request, + PluginFactoryLedgerConnector, +} from "@hyperledger/cacti-plugin-ledger-connector-chainlink"; + +describe("PluginLedgerConnectorChainlink", () => { + const logLevel: LogLevelDesc = "INFO"; + const log = LoggerProvider.getOrCreate({ + label: __filename, + level: logLevel, + }); + + const keychainId = uuidv4(); + const keychain = new PluginKeychainMemory({ + backend: new Map([]), + keychainId, + logLevel, + instanceId: uuidv4(), + }); + const pluginRegistry = new PluginRegistry({ plugins: [keychain] }); + const httpServer1 = createServer(); + + const expectedBalance = Math.ceil(Math.random() * Math.pow(10, 6)); + + let ledger: ChainlinkTestLedger; + let apiServer: ApiServer; + let node1Host: string; + + beforeAll(async () => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await expect(pruning).toResolve(); + }); + + beforeAll(async () => { + ledger = new ChainlinkTestLedger({ + logLevel, + }); + // we've NOT built the image locally so need to pull it from the network + const omitImagePullFromNetwork = false; + await ledger.start(omitImagePullFromNetwork); + }); + + beforeAll(async () => { + await new Promise((resolve, reject) => { + httpServer1.once("error", reject); + httpServer1.once("listening", resolve); + httpServer1.listen(0, "127.0.0.1"); + }); + + const addressInfo1 = httpServer1.address() as AddressInfo; + log.debug(`HttpServer1 AddressInfo: ${JSON.stringify(addressInfo1)}`); + + node1Host = `http://${addressInfo1.address}:${addressInfo1.port}`; + log.debug(`Cactus Node 1 Host: ${node1Host}`); + + const ledgerHttpPort = await ledger.getHttpPortPublic(); + const ledgerHttpHost = "127.0.0.1"; + + const factory = new PluginFactoryLedgerConnector({ + pluginImportType: PluginImportType.Local, + }); + + // 3. Instantiate the web service consortium plugin + const options: IPluginLedgerConnectorChainlinkOptions = { + instanceId: uuidv4(), + pluginRegistry, + ledgerHttpPort, + ledgerHttpHost, + logLevel, + }; + const connector = await factory.create(options); + + // 4. Create the API Server object that we embed in this test + const cfgSvc = new ConfigService(); + const apiSrvOpts = await cfgSvc.newExampleConfig(); + apiSrvOpts.authorizationProtocol = AuthorizationProtocol.NONE; + apiSrvOpts.configFile = ""; + apiSrvOpts.apiCorsDomainCsv = "*"; + apiSrvOpts.apiPort = addressInfo1.port; + apiSrvOpts.cockpitPort = 0; + apiSrvOpts.grpcPort = 0; + apiSrvOpts.crpcPort = 0; + apiSrvOpts.apiTlsEnabled = false; + const config = await cfgSvc.newExampleConfigConvict(apiSrvOpts); + + pluginRegistry.add(connector); + + apiServer = new ApiServer({ + httpServerApi: httpServer1, + config: config.getProperties(), + pluginRegistry, + }); + + await apiServer.start(); + log.debug(`AddressInfo: ${JSON.stringify(addressInfo1)}`); + }); + + afterAll(async () => { + const pruning = pruneDockerAllIfGithubAction({ logLevel }); + await expect(pruning).toResolve(); + }); + + afterAll(async () => { + await ledger.stop(); + await ledger.destroy(); + }); + + afterAll(async () => await apiServer.shutdown()); + + it("getSubscriptionInfoV1() - retrieves subscription info", async () => { + const request: GetSubscriptionInfoV1Request = { + subscriptionId: "FIXME", + }; + + const configuration = new ChainlinkApiClientOptions({ + basePath: node1Host, + }); + const api = new ChainlinkApiClient(configuration); + + // Test for 200 valid response test case + const getBalanceExchange = api.getSubscriptionInfoV1(request); + await expect(getBalanceExchange).resolves.toMatchObject({ + status: StatusCodes.OK, + data: expect.objectContaining({ + balance: expect.stringMatching(expectedBalance.toFixed(0)), + }), + }); + }); +}); diff --git a/packages/cacti-test-plugin-ledger-connector-chainlink/tsconfig.json b/packages/cacti-test-plugin-ledger-connector-chainlink/tsconfig.json new file mode 100644 index 00000000000..0f6045bbfe3 --- /dev/null +++ b/packages/cacti-test-plugin-ledger-connector-chainlink/tsconfig.json @@ -0,0 +1,35 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist/lib/", + "declarationDir": "dist/lib", + "resolveJsonModule": true, + "rootDir": "./src", + "tsBuildInfoFile": "../../.build-cache/cactus-test-plugin-ledger-connector-besu.tsbuildinfo" + }, + "include": [ + "./src", + "src/**/*.json" + ], + "references": [ + { + "path": "../cactus-cmd-api-server/tsconfig.json" + }, + { + "path": "../cactus-common/tsconfig.json" + }, + { + "path": "../cactus-core/tsconfig.json" + }, + { + "path": "../cactus-plugin-keychain-memory/tsconfig.json" + }, + { + "path": "../cactus-plugin-ledger-connector-besu/tsconfig.json" + }, + { + "path": "../cactus-test-tooling/tsconfig.json" + } + ] +} diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts index 2cb3d80e363..e2a6eb54c30 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts @@ -166,6 +166,7 @@ export class PluginLedgerConnectorBesu const label = this.className; this.log = LoggerProvider.getOrCreate({ level: this.logLevel, label }); + this.log.debug("Creating WebsocketProvider for %s", options.rpcApiWsHost); this.web3Provider = new Web3.providers.WebsocketProvider( this.options.rpcApiWsHost, ); diff --git a/packages/cactus-test-tooling/package.json b/packages/cactus-test-tooling/package.json index 7057437d5e2..e7988b48b74 100644 --- a/packages/cactus-test-tooling/package.json +++ b/packages/cactus-test-tooling/package.json @@ -68,7 +68,8 @@ "@hyperledger/cactus-common": "2.0.0-rc.4", "axios": "1.7.7", "compare-versions": "3.6.0", - "dockerode": "3.3.0", + "dockerode": "4.0.2", + "dockerode-compose": "1.4.0", "elliptic": "6.5.7", "execa": "5.1.1", "fabric-ca-client": "2.5.0-snapshot.23", @@ -88,6 +89,7 @@ "socket.io-client-fixed-types": "4.5.4", "tar-stream": "2.2.0", "temp": "0.9.4", + "ts-results": "3.3.0", "typescript-optional": "2.0.1", "uuid": "10.0.0", "web3": "1.6.1", @@ -102,6 +104,7 @@ "@hyperledger/aries-askar-nodejs": "0.2.0", "@hyperledger/indy-vdr-nodejs": "0.2.0", "@types/dockerode": "3.2.7", + "@types/dockerode-compose": "1.4.1", "@types/esm": "3.2.0", "@types/fs-extra": "11.0.4", "@types/js-yaml": "4.0.3", diff --git a/packages/cactus-test-tooling/src/main/resources/cacti/cacti.config.json b/packages/cactus-test-tooling/src/main/resources/cacti/cacti.config.json new file mode 100644 index 00000000000..5ef66a44769 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/cacti/cacti.config.json @@ -0,0 +1,15 @@ +{ + "plugins": [ + { + "packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", + "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", + "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", + "options": { + "packageSrc": "/usr/src/cacti/packages/cactus-plugin-ledger-connector-besu", + "rpcApiWsHost": "http://127.0.0.1:8546", + "rpcApiHttpHost": "http://127.0.0.1:8545", + "instanceId": "some-unique-besu-connector-instance-id" + } + } + ] +} diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/LinkToken_solc_v0.6.json b/packages/cactus-test-tooling/src/main/resources/chainlink/LinkToken_solc_v0.6.json new file mode 100644 index 00000000000..e9e3d5b2100 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/LinkToken_solc_v0.6.json @@ -0,0 +1,404 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "LinkToken", + "sourceName": "contracts/v0.6/LinkToken.sol", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b50604080518082018252600f81526e21b430b4b72634b735902a37b5b2b760891b6020808301918252835180850190945260048452634c494e4b60e01b90840152815191929162000065916003916200022b565b5080516200007b9060049060208401906200022b565b50506005805460ff1916601217905550620000956200009b565b620002c7565b620000b3336b033b2e3c9fd0803ce8000000620000b5565b565b6001600160a01b03821662000111576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200011f60008383620001c4565b6200013b81600254620001c960201b620007fd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200016e918390620007fd620001c9821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000224576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026e57805160ff19168380011785556200029e565b828001600101855582156200029e579182015b828111156200029e57825182559160200191906001019062000281565b50620002ac929150620002b0565b5090565b5b80821115620002ac5760008155600101620002b1565b610e0e80620002d76000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80634000aea011610097578063a457c2d711610066578063a457c2d71461036e578063a9059cbb1461039a578063d73dd623146103c6578063dd62ed3e146103f2576100f5565b80634000aea014610259578063661884631461031457806370a082311461034057806395d89b4114610366576100f5565b8063181f5a77116100d3578063181f5a77146101d157806323b872dd146101d9578063313ce5671461020f578063395093511461022d576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b610102610420565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b0381351690602001356104b6565b604080519115158252519081900360200190f35b6101bf6104d3565b60408051918252519081900360200190f35b6101026104d9565b6101a3600480360360608110156101ef57600080fd5b506001600160a01b03813581169160208101359091169060400135610502565b610217610589565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561024357600080fd5b506001600160a01b038135169060200135610592565b6101a36004803603606081101561026f57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561029f57600080fd5b8201836020820111156102b157600080fd5b803590602001918460018302840111640100000000831117156102d357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105e0945050505050565b6101a36004803603604081101561032a57600080fd5b506001600160a01b0381351690602001356106bb565b6101bf6004803603602081101561035657600080fd5b50356001600160a01b03166106ce565b6101026106e9565b6101a36004803603604081101561038457600080fd5b506001600160a01b03813516906020013561074a565b6101a3600480360360408110156103b057600080fd5b506001600160a01b0381351690602001356107b2565b6101a3600480360360408110156103dc57600080fd5b506001600160a01b0381351690602001356107c6565b6101bf6004803603604081101561040857600080fd5b506001600160a01b03813581169160200135166107d2565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b5050505050905090565b60006104ca6104c3610857565b848461085b565b50600192915050565b60025490565b60408051808201909152600f81526e4c696e6b546f6b656e20302e302e3360881b602082015290565b600061050f8484846108b5565b61057f8461051b610857565b61057a85604051806060016040528060288152602001610d6c602891396001600160a01b038a16600090815260016020526040812090610559610857565b6001600160a01b031681526020810191909152604001600020549190610909565b61085b565b5060019392505050565b60055460ff1690565b60006104ca61059f610857565b8461057a85600160006105b0610857565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906107fd565b60006105ec84846107b2565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561066757818101518382015260200161064f565b50505050905090810190601f1680156106945780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36106ab846109a0565b1561057f5761057f8484846109a6565b60006106c7838361074a565b9392505050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b60006104ca610757610857565b8461057a85604051806060016040528060258152602001610ddd6025913960016000610781610857565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610909565b60006104ca6107bf610857565b84846108b5565b60006106c78383610592565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000828201838110156106c7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b816001600160a01b0381163014156108a45760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610a80565b50505050565b816001600160a01b0381163014156108fe5760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610b6c565b600081848411156109985760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561095d578181015183820152602001610945565b50505050905090810190601f16801561098a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b83811015610a145781810151838201526020016109fc565b50505050905090810190601f168015610a415780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610a6257600080fd5b505af1158015610a76573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316610ac55760405162461bcd60e51b8152600401808060200182810382526024815260200180610db96024913960400191505060405180910390fd5b6001600160a01b038216610b0a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610cf06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610bb15760405162461bcd60e51b8152600401808060200182810382526025815260200180610d946025913960400191505060405180910390fd5b6001600160a01b038216610bf65760405162461bcd60e51b8152600401808060200182810382526023815260200180610ccd6023913960400191505060405180910390fd5b610c01838383610cc7565b610c3e81604051806060016040528060268152602001610d46602691396001600160a01b0386166000908152602081905260409020549190610909565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c6d90826107fd565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734c696e6b546f6b656e3a207472616e736665722f617070726f766520746f207468697320636f6e7472616374206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa164736f6c634300060c000a" +} diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/README.md b/packages/cactus-test-tooling/src/main/resources/chainlink/README.md new file mode 100644 index 00000000000..deec200803d --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/README.md @@ -0,0 +1,38 @@ +# Chainlink Docker Compose Setup + +Run it from the Cacti project root: + +```sh +docker compose \ + --project-directory packages/cactus-test-tooling/src/main/resources/chainlink/ \ + --file packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-aio.docker-compose.yaml \ + up \ + --build +``` + + +```sh +./packages/cactus-test-tooling/src/main/resources/infra-bootstrap.sh +``` + + +### LinkToken Contract API Surface + +```solidity +contract LinkToken { + function allowance(address owner, address spender) public returns (bool success); + function approve(address spender, uint256 value) returns (bool success); + function balanceOf(address owner) returns (uint256 balance); + function decimals() returns (uint8 decimalPlaces); + function decreaseApproval(address spender, uint256 addedValue) returns (bool success); + function increaseApproval(address spender, uint256 subtractedValue); + function decreaseAllowance(address spender, uint256 addedValue) returns (bool success); + function increaseAllowance(address spender, uint256 subtractedValue); + function name() returns (string tokenName); + function symbol() returns (string tokenSymbol); + function totalSupply() returns (uint256 totalTokensIssued); + function transfer(address to, uint256 value) returns (bool success); + function transferAndCall(address to, uint256 value, bytes data) returns (bool success); + function transferFrom(address from, address to, uint256 value) returns (bool success); +} +``` \ No newline at end of file diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/avalanche/config/avalanche.config.json b/packages/cactus-test-tooling/src/main/resources/chainlink/avalanche/config/avalanche.config.json new file mode 100644 index 00000000000..e84da755d76 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/avalanche/config/avalanche.config.json @@ -0,0 +1,4 @@ +{ + "log-level": "info", + "http-host": "0.0.0.0" +} diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-aio.docker-compose.yaml b/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-aio.docker-compose.yaml new file mode 100644 index 00000000000..24072663b79 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-aio.docker-compose.yaml @@ -0,0 +1,179 @@ +services: + postgres: + image: postgres:16.4-alpine3.20 + container_name: postgres + + environment: + POSTGRES_DB: chainlink_db + POSTGRES_USER: chainlink_user + POSTGRES_PASSWORD: 3kcixh_xgm3_yJs_uV9q + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - "5432:5432" + + # log_statement possible options: none, ddl, mod, all + command: ["postgres", "-c", "log_statement=none"] + + chainlink: + image: smartcontract/chainlink:2.15.0 + container_name: chainlink + depends_on: + - postgres + - besu + volumes: + - ./config:/chainlink/config + - ./secrets:/chainlink/secrets + - ./chainlink-demo-gui-email-and-password.txt:/chainlink/.api + ports: + - "6688:6688" + command: + [ + "node", + "-config=/chainlink/config/config.toml", + "-secrets=/chainlink/secrets/secrets.toml", + "start", + "-a=/chainlink/.api", + ] + + besu: + image: hyperledger/besu:24.8.0 + container_name: besu + environment: + # https://besu.hyperledger.org/development/public-networks/how-to/monitor/logging#basic-logging + # Valid log levels are OFF, ERROR, WARN, INFO, DEBUG, TRACE, ALL. The default level is INFO. + BESU_LOGGING: WARN + BESU_NETWORK: dev # Equivalent to --network=dev + BESU_RPC_HTTP_ENABLED: "true" # Equivalent to --rpc-http-enabled + BESU_RPC_WS_ENABLED: "true" # Equivalent to --rpc-ws-enabled + BESU_HOST_WHITELIST: "*" # Equivalent to --host-whitelist=* + BESU_RPC_HTTP_API: "ETH,NET,WEB3,CLIQUE" # Equivalent to --rpc-http-api=ETH,NET,WEB3,CLIQUE + BESU_MINER_ENABLED: "true" # Equivalent to --miner-enabled + BESU_MINER_COINBASE: "0x0000000000000000000000000000000000000000" # Miner coinbase address + BESU_MIN_GAS_PRICE: "0" # Equivalent to --min-gas-price=0 + ports: + - "8545:8545" # HTTP JSON-RPC + - "8546:8546" # WebSocket JSON-RPC + + # docker run --volume ./config/mainnet:/config --env RUN_ARGS=--config-dir=/config + avalanche: + # image: 0labs/avalanchego:1.9.16 + build: + context: ../../../../../../tools/docker/avalanche-all-in-one/ + dockerfile: Dockerfile + container_name: avalanche + + ports: + - 9650:9650 + - 9651:9651 + + volumes: + - ./avalanche/config/avalanche.config.json:/config/avalanche.config.json + + environment: + RUN_ARGS: --config-file=/config/avalanche.config.json + + # curl -vv http://localhost:9650/ext/health + # healthcheck: + # test: + # [ + # "CMD-SHELL", + # "curl", + # "-X", + # "POST", + # "--data", + # '{"jsonrpc":"2.0","id":1,"method":"info.isBootstrapped","params":{"chain":"X"}}', + # "-H", + # "content-type:application/json;", + # "127.0.0.1:9650/ext/info", + # ] + # interval: 1m30s + # timeout: 30s + # retries: 5 + # start_period: 30s + + cacti: + container_name: cacti + restart: on-failure + build: + context: ../../../../../../packages/cactus-cmd-api-server/ + dockerfile: cmd-api-server.Dockerfile + + depends_on: + - chainlink + - besu + - avalanche + + volumes: + - ${PWD}:/usr/src/cacti + + ports: + - 3000:3000 + - 4000:4000 + + environment: + AUTHORIZATION_PROTOCOL: NONE + AUTHORIZATION_CONFIG_JSON: "{}" + API_MTLS_ENABLED: "false" + API_TLS_ENABLED: "false" + API_CORS_DOMAIN_CSV: \* + API_TLS_CERT_PEM: "-" + API_TLS_CLIENT_CA_PEM: "-" + API_TLS_KEY_PEM: "-" + API_HOST: 0.0.0.0 + API_PORT: 4000 + CRPC_HOST: 0.0.0.0 + GRPC_TLS_ENABLED: false + LOG_LEVEL: DEBUG + PLUGINS: >- + [ + { + "packageName": "@hyperledger/cactus-plugin-keychain-memory", + "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", + "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", + "options": { + "packageSrc": "/usr/src/cacti/packages/cactus-plugin-keychain-memory/", + "keychainId": "keychain_id_1", + "instanceId": "plugin-keychain-memory-1" + } + }, + { + "packageName": "@hyperledger/cactus-plugin-ledger-connector-besu", + "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", + "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", + "options": { + "packageSrc": "/usr/src/cacti/packages/cactus-plugin-ledger-connector-besu/", + "rpcApiHttpHost": "http://besu:8545", + "rpcApiWsHost": "ws://besu:8546", + "instanceId": "plugin-connetor-besu-1" + } + }, + { + "packageName": "@hyperledger/cacti-plugin-ledger-connector-chainlink", + "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", + "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", + "options": { + "packageSrc": "/usr/src/cacti/packages/cacti-plugin-ledger-connector-chainlink/", + "instanceId": "plugin-connetor-chainlink-1", + "ledgerHttpHost": "http://chainlink", + "ledgerHttpPort": 6688 + } + }, + { + "packageName": "@hyperledger/cacti-plugin-ledger-connector-avalanche", + "type": "org.hyperledger.cactus.plugin_import_type.LOCAL", + "action": "org.hyperledger.cactus.plugin_import_action.INSTALL", + "options": { + "packageSrc": "/usr/src/cacti/packages/cacti-plugin-ledger-connector-avalanche/", + "rpcUrlHttp": "http://avalanche:9650/ext/bc/subnet1/rpc", + "rpcUrlWs": "ws://avalanche:9650/ext/bc/subnet1/ws", + "instanceId": "plugin-connetor-avalanche-1" + } + } + ] + infra-init: + container_name: infra-init + image: node:22.8.0-bookworm-slim + command: ["node", "-e", "console.log('hello world')"] + +volumes: + besu_data: diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-demo-gui-email-and-password.txt b/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-demo-gui-email-and-password.txt new file mode 100644 index 00000000000..d846ab9cd8f --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/chainlink-demo-gui-email-and-password.txt @@ -0,0 +1,2 @@ +cacti-dev@caci.example.com +cacti-dev@caci.example.com \ No newline at end of file diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/config/config.toml b/packages/cactus-test-tooling/src/main/resources/chainlink/config/config.toml new file mode 100644 index 00000000000..c586d0e299e --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/config/config.toml @@ -0,0 +1,61 @@ +Log.Level = 'info' + +[Insecure] +DevWebServer = false # Default is false +OCRDevelopmentMode = false # Default +InfiniteDepthQueries = false # Default +DisableRateLimiting = false # Default + +[WebServer] +AuthenticationMethod = 'local' # Default +AllowOrigins = 'http://localhost:3000,http://localhost:6688' # Default +BridgeCacheTTL = '0s' # Default +# BridgeResponseURL = 'https://my-chainlink-node.example.com:6688' # Example +HTTPWriteTimeout = '10s' # Default +HTTPPort = 6688 # Default +SecureCookies = true # Default +SessionTimeout = '15m' # Default +SessionReaperExpiration = '240h' # Default +HTTPMaxSize = '32768b' # Default +StartTimeout = '15s' # Default +ListenIP = '0.0.0.0' # Default + +[WebServer.TLS] +HTTPSPort=0 + +[Database] +# URL = 'postgres://chainlink_user:chainlink_pass@postgres:5432/chainlink_db?sslmode=disable' +DefaultIdleInTxSessionTimeout = '1h' # Default +DefaultLockTimeout = '15s' # Default +DefaultQueryTimeout = '10s' # Default +LogQueries = true # Default is false +MaxIdleConns = 10 # Default +MaxOpenConns = 100 # Default +MigrateOnStartup = true # Default + + +[[EVM]] +ChainID = '1337' # Required + +[[EVM.Nodes]] +Name = 'besu-1' # Required +WSURL = 'ws://besu:8546' +HTTPURL = 'http://besu:8545' # Required + +# [Blockchain] +# [Ethereum] +# URL = "http://besu:8545" +# ChainID = "1337" +# LinkContractAddress = "0x0" # Replace with the actual LINK token contract address + +# [Job] +# MinPayment = "0.1" + + +# [[EVM]] +# ChainID = '1' # Required + +# [[EVM.Nodes]] +# Name = 'fake' # Required +# WSURL = 'wss://foo.bar/ws' +# HTTPURL = 'https://foo.bar' # Required diff --git a/packages/cactus-test-tooling/src/main/resources/chainlink/secrets/secrets.toml b/packages/cactus-test-tooling/src/main/resources/chainlink/secrets/secrets.toml new file mode 100644 index 00000000000..db095d62a11 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/chainlink/secrets/secrets.toml @@ -0,0 +1,6 @@ +[Database] +URL = "postgres://chainlink_user:3kcixh_xgm3_yJs_uV9q@postgres:5432/chainlink_db?sslmode=disable" # Example +AllowSimplePasswords = false # Default + +[Password] +Keystore = '3kcixh_xgm3_yJs_uV9q' # Required diff --git a/packages/cactus-test-tooling/src/main/resources/deploy-avalanche-link-token-v06-contract.sh b/packages/cactus-test-tooling/src/main/resources/deploy-avalanche-link-token-v06-contract.sh new file mode 100644 index 00000000000..1ec7afead16 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/deploy-avalanche-link-token-v06-contract.sh @@ -0,0 +1,433 @@ + +deploy_avalanche_link_token_v06_contract() { + + local url="$1" + + # Regex pattern to validate a URL + local url_regex="^(https?|http?)://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$" + + if [[ -z "$url" ]]; then + echo "Error: 'url' parameter is mandatory and cannot be empty." >&2 + exit 1 + fi + + if [[ "$url" =~ $url_regex ]]; then + echo "Valid URL: $url" + else + echo "Error: Invalid URL format: $url" >&2 + exit 1 + fi + + curl -vv --location "$url" \ + --header 'Content-Type: application/json' \ + --data '{ + "keychainId": "keychain_id_1", + "contractName": "LinkToken", + "contractAbi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "constructorArgs": [], + "web3SigningCredential": { + "ethAccount": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", + "secret": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "type": "PRIVATE_KEY_HEX" + }, + "bytecode": "0x60806040523480156200001157600080fd5b50604080518082018252600f81526e21b430b4b72634b735902a37b5b2b760891b6020808301918252835180850190945260048452634c494e4b60e01b90840152815191929162000065916003916200022b565b5080516200007b9060049060208401906200022b565b50506005805460ff1916601217905550620000956200009b565b620002c7565b620000b3336b033b2e3c9fd0803ce8000000620000b5565b565b6001600160a01b03821662000111576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200011f60008383620001c4565b6200013b81600254620001c960201b620007fd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200016e918390620007fd620001c9821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000224576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026e57805160ff19168380011785556200029e565b828001600101855582156200029e579182015b828111156200029e57825182559160200191906001019062000281565b50620002ac929150620002b0565b5090565b5b80821115620002ac5760008155600101620002b1565b610e0e80620002d76000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80634000aea011610097578063a457c2d711610066578063a457c2d71461036e578063a9059cbb1461039a578063d73dd623146103c6578063dd62ed3e146103f2576100f5565b80634000aea014610259578063661884631461031457806370a082311461034057806395d89b4114610366576100f5565b8063181f5a77116100d3578063181f5a77146101d157806323b872dd146101d9578063313ce5671461020f578063395093511461022d576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b610102610420565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b0381351690602001356104b6565b604080519115158252519081900360200190f35b6101bf6104d3565b60408051918252519081900360200190f35b6101026104d9565b6101a3600480360360608110156101ef57600080fd5b506001600160a01b03813581169160208101359091169060400135610502565b610217610589565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561024357600080fd5b506001600160a01b038135169060200135610592565b6101a36004803603606081101561026f57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561029f57600080fd5b8201836020820111156102b157600080fd5b803590602001918460018302840111640100000000831117156102d357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105e0945050505050565b6101a36004803603604081101561032a57600080fd5b506001600160a01b0381351690602001356106bb565b6101bf6004803603602081101561035657600080fd5b50356001600160a01b03166106ce565b6101026106e9565b6101a36004803603604081101561038457600080fd5b506001600160a01b03813516906020013561074a565b6101a3600480360360408110156103b057600080fd5b506001600160a01b0381351690602001356107b2565b6101a3600480360360408110156103dc57600080fd5b506001600160a01b0381351690602001356107c6565b6101bf6004803603604081101561040857600080fd5b506001600160a01b03813581169160200135166107d2565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b5050505050905090565b60006104ca6104c3610857565b848461085b565b50600192915050565b60025490565b60408051808201909152600f81526e4c696e6b546f6b656e20302e302e3360881b602082015290565b600061050f8484846108b5565b61057f8461051b610857565b61057a85604051806060016040528060288152602001610d6c602891396001600160a01b038a16600090815260016020526040812090610559610857565b6001600160a01b031681526020810191909152604001600020549190610909565b61085b565b5060019392505050565b60055460ff1690565b60006104ca61059f610857565b8461057a85600160006105b0610857565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906107fd565b60006105ec84846107b2565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561066757818101518382015260200161064f565b50505050905090810190601f1680156106945780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36106ab846109a0565b1561057f5761057f8484846109a6565b60006106c7838361074a565b9392505050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b60006104ca610757610857565b8461057a85604051806060016040528060258152602001610ddd6025913960016000610781610857565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610909565b60006104ca6107bf610857565b84846108b5565b60006106c78383610592565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000828201838110156106c7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b816001600160a01b0381163014156108a45760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610a80565b50505050565b816001600160a01b0381163014156108fe5760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610b6c565b600081848411156109985760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561095d578181015183820152602001610945565b50505050905090810190601f16801561098a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b83811015610a145781810151838201526020016109fc565b50505050905090810190601f168015610a415780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610a6257600080fd5b505af1158015610a76573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316610ac55760405162461bcd60e51b8152600401808060200182810382526024815260200180610db96024913960400191505060405180910390fd5b6001600160a01b038216610b0a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610cf06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610bb15760405162461bcd60e51b8152600401808060200182810382526025815260200180610d946025913960400191505060405180910390fd5b6001600160a01b038216610bf65760405162461bcd60e51b8152600401808060200182810382526023815260200180610ccd6023913960400191505060405180910390fd5b610c01838383610cc7565b610c3e81604051806060016040528060268152602001610d46602691396001600160a01b0386166000908152602081905260409020549190610909565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c6d90826107fd565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734c696e6b546f6b656e3a207472616e736665722f617070726f766520746f207468697320636f6e7472616374206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa164736f6c634300060c000a", + "gas": 1000000 + }' +} diff --git a/packages/cactus-test-tooling/src/main/resources/deploy-besu-link-token-v06-contract.sh b/packages/cactus-test-tooling/src/main/resources/deploy-besu-link-token-v06-contract.sh new file mode 100644 index 00000000000..8a2c19fccdc --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/deploy-besu-link-token-v06-contract.sh @@ -0,0 +1,433 @@ + +deploy_besu_link_token_v06_contract() { + + local url="$1" + + # Regex pattern to validate a URL + local url_regex="^(https?|http?)://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$" + + if [[ -z "$url" ]]; then + echo "Error: 'url' parameter is mandatory and cannot be empty." >&2 + exit 1 + fi + + if [[ "$url" =~ $url_regex ]]; then + echo "Valid URL: $url" + else + echo "Error: Invalid URL format: $url" >&2 + exit 1 + fi + + curl -vv --location "$url" \ + --header 'Content-Type: application/json' \ + --data '{ + "keychainId": "keychain_id_1", + "contractName": "LinkToken", + "contractAbi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseApproval", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "transferAndCall", + "outputs": [ + { + "internalType": "bool", + "name": "success", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "typeAndVersion", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "constructorArgs": [], + "web3SigningCredential": { + "ethAccount": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", + "secret": "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3", + "type": "PRIVATE_KEY_HEX" + }, + "bytecode": "0x60806040523480156200001157600080fd5b50604080518082018252600f81526e21b430b4b72634b735902a37b5b2b760891b6020808301918252835180850190945260048452634c494e4b60e01b90840152815191929162000065916003916200022b565b5080516200007b9060049060208401906200022b565b50506005805460ff1916601217905550620000956200009b565b620002c7565b620000b3336b033b2e3c9fd0803ce8000000620000b5565b565b6001600160a01b03821662000111576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6200011f60008383620001c4565b6200013b81600254620001c960201b620007fd1790919060201c565b6002556001600160a01b038216600090815260208181526040909120546200016e918390620007fd620001c9821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b60008282018381101562000224576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200026e57805160ff19168380011785556200029e565b828001600101855582156200029e579182015b828111156200029e57825182559160200191906001019062000281565b50620002ac929150620002b0565b5090565b5b80821115620002ac5760008155600101620002b1565b610e0e80620002d76000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80634000aea011610097578063a457c2d711610066578063a457c2d71461036e578063a9059cbb1461039a578063d73dd623146103c6578063dd62ed3e146103f2576100f5565b80634000aea014610259578063661884631461031457806370a082311461034057806395d89b4114610366576100f5565b8063181f5a77116100d3578063181f5a77146101d157806323b872dd146101d9578063313ce5671461020f578063395093511461022d576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b610102610420565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b0381351690602001356104b6565b604080519115158252519081900360200190f35b6101bf6104d3565b60408051918252519081900360200190f35b6101026104d9565b6101a3600480360360608110156101ef57600080fd5b506001600160a01b03813581169160208101359091169060400135610502565b610217610589565b6040805160ff9092168252519081900360200190f35b6101a36004803603604081101561024357600080fd5b506001600160a01b038135169060200135610592565b6101a36004803603606081101561026f57600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561029f57600080fd5b8201836020820111156102b157600080fd5b803590602001918460018302840111640100000000831117156102d357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105e0945050505050565b6101a36004803603604081101561032a57600080fd5b506001600160a01b0381351690602001356106bb565b6101bf6004803603602081101561035657600080fd5b50356001600160a01b03166106ce565b6101026106e9565b6101a36004803603604081101561038457600080fd5b506001600160a01b03813516906020013561074a565b6101a3600480360360408110156103b057600080fd5b506001600160a01b0381351690602001356107b2565b6101a3600480360360408110156103dc57600080fd5b506001600160a01b0381351690602001356107c6565b6101bf6004803603604081101561040857600080fd5b506001600160a01b03813581169160200135166107d2565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b820191906000526020600020905b81548152906001019060200180831161048f57829003601f168201915b5050505050905090565b60006104ca6104c3610857565b848461085b565b50600192915050565b60025490565b60408051808201909152600f81526e4c696e6b546f6b656e20302e302e3360881b602082015290565b600061050f8484846108b5565b61057f8461051b610857565b61057a85604051806060016040528060288152602001610d6c602891396001600160a01b038a16600090815260016020526040812090610559610857565b6001600160a01b031681526020810191909152604001600020549190610909565b61085b565b5060019392505050565b60055460ff1690565b60006104ca61059f610857565b8461057a85600160006105b0610857565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906107fd565b60006105ec84846107b2565b50836001600160a01b0316336001600160a01b03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1685856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561066757818101518382015260200161064f565b50505050905090810190601f1680156106945780820380516001836020036101000a031916815260200191505b50935050505060405180910390a36106ab846109a0565b1561057f5761057f8484846109a6565b60006106c7838361074a565b9392505050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104ac5780601f10610481576101008083540402835291602001916104ac565b60006104ca610757610857565b8461057a85604051806060016040528060258152602001610ddd6025913960016000610781610857565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190610909565b60006104ca6107bf610857565b84846108b5565b60006106c78383610592565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000828201838110156106c7576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b3390565b816001600160a01b0381163014156108a45760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610a80565b50505050565b816001600160a01b0381163014156108fe5760405162461bcd60e51b8152600401808060200182810382526034815260200180610d126034913960400191505060405180910390fd5b6108af848484610b6c565b600081848411156109985760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561095d578181015183820152602001610945565b50505050905090810190601f16801561098a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b3b151590565b604051635260769b60e11b815233600482018181526024830185905260606044840190815284516064850152845187946001600160a01b0386169463a4c0ed369490938993899360840190602085019080838360005b83811015610a145781810151838201526020016109fc565b50505050905090810190601f168015610a415780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b158015610a6257600080fd5b505af1158015610a76573d6000803e3d6000fd5b5050505050505050565b6001600160a01b038316610ac55760405162461bcd60e51b8152600401808060200182810382526024815260200180610db96024913960400191505060405180910390fd5b6001600160a01b038216610b0a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610cf06022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610bb15760405162461bcd60e51b8152600401808060200182810382526025815260200180610d946025913960400191505060405180910390fd5b6001600160a01b038216610bf65760405162461bcd60e51b8152600401808060200182810382526023815260200180610ccd6023913960400191505060405180910390fd5b610c01838383610cc7565b610c3e81604051806060016040528060268152602001610d46602691396001600160a01b0386166000908152602081905260409020549190610909565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610c6d90826107fd565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734c696e6b546f6b656e3a207472616e736665722f617070726f766520746f207468697320636f6e7472616374206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa164736f6c634300060c000a", + "gas": 1000000 + }' +} diff --git a/packages/cactus-test-tooling/src/main/resources/infra-bootstrap.sh b/packages/cactus-test-tooling/src/main/resources/infra-bootstrap.sh new file mode 100755 index 00000000000..f5fc1853dbc --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/infra-bootstrap.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -ex + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +echo "SCRIPT_DIR=$SCRIPT_DIR" + +source "$SCRIPT_DIR/set-keychain-link-token-v06-contract.sh" +source "$SCRIPT_DIR/deploy-besu-link-token-v06-contract.sh" +source "$SCRIPT_DIR/deploy-avalnche-link-token-v06-contract.sh" + +main() { + echo "hello world" + + # Besu + set_keychain_link_token_v06_contract "http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry" + deploy_besu_link_token_v06_contract "http://127.0.0.1:4000/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-besu/deploy-contract-solidity-bytecode" + + # Avalanche (second API server with a Besu connector) + # set_keychain_link_token_v06_contract "http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-keychain-memory/set-keychain-entry" + # deploy_avalanche_link_token_v06_contract "http://127.0.0.1:4100/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-avalanche/deploy-contract-solidity-bytecode" + + # docker exec -it avalanche avalanche subnet create subnet1 --evm --evm-chain-id=1337 --evm-token=AETH --test-defaults + # docker exec -it avalanche avalanche subnet deploy subnet1 --local +} + +# FIXME add curl checking utility function +# FIXME add jq checking utility function + +main diff --git a/packages/cactus-test-tooling/src/main/resources/set-keychain-link-token-v06-contract.sh b/packages/cactus-test-tooling/src/main/resources/set-keychain-link-token-v06-contract.sh new file mode 100644 index 00000000000..3f43d159c93 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/resources/set-keychain-link-token-v06-contract.sh @@ -0,0 +1,29 @@ +set_keychain_link_token_v06_contract() { + SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + echo "SCRIPT_DIR=$SCRIPT_DIR" + CONTRACT_JSON_PATH="$SCRIPT_DIR/chainlink/LinkToken_solc_v0.6.json" + CONTRACT_JSON_STRINGIFIED=$(cat $CONTRACT_JSON_PATH | jq '@json') + REQUEST_BODY="{\"key\": \"LinkToken\", \"value\": "$CONTRACT_JSON_STRINGIFIED" }" + + local url="$1" + + # Regex pattern to validate a URL + local url_regex="^(https?|http?)://[a-zA-Z0-9.-]+(:[0-9]+)?(/.*)?$" + + if [[ -z "$url" ]]; then + echo "Error: 'url' parameter is mandatory and cannot be empty." >&2 + exit 1 + fi + + if [[ "$url" =~ $url_regex ]]; then + echo "Valid URL: $url" + else + echo "Error: Invalid URL format: $url" >&2 + exit 1 + fi + + curl --verbose \ + --location "$url" \ + --header 'Content-Type: application/json' \ + --data "$REQUEST_BODY" +} diff --git a/packages/cactus-test-tooling/src/main/typescript/chainlink/build-image-chainlink-all-in-one-latest.ts b/packages/cactus-test-tooling/src/main/typescript/chainlink/build-image-chainlink-all-in-one-latest.ts new file mode 100644 index 00000000000..cc00af96167 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/chainlink/build-image-chainlink-all-in-one-latest.ts @@ -0,0 +1,49 @@ +import path from "node:path"; +import { buildContainerImage } from "../public-api"; +import { LoggerProvider, LogLevelDesc } from "@hyperledger/cactus-common"; + +export interface IBuildImageChainlinkAllInOneV412Response { + readonly imageName: Readonly; + readonly imageVersion: Readonly; + /** + * The concatenation of `imageName` a colon character and `imageVersion`. + */ + readonly imageTag: Readonly; +} + +export interface IBuildImageChainlinkAllInOneV412Request { + readonly logLevel?: Readonly; +} + +export async function buildImageChainlinkAllInOneLatest( + req: IBuildImageChainlinkAllInOneV412Request, +): Promise { + if (!req) { + throw new Error("Expected arg req to be truthy."); + } + const logLevel: LogLevelDesc = req.logLevel || "WARN"; + const log = LoggerProvider.getOrCreate({ + level: logLevel, + label: "build-image-connector-chainlink-server.ts", + }); + const projectRoot = path.join(__dirname, "../../../../../../../"); + + const buildDirRel = "./tools/docker/chainlink-all-in-one/chainlink-v4_12/"; + + const buildDirAbs = path.join(projectRoot, buildDirRel); + + log.info("Invoking container build with build dir: %s", buildDirAbs); + + const imageName = "caio412"; + const imageVersion = "latest"; + const imageTag = `${imageName}:${imageVersion}`; + + await buildContainerImage({ + buildDir: buildDirAbs, + imageFile: "Dockerfile", + imageTag, + logLevel: logLevel, + }); + + return { imageName, imageVersion, imageTag }; +} diff --git a/packages/cactus-test-tooling/src/main/typescript/chainlink/chainlink-test-ledger.ts b/packages/cactus-test-tooling/src/main/typescript/chainlink/chainlink-test-ledger.ts new file mode 100644 index 00000000000..b31083dc58b --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/chainlink/chainlink-test-ledger.ts @@ -0,0 +1,268 @@ +import { EventEmitter } from "node:events"; +import path from "node:path"; + +import DockerodeCompose from "dockerode-compose"; +import Docker, { Container, ContainerInfo } from "dockerode"; +import Joi from "joi"; +import { None, Option, Some } from "ts-results"; + +import { ITestLedger } from "../i-test-ledger"; +import { Containers } from "../common/containers"; + +import { + LogLevelDesc, + Logger, + LoggerProvider, + Checks, + Bools, +} from "@hyperledger/cactus-common"; + +export interface IChainlinkTestLedgerConstructorOptions { + imageVersion?: string; + imageName?: string; + rpcPortNotary?: number; + sshPort?: number; + rpcPortA?: number; + rpcPortB?: number; + httpPort?: number; + logLevel?: LogLevelDesc; + envVars?: string[]; + emitContainerLogs?: boolean; +} + +// const imageTag = "smartcontract/chainlink:2.15.0"; + +const DEFAULTS = Object.freeze({ + imageVersion: "2.15.0", + imageName: "smartcontract/chainlink", + httpPort: 8080, + envVars: [], +}); +export const CHAINLINK_TEST_LEDGER_DEFAULT_OPTIONS = DEFAULTS; + +/* + * Provides validations for the Chainlink AIO ledger container's options + */ +const JOI_SCHEMA: Joi.Schema = Joi.object().keys({ + imageVersion: Joi.string().min(5).required(), + imageName: Joi.string().min(1).required(), + httpPort: Joi.number().min(1).max(65535).required(), +}); +export const CHAINLINK_TEST_LEDGER_OPTIONS_JOI_SCHEMA = JOI_SCHEMA; + +/** + * @see https://github.com/smartcontractkit/chainlink/blob/develop/core/chainlink.Dockerfile + */ +export class ChainlinkTestLedger implements ITestLedger { + public static readonly CLASS_NAME = "ChainlinkTestLedger"; + + private readonly log: Logger; + private readonly envVars: string[]; + + public get className(): string { + return ChainlinkTestLedger.CLASS_NAME; + } + + public readonly imageVersion: string; + public readonly imageName: string; + public readonly httpPort: number; + public readonly emitContainerLogs: boolean; + + private container: Container | undefined; + private containerId: string | undefined; + + constructor( + public readonly opts: IChainlinkTestLedgerConstructorOptions = {}, + ) { + const fnTag = `${this.className}#constructor()`; + Checks.truthy(opts, `${fnTag} options`); + + this.imageVersion = opts.imageVersion || DEFAULTS.imageVersion; + this.imageName = opts.imageName || DEFAULTS.imageName; + + this.httpPort = opts.httpPort || DEFAULTS.httpPort; + + this.emitContainerLogs = Bools.isBooleanStrict(opts.emitContainerLogs) + ? (opts.emitContainerLogs as boolean) + : true; + + this.envVars = opts.envVars ? opts.envVars : DEFAULTS.envVars; + Checks.truthy(Array.isArray(this.envVars), `${fnTag}:envVars not an array`); + + this.validateConstructorOptions(); + const label = "chainlink-test-ledger"; + const level = opts.logLevel || "INFO"; + this.log = LoggerProvider.getOrCreate({ level, label }); + } + + public getContainerId(): string { + const fnTag = `${this.className}.getContainerId()`; + Checks.nonBlankString(this.containerId, `${fnTag}::containerId`); + return this.containerId as string; + } + + public async start(skipPull = false): Promise { + const imageFqn = this.getContainerImageName(); + + if (this.container) { + await this.container.stop(); + await this.container.remove(); + } + + const composeFile = path.join( + __dirname, + "../../yaml/chainlink-aio.docker-compose.yaml", + ); + this.log.debug("Chainlink AIO Docker Compose file: %s", composeFile); + + const docker = new Docker(); + const compose = new DockerodeCompose( + docker as any, + "./test/wordpress.yml", + "wordpress", + ); + + (async () => { + await compose.pull(); + const state = await compose.up(); + console.log(state); + })(); + + if (!skipPull) { + await Containers.pullImage(imageFqn, {}, this.opts.logLevel); + } + + return new Promise((resolve, reject) => { + const eventEmitter: EventEmitter = docker.run( + imageFqn, + [], + [], + { + ExposedPorts: { + [`${this.httpPort}/tcp`]: {}, + }, + HostConfig: { + PublishAllPorts: true, + }, + // TODO: this can be removed once the new docker image is published and + // specified as the default one to be used by the tests. + // Healthcheck: { + // Test: [ + // "CMD-SHELL", + // `curl -v 'http://127.0.0.1:7005/jolokia/exec/org.apache.activemq.artemis:address=%22rpc.server%22,broker=%22RPC%22,component=addresses,queue=%22rpc.server%22,routing-type=%22multicast%22,subcomponent=queues/countMessages()/'`, + // ], + // Interval: 1000000000, // 1 second + // Timeout: 3000000000, // 3 seconds + // Retries: 99, + // StartPeriod: 1000000000, // 1 second + // }, + Env: this.envVars, + }, + {}, + (err: unknown) => { + if (err) { + reject(err); + } + }, + ); + + eventEmitter.once("start", async (container: Container) => { + this.container = container; + this.containerId = container.id; + + if (this.emitContainerLogs) { + const fnTag = `[${this.getContainerImageName()}]`; + await Containers.streamLogs({ + container: this.getContainer().expect("stream logs: no container"), + tag: fnTag, + log: this.log, + }); + } + + try { + let isHealthy = false; + do { + const containerInfo = await this.getContainerInfo(); + this.log.debug(`ContainerInfo.Status=%o`, containerInfo.Status); + this.log.debug(`ContainerInfo.State=%o`, containerInfo.State); + isHealthy = containerInfo.Status.endsWith("(healthy)"); + if (!isHealthy) { + await new Promise((resolve2) => setTimeout(resolve2, 1000)); + } + } while (!isHealthy); + resolve(container); + } catch (ex) { + reject(ex); + } + }); + }); + } + + public async logDebugPorts(): Promise { + const httpPort = await this.getHttpPortPublic(); + this.log.info(`HTTP Port: ${httpPort}`); + } + + public async stop(): Promise { + const container = this.getContainer(); + if (container.none) { + return "Container was not present. Skipped stopping it."; + } + return Containers.stop(container.val); + } + + public async destroy(): Promise { + const fnTag = `${this.className}.destroy()`; + if (this.container) { + return this.container.remove(); + } else { + return Promise.reject( + new Error(`${fnTag} Container was never created, nothing to destroy.`), + ); + } + } + + protected async getContainerInfo(): Promise { + const fnTag = `${this.className}.getContainerInfo()`; + const docker = new Docker(); + const containerInfos = await docker.listContainers({}); + const id = this.getContainerId(); + + const aContainerInfo = containerInfos.find((ci) => ci.Id === id); + + if (aContainerInfo) { + return aContainerInfo; + } else { + throw new Error(`${fnTag} no container with ID "${id}"`); + } + } + + /** + * @returns The port mapped to the host machine's network interface. + */ + public async getHttpPortPublic(): Promise { + const aContainerInfo = await this.getContainerInfo(); + return Containers.getPublicPort(this.httpPort, aContainerInfo); + } + + public getContainer(): Option { + return this.container instanceof Container ? Some(this.container) : None; + } + + public getContainerImageName(): string { + return `${this.imageName}:${this.imageVersion}`; + } + + private validateConstructorOptions(): void { + const fnTag = `${this.className}#validateConstructorOptions()`; + const validationResult = JOI_SCHEMA.validate({ + imageVersion: this.imageVersion, + imageName: this.imageName, + httpPort: this.httpPort, + }); + + if (validationResult.error) { + throw new Error(`${fnTag} ${validationResult.error.annotate()}`); + } + } +} diff --git a/packages/cactus-test-tooling/src/main/typescript/public-api.ts b/packages/cactus-test-tooling/src/main/typescript/public-api.ts index 25b85a43c91..fecaf2947d2 100755 --- a/packages/cactus-test-tooling/src/main/typescript/public-api.ts +++ b/packages/cactus-test-tooling/src/main/typescript/public-api.ts @@ -169,6 +169,13 @@ export { SubstrateTestLedger, } from "./substrate-test-ledger/substrate-test-ledger"; +export { + CHAINLINK_TEST_LEDGER_DEFAULT_OPTIONS, + CHAINLINK_TEST_LEDGER_OPTIONS_JOI_SCHEMA, + ChainlinkTestLedger, + IChainlinkTestLedgerConstructorOptions, +} from "./chainlink/chainlink-test-ledger"; + export { Streams } from "./common/streams"; export { isRunningInGithubAction } from "./github-actions/is-running-in-github-action"; diff --git a/tools/docker/avalanche-all-in-one/Dockerfile b/tools/docker/avalanche-all-in-one/Dockerfile new file mode 100644 index 00000000000..1d9c44a8457 --- /dev/null +++ b/tools/docker/avalanche-all-in-one/Dockerfile @@ -0,0 +1,29 @@ +FROM debian:12.5-slim + +RUN apt update --allow-releaseinfo-change && \ + apt install -y curl && \ + curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-cli/main/scripts/install.sh | sh -s -- -b /usr/local/bin/ && \ + curl -sSfL https://raw.githubusercontent.com/ava-labs/avalanche-network-runner/main/scripts/install.sh | sh -s -- -b /usr/local/bin/ + +COPY ./avalanche-cli.config.json /config/avalanche-cli.config.json + +RUN avalanche subnet create subnet1 --evm --evm-chain-id=1337 --evm-token=AETH --test-defaults +RUN avalanche subnet deploy subnet1 --local + +# RUN avalanche blockchain deploy mybc --local --log-level=debug --config=/config/avalanche-cli.config.json + + +HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "avalanche-network-runner", "ping", "--log-level", "debug", "--endpoint=0.0.0.0:8080" ] + +# Additional optinal CLI arguments for the network runner: +# Source: https://docs.avax.network/tooling/avalanche-network-runner/introduction +# +# --plugin-dir ${AVALANCHEGO_PLUGIN_PATH} \ +# --blockchain-specs '[{"vm_name":"subnetevm","genesis":"/tmp/subnet-evm.genesis.json"}]' \ +# --global-node-config '{"index-enabled":false, "api-admin-enabled":true,"network-peer-list-gossip-frequency":"300ms"}' \ +# --custom-node-configs" '{"node1":{"log-level":"debug","api-admin-enabled":false},"node2":{...},...}' + +CMD [ "avalanche-network-runner", "server", "--log-level", "debug", "--port=:8080", "--grpc-gateway-port=:8081" ] +# CMD [ "avalanche-network-runner", "control", "start", "--num-nodes=3" ,"--log-level", "debug", "--dial-timeout=3m0s" ] +# CMD [ "avalanche-network-runner", "control", "start" ] + diff --git a/tools/docker/avalanche-all-in-one/README.md b/tools/docker/avalanche-all-in-one/README.md new file mode 100644 index 00000000000..5a4720bb7ac --- /dev/null +++ b/tools/docker/avalanche-all-in-one/README.md @@ -0,0 +1,14 @@ +# avalanche-all-in-one + +## Building the Image Locally + + +```sh +docker build \ + --progress=plain \ + --file ./tools/docker/avalanche-all-in-one/Dockerfile \ + ./tools/docker/avalanche-all-in-one/ \ + --tag aaio \ + --tag avalanche-all-in-one \ + --tag ghcr.io/hyperledger/cacti-avalanche-all-in-one:$(git describe --contains --all HEAD | tr / _)_$(git rev-parse --short HEAD)_$(date -u +"%Y-%m-%dT%H-%M-%SZ") +``` diff --git a/tools/docker/avalanche-all-in-one/avalanche-cli.config.json b/tools/docker/avalanche-all-in-one/avalanche-cli.config.json new file mode 100644 index 00000000000..9e26dfeeb6e --- /dev/null +++ b/tools/docker/avalanche-all-in-one/avalanche-cli.config.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tools/docker/chainlink-all-in-one/Dockerfile b/tools/docker/chainlink-all-in-one/Dockerfile new file mode 100644 index 00000000000..20a49117125 --- /dev/null +++ b/tools/docker/chainlink-all-in-one/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:22.04 + +# Install dependencies +RUN apt-get update && apt-get install -y wget curl gnupg2 + +# Add Chainlink GPG key +RUN wget -O - https://raw.githubusercontent.com/chainlink/docker-chainlink/master/chainlink.gpg | gpg --dearmor -o /usr/share/keyrings/chainlink.gpg +RUN echo "deb [signed-by=/usr/share/keyrings/chainlink.gpg] https://chainlink.github.io/chainlink/stable/ubuntu/22.04 amd64 main" | tee /etc/apt/sources.list.d/chainlink.list + +RUN apt-get update && apt-get install -y chainlink + +# Create a Chainlink configuration file +RUN mkdir -p /etc/chainlink +COPY chainlink.config.yaml /etc/chainlink/chainlink.config.yaml + +# Expose the Chainlink port (8080) +EXPOSE 8080 + +# Command to run the Chainlink node +CMD chainlink node run --config /etc/chainlink/chainlink.config.yaml diff --git a/tools/docker/chainlink-all-in-one/README.md b/tools/docker/chainlink-all-in-one/README.md new file mode 100644 index 00000000000..124e874786d --- /dev/null +++ b/tools/docker/chainlink-all-in-one/README.md @@ -0,0 +1,29 @@ +# ChainLink All-In-One Ledger Image + +This is a container image which is designed to accurately simulate a ChainLInk node for testing purposes on localhost. + +Because of it having been designed for test automation use-cases, we try +to make the image as light as possible. + +## Usage + +### Build and Run Image Locally + +```sh +DOCKER_BUILDKIT=1 docker build \ + --progress=plain \ + --file ./tools/docker/chainlink-all-in-one/Dockerfile \ + ./tools/docker/chainlink-all-in-one/ \ + --tag claio \ + --tag chainlink-all-in-one \ + --tag ghcr.io/hyperledger/cacti-chainlink-all-in-one:$(date +"%Y-%m-%dT%H-%M-%S" --utc)-dev-$(git rev-parse --short HEAD) +``` + +```sh +docker run --rm -it claio +``` + + +## References + +$ cd ~/.chainlink && docker run -p 6688:6688 -v ~/.chainlink:/chainlink -it --env-file=.env smartcontract/chainlink local n \ No newline at end of file diff --git a/tools/docker/chainlink-all-in-one/chainlink.config.yaml b/tools/docker/chainlink-all-in-one/chainlink.config.yaml new file mode 100644 index 00000000000..4bc44375cc5 --- /dev/null +++ b/tools/docker/chainlink-all-in-one/chainlink.config.yaml @@ -0,0 +1,19 @@ +# Chainlink configuration file +ethereum: + url: https://mainnet.infura.io/v3/ + accounts: + - private_key: + +# Job definitions +jobs: + - type: web + name: google_price + tasks: + - type: http + url: https://api.priceofbitcoin.com/v1/current + - type: jsonparse + path: $.price + target: + - type: eth + address: + data: 0x6080604052361561000f576020357f1656d78fa275ee266d0e7f380a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tsconfig.json b/tsconfig.json index 600c138e5ed..99297c9054d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -55,9 +55,15 @@ { "path": "./packages/cactus-plugin-ledger-connector-aries/tsconfig.json" }, + { + "path": "./packages/cacti-plugin-ledger-connector-avalanche/tsconfig.json" + }, { "path": "./packages/cactus-plugin-ledger-connector-besu/tsconfig.json" }, + { + "path": "./packages/cacti-plugin-ledger-connector-chainlink/tsconfig.json" + }, { "path": "./packages/cactus-plugin-ledger-connector-polkadot/tsconfig.json" }, @@ -106,9 +112,15 @@ { "path": "./packages/cactus-test-plugin-keychain-memory/tsconfig.json" }, + { + "path": "./packages/cacti-test-plugin-ledger-connector-avalanche/tsconfig.json" + }, { "path": "./packages/cactus-test-plugin-ledger-connector-besu/tsconfig.json" }, + { + "path": "./packages/cacti-test-plugin-ledger-connector-chainlink/tsconfig.json" + }, { "path": "./packages/cactus-test-plugin-ledger-connector-ethereum/tsconfig.json" }, diff --git a/yarn.lock b/yarn.lock index 73222648ea7..48bea231408 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1189,6 +1189,19 @@ __metadata: languageName: node linkType: hard +"@avalabs/avalanchejs@npm:4.0.5": + version: 4.0.5 + resolution: "@avalabs/avalanchejs@npm:4.0.5" + dependencies: + "@noble/curves": "npm:1.3.0" + "@noble/hashes": "npm:1.3.3" + "@noble/secp256k1": "npm:2.0.0" + "@scure/base": "npm:1.1.5" + micro-eth-signer: "npm:0.7.2" + checksum: 10/3cb5102ff9021558762aeb8dd7ce02946c4a0190055611f127ae329becc4bc4dab367f5ae37fa89e3fa61498a6d51b00f81038f14c1837b6caaee3d7a84353f3 + languageName: node + linkType: hard + "@azure/abort-controller@npm:^1.0.0": version: 1.0.4 resolution: "@azure/abort-controller@npm:1.0.4" @@ -5410,6 +5423,15 @@ __metadata: languageName: node linkType: hard +"@babel/runtime@npm:7.20.13": + version: 7.20.13 + resolution: "@babel/runtime@npm:7.20.13" + dependencies: + regenerator-runtime: "npm:^0.13.11" + checksum: 10/7a2f4d8d2ed40ea9fa70c1debc94c9ca1afa86f2cad851eb040489c1f46c1233779e5f25fda4ddc2f7ed471067cd0072cb3caf329b4c0427e1ad828541f30017 + languageName: node + linkType: hard + "@babel/runtime@npm:7.22.6, @babel/runtime@npm:^7.6.3, @babel/runtime@npm:^7.9.2": version: 7.22.6 resolution: "@babel/runtime@npm:7.22.6" @@ -5710,6 +5732,13 @@ __metadata: languageName: node linkType: hard +"@balena/dockerignore@npm:^1.0.2": + version: 1.0.2 + resolution: "@balena/dockerignore@npm:1.0.2" + checksum: 10/13d654fdd725008577d32e721c720275bdc48f72bce612326363d5bed449febbed856c517a0b23c7c40d87cb531e63432804550b4ecc13e365d26fee38fb6c8a + languageName: node + linkType: hard + "@bcoe/v8-coverage@npm:^0.2.3": version: 0.2.3 resolution: "@bcoe/v8-coverage@npm:0.2.3" @@ -5832,6 +5861,21 @@ __metadata: languageName: node linkType: hard +"@chainlink/functions-toolkit@npm:0.3.1": + version: 0.3.1 + resolution: "@chainlink/functions-toolkit@npm:0.3.1" + dependencies: + axios: "npm:^1.4.0" + bcrypto: "npm:^5.4.0" + cbor: "npm:^9.0.1" + eth-crypto: "npm:^2.6.0" + ethers: "npm:^5.7.2" + ganache: "npm:^7.9.1" + uniq: "npm:^1.0.1" + checksum: 10/65634b79d5ed430d463f1fa1ae144adf72d8d149ad1c83b58040272e67f700166e15324b5d02805c3726faea9f8a360e480ab599a22af8b74cd009456feaae35 + languageName: node + linkType: hard + "@chainsafe/as-sha256@npm:^0.3.1": version: 0.3.1 resolution: "@chainsafe/as-sha256@npm:0.3.1" @@ -7839,21 +7883,21 @@ __metadata: languageName: node linkType: hard -"@ethereumjs/rlp@npm:^4.0.1": - version: 4.0.1 - resolution: "@ethereumjs/rlp@npm:4.0.1" +"@ethereumjs/rlp@npm:5.0.0, @ethereumjs/rlp@npm:^5.0.0": + version: 5.0.0 + resolution: "@ethereumjs/rlp@npm:5.0.0" bin: rlp: bin/rlp - checksum: 10/bfdffd634ce72f3b17e3d085d071f2fe7ce9680aebdf10713d74b30afd80ef882d17f19ff7175fcb049431a56e800bd3558d3b028bd0d82341927edb303ab450 + checksum: 10/ed2478580489f0adbb037b8c054b178ab2f22e0b1417470fb6659e655436a3a5c9762030f29c5ab64db6a902911fcad92eeaebdfe59d0561a6ecc149d1a42f06 languageName: node linkType: hard -"@ethereumjs/rlp@npm:^5.0.0": - version: 5.0.0 - resolution: "@ethereumjs/rlp@npm:5.0.0" +"@ethereumjs/rlp@npm:^4.0.1": + version: 4.0.1 + resolution: "@ethereumjs/rlp@npm:4.0.1" bin: rlp: bin/rlp - checksum: 10/ed2478580489f0adbb037b8c054b178ab2f22e0b1417470fb6659e655436a3a5c9762030f29c5ab64db6a902911fcad92eeaebdfe59d0561a6ecc149d1a42f06 + checksum: 10/bfdffd634ce72f3b17e3d085d071f2fe7ce9680aebdf10713d74b30afd80ef882d17f19ff7175fcb049431a56e800bd3558d3b028bd0d82341927edb303ab450 languageName: node linkType: hard @@ -7867,6 +7911,16 @@ __metadata: languageName: node linkType: hard +"@ethereumjs/tx@npm:3.5.2, @ethereumjs/tx@npm:^3.3.2": + version: 3.5.2 + resolution: "@ethereumjs/tx@npm:3.5.2" + dependencies: + "@ethereumjs/common": "npm:^2.6.4" + ethereumjs-util: "npm:^7.1.5" + checksum: 10/891e12738206229ac428685536844f7765e8547ae794462b1e406399445bf1f6f918af6ebc33ee5fa4a1340f14f48871a579f11c0e1d7c142ba0dd525bae5df5 + languageName: node + linkType: hard + "@ethereumjs/tx@npm:5.0.0": version: 5.0.0 resolution: "@ethereumjs/tx@npm:5.0.0" @@ -7884,16 +7938,6 @@ __metadata: languageName: node linkType: hard -"@ethereumjs/tx@npm:^3.3.2": - version: 3.5.2 - resolution: "@ethereumjs/tx@npm:3.5.2" - dependencies: - "@ethereumjs/common": "npm:^2.6.4" - ethereumjs-util: "npm:^7.1.5" - checksum: 10/891e12738206229ac428685536844f7765e8547ae794462b1e406399445bf1f6f918af6ebc33ee5fa4a1340f14f48871a579f11c0e1d7c142ba0dd525bae5df5 - languageName: node - linkType: hard - "@ethereumjs/util@npm:^8.1.0": version: 8.1.0 resolution: "@ethereumjs/util@npm:8.1.0" @@ -8831,6 +8875,16 @@ __metadata: languageName: node linkType: hard +"@grpc/grpc-js@npm:1.11.1": + version: 1.11.1 + resolution: "@grpc/grpc-js@npm:1.11.1" + dependencies: + "@grpc/proto-loader": "npm:^0.7.13" + "@js-sdsl/ordered-map": "npm:^4.4.2" + checksum: 10/28fb8d0bbccc0a8f9f73899e6f982e5e762e8f0c009eb9234d4067021f96896479be76463f8a02b80d13ecfd52817ae6d0a189f6cfe22fd32df0505bf577a720 + languageName: node + linkType: hard + "@grpc/grpc-js@npm:1.11.2": version: 1.11.2 resolution: "@grpc/grpc-js@npm:1.11.2" @@ -9116,6 +9170,88 @@ __metadata: languageName: unknown linkType: soft +"@hyperledger/cacti-plugin-ledger-connector-avalanche@npm:2.0.0-rc.4, @hyperledger/cacti-plugin-ledger-connector-avalanche@workspace:packages/cacti-plugin-ledger-connector-avalanche": + version: 0.0.0-use.local + resolution: "@hyperledger/cacti-plugin-ledger-connector-avalanche@workspace:packages/cacti-plugin-ledger-connector-avalanche" + dependencies: + "@avalabs/avalanchejs": "npm:4.0.5" + "@grpc/grpc-js": "npm:1.11.2" + "@hyperledger/cactus-common": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core-api": "npm:2.0.0-rc.4" + "@hyperledger/cactus-plugin-keychain-memory": "npm:2.0.0-rc.4" + "@hyperledger/cactus-test-tooling": "npm:2.0.0-rc.4" + "@openapitools/openapi-generator-cli": "npm:2.7.0" + "@types/benchmark": "npm:2.1.5" + "@types/body-parser": "npm:1.19.4" + "@types/express": "npm:4.17.21" + "@types/fs-extra": "npm:11.0.4" + "@types/google-protobuf": "npm:3.15.5" + "@types/http-errors": "npm:2.0.4" + "@types/uuid": "npm:10.0.0" + axios: "npm:1.7.7" + benchmark: "npm:2.1.4" + body-parser: "npm:1.20.2" + ethers: "npm:6.13.2" + express: "npm:4.19.2" + fs-extra: "npm:11.2.0" + google-protobuf: "npm:3.21.4" + grpc-tools: "npm:1.12.4" + grpc_tools_node_protoc_ts: "npm:5.3.3" + http-errors-enhanced-cjs: "npm:2.0.1" + joi: "npm:17.13.3" + npm-run-all2: "npm:6.1.2" + openapi-types: "npm:12.1.3" + prom-client: "npm:15.1.3" + protobufjs: "npm:7.4.0" + run-time-error-cjs: "npm:1.4.0" + rxjs: "npm:7.8.1" + socket.io: "npm:4.6.2" + socket.io-client-fixed-types: "npm:4.5.4" + tsx: "npm:4.16.2" + typescript-optional: "npm:2.0.1" + languageName: unknown + linkType: soft + +"@hyperledger/cacti-plugin-ledger-connector-chainlink@npm:2.0.0-rc.4, @hyperledger/cacti-plugin-ledger-connector-chainlink@workspace:packages/cacti-plugin-ledger-connector-chainlink": + version: 0.0.0-use.local + resolution: "@hyperledger/cacti-plugin-ledger-connector-chainlink@workspace:packages/cacti-plugin-ledger-connector-chainlink" + dependencies: + "@chainlink/functions-toolkit": "npm:0.3.1" + "@grpc/grpc-js": "npm:1.11.1" + "@hyperledger/cactus-common": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core-api": "npm:2.0.0-rc.4" + "@hyperledger/cactus-plugin-keychain-memory": "npm:2.0.0-rc.4" + "@hyperledger/cactus-test-tooling": "npm:2.0.0-rc.4" + "@openapitools/openapi-generator-cli": "npm:2.7.0" + "@types/benchmark": "npm:2.1.5" + "@types/body-parser": "npm:1.19.4" + "@types/express": "npm:4.17.21" + "@types/fs-extra": "npm:11.0.4" + "@types/google-protobuf": "npm:3.15.5" + axios: "npm:1.7.7" + benchmark: "npm:2.1.4" + body-parser: "npm:1.20.2" + express: "npm:4.19.2" + fs-extra: "npm:11.2.0" + google-protobuf: "npm:3.21.4" + grpc-tools: "npm:1.12.4" + grpc_tools_node_protoc_ts: "npm:5.3.3" + http-errors-enhanced-cjs: "npm:2.0.1" + npm-run-all2: "npm:6.1.2" + openapi-types: "npm:12.1.3" + prom-client: "npm:15.1.3" + protobufjs: "npm:7.4.0" + run-time-error-cjs: "npm:1.4.0" + rxjs: "npm:7.8.1" + socket.io: "npm:4.6.2" + socket.io-client-fixed-types: "npm:4.5.4" + ts-results: "npm:3.3.0" + tsx: "npm:4.16.2" + languageName: unknown + linkType: soft + "@hyperledger/cacti-plugin-ledger-connector-stellar@workspace:packages/cacti-plugin-ledger-connector-stellar": version: 0.0.0-use.local resolution: "@hyperledger/cacti-plugin-ledger-connector-stellar@workspace:packages/cacti-plugin-ledger-connector-stellar" @@ -9153,6 +9289,25 @@ __metadata: languageName: unknown linkType: soft +"@hyperledger/cacti-test-plugin-ledger-connector-chainlink@workspace:packages/cacti-test-plugin-ledger-connector-chainlink": + version: 0.0.0-use.local + resolution: "@hyperledger/cacti-test-plugin-ledger-connector-chainlink@workspace:packages/cacti-test-plugin-ledger-connector-chainlink" + dependencies: + "@grpc/grpc-js": "npm:1.11.1" + "@hyperledger/cacti-plugin-ledger-connector-chainlink": "npm:2.0.0-rc.4" + "@hyperledger/cactus-cmd-api-server": "npm:2.0.0-rc.4" + "@hyperledger/cactus-common": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core-api": "npm:2.0.0-rc.4" + "@hyperledger/cactus-plugin-keychain-memory": "npm:2.0.0-rc.4" + "@hyperledger/cactus-test-tooling": "npm:2.0.0-rc.4" + "@types/express": "npm:4.17.21" + axios: "npm:1.7.7" + express: "npm:4.19.2" + http-status-codes: "npm:2.3.0" + languageName: unknown + linkType: soft + "@hyperledger/cacti-weaver-besu-cli@workspace:weaver/samples/besu/besu-cli": version: 0.0.0-use.local resolution: "@hyperledger/cacti-weaver-besu-cli@workspace:weaver/samples/besu/besu-cli" @@ -10840,6 +10995,33 @@ __metadata: languageName: unknown linkType: soft +"@hyperledger/cactus-test-plugin-ledger-connector-avalanche@workspace:packages/cacti-test-plugin-ledger-connector-avalanche": + version: 0.0.0-use.local + resolution: "@hyperledger/cactus-test-plugin-ledger-connector-avalanche@workspace:packages/cacti-test-plugin-ledger-connector-avalanche" + dependencies: + "@grpc/grpc-js": "npm:1.11.2" + "@hyperledger/cacti-plugin-ledger-connector-avalanche": "npm:2.0.0-rc.4" + "@hyperledger/cactus-cmd-api-server": "npm:2.0.0-rc.4" + "@hyperledger/cactus-common": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core": "npm:2.0.0-rc.4" + "@hyperledger/cactus-core-api": "npm:2.0.0-rc.4" + "@hyperledger/cactus-plugin-keychain-memory": "npm:2.0.0-rc.4" + "@hyperledger/cactus-test-tooling": "npm:2.0.0-rc.4" + "@hyperledger/cactus-verifier-client": "npm:2.0.0-rc.4" + "@types/express": "npm:4.17.21" + "@types/uuid": "npm:10.0.0" + axios: "npm:1.7.7" + express: "npm:4.19.2" + http-status-codes: "npm:2.3.0" + key-encoder: "npm:2.0.3" + socket.io: "npm:4.6.2" + uuid: "npm:10.0.0" + web3: "npm:1.6.1" + web3-core: "npm:1.6.1" + web3js-quorum: "npm:22.4.0" + languageName: unknown + linkType: soft + "@hyperledger/cactus-test-plugin-ledger-connector-besu@workspace:packages/cactus-test-plugin-ledger-connector-besu": version: 0.0.0-use.local resolution: "@hyperledger/cactus-test-plugin-ledger-connector-besu@workspace:packages/cactus-test-plugin-ledger-connector-besu" @@ -10901,6 +11083,7 @@ __metadata: "@hyperledger/cactus-common": "npm:2.0.0-rc.4" "@hyperledger/indy-vdr-nodejs": "npm:0.2.0" "@types/dockerode": "npm:3.2.7" + "@types/dockerode-compose": "npm:1.4.1" "@types/esm": "npm:3.2.0" "@types/fs-extra": "npm:11.0.4" "@types/js-yaml": "npm:4.0.3" @@ -10913,7 +11096,8 @@ __metadata: "@types/temp": "npm:0.9.1" axios: "npm:1.7.7" compare-versions: "npm:3.6.0" - dockerode: "npm:3.3.0" + dockerode: "npm:4.0.2" + dockerode-compose: "npm:1.4.0" elliptic: "npm:6.5.7" esm: "npm:3.2.25" execa: "npm:5.1.1" @@ -10934,6 +11118,7 @@ __metadata: socket.io-client-fixed-types: "npm:4.5.4" tar-stream: "npm:2.2.0" temp: "npm:0.9.4" + ts-results: "npm:3.3.0" typescript-optional: "npm:2.0.1" uuid: "npm:10.0.0" web3: "npm:1.6.1" @@ -13206,7 +13391,7 @@ __metadata: languageName: node linkType: hard -"@noble/curves@npm:^1.3.0": +"@noble/curves@npm:1.3.0, @noble/curves@npm:^1.3.0, @noble/curves@npm:~1.3.0": version: 1.3.0 resolution: "@noble/curves@npm:1.3.0" dependencies: @@ -13250,7 +13435,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1.3.3": +"@noble/hashes@npm:1.3.3, @noble/hashes@npm:^1.3.3, @noble/hashes@npm:~1.3.3": version: 1.3.3 resolution: "@noble/hashes@npm:1.3.3" checksum: 10/1025ddde4d24630e95c0818e63d2d54ee131b980fe113312d17ed7468bc18f54486ac86c907685759f8a7e13c2f9b9e83ec7b67d1cc20836f36b5e4a65bb102d @@ -13264,6 +13449,13 @@ __metadata: languageName: node linkType: hard +"@noble/secp256k1@npm:2.0.0": + version: 2.0.0 + resolution: "@noble/secp256k1@npm:2.0.0" + checksum: 10/64677b25988c1fa0a97af718332f88d49ec46a9d030c1d119861a665863cbabddefb1fd1e037608e130ee2aedb4c5edfc430b9bf4c96b43797855343b96318de + languageName: node + linkType: hard + "@nodelib/fs.scandir@npm:2.1.5": version: 2.1.5 resolution: "@nodelib/fs.scandir@npm:2.1.5" @@ -15004,7 +15196,7 @@ __metadata: languageName: node linkType: hard -"@scure/base@npm:^1.1.5": +"@scure/base@npm:1.1.5, @scure/base@npm:^1.1.5": version: 1.1.5 resolution: "@scure/base@npm:1.1.5" checksum: 10/543fa9991c6378b6a0d5ab7f1e27b30bb9c1e860d3ac81119b4213cfdf0ad7b61be004e06506e89de7ce0cec9391c17f5c082bb34c3b617a2ee6a04129f52481 @@ -15018,6 +15210,13 @@ __metadata: languageName: node linkType: hard +"@scure/base@npm:~1.1.5": + version: 1.1.8 + resolution: "@scure/base@npm:1.1.8" + checksum: 10/5b764c0e98610bc4993479965db718457d91b68d3c6f1339e3cc74e53fc6b0ae0428d1d64d29a0de0cee9d966034674d4464fdbd2d1dbef27013927b2fe05c45 + languageName: node + linkType: hard + "@scure/bip32@npm:1.1.5": version: 1.1.5 resolution: "@scure/bip32@npm:1.1.5" @@ -16276,6 +16475,22 @@ __metadata: languageName: node linkType: hard +"@trufflesuite/uws-js-unofficial@npm:20.30.0-unofficial.0": + version: 20.30.0-unofficial.0 + resolution: "@trufflesuite/uws-js-unofficial@npm:20.30.0-unofficial.0" + dependencies: + bufferutil: "npm:4.0.7" + utf-8-validate: "npm:6.0.3" + ws: "npm:8.13.0" + dependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 10/4aa6c3c00e8d448c18c4fb5a3f61dd6f8b2162ed9bacf7ecc9f6750c81fd1befcda1b821563f65c4608890949bcd01a868166f9aba591939b6abdbed5c664576 + languageName: node + linkType: hard + "@trysound/sax@npm:0.2.0": version: 0.2.0 resolution: "@trysound/sax@npm:0.2.0" @@ -16469,21 +16684,21 @@ __metadata: languageName: node linkType: hard -"@types/bn.js@npm:^4.11.3, @types/bn.js@npm:^4.11.5": - version: 4.11.6 - resolution: "@types/bn.js@npm:4.11.6" +"@types/bn.js@npm:5.1.1, @types/bn.js@npm:^5.1.1": + version: 5.1.1 + resolution: "@types/bn.js@npm:5.1.1" dependencies: "@types/node": "npm:*" - checksum: 10/9ff3e7a1539a953c381c0d30ea2049162e3cab894cda91ee10f3a84d603f9afa2b2bc2a38fe9b427de94b6e2b7b77aefd217c1c7b07a10ae8d7499f9d6697a41 + checksum: 10/cf2c45833e67ecfc45e5336151965a47857431640b61708b6e4dc81d88ed53585c9b30be59abbbee609cdf7a63828e5b8a58c1a27eb4306e5cb7ddd9bad46650 languageName: node linkType: hard -"@types/bn.js@npm:^5.1.1": - version: 5.1.1 - resolution: "@types/bn.js@npm:5.1.1" +"@types/bn.js@npm:^4.11.3, @types/bn.js@npm:^4.11.5": + version: 4.11.6 + resolution: "@types/bn.js@npm:4.11.6" dependencies: "@types/node": "npm:*" - checksum: 10/cf2c45833e67ecfc45e5336151965a47857431640b61708b6e4dc81d88ed53585c9b30be59abbbee609cdf7a63828e5b8a58c1a27eb4306e5cb7ddd9bad46650 + checksum: 10/9ff3e7a1539a953c381c0d30ea2049162e3cab894cda91ee10f3a84d603f9afa2b2bc2a38fe9b427de94b6e2b7b77aefd217c1c7b07a10ae8d7499f9d6697a41 languageName: node linkType: hard @@ -16693,6 +16908,26 @@ __metadata: languageName: node linkType: hard +"@types/dockerode-compose@npm:1.4.1": + version: 1.4.1 + resolution: "@types/dockerode-compose@npm:1.4.1" + dependencies: + "@types/dockerode": "npm:*" + checksum: 10/ee63b7e77aced411afd5489d0a92b8fe6521af5e72a3a6cff97a9dedff8814b0b454baf3a2c2bba5470d5553a7ef1bcc6f033b7d50dab10ca42e5ed734536f30 + languageName: node + linkType: hard + +"@types/dockerode@npm:*": + version: 3.3.31 + resolution: "@types/dockerode@npm:3.3.31" + dependencies: + "@types/docker-modem": "npm:*" + "@types/node": "npm:*" + "@types/ssh2": "npm:*" + checksum: 10/14d7e8bd0860de0d22aa52fd51aaea637462aba1636735a89a2e7d54b4cd63a28f8dc28aec7f81ae0950c6f9035aafa1d68152264d77dba155064afa49ed1b4b + languageName: node + linkType: hard + "@types/dockerode@npm:3.2.7": version: 3.2.7 resolution: "@types/dockerode@npm:3.2.7" @@ -19178,6 +19413,15 @@ __metadata: languageName: node linkType: hard +"acorn@npm:7.1.1": + version: 7.1.1 + resolution: "acorn@npm:7.1.1" + bin: + acorn: bin/acorn + checksum: 10/24a5201151803bd7fda32e4bb186e6d63eb2cac11353f9a2dc52cd85c8e5024541a52b8b4ad5c7eda4d7e8feafc0779c71179db861cccb23d9987aa56bbcc735 + languageName: node + linkType: hard + "acorn@npm:^3.0.4": version: 3.3.0 resolution: "acorn@npm:3.3.0" @@ -21144,6 +21388,17 @@ __metadata: languageName: node linkType: hard +"bcrypto@npm:^5.4.0": + version: 5.5.2 + resolution: "bcrypto@npm:5.5.2" + dependencies: + bufio: "npm:~1.0.7" + loady: "npm:~0.0.5" + node-gyp: "npm:latest" + checksum: 10/296773ca3c4a496fb96a0f929b29b2e69de3e17a9524d7c0c41ffa4a4b2ed52cb54d980c86df84d23ab791ac960a6ffabc0702528d572163ee2c53a68c336c81 + languageName: node + linkType: hard + "bech32@npm:1.1.4, bech32@npm:^1.1.3": version: 1.1.4 resolution: "bech32@npm:1.1.4" @@ -21269,7 +21524,7 @@ __metadata: languageName: node linkType: hard -"bindings@npm:^1.3.1": +"bindings@npm:^1.3.1, bindings@npm:^1.5.0": version: 1.5.0 resolution: "bindings@npm:1.5.0" dependencies: @@ -21285,6 +21540,15 @@ __metadata: languageName: node linkType: hard +"bip66@npm:^1.1.5": + version: 1.1.5 + resolution: "bip66@npm:1.1.5" + dependencies: + safe-buffer: "npm:^5.0.1" + checksum: 10/6257e90ff2149aa08740ff4009730c1bceb1a3456571d3006a36b39f30044f2973e05f043ea6977046d6ab66e4a8d6f5c9785094f8317f4ff546a325baece1ab + languageName: node + linkType: hard + "bl@npm:6.0.14": version: 6.0.14 resolution: "bl@npm:6.0.14" @@ -21593,7 +21857,7 @@ __metadata: languageName: node linkType: hard -"browserify-aes@npm:^1.0.0, browserify-aes@npm:^1.0.4, browserify-aes@npm:^1.2.0": +"browserify-aes@npm:^1.0.0, browserify-aes@npm:^1.0.4, browserify-aes@npm:^1.0.6, browserify-aes@npm:^1.2.0": version: 1.2.0 resolution: "browserify-aes@npm:1.2.0" dependencies: @@ -21938,6 +22202,16 @@ __metadata: languageName: node linkType: hard +"bufferutil@npm:4.0.7": + version: 4.0.7 + resolution: "bufferutil@npm:4.0.7" + dependencies: + node-gyp: "npm:latest" + node-gyp-build: "npm:^4.3.0" + checksum: 10/01e2144e88a6cb1cd8e4e0bb1ec622c6e400646fb451a672d20e7d40cdc7d4a82a64dbcda6f5f92b36eeca0d1e5290baf7af707994f7b7c87e911d51a265bf07 + languageName: node + linkType: hard + "bufferutil@npm:^4.0.1": version: 4.0.6 resolution: "bufferutil@npm:4.0.6" @@ -21948,6 +22222,13 @@ __metadata: languageName: node linkType: hard +"bufio@npm:~1.0.7": + version: 1.0.7 + resolution: "bufio@npm:1.0.7" + checksum: 10/281073ac13ddb8fbb761015263aef6af3f4085b12cd468a2d254be8665d956cbc07917a40433e8e0ee6de44a136fa9a2400737d0723f9b92e5c18263ab6abfaf + languageName: node + linkType: hard + "buildcheck@npm:~0.0.6": version: 0.0.6 resolution: "buildcheck@npm:0.0.6" @@ -22540,6 +22821,15 @@ __metadata: languageName: node linkType: hard +"cbor@npm:^9.0.1": + version: 9.0.2 + resolution: "cbor@npm:9.0.2" + dependencies: + nofilter: "npm:^3.1.0" + checksum: 10/a64f7d4dafed933adeafe7745e2ce9f39a2e669eba73db96de6bd1b39c2dbde4bdd51d0240beed179cc429a7dc8653c8d7c991c5addb9f4e0cee8cd167d87116 + languageName: node + linkType: hard + "cborg@npm:^4.0.0": version: 4.0.3 resolution: "cborg@npm:4.0.3" @@ -24205,6 +24495,17 @@ __metadata: languageName: node linkType: hard +"cpu-features@npm:~0.0.9": + version: 0.0.10 + resolution: "cpu-features@npm:0.0.10" + dependencies: + buildcheck: "npm:~0.0.6" + nan: "npm:^2.19.0" + node-gyp: "npm:latest" + checksum: 10/941b828ffe77582b2bdc03e894c913e2e2eeb5c6043ccb01338c34446d026f6888dc480ecb85e684809f9c3889d245f3648c7907eb61a92bdfc6aed039fcda8d + languageName: node + linkType: hard + "cpy-cli@npm:4.2.0": version: 4.2.0 resolution: "cpy-cli@npm:4.2.0" @@ -26061,6 +26362,29 @@ __metadata: languageName: node linkType: hard +"docker-modem@npm:^5.0.3": + version: 5.0.3 + resolution: "docker-modem@npm:5.0.3" + dependencies: + debug: "npm:^4.1.1" + readable-stream: "npm:^3.5.0" + split-ca: "npm:^1.0.1" + ssh2: "npm:^1.15.0" + checksum: 10/fc4cc09f3aab0e17d32eb5a01974bed845a803e23352937aceab2e35c35bdcd283d1655c154b737063b037f164f57addbd447628d620f564a2da82e036543a5f + languageName: node + linkType: hard + +"dockerode-compose@npm:1.4.0": + version: 1.4.0 + resolution: "dockerode-compose@npm:1.4.0" + dependencies: + dockerode: "npm:^4.0.0" + js-yaml: "npm:^4.0.0" + tar-fs: "npm:^2.1.1" + checksum: 10/157d1e4e97d0e6f92f7c93597952e2081d8c4fe56618bfb453c7e2c95bc80decb09db29addc74e8416efff4a08d7cf4f5b1eb28ed447e0838c69e6c6e4edda56 + languageName: node + linkType: hard + "dockerode@npm:3.3.0": version: 3.3.0 resolution: "dockerode@npm:3.3.0" @@ -26071,6 +26395,17 @@ __metadata: languageName: node linkType: hard +"dockerode@npm:4.0.2, dockerode@npm:^4.0.0": + version: 4.0.2 + resolution: "dockerode@npm:4.0.2" + dependencies: + "@balena/dockerignore": "npm:^1.0.2" + docker-modem: "npm:^5.0.3" + tar-fs: "npm:~2.0.1" + checksum: 10/859279721553cc07d00f8e7ac55abb3bba3a8a42685c742f3651c46a996755c720005fedc8b6bb7ac0ca5dc9123536164099c93741d691c7779669ecde3bbc3d + languageName: node + linkType: hard + "dockerode@npm:^3.3.1": version: 3.3.1 resolution: "dockerode@npm:3.3.1" @@ -26381,6 +26716,17 @@ __metadata: languageName: node linkType: hard +"drbg.js@npm:^1.0.1": + version: 1.0.1 + resolution: "drbg.js@npm:1.0.1" + dependencies: + browserify-aes: "npm:^1.0.6" + create-hash: "npm:^1.1.2" + create-hmac: "npm:^1.1.4" + checksum: 10/a50e770cf641ec364f6b8de8e955c63e0db59f0af6525cc0306f392f4361427e37bf5c74373b31589b24e98d523acc7bbab4c8ee421bc35a2a8a82fe6e06ce95 + languageName: node + linkType: hard + "ds-test@https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0": version: 1.0.0 resolution: "ds-test@https://github.com/dapphub/ds-test.git#commit=e282159d5170298eb2455a6c05280ab5a73a4ef0" @@ -26453,6 +26799,23 @@ __metadata: languageName: node linkType: hard +"eccrypto@npm:1.1.6": + version: 1.1.6 + resolution: "eccrypto@npm:1.1.6" + dependencies: + acorn: "npm:7.1.1" + elliptic: "npm:6.5.4" + es6-promise: "npm:4.2.8" + nan: "npm:2.14.0" + node-gyp: "npm:latest" + secp256k1: "npm:3.7.1" + dependenciesMeta: + secp256k1: + optional: true + checksum: 10/8d446da662ab31134f73a9438dabcc350e551de2c4969e1e1f7c14c85ffeee3d8fc1ad58877442546bea427dfcbb53181a55afe70409537ce9809701404f1b17 + languageName: node + linkType: hard + "ecdsa-sig-formatter@npm:1.0.11, ecdsa-sig-formatter@npm:^1.0.11": version: 1.0.11 resolution: "ecdsa-sig-formatter@npm:1.0.11" @@ -27257,7 +27620,7 @@ __metadata: languageName: node linkType: hard -"es6-promise@npm:^4.1.1, es6-promise@npm:^4.2.8": +"es6-promise@npm:4.2.8, es6-promise@npm:^4.1.1, es6-promise@npm:^4.2.8": version: 4.2.8 resolution: "es6-promise@npm:4.2.8" checksum: 10/b250c55523c496c43c9216c2646e58ec182b819e036fe5eb8d83fa16f044ecc6b8dcefc88ace2097be3d3c4d02b6aa8eeae1a66deeaf13e7bee905ebabb350a3 @@ -28415,6 +28778,21 @@ __metadata: languageName: node linkType: hard +"eth-crypto@npm:^2.6.0": + version: 2.6.0 + resolution: "eth-crypto@npm:2.6.0" + dependencies: + "@babel/runtime": "npm:7.20.13" + "@ethereumjs/tx": "npm:3.5.2" + "@types/bn.js": "npm:5.1.1" + eccrypto: "npm:1.1.6" + ethereumjs-util: "npm:7.1.5" + ethers: "npm:5.7.2" + secp256k1: "npm:5.0.0" + checksum: 10/083f919ac75a0401472b9212cf33647e36598d40c1ad3cd424108ab59b1daeaba87c0efd3f37a1d33988d5ce4d830230b377ba37887372cabfba68f37578b570 + languageName: node + linkType: hard + "eth-ens-namehash@npm:2.0.8, eth-ens-namehash@npm:^2.0.8": version: 2.0.8 resolution: "eth-ens-namehash@npm:2.0.8" @@ -28602,6 +28980,19 @@ __metadata: languageName: node linkType: hard +"ethereumjs-util@npm:7.1.5, ethereumjs-util@npm:^7.0.2, ethereumjs-util@npm:^7.1.2, ethereumjs-util@npm:^7.1.5": + version: 7.1.5 + resolution: "ethereumjs-util@npm:7.1.5" + dependencies: + "@types/bn.js": "npm:^5.1.0" + bn.js: "npm:^5.1.2" + create-hash: "npm:^1.1.2" + ethereum-cryptography: "npm:^0.1.3" + rlp: "npm:^2.2.4" + checksum: 10/f28fc1ebb8f35bf9e418f76f51be737d94d603b912c3e014c4e87cd45ccd1b10bdfef764c8f152574b57e9faa260a18773cbc110f9e0a754d6b3730699e54dc9 + languageName: node + linkType: hard + "ethereumjs-util@npm:^5.0.0": version: 5.2.1 resolution: "ethereumjs-util@npm:5.2.1" @@ -28630,19 +29021,6 @@ __metadata: languageName: node linkType: hard -"ethereumjs-util@npm:^7.0.2, ethereumjs-util@npm:^7.1.2, ethereumjs-util@npm:^7.1.5": - version: 7.1.5 - resolution: "ethereumjs-util@npm:7.1.5" - dependencies: - "@types/bn.js": "npm:^5.1.0" - bn.js: "npm:^5.1.2" - create-hash: "npm:^1.1.2" - ethereum-cryptography: "npm:^0.1.3" - rlp: "npm:^2.2.4" - checksum: 10/f28fc1ebb8f35bf9e418f76f51be737d94d603b912c3e014c4e87cd45ccd1b10bdfef764c8f152574b57e9faa260a18773cbc110f9e0a754d6b3730699e54dc9 - languageName: node - linkType: hard - "ethereumjs-vm@npm:4.1.3": version: 4.1.3 resolution: "ethereumjs-vm@npm:4.1.3" @@ -28666,6 +29044,44 @@ __metadata: languageName: node linkType: hard +"ethers@npm:5.7.2, ethers@npm:^5.0.13, ethers@npm:^5.7.1, ethers@npm:^5.7.2": + version: 5.7.2 + resolution: "ethers@npm:5.7.2" + dependencies: + "@ethersproject/abi": "npm:5.7.0" + "@ethersproject/abstract-provider": "npm:5.7.0" + "@ethersproject/abstract-signer": "npm:5.7.0" + "@ethersproject/address": "npm:5.7.0" + "@ethersproject/base64": "npm:5.7.0" + "@ethersproject/basex": "npm:5.7.0" + "@ethersproject/bignumber": "npm:5.7.0" + "@ethersproject/bytes": "npm:5.7.0" + "@ethersproject/constants": "npm:5.7.0" + "@ethersproject/contracts": "npm:5.7.0" + "@ethersproject/hash": "npm:5.7.0" + "@ethersproject/hdnode": "npm:5.7.0" + "@ethersproject/json-wallets": "npm:5.7.0" + "@ethersproject/keccak256": "npm:5.7.0" + "@ethersproject/logger": "npm:5.7.0" + "@ethersproject/networks": "npm:5.7.1" + "@ethersproject/pbkdf2": "npm:5.7.0" + "@ethersproject/properties": "npm:5.7.0" + "@ethersproject/providers": "npm:5.7.2" + "@ethersproject/random": "npm:5.7.0" + "@ethersproject/rlp": "npm:5.7.0" + "@ethersproject/sha2": "npm:5.7.0" + "@ethersproject/signing-key": "npm:5.7.0" + "@ethersproject/solidity": "npm:5.7.0" + "@ethersproject/strings": "npm:5.7.0" + "@ethersproject/transactions": "npm:5.7.0" + "@ethersproject/units": "npm:5.7.0" + "@ethersproject/wallet": "npm:5.7.0" + "@ethersproject/web": "npm:5.7.1" + "@ethersproject/wordlists": "npm:5.7.0" + checksum: 10/227dfa88a2547c799c0c3c9e92e5e246dd11342f4b495198b3ae7c942d5bf81d3970fcef3fbac974a9125d62939b2d94f3c0458464e702209b839a8e6e615028 + languageName: node + linkType: hard + "ethers@npm:6.12.1": version: 6.12.1 resolution: "ethers@npm:6.12.1" @@ -28681,6 +29097,21 @@ __metadata: languageName: node linkType: hard +"ethers@npm:6.13.2": + version: 6.13.2 + resolution: "ethers@npm:6.13.2" + dependencies: + "@adraffy/ens-normalize": "npm:1.10.1" + "@noble/curves": "npm:1.2.0" + "@noble/hashes": "npm:1.3.2" + "@types/node": "npm:18.15.13" + aes-js: "npm:4.0.0-beta.5" + tslib: "npm:2.4.0" + ws: "npm:8.17.1" + checksum: 10/e611c2e2c5340982dfd1f004895f55abda11748a7edec9e6315226dec42d58aa61b827dd389ec904db5f9a244c475ae795e528da579251fdf62e914bde12809e + languageName: node + linkType: hard + "ethers@npm:6.3.0": version: 6.3.0 resolution: "ethers@npm:6.3.0" @@ -28727,44 +29158,6 @@ __metadata: languageName: node linkType: hard -"ethers@npm:^5.0.13, ethers@npm:^5.7.1": - version: 5.7.2 - resolution: "ethers@npm:5.7.2" - dependencies: - "@ethersproject/abi": "npm:5.7.0" - "@ethersproject/abstract-provider": "npm:5.7.0" - "@ethersproject/abstract-signer": "npm:5.7.0" - "@ethersproject/address": "npm:5.7.0" - "@ethersproject/base64": "npm:5.7.0" - "@ethersproject/basex": "npm:5.7.0" - "@ethersproject/bignumber": "npm:5.7.0" - "@ethersproject/bytes": "npm:5.7.0" - "@ethersproject/constants": "npm:5.7.0" - "@ethersproject/contracts": "npm:5.7.0" - "@ethersproject/hash": "npm:5.7.0" - "@ethersproject/hdnode": "npm:5.7.0" - "@ethersproject/json-wallets": "npm:5.7.0" - "@ethersproject/keccak256": "npm:5.7.0" - "@ethersproject/logger": "npm:5.7.0" - "@ethersproject/networks": "npm:5.7.1" - "@ethersproject/pbkdf2": "npm:5.7.0" - "@ethersproject/properties": "npm:5.7.0" - "@ethersproject/providers": "npm:5.7.2" - "@ethersproject/random": "npm:5.7.0" - "@ethersproject/rlp": "npm:5.7.0" - "@ethersproject/sha2": "npm:5.7.0" - "@ethersproject/signing-key": "npm:5.7.0" - "@ethersproject/solidity": "npm:5.7.0" - "@ethersproject/strings": "npm:5.7.0" - "@ethersproject/transactions": "npm:5.7.0" - "@ethersproject/units": "npm:5.7.0" - "@ethersproject/wallet": "npm:5.7.0" - "@ethersproject/web": "npm:5.7.1" - "@ethersproject/wordlists": "npm:5.7.0" - checksum: 10/227dfa88a2547c799c0c3c9e92e5e246dd11342f4b495198b3ae7c942d5bf81d3970fcef3fbac974a9125d62939b2d94f3c0458464e702209b839a8e6e615028 - languageName: node - linkType: hard - "ethjs-unit@npm:0.1.6": version: 0.1.6 resolution: "ethjs-unit@npm:0.1.6" @@ -30769,6 +31162,36 @@ __metadata: languageName: node linkType: hard +"ganache@npm:^7.9.1": + version: 7.9.2 + resolution: "ganache@npm:7.9.2" + dependencies: + "@trufflesuite/bigint-buffer": "npm:1.1.10" + "@trufflesuite/uws-js-unofficial": "npm:20.30.0-unofficial.0" + "@types/bn.js": "npm:^5.1.0" + "@types/lru-cache": "npm:5.1.1" + "@types/seedrandom": "npm:3.0.1" + abstract-level: "npm:1.0.3" + abstract-leveldown: "npm:7.2.0" + async-eventemitter: "npm:0.2.4" + bufferutil: "npm:4.0.5" + emittery: "npm:0.10.0" + keccak: "npm:3.0.2" + leveldown: "npm:6.1.0" + secp256k1: "npm:4.0.3" + utf-8-validate: "npm:5.0.7" + dependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + bin: + ganache: dist/node/cli.js + ganache-cli: dist/node/cli.js + checksum: 10/69c66d2103f06f16fbbe9587317b87aeccb53343259da0fe4c3fe1bb3914e17c81493aca92f5be7258b7613b4f179cfdf38282316c0df1d58ec373c11c70e278 + languageName: node + linkType: hard + "gauge@npm:^3.0.0": version: 3.0.2 resolution: "gauge@npm:3.0.2" @@ -36239,7 +36662,7 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": +"js-yaml@npm:4.1.0, js-yaml@npm:^4.0.0, js-yaml@npm:^4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" dependencies: @@ -37819,6 +38242,13 @@ __metadata: languageName: node linkType: hard +"loady@npm:~0.0.5": + version: 0.0.5 + resolution: "loady@npm:0.0.5" + checksum: 10/3cba2ffa8cef8a082b3d23f22c1269a339e9f268105c30229bb3fed9123bb79830c0c7f3fa79f52286e1de9303b87e4eb3236952a6ee3fcffa83e7c576f7a8f5 + languageName: node + linkType: hard + "locate-path@npm:^2.0.0": version: 2.0.0 resolution: "locate-path@npm:2.0.0" @@ -39082,6 +39512,19 @@ __metadata: languageName: node linkType: hard +"micro-eth-signer@npm:0.7.2": + version: 0.7.2 + resolution: "micro-eth-signer@npm:0.7.2" + dependencies: + "@ethereumjs/rlp": "npm:5.0.0" + "@noble/curves": "npm:~1.3.0" + "@noble/hashes": "npm:~1.3.3" + "@scure/base": "npm:~1.1.5" + micro-packed: "npm:~0.5.1" + checksum: 10/014352db9863e493d9b084a37b935bb4b824c39aca02ea2f10f2c4d9c5c275093e4af1fca0e0b27f153a58e21257e2f45c1e4e8c5135179b1a62175929cb4ed1 + languageName: node + linkType: hard + "micro-ftch@npm:^0.3.1": version: 0.3.1 resolution: "micro-ftch@npm:0.3.1" @@ -39089,6 +39532,15 @@ __metadata: languageName: node linkType: hard +"micro-packed@npm:~0.5.1": + version: 0.5.3 + resolution: "micro-packed@npm:0.5.3" + dependencies: + "@scure/base": "npm:~1.1.5" + checksum: 10/feb1e00f4e7b691ca6face3bcd21691231d37372151fe42602449bc4418c8e999138951ec1eec734dbce3c96464af065e1cb3cb74896d8cf9f8dd80e4db37a1a + languageName: node + linkType: hard + "micromatch@npm:^2.3.11": version: 2.3.11 resolution: "micromatch@npm:2.3.11" @@ -40012,6 +40464,15 @@ __metadata: languageName: node linkType: hard +"nan@npm:2.14.0": + version: 2.14.0 + resolution: "nan@npm:2.14.0" + dependencies: + node-gyp: "npm:latest" + checksum: 10/9d005e0983988682dffb240b2c9ef74abf66059482cdaca1c16b3968b582176289578f00ad9a08d95c2c6398020e676858ed9bde3bfb94857a8290f896e90e61 + languageName: node + linkType: hard + "nan@npm:^2.11.1": version: 2.18.0 resolution: "nan@npm:2.18.0" @@ -40021,6 +40482,15 @@ __metadata: languageName: node linkType: hard +"nan@npm:^2.14.0, nan@npm:^2.18.0, nan@npm:^2.19.0": + version: 2.20.0 + resolution: "nan@npm:2.20.0" + dependencies: + node-gyp: "npm:latest" + checksum: 10/5f16e4c9953075d9920229c703c1d781c0b74118ce3d9e926b448a4eef92b7d8be5ac6adc748a13a5fafb594436cbfe63250e3471aefdd78e3a0cd14603b9ba7 + languageName: node + linkType: hard + "nan@npm:^2.14.1, nan@npm:^2.15.0": version: 2.15.0 resolution: "nan@npm:2.15.0" @@ -40388,6 +40858,15 @@ __metadata: languageName: node linkType: hard +"node-addon-api@npm:^5.0.0": + version: 5.1.0 + resolution: "node-addon-api@npm:5.1.0" + dependencies: + node-gyp: "npm:latest" + checksum: 10/595f59ffb4630564f587c502119cbd980d302e482781021f3b479f5fc7e41cf8f2f7280fdc2795f32d148e4f3259bd15043c52d4a3442796aa6f1ae97b959636 + languageName: node + linkType: hard + "node-cache@npm:^5.1.2": version: 5.1.2 resolution: "node-cache@npm:5.1.2" @@ -47715,6 +48194,23 @@ __metadata: languageName: node linkType: hard +"secp256k1@npm:3.7.1": + version: 3.7.1 + resolution: "secp256k1@npm:3.7.1" + dependencies: + bindings: "npm:^1.5.0" + bip66: "npm:^1.1.5" + bn.js: "npm:^4.11.8" + create-hash: "npm:^1.2.0" + drbg.js: "npm:^1.0.1" + elliptic: "npm:^6.4.1" + nan: "npm:^2.14.0" + node-gyp: "npm:latest" + safe-buffer: "npm:^5.1.2" + checksum: 10/69e2da3c2f1cd31cab286467032313be237f6f1850980007288609e8d498950ac783214bec7f2da9f57a90ff8a782ef82db516f295db344842a53f6cd6788cc2 + languageName: node + linkType: hard + "secp256k1@npm:4.0.2": version: 4.0.2 resolution: "secp256k1@npm:4.0.2" @@ -47739,6 +48235,18 @@ __metadata: languageName: node linkType: hard +"secp256k1@npm:5.0.0": + version: 5.0.0 + resolution: "secp256k1@npm:5.0.0" + dependencies: + elliptic: "npm:^6.5.4" + node-addon-api: "npm:^5.0.0" + node-gyp: "npm:latest" + node-gyp-build: "npm:^4.2.0" + checksum: 10/6e146c876ef202dbfbb35836d6ccd0ea3779dc09bad632bb9e0fe2e702848a4ee96638f39da54895430de832232d6292d858529e2eda56db3ddda13e40d7facc + languageName: node + linkType: hard + "secure-json-parse@npm:^2.7.0": version: 2.7.0 resolution: "secure-json-parse@npm:2.7.0" @@ -49077,6 +49585,23 @@ __metadata: languageName: node linkType: hard +"ssh2@npm:^1.15.0": + version: 1.15.0 + resolution: "ssh2@npm:1.15.0" + dependencies: + asn1: "npm:^0.2.6" + bcrypt-pbkdf: "npm:^1.0.2" + cpu-features: "npm:~0.0.9" + nan: "npm:^2.18.0" + dependenciesMeta: + cpu-features: + optional: true + nan: + optional: true + checksum: 10/afe7cb646d73348753c25938f677b61f6ac7554ff3d7dbbcdd4e7bbb275eaff9956729267c1828de92bbbdcd8431253cff995b05d4c882b9e411661fb4f4cd88 + languageName: node + linkType: hard + "ssh2@npm:^1.4.0": version: 1.6.0 resolution: "ssh2@npm:1.6.0" @@ -51425,6 +51950,13 @@ __metadata: languageName: node linkType: hard +"ts-results@npm:3.3.0": + version: 3.3.0 + resolution: "ts-results@npm:3.3.0" + checksum: 10/127371a096d0ec0d31ee813ae7e160fb7c4e2535c063a154e969389f746a319cf9612f21402aaa2a563cd0d8b6aee8604e955c0d2971b1803979e6f5300e98ea + languageName: node + linkType: hard + "tsconfig-paths@npm:^3.14.2": version: 3.14.2 resolution: "tsconfig-paths@npm:3.14.2" @@ -52651,6 +53183,16 @@ __metadata: languageName: node linkType: hard +"utf-8-validate@npm:6.0.3": + version: 6.0.3 + resolution: "utf-8-validate@npm:6.0.3" + dependencies: + node-gyp: "npm:latest" + node-gyp-build: "npm:^4.3.0" + checksum: 10/d137d076c58d4b4ed1a5524f4a2aefbbd4983eda58246e2c45d2c93a55ccc3741923d54cdd9571bf1b8584a8f43dfcdac69fcdda0fbc543fa53587ce40c3cb0e + languageName: node + linkType: hard + "utf-8-validate@npm:^5.0.2": version: 5.0.8 resolution: "utf-8-validate@npm:5.0.8"