diff --git a/.dockerignore b/.dockerignore index d3337c5373..1087f90813 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,6 +4,7 @@ .husky audits docs +docker-setup scripts **/node_modules **/build @@ -22,3 +23,6 @@ scripts .dockerignore **/Dockerfile* **/docker-compose* + +# Local .env files +**/.env.local diff --git a/.github/workflows/cd-subgraph.yaml b/.github/workflows/cd-subgraph.yaml index 4abd139dad..9a61753575 100644 --- a/.github/workflows/cd-subgraph.yaml +++ b/.github/workflows/cd-subgraph.yaml @@ -1,5 +1,4 @@ name: Subgraph deployment - on: workflow_dispatch: inputs: @@ -53,23 +52,21 @@ jobs: - name: Build core package if: steps.filter_networks.outputs.continue == 'true' run: yarn build:core - - name: Install Graph CLI - if: steps.filter_networks.outputs.continue == 'true' - run: yarn global add @graphprotocol/graph-cli@0.71.2 - - name: Authenticate Graph CLI - if: steps.filter_networks.outputs.continue == 'true' - run: graph auth --studio ${API_KEY} - env: - API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} - name: Generate and build Subgraph if: steps.filter_networks.outputs.continue == 'true' run: yarn generate && yarn build working-directory: ./packages/sdk/typescript/subgraph env: NETWORK: ${{ matrix.network.name }} - - name: Deploy Subgraph + - name: Authenticate & Deploy if: steps.filter_networks.outputs.continue == 'true' - run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }} - working-directory: ./packages/sdk/typescript/subgraph env: - NETWORK: ${{ matrix.network.name }} + API_KEY: ${{ secrets.HP_GRAPH_API_KEY }} + NETWORK: ${{ matrix.network.name }} + LABEL: ${{ github.event.inputs.label }} + working-directory: ./packages/sdk/typescript/subgraph + run: | + yarn dlx @graphprotocol/graph-cli@0.71.2 \ + auth --studio "$API_KEY" + yarn dlx @graphprotocol/graph-cli@0.71.2 \ + deploy --studio ${NETWORK} -l ${LABEL} \ No newline at end of file diff --git a/.github/workflows/ci-dependency-review.yaml b/.github/workflows/ci-dependency-review.yaml index 11f1509fae..79a3c2feeb 100644 --- a/.github/workflows/ci-dependency-review.yaml +++ b/.github/workflows/ci-dependency-review.yaml @@ -14,6 +14,6 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - name: Dependency Review - uses: actions/dependency-review-action@v4.7.0 + uses: actions/dependency-review-action@v4.7.1 with: show-openssf-scorecard: false diff --git a/.gitignore b/.gitignore index 2428824dcc..70399e1fe6 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,5 @@ dist *.tsbuildinfo hardhat-dependency-compiler -#cache -cache - -#docker databases -docker-db \ No newline at end of file +# cache +cache \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index b1dd4d8a8e..19c3fa6e16 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,5 @@ yarn dlx lint-staged +yarn workspaces foreach --all -p run typecheck # Format python file changes cd packages/sdk/python/human-protocol-sdk diff --git a/docker-setup/.env.compose b/docker-setup/.env.compose new file mode 100644 index 0000000000..7252e86817 --- /dev/null +++ b/docker-setup/.env.compose @@ -0,0 +1,21 @@ +MINIO_PORT=9000 + +# NOTE: Avoid changing this since it impact KV store urls +BACKEND_APPS_INTERNAL_PORT=5000 + +REPUTATION_ORACLE_EXPOSED_PORT=5001 +HUMAN_APP_SERVER_EXPOSED_PORT=5002 +JOB_LAUNCHER_EXPOSED_PORT=5003 +EXCHANGE_ORACLE_CVAT_EXPOSED_PORT=5004 +RECORDING_ORACLE_CVAT_EXPOSED_PORT=5005 +EXCHANGE_ORACLE_FORTUNE_EXPOSED_PORT=5006 +RECORDING_ORACLE_FORTUNE_EXPOSED_PORT=5007 + +HUMAN_APP_CLIENT_EXPOSED_PORT=3001 +JOB_LAUNCHER_CLIENT_EXPOSED_PORT=3002 +FORTUNE_CLIENT_EXPOSED_PORT=3003 + +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology + +# Might be empty +SUBGRAPH_API_KEY= diff --git a/docker-setup/Makefile b/docker-setup/Makefile new file mode 100644 index 0000000000..365895d059 --- /dev/null +++ b/docker-setup/Makefile @@ -0,0 +1,31 @@ +.PHONY: check-env-file \ + infra-up infra-stop \ + build-services services-up services-stop + +DOCKER_PARALLEL ?= 4 + +check-env-file: + @if [ ! -f "./.env.compose.local" ]; then \ + cp ./.env.compose ./.env.compose.local ; \ + fi + +infra-up: check-env-file + @docker compose --env-file .env.compose.local up -d postgres redis minio minio-client + +infra-stop: + @docker compose --env-file .env.compose.local stop postgres redis minio minio-client + +build-services: check-env-file + @docker compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up --no-start + +services-up: check-env-file + @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ + docker compose --env-file .env.compose.local --parallel $(DOCKER_PARALLEL) up -d $$service_names + +services-stop: + @service_names="$(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))"; \ + docker compose --env-file .env.compose.local stop $$service_names + +# catch-all and noop; to avoid warnings when using MAKECMDGOALS +%: + @: diff --git a/docker-setup/Makefile.dev b/docker-setup/Makefile.dev new file mode 100644 index 0000000000..567f633f0c --- /dev/null +++ b/docker-setup/Makefile.dev @@ -0,0 +1,23 @@ +.PHONY: web3-up web3-down \ + infra-up infra-stop infra-down + +web3-up: + @docker compose -f docker-compose.dev.yml up -d blockchain-node ipfs graph-node-db graph-node + +web3-down: +# also remove volumes to get the clean start after + @docker compose -f docker-compose.dev.yml down -v blockchain-node ipfs graph-node-db graph-node + +infra-up: + @docker compose -f docker-compose.dev.yml up -d postgres minio minio-client + +infra-stop: + @docker compose -f docker-compose.dev.yml stop postgres minio minio-client + +infra-down: +# also remove volumes to get the clean start after + @docker compose -f docker-compose.dev.yml down -v postgres minio minio-client + +# catch-all and noop; to avoid warnings when using MAKECMDGOALS +%: + @: diff --git a/docker-setup/docker-compose.dev.yml b/docker-setup/docker-compose.dev.yml new file mode 100644 index 0000000000..b329016fb9 --- /dev/null +++ b/docker-setup/docker-compose.dev.yml @@ -0,0 +1,229 @@ +name: human-protocol-local-dev + +x-service-default-config: + restart: &default-restart unless-stopped + logging: &default-logging + options: + max-size: 10m + max-file: 3 + +x-hardcoded-vars: + graph_db_user: &graph_db_user graph-node + graph_db_passwrod: &graph_db_passwrod let-me-in + graph_db_name: &graph_db_name graph-node + +x-general-env-variables: + postgres_user: &postgres_user ${POSTGRES_USER:-default} + postgres_password: &postgres_password ${POSTGRES_PASSWORD:-qwerty} + # MINIO VARS + minio_port: &minio_port ${MINIO_PORT:-9000} + minio_console_port: &minio_console_port ${MINIO_CONSOLE_PORT:-9001} + minio_root_user: &minio_root_user ${MINIO_ROOT_USER:-minioadmin} + minio_root_password: &minio_root_password ${MINIO_ROOT_PASSWORD:-minioadmin} + minio_services_access_key: &minio_services_access_key ${MINIO_SERVICES_ACCESS_KEY:-human-oracle} + minio_services_secret_key: &minio_services_secret_key ${MINIO_SERVICES_SECRET_KEY:-human-oracle-s3-secret} + # BUCKET NAMES + bucket_name_manifests: &bucket_name_manifests ${BUCKET_NAME_MANIFESTS:-manifests} + bucket_name_datasets: &bucket_name_datasets ${BUCKET_NAME_DATASETS:-datasets} + bucket_name_rep_o: &bucket_name_rep_o ${BUCKET_NAME_REPUTATION_ORACLE:-reputation-oracle} + bucket_name_fortune: &bucket_name_fortune ${BUCKEN_NAME_FORTUNE:-fortune} + +services: + blockchain-node: + container_name: hp-dev-blockchain-node + image: human-protocol/hardhat-blockchain-node + pull_policy: build + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/core/Dockerfile.local + healthcheck: + test: yarn local:readiness + interval: 15s + timeout: 30s + retries: 0 + networks: + - human_protocol_web3 + ports: + - name: node-port + target: 8545 + published: ${BLOCKCHAIN_NODE_PORT:-8545} + + ipfs: + container_name: hp-dev-ipfs + image: ipfs/kubo:v0.14.0 + restart: *default-restart + logging: + <<: *default-logging + healthcheck: + test: ["CMD-SHELL", "ipfs id > /dev/null"] + interval: 10s + timeout: 5s + retries: 3 + networks: + - human_protocol_web3 + ports: + - name: ipfs-port + target: 5001 + published: ${IPFS_PORT:-5010} + volumes: + - ipfs-data:/data/ipfs:Z + + graph-node-db: + container_name: hp-dev-graph-node-db + image: postgres:latest + restart: *default-restart + logging: + <<: *default-logging + networks: + - human_protocol_web3 + command: + [ + "postgres", + "-cshared_preload_libraries=pg_stat_statements", + "-cmax_connections=200" + ] + healthcheck: + test: ["CMD", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 + volumes: + - graph-node-db-data:/var/lib/postgresql/data:Z + environment: + POSTGRES_USER: *graph_db_user + POSTGRES_PASSWORD: *graph_db_passwrod + POSTGRES_DB: *graph_db_name + POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" + + graph-node: + container_name: hp-dev-graph-node + # In case of issues on Mac M1 rebuild the image for it locally + # https://github.com/graphprotocol/graph-node/blob/master/docker/README.md#running-graph-node-on-an-macbook-m1 + image: graphprotocol/graph-node + restart: *default-restart + logging: + <<: *default-logging + networks: + - human_protocol_web3 + ports: + - '8000:8000' + - '8001:8001' + - '8020:8020' + - '8030:8030' + - '8040:8040' + depends_on: + - blockchain-node + - ipfs + - graph-node-db + environment: + postgres_host: graph-node-db + postgres_user: *graph_db_user + postgres_pass: *graph_db_passwrod + postgres_db: *graph_db_name + ipfs: ipfs:5001 + ethereum: localhost:http://blockchain-node:8545 + GRAPH_LOG: info + healthcheck: + test: ["CMD-SHELL", "nc -z localhost 8000 || exit 1"] + interval: 5s + timeout: 5s + retries: 10 + start_period: 10s + + postgres: + container_name: hp-dev-postgres + image: postgres:16 + restart: *default-restart + logging: + <<: *default-logging + ports: + - name: instance_port + target: 5432 + # default 5432 is used by CVAT installation + published: ${POSTGRES_PORT:-5433} + volumes: + - ./initdb:/docker-entrypoint-initdb.d + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: *postgres_user + POSTGRES_PASSWORD: *postgres_password + healthcheck: + test: ["CMD", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 + + minio: + container_name: hp-dev-minio + image: minio/minio:RELEASE.2024-12-18T13-15-44Z + restart: *default-restart + logging: + <<: *default-logging + entrypoint: 'sh' + ports: + - name: instance_port + target: 9000 + published: *minio_port + - name: console_port + target: 9001 + published: *minio_console_port + volumes: + - minio-data:/data + environment: + MINIO_ROOT_USER: *minio_root_user + MINIO_ROOT_PASSWORD: *minio_root_password + command: + -c "minio server /data --console-address ':9001'" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 5s + timeout: 5s + retries: 3 + + minio-client: + container_name: hp-dev-minio-client + image: minio/mc:RELEASE.2024-11-21T17-21-54Z + depends_on: + minio: + condition: service_healthy + environment: + MINIO_ROOT_USER: *minio_root_user + MINIO_ROOT_PASSWORD: *minio_root_password + SERVICES_ACCESS_KEY: *minio_services_access_key + SERVICES_SECRET_KEY: *minio_services_secret_key + BUCKET_MANIFESTS: *bucket_name_manifests + BUCKET_DATASETS: *bucket_name_datasets + BUCKET_REPUTATION_ORACLE: *bucket_name_rep_o + BUCKET_FORTUNE: *bucket_name_fortune + entrypoint: > + /bin/sh -c " + mc alias set myminio http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD + + mc admin user add myminio $$SERVICES_ACCESS_KEY $$SERVICES_SECRET_KEY + mc admin policy attach myminio readwrite --user=$$SERVICES_ACCESS_KEY + + mc mb myminio/$$BUCKET_MANIFESTS; + mc anonymous set public myminio/$$BUCKET_MANIFESTS; + + mc mb myminio/$$BUCKET_DATASETS; + mc anonymous set public myminio/$$BUCKET_DATASETS; + + mc mb myminio/$$BUCKET_REPUTATION_ORACLE; + mc anonymous set public myminio/$$BUCKET_REPUTATION_ORACLE; + + mc mb myminio/$$BUCKET_FORTUNE; + mc anonymous set public myminio/$$BUCKET_FORTUNE; + " + +volumes: + ipfs-data: + graph-node-db-data: + postgres-data: + minio-data: + +networks: + human_protocol_web3: + name: human-protocol-web3 diff --git a/scripts/cvat/docker-compose.local.yml b/docker-setup/docker-compose.yml similarity index 70% rename from scripts/cvat/docker-compose.local.yml rename to docker-setup/docker-compose.yml index 59db252e5b..5ecff8c246 100644 --- a/scripts/cvat/docker-compose.local.yml +++ b/docker-setup/docker-compose.yml @@ -23,8 +23,7 @@ x-hardcoded-vars: x-general-env-variables: # GENERAL VARS subgraph_api_key: &subgraph_api_key ${SUBGRAPH_API_KEY} - sendgrid_api_key: &sendgrid_api_key ${SENDGRID_API_KEY:-sendgrid-disabled} - rpc_url_polygon_amoy: &rpc_url_polygon_amoy ${RPC_URL_POLYGON_AMOY:-} + rpc_url_polygon_amoy: &rpc_url_polygon_amoy ${RPC_URL_POLYGON_AMOY:?} # POSTGRES VARS postgres_user: &postgres_user ${POSTGRES_USER:-default} postgres_password: &postgres_password ${POSTGRES_PASSWORD:-qwerty} @@ -39,16 +38,11 @@ x-general-env-variables: bucket_name_manifests: &bucket_name_manifests ${BUCKET_NAME_MANIFESTS:-manifests} bucket_name_datasets: &bucket_name_datasets ${BUCKET_NAME_DATASETS:-datasets} bucket_name_rep_o: &bucket_name_rep_o ${BUCKET_NAME_REPUTATION_ORACLE:-reputation-oracle} - bucket_name_exc_o: &bucket_name_exc_o ${BUCKET_NAME_EXCHANGE_ORACLE:-exchange-oracle} - bucket_name_rec_o: &bucket_name_rec_o ${BUCKET_NAME_RECORDING_ORACLE:-recording-oracle} - # WEB3 ADDRESSES - reputation_oracle_address: &reputation_oracle_address ${REPUTATION_ORACLE_ADDRESS:?} - exchange_oracle_address: &exchange_oracle_address ${EXCHANGE_ORACLE_ADDRESS:?} - recording_oracle_address: &recording_oracle_address ${RECORDING_ORACLE_ADDRESS:?} + bucket_name_cvat_exc_o: &bucket_name_cvat_exc_o ${BUCKET_NAME_CVAT_EXCHANGE_ORACLE:-cvat-exchange-oracle} + bucket_name_cvat_rec_o: &bucket_name_cvat_rec_o ${BUCKET_NAME_CVAT_RECORDING_ORACLE:-cvat-recording-oracle} + bucket_name_fortune: &bucket_name_fortune ${BUCKEN_NAME_FORTUNE:-fortune} # OTHER backend_apps_internal_port: &backend_apps_internal_port ${BACKEND_APPS_INTERNAL_PORT:?} - human_app_secret_key: &human_app_secret_key ${HUMAN_APP_SECRET_KEY:?} - reputation_oracle_jwt_public_key: &reputation_oracle_jwt_public_key ${REPUTATION_ORACLE_JWT_PUBLIC_KEY:?} cvat_oracle_storage_endpoint: &cvat_oracle_storage_endpoint minio:${MINIO_PORT:?} x-service-env-vars-groups: @@ -60,13 +54,11 @@ x-service-env-vars-groups: REDIS_PORT: *redis_port nodejs_app_vars: &nodejs_app_vars NODE_ENV: *node_env - WEB3_ENV: *web3_env + SUBGRAPH_API_KEY: *subgraph_api_key RPC_URL_POLYGON_AMOY: *rpc_url_polygon_amoy - SENDGRID_API_KEY: *sendgrid_api_key + cvat_oracle_vars: &cvat_oracle_vars SUBGRAPH_API_KEY: *subgraph_api_key - HCAPTCHA_SITE_KEY: ${HCAPTCHA_SITE_KEY:-10000000-ffff-ffff-ffff-000000000001} - HCAPTCHA_SECRET: ${HCAPTCHA_SECRET:-0x0000000000000000000000000000000000000000} - HCAPTCHA_API_KEY: ${HCAPTCHA_API_KEY:-test} + POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy nodejs_app_postgres_vars: &nodejs_app_postgres_vars <<: *postgres_auth_vars POSTGRES_HOST: *postgres_host @@ -188,8 +180,9 @@ services: BUCKET_MANIFESTS: *bucket_name_manifests BUCKET_DATASETS: *bucket_name_datasets BUCKET_REPUTATION_ORACLE: *bucket_name_rep_o - BUCKET_EXCHANGE_ORACLE: *bucket_name_exc_o - BUCKET_RECORDING_ORACLE: *bucket_name_rec_o + BUCKET_CVAT_EXCHANGE_ORACLE: *bucket_name_cvat_exc_o + BUCKET_CVAT_RECORDING_ORACLE: *bucket_name_cvat_rec_o + BUCKET_FORTUNE: *bucket_name_fortune entrypoint: > /bin/sh -c " mc alias set myminio http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD @@ -206,11 +199,14 @@ services: mc mb myminio/$$BUCKET_REPUTATION_ORACLE; mc anonymous set public myminio/$$BUCKET_REPUTATION_ORACLE; - mc mb myminio/$$BUCKET_EXCHANGE_ORACLE; - mc anonymous set public myminio/$$BUCKET_EXCHANGE_ORACLE; + mc mb myminio/$$BUCKET_CVAT_EXCHANGE_ORACLE; + mc anonymous set public myminio/$$BUCKET_CVAT_EXCHANGE_ORACLE; + + mc mb myminio/$$BUCKET_CVAT_RECORDING_ORACLE; + mc anonymous set public myminio/$$BUCKET_CVAT_RECORDING_ORACLE; - mc mb myminio/$$BUCKET_RECORDING_ORACLE; - mc anonymous set public myminio/$$BUCKET_RECORDING_ORACLE; + mc mb myminio/$$BUCKET_FORTUNE; + mc anonymous set public myminio/$$BUCKET_FORTUNE; " reputation-oracle: @@ -228,7 +224,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/reputation-oracle/server/Dockerfile expose: - *backend_apps_internal_port @@ -237,19 +233,18 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${REPUTATION_ORACLE_PORT:-5001} - env_file: ./.env.reputation-oracle.local + published: ${REPUTATION_ORACLE_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port POSTGRES_DATABASE: reputation-oracle S3_BUCKET: *bucket_name_rep_o - HUMAN_APP_SECRET_KEY: *human_app_secret_key # It is accessed by user, not from container # so put here exposed port, not internal - FE_URL: http://localhost:${HUMAN_APP_CLIENT_PORT:?} - JWT_PUBLIC_KEY: *reputation_oracle_jwt_public_key + FE_URL: http://localhost:${HUMAN_APP_CLIENT_EXPOSED_PORT:?} + # User for KV store setup + SERVER_URL: http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?} human-app-server: container_name: human-app-server @@ -262,7 +257,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/human-app/server/Dockerfile expose: - *backend_apps_internal_port @@ -271,17 +266,14 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${HUMAN_APP_SERVER_PORT:-5002} - env_file: ./.env.human-app-server.local + published: ${HUMAN_APP_SERVER_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *redis_app_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port REDIS_DB: 1 + REPUTATION_ORACLE_URL: http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?} RPC_URL: *rpc_url_polygon_amoy - HUMAN_APP_SECRET_KEY: *human_app_secret_key - REPUTATION_ORACLE_URL: "http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?}" - REPUTATION_ORACLE_ADDRESS: *reputation_oracle_address human-app-client: container_name: human-app-client @@ -294,7 +286,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/human-app/frontend/Dockerfile expose: - *frontend_default_port @@ -303,11 +295,11 @@ services: ports: - name: server_port target: *frontend_default_port - published: ${HUMAN_APP_CLIENT_PORT:?} + published: ${HUMAN_APP_CLIENT_EXPOSED_PORT:?} environment: PORT: *frontend_default_port - exchange-oracle: + exchange-oracle-cvat: container_name: exchange-oracle-cvat image: human-protocol/exchange-oracle-cvat pull_policy: build @@ -324,7 +316,7 @@ services: logging: <<: *default-logging build: - context: ../../packages/examples/cvat/exchange-oracle + context: ../packages/examples/cvat/exchange-oracle dockerfile: ./Dockerfile expose: - *backend_apps_internal_port @@ -336,29 +328,26 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${EXCHANGE_ORACLE_PORT:-5003} - env_file: ./.env.exchange-oracle.local + published: ${EXCHANGE_ORACLE_CVAT_EXPOSED_PORT:?} environment: HOST: *all_interfaces_ip PORT: *backend_apps_internal_port <<: [ + *cvat_oracle_vars, *cvat_oracle_postgres_vars, *redis_app_vars, *cvat_oracle_storage_connection_vars, *cvat_connection_vars ] REDIS_DB: 2 - PG_DB: exchange-oracle - POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy - POLYGON_AMOY_ADDR: *exchange_oracle_address - STORAGE_BUCKET_NAME: *bucket_name_exc_o - HUMAN_APP_JWT_KEY: *reputation_oracle_jwt_public_key + PG_DB: exchange-oracle-cvat + STORAGE_BUCKET_NAME: *bucket_name_cvat_exc_o CVAT_INCOMING_WEBHOOKS_URL: "http://exchange-oracle.app:${BACKEND_APPS_INTERNAL_PORT:?}/cvat-webhook" - LOCALHOST_RECORDING_ORACLE_URL: "http://recording-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_JOB_LAUNCHER_URL: "http://job-launcher:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_RECORDING_ORACLE_ADDRESS: *recording_oracle_address + ENABLE_CUSTOM_CLOUD_HOST: yes + # User for KV store setup + SERVER_URL: http://exchange-oracle-cvat:${BACKEND_APPS_INTERNAL_PORT:?} - recording-oracle: + recording-oracle-cvat: container_name: recording-oracle-cvat image: human-protocol/recording-oracle-cvat pull_policy: build @@ -373,7 +362,7 @@ services: logging: <<: *default-logging build: - context: ../../packages/examples/cvat/recording-oracle + context: ../packages/examples/cvat/recording-oracle dockerfile: ./Dockerfile expose: - *backend_apps_internal_port @@ -383,30 +372,22 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${RECORDING_ORACLE_PORT:-5004} - env_file: ./.env.recording-oracle.local + published: ${RECORDING_ORACLE_CVAT_EXPOSED_PORT:?} environment: HOST: *all_interfaces_ip PORT: *backend_apps_internal_port <<: [ + *cvat_oracle_vars, *cvat_oracle_postgres_vars, *cvat_oracle_storage_connection_vars, *cvat_connection_vars ] - PG_DB: recording-oracle - POLYGON_AMOY_RPC_API_URL: *rpc_url_polygon_amoy - POLYGON_AMOY_ADDR: *recording_oracle_address - STORAGE_RESULTS_BUCKET_NAME: *bucket_name_rec_o + PG_DB: recording-oracle-cvat + STORAGE_RESULTS_BUCKET_NAME: *bucket_name_cvat_rec_o STORAGE_USE_PATH_STYLE: "true" - EXCHANGE_ORACLE_STORAGE_PROVIDER: *cvat_oracle_storage_provider - EXCHANGE_ORACLE_STORAGE_ENDPOINT_URL: *cvat_oracle_storage_endpoint - EXCHANGE_ORACLE_STORAGE_ACCESS_KEY: *minio_services_access_key - EXCHANGE_ORACLE_STORAGE_SECRET_KEY: *minio_services_secret_key - EXCHANGE_ORACLE_STORAGE_RESULTS_BUCKET_NAME: *bucket_name_exc_o - EXCHANGE_ORACLE_STORAGE_USE_SSL: 'false' - LOCALHOST_EXCHANGE_ORACLE_URL: "http://exchange-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_REPUTATION_ORACLE_URL: "http://reputation-oracle:${BACKEND_APPS_INTERNAL_PORT:?}/webhook" - LOCALHOST_EXCHANGE_ORACLE_ADDRESS: *exchange_oracle_address + ENABLE_CUSTOM_CLOUD_HOST: "yes" + # User for KV store setup + SERVER_URL: http://recording-oracle-cvat:${BACKEND_APPS_INTERNAL_PORT:?} job-launcher: container_name: job-launcher @@ -423,7 +404,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/job-launcher/server/Dockerfile expose: - *backend_apps_internal_port @@ -432,19 +413,16 @@ services: ports: - name: server_port target: *backend_apps_internal_port - published: ${JOB_LAUNCHER_PORT:-5005} - env_file: ./.env.job-launcher.local + published: ${JOB_LAUNCHER_EXPOSED_PORT:?} environment: <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] HOST: *all_interfaces_ip PORT: *backend_apps_internal_port POSTGRES_DATABASE: job-launcher S3_BUCKET: *bucket_name_manifests - REPUTATION_ORACLES: *reputation_oracle_address - REPUTATION_ORACLE_ADDRESS: *reputation_oracle_address - CVAT_EXCHANGE_ORACLE_ADDRESS: *exchange_oracle_address - CVAT_RECORDING_ORACLE_ADDRESS: *recording_oracle_address - FE_URL: http://localhost:${JOB_LAUNCHER_CLIENT_PORT:?} + FE_URL: http://localhost:${JOB_LAUNCHER_CLIENT_EXPOSED_PORT:?} + # User for KV store setup + SERVER_URL: http://job-launcher:${BACKEND_APPS_INTERNAL_PORT:?} job-launcher-client: container_name: job-launcher-client @@ -457,7 +435,7 @@ services: logging: <<: *default-logging build: - context: ../../ + context: ../ dockerfile: packages/apps/job-launcher/client/Dockerfile expose: - *frontend_default_port @@ -466,10 +444,99 @@ services: ports: - name: server_port target: *frontend_default_port - published: ${JOB_LAUNCHER_CLIENT_PORT:?} + published: ${JOB_LAUNCHER_CLIENT_EXPOSED_PORT:?} + environment: + PORT: *frontend_default_port + + exchange-oracle-fortune: + container_name: exchange-oracle-fortune + image: human-protocol/exchange-oracle-fortune + pull_policy: build + depends_on: + postgres: + condition: service_healthy + minio: + condition: service_healthy + minio-client: + condition: service_completed_successfully + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/exchange-oracle/server/Dockerfile + expose: + - *backend_apps_internal_port + networks: + - human_protocol + ports: + - name: server_port + target: *backend_apps_internal_port + published: ${EXCHANGE_ORACLE_FORTUNE_EXPOSED_PORT:?} + environment: + <<: [*nodejs_app_vars, *nodejs_app_postgres_vars, *nodejs_app_s3_vars] + HOST: *all_interfaces_ip + PORT: *backend_apps_internal_port + POSTGRES_DATABASE: exchange-oracle-fortune + S3_BUCKET: *bucket_name_fortune + # User for KV store setup + SERVER_URL: http://exchange-oracle-fortune:${BACKEND_APPS_INTERNAL_PORT:?} + + fortune-client: + container_name: fortune-client + image: human-protocol/fortune-client + pull_policy: build + depends_on: + exchange-oracle-fortune: + condition: service_started + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/exchange-oracle/client/Dockerfile + expose: + - *frontend_default_port + networks: + - human_protocol + ports: + - name: server_port + target: *frontend_default_port + published: ${FORTUNE_CLIENT_EXPOSED_PORT:?} environment: PORT: *frontend_default_port + recording-oracle-fortune: + container_name: recording-oracle-fortune + image: human-protocol/recording-oracle-fortune + pull_policy: build + depends_on: + minio: + condition: service_healthy + minio-client: + condition: service_completed_successfully + restart: *default-restart + logging: + <<: *default-logging + build: + context: ../ + dockerfile: packages/apps/fortune/recording-oracle/Dockerfile + expose: + - *backend_apps_internal_port + networks: + - human_protocol + ports: + - name: server_port + target: *backend_apps_internal_port + published: ${RECORDING_ORACLE_FORTUNE_EXPOSED_PORT:?} + environment: + <<: [*nodejs_app_vars, *nodejs_app_s3_vars] + HOST: *all_interfaces_ip + PORT: *backend_apps_internal_port + S3_BUCKET: *bucket_name_fortune + # User for KV store setup + SERVER_URL: http://recording-oracle-fortune:${BACKEND_APPS_INTERNAL_PORT:?} + volumes: # When init for the first time postgres requires empty directory # that is exclusive to its user, so providing a separate volume diff --git a/docker-setup/initdb/create-dbs.sql b/docker-setup/initdb/create-dbs.sql new file mode 100644 index 0000000000..da24368f29 --- /dev/null +++ b/docker-setup/initdb/create-dbs.sql @@ -0,0 +1,5 @@ +CREATE DATABASE "reputation-oracle"; +CREATE DATABASE "job-launcher"; +CREATE DATABASE "exchange-oracle-cvat"; +CREATE DATABASE "recording-oracle-cvat"; +CREATE DATABASE "exchange-oracle-fortune"; diff --git a/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md b/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md index 86d1fd9559..2d067904ba 100644 --- a/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md +++ b/docs/sdk/python/human_protocol_sdk.escrow.escrow_client.md @@ -74,199 +74,13 @@ Initializes a Escrow instance. * **Parameters:** **web3** (`Web3`) – The Web3 object -#### add_trusted_handlers(escrow_address, handlers, tx_options=None) +#### add_trusted_handlers(\*args, \*\*kwargs) -Adds an array of addresses to the trusted handlers list. +#### bulk_payout(\*args, \*\*kwargs) -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow - * **handlers** (`List`[`str`]) – Array of trusted handler addresses - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) +#### cancel(\*args, \*\*kwargs) - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - trusted_handlers = [ - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' - ] - escrow_client.add_trusted_handlers( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - trusted_handlers - ) - ``` - -#### bulk_payout(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None) - -Pays out the amounts specified to the workers and sets the URL of the final results file. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow - * **recipients** (`List`[`str`]) – Array of recipient addresses - * **amounts** (`List`[`Decimal`]) – Array of amounts the recipients will receive - * **final_results_url** (`str`) – Final results file URL - * **final_results_hash** (`str`) – Final results file hash - * **txId** (`Decimal`) – Serial number of the bulks - * **force_complete** (`Optional`[`bool`]) – (Optional) Indicates if remaining balance should be transferred to the escrow creator - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - recipients = [ - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92267' - ] - amounts = [ - Web3.to_wei(5, 'ether'), - Web3.to_wei(10, 'ether') - ] - results_url = 'http://localhost/results.json' - results_hash = 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079' - - escrow_client.bulk_payout( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - recipients, - amounts, - results_url, - results_hash, - 1 - ) - ``` - -#### cancel(escrow_address, tx_options=None) - -Cancels the specified escrow and sends the balance to the canceler. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to cancel - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - [`EscrowCancel`](#human_protocol_sdk.escrow.escrow_client.EscrowCancel) -* **Returns:** - EscrowCancel: - An instance of the EscrowCancel class containing details of the cancellation transaction, - including the transaction hash and the amount refunded. -* **Raises:** - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If the transfer event associated with the cancellation - is not found in the transaction logs -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_cancel_data = escrow_client.cancel( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f" - ) - ``` - -#### complete(escrow_address, tx_options=None) - -Sets the status of an escrow to completed. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to complete - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_client.complete("0x62dD51230A30401C455c8398d06F85e4EaB6309f") - ``` +#### complete(\*args, \*\*kwargs) #### create_bulk_payout_transaction(escrow_address, recipients, amounts, final_results_url, final_results_hash, txId, force_complete=False, tx_options=None) @@ -343,55 +157,7 @@ Creates a prepared transaction for bulk payout without signing or sending it. print(f"Transaction receipt: {tx_receipt}") ``` -#### create_escrow(token_address, trusted_handlers, job_requester_id, tx_options=None) - -Creates a new escrow contract. - -* **Parameters:** - * **token_address** (`str`) – Address of the token to be used in the escrow - * **trusted_handlers** (`List`[`str`]) – List of trusted handler addresses - * **job_requester_id** (`str`) – ID of the job requester - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options -* **Return type:** - `str` -* **Returns:** - Address of the created escrow contract -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri( - URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - token_address = '0x1234567890abcdef1234567890abcdef12345678' - trusted_handlers = [ - '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - '0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef' - ] - job_requester_id = 'job-requester' - escrow_address = escrow_client.create_escrow( - token_address, - trusted_handlers, - job_requester_id - ) - ``` +#### create_escrow(\*args, \*\*kwargs) #### ensure_correct_bulk_payout_input(escrow_address, recipients, amounts, final_results_url, final_results_hash) @@ -410,48 +176,7 @@ Validates input parameters for bulk payout operations. * **Raises:** [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If validation fails -#### fund(escrow_address, amount, tx_options=None) - -Adds funds to the escrow. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to fund - * **amount** (`Decimal`) – Amount to be added as funds - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - escrow_client.fund( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", amount - ) - ``` +#### fund(\*args, \*\*kwargs) #### get_balance(escrow_address) @@ -789,151 +514,11 @@ Gets the address of the token used to fund the escrow. ) ``` -#### setup(escrow_address, escrow_config, tx_options=None) - -Sets up the parameters of the escrow. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow contract - * **escrow_config** ([`EscrowConfig`](#human_protocol_sdk.escrow.escrow_client.EscrowConfig)) – Configuration parameters for the escrow - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Transaction options -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri( - URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_address = "0x1234567890abcdef1234567890abcdef12345678" - escrow_config = EscrowConfig( - recording_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - reputation_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - exchange_oracle_address='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef', - recording_oracle_fee=100, - reputation_oracle_fee=100, - exchange_oracle_fee=100, - recording_oracle_url='https://example.com/recording', - reputation_oracle_url='https://example.com/reputation', - exchange_oracle_url='https://example.com/exchange', - manifest_url='https://example.com/manifest', - manifest_hash='0xabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef' - ) - escrow_client.setup( - escrow_address, - escrow_config - ) - ``` -* **Return type:** - `None` - -#### store_results(escrow_address, url, hash, tx_options=None) - -Stores the results URL. - -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow - * **url** (`str`) – Results file URL - * **hash** (`str`) – Results file hash - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_client.store_results( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - "http://localhost/results.json", - "b5dad76bf6772c0f07fd5e048f6e75a5f86ee079" - ) - ``` - -#### withdraw(escrow_address, token_address, tx_options=None) +#### setup(\*args, \*\*kwargs) -Withdraws additional tokens in the escrow to the canceler. +#### store_results(\*args, \*\*kwargs) -* **Parameters:** - * **escrow_address** (`str`) – Address of the escrow to withdraw - * **token_address** (`str`) – Address of the token to withdraw - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - [`EscrowWithdraw`](#human_protocol_sdk.escrow.escrow_client.EscrowWithdraw) -* **Returns:** - EscrowWithdraw: - An instance of the EscrowWithdraw class containing details of the withdrawal transaction, - including the transaction hash and the token address and amount withdrawn. -* **Raises:** - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If an error occurs while checking the parameters - * [**EscrowClientError**](#human_protocol_sdk.escrow.escrow_client.EscrowClientError) – If the transfer event associated with the withdrawal - is not found in the transaction logs -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.escrow import EscrowClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - escrow_client = EscrowClient(w3) - - escrow_cancel_data = escrow_client.withdraw( - "0x62dD51230A30401C455c8398d06F85e4EaB6309f", - "0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4" - ) - ``` +#### withdraw(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.escrow.escrow_client.EscrowClientError diff --git a/docs/sdk/python/human_protocol_sdk.filter.md b/docs/sdk/python/human_protocol_sdk.filter.md index ae0d301983..a4b2004a2d 100644 --- a/docs/sdk/python/human_protocol_sdk.filter.md +++ b/docs/sdk/python/human_protocol_sdk.filter.md @@ -96,13 +96,13 @@ Initializes a filter for status events. * **skip** (`int`) – Optional number of events to skip. Default is 0. * **order_direction** ([`OrderDirection`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.OrderDirection)) – Optional order direction. Default is DESC. -### *class* human_protocol_sdk.filter.TransactionFilter(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, first=10, skip=0, order_direction=OrderDirection.DESC) +### *class* human_protocol_sdk.filter.TransactionFilter(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC) Bases: `object` A class used to filter transactions. -#### \_\_init_\_(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, first=10, skip=0, order_direction=OrderDirection.DESC) +#### \_\_init_\_(chain_id, from_address=None, to_address=None, start_date=None, end_date=None, start_block=None, end_block=None, method=None, escrow=None, token=None, first=10, skip=0, order_direction=OrderDirection.DESC) Initializes a TransactionsFilter instance. @@ -114,19 +114,22 @@ Initializes a TransactionsFilter instance. * **end_date** (`Optional`[`datetime`]) – End date for filtering transactions * **start_block** (`Optional`[`int`]) – Start block number for filtering transactions * **end_block** (`Optional`[`int`]) – End block number for filtering transactions + * **method** (`Optional`[`str`]) – Method name to filter transactions + * **escrow** (`Optional`[`str`]) – Escrow address to filter transactions + * **token** (`Optional`[`str`]) – Token address to filter transactions * **first** (`int`) – Number of items per page * **skip** (`int`) – Page number to retrieve * **order** – Order of results, “asc” or “desc” * **Raises:** **ValueError** – If start_date is after end_date -### *class* human_protocol_sdk.filter.WorkerFilter(chain_id, worker_address=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0) +### *class* human_protocol_sdk.filter.WorkerFilter(chain_id, worker_address=None, order_by='payoutCount', order_direction=OrderDirection.DESC, first=10, skip=0) Bases: `object` A class used to filter workers. -#### \_\_init_\_(chain_id, worker_address=None, order_by=None, order_direction=OrderDirection.DESC, first=10, skip=0) +#### \_\_init_\_(chain_id, worker_address=None, order_by='payoutCount', order_direction=OrderDirection.DESC, first=10, skip=0) Initializes a WorkerFilter instance. diff --git a/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md b/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md index 4c9cc4767f..5e2028944c 100644 --- a/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md +++ b/docs/sdk/python/human_protocol_sdk.kvstore.kvstore_client.md @@ -63,123 +63,11 @@ Initializes a KVStore instance. * **web3** (`Web3`) – The Web3 object * **gas_limit** (`Optional`[`int`]) – (Optional) Gas limit for transactions -#### set(key, value, tx_options=None) +#### set(\*args, \*\*kwargs) -Sets the value of a key-value pair in the contract. +#### set_bulk(\*args, \*\*kwargs) -* **Parameters:** - * **key** (`str`) – The key of the key-value pair to set - * **value** (`str`) – The value of the key-value pair to set - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - kvstore_client.set('Role', 'RecordingOracle') - ``` - -#### set_bulk(keys, values, tx_options=None) - -Sets multiple key-value pairs in the contract. - -* **Parameters:** - * **keys** (`List`[`str`]) – A list of keys to set - * **values** (`List`[`str`]) – A list of values to set - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - - keys = ['Role', 'Webhook_url'] - values = ['RecordingOracle', 'http://localhost'] - kvstore_client.set_bulk(keys, values) - ``` - -#### set_file_url_and_hash(url, key='url', tx_options=None) - -Sets a URL value for the address that submits the transaction, and its hash. - -* **Parameters:** - * **url** (`str`) – URL to set - * **key** (`Optional`[`str`]) – Configurable URL key. url by default. - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Raises:** - [**KVStoreClientError**](#human_protocol_sdk.kvstore.kvstore_client.KVStoreClientError) – If an error occurs while validating URL, or handling transaction -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.kvstore import KVStoreClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - kvstore_client = KVStoreClient(w3) - - kvstore_client.set_file_url_and_hash('http://localhost') - kvstore_client.set_file_url_and_hash('https://linkedin.com/me', 'linkedin_url') - ``` +#### set_file_url_and_hash(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.kvstore.kvstore_client.KVStoreClientError diff --git a/docs/sdk/python/human_protocol_sdk.md b/docs/sdk/python/human_protocol_sdk.md index 7f19d62801..ef2b0b539e 100644 --- a/docs/sdk/python/human_protocol_sdk.md +++ b/docs/sdk/python/human_protocol_sdk.md @@ -114,6 +114,12 @@ * [`TransactionData`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionData) * [`TransactionUtils`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtils) * [`TransactionUtilsError`](human_protocol_sdk.transaction.transaction_utils.md#human_protocol_sdk.transaction.transaction_utils.TransactionUtilsError) +* [human_protocol_sdk.worker package](human_protocol_sdk.worker.md) + * [Submodules](human_protocol_sdk.worker.md#submodules) + * [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md) + * [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData) + * [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils) + * [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError) ## Submodules @@ -194,7 +200,7 @@ * [`get_hmt_balance()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_hmt_balance) * [`get_kvstore_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_kvstore_interface) * [`get_staking_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_staking_interface) - * [`handle_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_transaction) + * [`handle_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_error) * [`parse_transfer_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.parse_transfer_transaction) * [`validate_url()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_url) * [`with_retry()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.with_retry) diff --git a/docs/sdk/python/human_protocol_sdk.staking.staking_client.md b/docs/sdk/python/human_protocol_sdk.staking.staking_client.md index e0a9fbc526..c0155d7cb5 100644 --- a/docs/sdk/python/human_protocol_sdk.staking.staking_client.md +++ b/docs/sdk/python/human_protocol_sdk.staking.staking_client.md @@ -62,45 +62,7 @@ Initializes a Staking instance * **Parameters:** **w3** (`Web3`) – Web3 instance -#### approve_stake(amount, tx_options=None) - -Approves HMT token for Staking. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to approve - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - Amount must be greater than 0 -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.approve_stake(amount) - ``` +#### approve_stake(\*args, \*\*kwargs) #### get_staker_info(staker_address) @@ -129,177 +91,13 @@ Retrieves comprehensive staking information for a staker. print(staking_info['stakedAmount']) ``` -#### slash(slasher, staker, escrow_address, amount, tx_options=None) +#### slash(\*args, \*\*kwargs) -Slashes HMT token. +#### stake(\*args, \*\*kwargs) -* **Parameters:** - * **slasher** (`str`) – Address of the slasher - * **staker** (`str`) – Address of the staker - * **escrow_address** (`str`) – Address of the escrow - * **amount** (`Decimal`) – Amount to slash - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the amount allocated to the escrow (on-chain) - - Escrow address must be valid -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.slash( - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', - '0x62dD51230A30401C455c8398d06F85e4EaB6309f', - amount - ) - ``` - -#### stake(amount, tx_options=None) +#### unstake(\*args, \*\*kwargs) -Stakes HMT token. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to stake - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the approved amount (on-chain) - - Amount must be less than or equal to the balance of the staker (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.approve_stake(amount) # if it was already approved before, this is not necessary - staking_client.stake(amount) - ``` - -#### unstake(amount, tx_options=None) - -Unstakes HMT token. - -* **Parameters:** - * **amount** (`Decimal`) – Amount to unstake - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - Amount must be greater than 0 - - Amount must be less than or equal to the staked amount which is not locked / allocated (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - amount = Web3.to_wei(5, 'ether') # convert from ETH to WEI - staking_client.unstake(amount) - ``` - -#### withdraw(tx_options=None) - -Withdraws HMT token. - -* **Parameters:** - **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters -* **Return type:** - `None` -* **Returns:** - None -* **Validate:** - - There must be unstaked tokens which is unlocked (on-chain) -* **Example:** - ```python - from eth_typing import URI - from web3 import Web3 - from web3.middleware import SignAndSendRawMiddlewareBuilder - from web3.providers.auto import load_provider_from_uri - - from human_protocol_sdk.staking import StakingClient - - def get_w3_with_priv_key(priv_key: str): - w3 = Web3(load_provider_from_uri(URI("http://localhost:8545"))) - gas_payer = w3.eth.account.from_key(priv_key) - w3.eth.default_account = gas_payer.address - w3.middleware_onion.inject( - SignAndSendRawMiddlewareBuilder.build(priv_key), - 'SignAndSendRawMiddlewareBuilder', - layer=0, - ) - return (w3, gas_payer) - - (w3, gas_payer) = get_w3_with_priv_key('YOUR_PRIVATE_KEY') - staking_client = StakingClient(w3) - - staking_client.withdraw() - ``` +#### withdraw(\*args, \*\*kwargs) ### *exception* human_protocol_sdk.staking.staking_client.StakingClientError diff --git a/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md b/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md index 7b31e4ea65..b982ca0071 100644 --- a/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md +++ b/docs/sdk/python/human_protocol_sdk.transaction.transaction_utils.md @@ -71,6 +71,7 @@ Get an array of transactions based on the specified filter parameters. * **Parameters:** **filter** ([`TransactionFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.TransactionFilter)) – Object containing all the necessary parameters to filter + (chain_id, from_address, to_address, start_date, end_date, start_block, end_block, method, escrow, token, first, skip, order_direction) * **Return type:** `List`[[`TransactionData`](#human_protocol_sdk.transaction.transaction_utils.TransactionData)] * **Returns:** @@ -86,6 +87,8 @@ Get an array of transactions based on the specified filter parameters. chain_id=ChainId.POLYGON_AMOY, from_address="0x1234567890123456789012345678901234567890", to_address="0x0987654321098765432109876543210987654321", + method="transfer", + escrow="0x0987654321098765432109876543210987654321", start_date=datetime.datetime(2023, 5, 8), end_date=datetime.datetime(2023, 6, 8), ) diff --git a/docs/sdk/python/human_protocol_sdk.utils.md b/docs/sdk/python/human_protocol_sdk.utils.md index 48aa0d3427..f0e73515b6 100644 --- a/docs/sdk/python/human_protocol_sdk.utils.md +++ b/docs/sdk/python/human_protocol_sdk.utils.md @@ -68,24 +68,26 @@ Retrieve the Staking interface. * **Returns:** The Staking interface of smart contract. -### human_protocol_sdk.utils.handle_transaction(w3, tx_name, tx, exception, tx_options) +### human_protocol_sdk.utils.handle_error(e, exception_class) -Executes the transaction and waits for the receipt. +Handles and translates errors raised during contract transactions. + +This function captures exceptions (especially ContractLogicError from web3.py), +extracts meaningful revert reasons if present, logs unexpected errors, and raises +a custom exception with a clear message for SDK users. * **Parameters:** - * **w3** (`Web3`) – Web3 instance - * **tx_name** (`str`) – Name of the transaction - * **tx** – Transaction object - * **exception** (`Exception`) – Exception class to raise in case of error - * **tx_options** (`Optional`[`TxParams`]) – (Optional) Additional transaction parameters - - If provided, can include values like ‘gas’, ‘gas_price’, ‘nonce’, etc - - If ‘gas’ is not specified or is None, it will be estimated using tx.estimate_gas() -* **Returns:** - The transaction receipt -* **Validate:** - - There must be a default account + * **e** – The exception object raised during a transaction. + * **exception_class** – The custom exception class to raise (e.g., EscrowClientError). * **Raises:** - **exception** – If the transaction fails + **exception_class** – With a detailed error message, including contract revert reasons if available. +* **Example:** + try: + : tx_hash = contract.functions.someMethod(…).transact() + w3.eth.wait_for_transaction_receipt(tx_hash) + + except Exception as e: + : handle_error(e, EscrowClientError) ### human_protocol_sdk.utils.parse_transfer_transaction(hmtoken_contract, tx_receipt) diff --git a/docs/sdk/python/human_protocol_sdk.worker.md b/docs/sdk/python/human_protocol_sdk.worker.md new file mode 100644 index 0000000000..e62f9a998c --- /dev/null +++ b/docs/sdk/python/human_protocol_sdk.worker.md @@ -0,0 +1,13 @@ +# human_protocol_sdk.worker package + +This module enables to obtain worker information from subgraph. + +## Submodules + +* [human_protocol_sdk.worker.worker_utils module](human_protocol_sdk.worker.worker_utils.md) + * [`WorkerData`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData) + * [`WorkerData.__init__()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerData.__init__) + * [`WorkerUtils`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils) + * [`WorkerUtils.get_worker()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_worker) + * [`WorkerUtils.get_workers()`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtils.get_workers) + * [`WorkerUtilsError`](human_protocol_sdk.worker.worker_utils.md#human_protocol_sdk.worker.worker_utils.WorkerUtilsError) diff --git a/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md b/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md new file mode 100644 index 0000000000..91dea1a87c --- /dev/null +++ b/docs/sdk/python/human_protocol_sdk.worker.worker_utils.md @@ -0,0 +1,50 @@ +# human_protocol_sdk.worker.worker_utils module + +### *class* human_protocol_sdk.worker.worker_utils.WorkerData(id, address, total_amount_received, payout_count) + +Bases: `object` + +#### \_\_init_\_(id, address, total_amount_received, payout_count) + +Initializes a WorkerData instance. + +* **Parameters:** + * **id** (`str`) – Worker ID + * **address** (`str`) – Worker address + * **total_amount_received** (`int`) – Total amount received by the worker + * **payout_count** (`int`) – Number of payouts received by the worker + +### *class* human_protocol_sdk.worker.worker_utils.WorkerUtils + +Bases: `object` + +A utility class that provides additional worker-related functionalities. + +#### *static* get_worker(chain_id, worker_address) + +Gets the worker details. + +* **Parameters:** + * **chain_id** ([`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId)) – Network in which the worker exists + * **worker_address** (`str`) – Address of the worker +* **Return type:** + `Optional`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)] +* **Returns:** + Worker data if exists, otherwise None + +#### *static* get_workers(filter) + +Get workers data of the protocol. + +* **Parameters:** + **filter** ([`WorkerFilter`](human_protocol_sdk.filter.md#human_protocol_sdk.filter.WorkerFilter)) – Worker filter +* **Return type:** + `List`[[`WorkerData`](#human_protocol_sdk.worker.worker_utils.WorkerData)] +* **Returns:** + List of workers data + +### *exception* human_protocol_sdk.worker.worker_utils.WorkerUtilsError + +Bases: `Exception` + +Raised when an error occurs when getting data from subgraph. diff --git a/docs/sdk/python/index.md b/docs/sdk/python/index.md index 75b6eaeb1e..dcba33dab9 100644 --- a/docs/sdk/python/index.md +++ b/docs/sdk/python/index.md @@ -42,6 +42,8 @@ pip install human-protocol-sdk[agreement] * [Submodules](human_protocol_sdk.storage.md#submodules) * [human_protocol_sdk.transaction package](human_protocol_sdk.transaction.md) * [Submodules](human_protocol_sdk.transaction.md#submodules) + * [human_protocol_sdk.worker package](human_protocol_sdk.worker.md) + * [Submodules](human_protocol_sdk.worker.md#submodules) * [Submodules](human_protocol_sdk.md#submodules) * [human_protocol_sdk.constants module](human_protocol_sdk.constants.md) * [`ChainId`](human_protocol_sdk.constants.md#human_protocol_sdk.constants.ChainId) @@ -71,7 +73,7 @@ pip install human-protocol-sdk[agreement] * [`get_hmt_balance()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_hmt_balance) * [`get_kvstore_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_kvstore_interface) * [`get_staking_interface()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.get_staking_interface) - * [`handle_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_transaction) + * [`handle_error()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.handle_error) * [`parse_transfer_transaction()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.parse_transfer_transaction) * [`validate_url()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.validate_url) * [`with_retry()`](human_protocol_sdk.utils.md#human_protocol_sdk.utils.with_retry) diff --git a/docs/sdk/typescript/base/classes/BaseEthersClient.md b/docs/sdk/typescript/base/classes/BaseEthersClient.md index a0277ae359..f1ab048696 100644 --- a/docs/sdk/typescript/base/classes/BaseEthersClient.md +++ b/docs/sdk/typescript/base/classes/BaseEthersClient.md @@ -6,7 +6,7 @@ # Class: `abstract` BaseEthersClient -Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) +Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10) ## Introduction @@ -20,11 +20,11 @@ This class is used as a base class for other clients making on-chain calls. ## Constructors -### new BaseEthersClient() +### Constructor -> **new BaseEthersClient**(`runner`, `networkData`): [`BaseEthersClient`](BaseEthersClient.md) +> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient` -Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) +Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20) **BaseClient constructor** @@ -44,7 +44,7 @@ The network information required to connect to the contracts #### Returns -[`BaseEthersClient`](BaseEthersClient.md) +`BaseEthersClient` ## Properties @@ -52,7 +52,7 @@ The network information required to connect to the contracts > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) *** @@ -60,4 +60,4 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) diff --git a/docs/sdk/typescript/encryption/classes/Encryption.md b/docs/sdk/typescript/encryption/classes/Encryption.md index 822c353959..ecf46779f5 100644 --- a/docs/sdk/typescript/encryption/classes/Encryption.md +++ b/docs/sdk/typescript/encryption/classes/Encryption.md @@ -6,7 +6,7 @@ # Class: Encryption -Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) +Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58) ## Introduction @@ -49,11 +49,11 @@ const encryption = await Encryption.build(privateKey, passphrase); ## Constructors -### new Encryption() +### Constructor -> **new Encryption**(`privateKey`): [`Encryption`](Encryption.md) +> **new Encryption**(`privateKey`): `Encryption` -Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) +Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66) Constructor for the Encryption class. @@ -67,15 +67,15 @@ The private key. #### Returns -[`Encryption`](Encryption.md) +`Encryption` ## Methods ### decrypt() -> **decrypt**(`message`, `publicKey`?): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> +> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\> -Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) +Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194) This function decrypts messages using the private key. In addition, the public key can be added for signature verification. @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message'); > **sign**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) +Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251) This function signs a message using the private key used to initialize the client. @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message'); > **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) +Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142) This function signs and encrypts a message using the private key used to initialize the client and the specified public keys. @@ -230,9 +230,9 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys); ### build() -> `static` **build**(`privateKeyArmored`, `passphrase`?): `Promise`\<[`Encryption`](Encryption.md)\> +> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\> -Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) +Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77) Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase. @@ -252,6 +252,6 @@ Optional: The passphrase for the private key. #### Returns -`Promise`\<[`Encryption`](Encryption.md)\> +`Promise`\<`Encryption`\> - The Encryption instance. diff --git a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md index 8d1127cea6..7c56fe6d8f 100644 --- a/docs/sdk/typescript/encryption/classes/EncryptionUtils.md +++ b/docs/sdk/typescript/encryption/classes/EncryptionUtils.md @@ -6,7 +6,7 @@ # Class: EncryptionUtils -Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) +Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290) ## Introduction @@ -34,13 +34,13 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai'); ## Constructors -### new EncryptionUtils() +### Constructor -> **new EncryptionUtils**(): [`EncryptionUtils`](EncryptionUtils.md) +> **new EncryptionUtils**(): `EncryptionUtils` #### Returns -[`EncryptionUtils`](EncryptionUtils.md) +`EncryptionUtils` ## Methods @@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai'); > `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\> -Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) +Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444) This function encrypts a message using the specified public keys. @@ -111,7 +111,7 @@ const result = await EncryptionUtils.encrypt('message', publicKeys); > `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\> -Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) +Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382) This function generates a key pair for encryption and decryption. @@ -158,7 +158,7 @@ const result = await EncryptionUtils.generateKeyPair(name, email, passphrase); > `static` **getSignedData**(`message`): `Promise`\<`string`\> -Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) +Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351) This function gets signed data from a signed message. @@ -190,7 +190,7 @@ const signedData = await EncryptionUtils.getSignedData('message'); > `static` **isEncrypted**(`message`): `boolean` -Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) +Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494) Verifies if a message appears to be encrypted with OpenPGP. @@ -238,7 +238,7 @@ if (isEncrypted) { > `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\> -Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) +Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318) This function verifies the signature of a signed message using the public key. diff --git a/docs/sdk/typescript/enums/enumerations/ChainId.md b/docs/sdk/typescript/enums/enumerations/ChainId.md index 5627a76ac9..bb3a336000 100644 --- a/docs/sdk/typescript/enums/enumerations/ChainId.md +++ b/docs/sdk/typescript/enums/enumerations/ChainId.md @@ -6,7 +6,7 @@ # Enumeration: ChainId -Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) +Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/1f > **ALL**: `-1` -Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) +Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2) *** @@ -22,7 +22,7 @@ Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/1f > **BSC\_MAINNET**: `56` -Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) +Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5) *** @@ -30,7 +30,7 @@ Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/1f > **BSC\_TESTNET**: `97` -Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) +Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6) *** @@ -38,7 +38,7 @@ Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/1f > **LOCALHOST**: `1338` -Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) +Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9) *** @@ -46,7 +46,7 @@ Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/1f > **MAINNET**: `1` -Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) +Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3) *** @@ -54,7 +54,7 @@ Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/1f > **POLYGON**: `137` -Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) +Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7) *** @@ -62,7 +62,7 @@ Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/1f > **POLYGON\_AMOY**: `80002` -Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) +Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8) *** @@ -70,4 +70,4 @@ Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/1f > **SEPOLIA**: `11155111` -Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) +Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4) diff --git a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md index 3d5d13af20..fe073231a7 100644 --- a/docs/sdk/typescript/enums/enumerations/OperatorCategory.md +++ b/docs/sdk/typescript/enums/enumerations/OperatorCategory.md @@ -6,7 +6,7 @@ # Enumeration: OperatorCategory -Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) +Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L17) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:17](https://github.com/humanprotocol/human-protocol/blob/1 > **MACHINE\_LEARNING**: `"machine_learning"` -Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) +Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/1 > **MARKET\_MAKING**: `"market_making"` -Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) +Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19) diff --git a/docs/sdk/typescript/enums/enumerations/OrderDirection.md b/docs/sdk/typescript/enums/enumerations/OrderDirection.md index e980964850..44edbc1f67 100644 --- a/docs/sdk/typescript/enums/enumerations/OrderDirection.md +++ b/docs/sdk/typescript/enums/enumerations/OrderDirection.md @@ -6,7 +6,7 @@ # Enumeration: OrderDirection -Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) +Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L12) ## Enumeration Members @@ -14,7 +14,7 @@ Defined in: [enums.ts:12](https://github.com/humanprotocol/human-protocol/blob/1 > **ASC**: `"asc"` -Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) +Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13) *** @@ -22,4 +22,4 @@ Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/1 > **DESC**: `"desc"` -Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) +Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14) diff --git a/docs/sdk/typescript/escrow/classes/EscrowClient.md b/docs/sdk/typescript/escrow/classes/EscrowClient.md index 445e354d15..7963dd8ec6 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowClient.md +++ b/docs/sdk/typescript/escrow/classes/EscrowClient.md @@ -6,7 +6,7 @@ # Class: EscrowClient -Defined in: [escrow.ts:141](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L141) +Defined in: [escrow.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L142) ## Introduction @@ -82,11 +82,11 @@ const escrowClient = await EscrowClient.build(provider); ## Constructors -### new EscrowClient() +### Constructor -> **new EscrowClient**(`runner`, `networkData`): [`EscrowClient`](EscrowClient.md) +> **new EscrowClient**(`runner`, `networkData`): `EscrowClient` -Defined in: [escrow.ts:150](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L150) +Defined in: [escrow.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L151) **EscrowClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the Escrow contract #### Returns -[`EscrowClient`](EscrowClient.md) +`EscrowClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,11 +118,11 @@ The network information required to connect to the Escrow contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -130,19 +130,19 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) ## Methods ### addTrustedHandlers() -> **addTrustedHandlers**(`escrowAddress`, `trustedHandlers`, `txOptions`?): `Promise`\<`void`\> +> **addTrustedHandlers**(`escrowAddress`, `trustedHandlers`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:778](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L778) +Defined in: [escrow.ts:779](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L779) This function adds an array of addresses to the trusted handlers list. @@ -195,9 +195,9 @@ await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309 ### bulkPayOut() -> **bulkPayOut**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions`?): `Promise`\<`void`\> +> **bulkPayOut**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:611](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L611) +Defined in: [escrow.ts:612](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L612) This function pays out the amounts specified to the workers and sets the URL of the final results file. @@ -285,9 +285,9 @@ await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', reci ### cancel() -> **cancel**(`escrowAddress`, `txOptions`?): `Promise`\<[`EscrowCancel`](../../types/type-aliases/EscrowCancel.md)\> +> **cancel**(`escrowAddress`, `txOptions?`): `Promise`\<[`EscrowCancel`](../../types/type-aliases/EscrowCancel.md)\> -Defined in: [escrow.ts:692](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L692) +Defined in: [escrow.ts:693](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L693) This function cancels the specified escrow and sends the balance to the canceler. @@ -333,9 +333,9 @@ await escrowClient.cancel('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); ### complete() -> **complete**(`escrowAddress`, `txOptions`?): `Promise`\<`void`\> +> **complete**(`escrowAddress`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:550](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L550) +Defined in: [escrow.ts:551](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L551) This function sets the status of an escrow to completed. @@ -381,9 +381,9 @@ await escrowClient.complete('0x62dD51230A30401C455c8398d06F85e4EaB6309f'); ### createBulkPayoutTransaction() -> **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions`?): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> +> **createBulkPayoutTransaction**(`escrowAddress`, `recipients`, `amounts`, `finalResultsUrl`, `finalResultsHash`, `txId`, `forceComplete`, `txOptions?`): `Promise`\<[`TransactionLikeWithNonce`](../../types/type-aliases/TransactionLikeWithNonce.md)\> -Defined in: [escrow.ts:947](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L947) +Defined in: [escrow.ts:948](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L948) Creates a prepared transaction for bulk payout without immediately sending it. @@ -475,9 +475,9 @@ console.log('Tx hash:', ethers.keccak256(signedTransaction)); ### createEscrow() -> **createEscrow**(`tokenAddress`, `trustedHandlers`, `jobRequesterId`, `txOptions`?): `Promise`\<`string`\> +> **createEscrow**(`tokenAddress`, `trustedHandlers`, `jobRequesterId`, `txOptions?`): `Promise`\<`string`\> -Defined in: [escrow.ts:230](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L230) +Defined in: [escrow.ts:231](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L231) This function creates an escrow contract that uses the token passed to pay oracle fees and reward workers. @@ -538,9 +538,9 @@ const escrowAddress = await escrowClient.createEscrow(tokenAddress, trustedHandl ### fund() -> **fund**(`escrowAddress`, `amount`, `txOptions`?): `Promise`\<`void`\> +> **fund**(`escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:421](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L421) +Defined in: [escrow.ts:422](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L422) This function adds funds of the chosen token to the escrow. @@ -593,7 +593,7 @@ await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount); > **getBalance**(`escrowAddress`): `Promise`\<`bigint`\> -Defined in: [escrow.ts:1092](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1092) +Defined in: [escrow.ts:1093](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1093) This function returns the balance for a specified escrow address. @@ -631,7 +631,7 @@ const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e > **getExchangeOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1478](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1478) +Defined in: [escrow.ts:1479](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1479) This function returns the exchange oracle address for a given escrow. @@ -669,7 +669,7 @@ const oracleAddress = await escrowClient.getExchangeOracleAddress('0x62dD51230A3 > **getFactoryAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1516](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1516) +Defined in: [escrow.ts:1517](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1517) This function returns the escrow factory address for a given escrow. @@ -707,7 +707,7 @@ const factoryAddress = await escrowClient.getFactoryAddress('0x62dD51230A30401C4 > **getIntermediateResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1250](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1250) +Defined in: [escrow.ts:1251](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1251) This function returns the intermediate results file URL. @@ -745,7 +745,7 @@ const intermediateResultsUrl = await escrowClient.getIntermediateResultsUrl('0x6 > **getJobLauncherAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1402](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1402) +Defined in: [escrow.ts:1403](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1403) This function returns the job launcher address for a given escrow. @@ -783,7 +783,7 @@ const jobLauncherAddress = await escrowClient.getJobLauncherAddress('0x62dD51230 > **getManifestHash**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1136) +Defined in: [escrow.ts:1137](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1137) This function returns the manifest file hash. @@ -821,7 +821,7 @@ const manifestHash = await escrowClient.getManifestHash('0x62dD51230A30401C455c8 > **getManifestUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1174](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1174) +Defined in: [escrow.ts:1175](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1175) This function returns the manifest file URL. @@ -859,7 +859,7 @@ const manifestUrl = await escrowClient.getManifestUrl('0x62dD51230A30401C455c839 > **getRecordingOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1364](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1364) +Defined in: [escrow.ts:1365](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1365) This function returns the recording oracle address for a given escrow. @@ -897,7 +897,7 @@ const oracleAddress = await escrowClient.getRecordingOracleAddress('0x62dD51230A > **getReputationOracleAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1440](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1440) +Defined in: [escrow.ts:1441](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1441) This function returns the reputation oracle address for a given escrow. @@ -935,7 +935,7 @@ const oracleAddress = await escrowClient.getReputationOracleAddress('0x62dD51230 > **getResultsUrl**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1212](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1212) +Defined in: [escrow.ts:1213](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1213) This function returns the results file URL. @@ -973,7 +973,7 @@ const resultsUrl = await escrowClient.getResultsUrl('0x62dD51230A30401C455c8398d > **getStatus**(`escrowAddress`): `Promise`\<[`EscrowStatus`](../../types/enumerations/EscrowStatus.md)\> -Defined in: [escrow.ts:1326](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1326) +Defined in: [escrow.ts:1327](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1327) This function returns the current status of the escrow. @@ -1011,7 +1011,7 @@ const status = await escrowClient.getStatus('0x62dD51230A30401C455c8398d06F85e4E > **getTokenAddress**(`escrowAddress`): `Promise`\<`string`\> -Defined in: [escrow.ts:1288](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1288) +Defined in: [escrow.ts:1289](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1289) This function returns the token address used for funding the escrow. @@ -1047,9 +1047,9 @@ const tokenAddress = await escrowClient.getTokenAddress('0x62dD51230A30401C455c8 ### setup() -> **setup**(`escrowAddress`, `escrowConfig`, `txOptions`?): `Promise`\<`void`\> +> **setup**(`escrowAddress`, `escrowConfig`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:311](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L311) +Defined in: [escrow.ts:312](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L312) This function sets up the parameters of the escrow. @@ -1112,9 +1112,9 @@ await escrowClient.setup(escrowAddress, escrowConfig); ### storeResults() -> **storeResults**(`escrowAddress`, `url`, `hash`, `txOptions`?): `Promise`\<`void`\> +> **storeResults**(`escrowAddress`, `url`, `hash`, `txOptions?`): `Promise`\<`void`\> -Defined in: [escrow.ts:486](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L486) +Defined in: [escrow.ts:487](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L487) This function stores the results URL and hash. @@ -1172,9 +1172,9 @@ await escrowClient.storeResults('0x62dD51230A30401C455c8398d06F85e4EaB6309f', 'h ### withdraw() -> **withdraw**(`escrowAddress`, `tokenAddress`, `txOptions`?): `Promise`\<[`EscrowWithdraw`](../../types/type-aliases/EscrowWithdraw.md)\> +> **withdraw**(`escrowAddress`, `tokenAddress`, `txOptions?`): `Promise`\<[`EscrowWithdraw`](../../types/type-aliases/EscrowWithdraw.md)\> -Defined in: [escrow.ts:844](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L844) +Defined in: [escrow.ts:845](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L845) This function withdraws additional tokens in the escrow to the canceler. @@ -1229,9 +1229,9 @@ await escrowClient.withdraw( ### build() -> `static` **build**(`runner`): `Promise`\<[`EscrowClient`](EscrowClient.md)\> +> `static` **build**(`runner`): `Promise`\<`EscrowClient`\> -Defined in: [escrow.ts:168](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L168) +Defined in: [escrow.ts:169](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L169) Creates an instance of EscrowClient from a Runner. @@ -1245,7 +1245,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`EscrowClient`](EscrowClient.md)\> +`Promise`\<`EscrowClient`\> An instance of EscrowClient diff --git a/docs/sdk/typescript/escrow/classes/EscrowUtils.md b/docs/sdk/typescript/escrow/classes/EscrowUtils.md index 7622cb9120..e683ad1f73 100644 --- a/docs/sdk/typescript/escrow/classes/EscrowUtils.md +++ b/docs/sdk/typescript/escrow/classes/EscrowUtils.md @@ -6,7 +6,7 @@ # Class: EscrowUtils -Defined in: [escrow.ts:1565](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1565) +Defined in: [escrow.ts:1566](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1566) ## Introduction @@ -40,21 +40,21 @@ const escrowAddresses = new EscrowUtils.getEscrows({ ## Constructors -### new EscrowUtils() +### Constructor -> **new EscrowUtils**(): [`EscrowUtils`](EscrowUtils.md) +> **new EscrowUtils**(): `EscrowUtils` #### Returns -[`EscrowUtils`](EscrowUtils.md) +`EscrowUtils` ## Methods ### getEscrow() -> `static` **getEscrow**(`chainId`, `escrowAddress`): `Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)\> +> `static` **getEscrow**(`chainId`, `escrowAddress`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)\> -Defined in: [escrow.ts:1780](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1780) +Defined in: [escrow.ts:1779](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1779) This function returns the escrow data for a given address. @@ -76,7 +76,7 @@ enum ChainId { ``` ```ts -type EscrowData = { +interface IEscrow { id: string; address: string; amountPaid: string; @@ -115,7 +115,7 @@ Address of the escrow #### Returns -`Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)\> +`Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)\> Escrow data @@ -124,16 +124,16 @@ Escrow data ```ts import { ChainId, EscrowUtils } from '@human-protocol/sdk'; -const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); +const escrow = new EscrowUtils.getEscrow(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890"); ``` *** ### getEscrows() -> `static` **getEscrows**(`filter`): `Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)[]\> +> `static` **getEscrows**(`filter`): `Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)[]\> -Defined in: [escrow.ts:1662](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1662) +Defined in: [escrow.ts:1663](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1663) This function returns an array of escrows based on the specified filter parameters. @@ -188,7 +188,7 @@ enum EscrowStatus { ``` ```ts -type EscrowData = { +interface IEscrow { id: string; address: string; amountPaid: string; @@ -221,7 +221,7 @@ Filter parameters. #### Returns -`Promise`\<[`EscrowData`](../../graphql/types/type-aliases/EscrowData.md)[]\> +`Promise`\<[`IEscrow`](../../interfaces/interfaces/IEscrow.md)[]\> List of escrows that match the filter. @@ -236,7 +236,7 @@ const filters: IEscrowsFilter = { to: new Date(2023, 5, 8), chainId: ChainId.POLYGON_AMOY }; -const escrowDatas = await EscrowUtils.getEscrows(filters); +const escrows = await EscrowUtils.getEscrows(filters); ``` *** @@ -245,7 +245,7 @@ const escrowDatas = await EscrowUtils.getEscrows(filters); > `static` **getPayouts**(`filter`): `Promise`\<[`Payout`](../../types/type-aliases/Payout.md)[]\> -Defined in: [escrow.ts:1950](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1950) +Defined in: [escrow.ts:1949](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1949) This function returns the payouts for a given set of networks. @@ -289,7 +289,7 @@ console.log(payouts); > `static` **getStatusEvents**(`filter`): `Promise`\<[`StatusEvent`](../../graphql/types/type-aliases/StatusEvent.md)[]\> -Defined in: [escrow.ts:1859](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1859) +Defined in: [escrow.ts:1858](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/escrow.ts#L1858) This function returns the status events for a given set of networks within an optional date range. diff --git a/docs/sdk/typescript/graphql/types/README.md b/docs/sdk/typescript/graphql/types/README.md index 7b33bd7937..627806191d 100644 --- a/docs/sdk/typescript/graphql/types/README.md +++ b/docs/sdk/typescript/graphql/types/README.md @@ -25,7 +25,6 @@ - [IMDataEntity](type-aliases/IMDataEntity.md) - [KVStoreData](type-aliases/KVStoreData.md) - [PaymentStatistics](type-aliases/PaymentStatistics.md) -- [PayoutData](type-aliases/PayoutData.md) - [RewardAddedEventData](type-aliases/RewardAddedEventData.md) - [StatusEvent](type-aliases/StatusEvent.md) - [TaskStatistics](type-aliases/TaskStatistics.md) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md index d1338d66b5..e756468529 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyEscrowData.md @@ -6,32 +6,54 @@ # Type Alias: DailyEscrowData -> **DailyEscrowData**: `object` +> **DailyEscrowData** = `object` -Defined in: [graphql/types.ts:83](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L83) +Defined in: [graphql/types.ts:75](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L75) -## Type declaration +## Properties ### escrowsCancelled > **escrowsCancelled**: `number` +Defined in: [graphql/types.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L81) + +*** + ### escrowsPaid > **escrowsPaid**: `number` +Defined in: [graphql/types.ts:80](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L80) + +*** + ### escrowsPending > **escrowsPending**: `number` +Defined in: [graphql/types.ts:78](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L78) + +*** + ### escrowsSolved > **escrowsSolved**: `number` +Defined in: [graphql/types.ts:79](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L79) + +*** + ### escrowsTotal > **escrowsTotal**: `number` +Defined in: [graphql/types.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L77) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md index 9244bdd1ec..00b8281cee 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyHMTData.md @@ -6,28 +6,46 @@ # Type Alias: DailyHMTData -> **DailyHMTData**: `object` +> **DailyHMTData** = `object` -Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) +Defined in: [graphql/types.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L119) -## Type declaration +## Properties ### dailyUniqueReceivers > **dailyUniqueReceivers**: `number` +Defined in: [graphql/types.ts:124](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L124) + +*** + ### dailyUniqueSenders > **dailyUniqueSenders**: `number` +Defined in: [graphql/types.ts:123](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L123) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L120) + +*** + ### totalTransactionAmount > **totalTransactionAmount**: `bigint` +Defined in: [graphql/types.ts:121](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L121) + +*** + ### totalTransactionCount > **totalTransactionCount**: `number` + +Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md index 5407a1faf6..579d949a7c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyPaymentData.md @@ -6,24 +6,38 @@ # Type Alias: DailyPaymentData -> **DailyPaymentData**: `object` +> **DailyPaymentData** = `object` -Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) +Defined in: [graphql/types.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L98) -## Type declaration +## Properties ### averageAmountPerWorker > **averageAmountPerWorker**: `bigint` +Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L99) + +*** + ### totalAmountPaid > **totalAmountPaid**: `bigint` +Defined in: [graphql/types.ts:100](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L100) + +*** + ### totalCount > **totalCount**: `number` + +Defined in: [graphql/types.ts:101](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L101) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md index 32d8aac1c6..64c00976cd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyTaskData.md @@ -6,20 +6,30 @@ # Type Alias: DailyTaskData -> **DailyTaskData**: `object` +> **DailyTaskData** = `object` -Defined in: [graphql/types.ts:148](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L148) +Defined in: [graphql/types.ts:140](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L140) -## Type declaration +## Properties ### tasksSolved > **tasksSolved**: `number` +Defined in: [graphql/types.ts:143](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L143) + +*** + ### tasksTotal > **tasksTotal**: `number` +Defined in: [graphql/types.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L142) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md index decaf5e782..5afd7db4fb 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/DailyWorkerData.md @@ -6,16 +6,22 @@ # Type Alias: DailyWorkerData -> **DailyWorkerData**: `object` +> **DailyWorkerData** = `object` -Defined in: [graphql/types.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L97) +Defined in: [graphql/types.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L89) -## Type declaration +## Properties ### activeWorkers > **activeWorkers**: `number` +Defined in: [graphql/types.ts:91](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L91) + +*** + ### timestamp > **timestamp**: `Date` + +Defined in: [graphql/types.ts:90](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L90) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md index 1b73e121ee..f2db4f6a50 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowData.md @@ -6,84 +6,158 @@ # Type Alias: EscrowData -> **EscrowData**: `object` +> **EscrowData** = `object` -Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) +Defined in: [graphql/types.ts:3](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L3) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L5) + +*** + ### amountPaid > **amountPaid**: `string` +Defined in: [graphql/types.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L6) + +*** + ### balance > **balance**: `string` +Defined in: [graphql/types.ts:7](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L7) + +*** + ### chainId > **chainId**: `number` +Defined in: [graphql/types.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L22) + +*** + ### count > **count**: `string` +Defined in: [graphql/types.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L8) + +*** + ### createdAt > **createdAt**: `string` +Defined in: [graphql/types.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L21) + +*** + ### exchangeOracle? > `optional` **exchangeOracle**: `string` +Defined in: [graphql/types.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L17) + +*** + ### factoryAddress > **factoryAddress**: `string` +Defined in: [graphql/types.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L9) + +*** + ### finalResultsUrl? > `optional` **finalResultsUrl**: `string` +Defined in: [graphql/types.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L10) + +*** + ### id > **id**: `string` +Defined in: [graphql/types.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L4) + +*** + ### intermediateResultsUrl? > `optional` **intermediateResultsUrl**: `string` +Defined in: [graphql/types.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L11) + +*** + ### launcher > **launcher**: `string` +Defined in: [graphql/types.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L12) + +*** + ### manifestHash? > `optional` **manifestHash**: `string` +Defined in: [graphql/types.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L13) + +*** + ### manifestUrl? > `optional` **manifestUrl**: `string` +Defined in: [graphql/types.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L14) + +*** + ### recordingOracle? > `optional` **recordingOracle**: `string` +Defined in: [graphql/types.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L15) + +*** + ### reputationOracle? > `optional` **reputationOracle**: `string` +Defined in: [graphql/types.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L16) + +*** + ### status > **status**: `string` +Defined in: [graphql/types.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L18) + +*** + ### token > **token**: `string` +Defined in: [graphql/types.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L19) + +*** + ### totalFundedAmount > **totalFundedAmount**: `string` + +Defined in: [graphql/types.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L20) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md index 6e6c5426c3..ec1bd885db 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatistics.md @@ -6,16 +6,22 @@ # Type Alias: EscrowStatistics -> **EscrowStatistics**: `object` +> **EscrowStatistics** = `object` -Defined in: [graphql/types.ts:92](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L92) +Defined in: [graphql/types.ts:84](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L84) -## Type declaration +## Properties ### dailyEscrowsData > **dailyEscrowsData**: [`DailyEscrowData`](DailyEscrowData.md)[] +Defined in: [graphql/types.ts:86](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L86) + +*** + ### totalEscrows > **totalEscrows**: `number` + +Defined in: [graphql/types.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L85) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md index d11549fd67..eaea901611 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EscrowStatisticsData.md @@ -6,48 +6,86 @@ # Type Alias: EscrowStatisticsData -> **EscrowStatisticsData**: `object` +> **EscrowStatisticsData** = `object` -Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) +Defined in: [graphql/types.ts:34](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L34) -## Type declaration +## Properties ### bulkPayoutEventCount > **bulkPayoutEventCount**: `string` +Defined in: [graphql/types.ts:37](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L37) + +*** + ### cancelledStatusEventCount > **cancelledStatusEventCount**: `string` +Defined in: [graphql/types.ts:39](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L39) + +*** + ### completedStatusEventCount > **completedStatusEventCount**: `string` +Defined in: [graphql/types.ts:42](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L42) + +*** + ### fundEventCount > **fundEventCount**: `string` +Defined in: [graphql/types.ts:35](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L35) + +*** + ### paidStatusEventCount > **paidStatusEventCount**: `string` +Defined in: [graphql/types.ts:41](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L41) + +*** + ### partialStatusEventCount > **partialStatusEventCount**: `string` +Defined in: [graphql/types.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L40) + +*** + ### pendingStatusEventCount > **pendingStatusEventCount**: `string` +Defined in: [graphql/types.ts:38](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L38) + +*** + ### storeResultsEventCount > **storeResultsEventCount**: `string` +Defined in: [graphql/types.ts:36](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L36) + +*** + ### totalEscrowCount > **totalEscrowCount**: `string` +Defined in: [graphql/types.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L44) + +*** + ### totalEventCount > **totalEventCount**: `string` + +Defined in: [graphql/types.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L43) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md index 1bdd057e5f..75206a67ad 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/EventDayData.md @@ -6,80 +6,150 @@ # Type Alias: EventDayData -> **EventDayData**: `object` +> **EventDayData** = `object` -Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) +Defined in: [graphql/types.ts:47](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L47) -## Type declaration +## Properties ### dailyBulkPayoutEventCount > **dailyBulkPayoutEventCount**: `string` +Defined in: [graphql/types.ts:51](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L51) + +*** + ### dailyCancelledStatusEventCount > **dailyCancelledStatusEventCount**: `string` +Defined in: [graphql/types.ts:53](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L53) + +*** + ### dailyCompletedStatusEventCount > **dailyCompletedStatusEventCount**: `string` +Defined in: [graphql/types.ts:56](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L56) + +*** + ### dailyEscrowCount > **dailyEscrowCount**: `string` +Defined in: [graphql/types.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L58) + +*** + ### dailyFundEventCount > **dailyFundEventCount**: `string` +Defined in: [graphql/types.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L49) + +*** + +### dailyHMTPayoutAmount + +> **dailyHMTPayoutAmount**: `string` + +Defined in: [graphql/types.ts:61](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L61) + +*** + ### dailyHMTTransferAmount > **dailyHMTTransferAmount**: `string` +Defined in: [graphql/types.ts:63](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L63) + +*** + ### dailyHMTTransferCount > **dailyHMTTransferCount**: `string` +Defined in: [graphql/types.ts:62](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L62) + +*** + ### dailyPaidStatusEventCount > **dailyPaidStatusEventCount**: `string` +Defined in: [graphql/types.ts:55](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L55) + +*** + ### dailyPartialStatusEventCount > **dailyPartialStatusEventCount**: `string` -### dailyPayoutAmount +Defined in: [graphql/types.ts:54](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L54) -> **dailyPayoutAmount**: `string` +*** ### dailyPayoutCount > **dailyPayoutCount**: `string` +Defined in: [graphql/types.ts:60](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L60) + +*** + ### dailyPendingStatusEventCount > **dailyPendingStatusEventCount**: `string` +Defined in: [graphql/types.ts:52](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L52) + +*** + ### dailyStoreResultsEventCount > **dailyStoreResultsEventCount**: `string` +Defined in: [graphql/types.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L50) + +*** + ### dailyTotalEventCount > **dailyTotalEventCount**: `string` +Defined in: [graphql/types.ts:57](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L57) + +*** + ### dailyUniqueReceivers > **dailyUniqueReceivers**: `string` +Defined in: [graphql/types.ts:65](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L65) + +*** + ### dailyUniqueSenders > **dailyUniqueSenders**: `string` +Defined in: [graphql/types.ts:64](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L64) + +*** + ### dailyWorkerCount > **dailyWorkerCount**: `string` +Defined in: [graphql/types.ts:59](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L59) + +*** + ### timestamp > **timestamp**: `string` + +Defined in: [graphql/types.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L48) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md index 3c2354fba4..c071ee89e1 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolder.md @@ -6,16 +6,22 @@ # Type Alias: HMTHolder -> **HMTHolder**: `object` +> **HMTHolder** = `object` -Defined in: [graphql/types.ts:122](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L122) +Defined in: [graphql/types.ts:114](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L114) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L115) + +*** + ### balance > **balance**: `bigint` + +Defined in: [graphql/types.ts:116](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L116) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md index 7a2407ca15..ee55c1590c 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTHolderData.md @@ -6,16 +6,22 @@ # Type Alias: HMTHolderData -> **HMTHolderData**: `object` +> **HMTHolderData** = `object` -Defined in: [graphql/types.ts:117](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L117) +Defined in: [graphql/types.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L109) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:110](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L110) + +*** + ### balance > **balance**: `string` + +Defined in: [graphql/types.ts:111](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L111) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md index e8e3e7364e..f55590cbf4 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatistics.md @@ -6,20 +6,30 @@ # Type Alias: HMTStatistics -> **HMTStatistics**: `object` +> **HMTStatistics** = `object` -Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) +Defined in: [graphql/types.ts:127](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L127) -## Type declaration +## Properties ### totalHolders > **totalHolders**: `number` +Defined in: [graphql/types.ts:130](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L130) + +*** + ### totalTransferAmount > **totalTransferAmount**: `bigint` +Defined in: [graphql/types.ts:128](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L128) + +*** + ### totalTransferCount > **totalTransferCount**: `number` + +Defined in: [graphql/types.ts:129](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L129) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md index d1401b9486..2a17ef82dd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/HMTStatisticsData.md @@ -6,32 +6,54 @@ # Type Alias: HMTStatisticsData -> **HMTStatisticsData**: `object` +> **HMTStatisticsData** = `object` -Defined in: [graphql/types.ts:33](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L33) +Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) -## Type declaration +## Properties ### holders > **holders**: `string` +Defined in: [graphql/types.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L31) + +*** + ### totalApprovalEventCount > **totalApprovalEventCount**: `string` +Defined in: [graphql/types.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L28) + +*** + ### totalBulkApprovalEventCount > **totalBulkApprovalEventCount**: `string` +Defined in: [graphql/types.ts:29](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L29) + +*** + ### totalBulkTransferEventCount > **totalBulkTransferEventCount**: `string` +Defined in: [graphql/types.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L27) + +*** + ### totalTransferEventCount > **totalTransferEventCount**: `string` +Defined in: [graphql/types.ts:26](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L26) + +*** + ### totalValueTransfered > **totalValueTransfered**: `string` + +Defined in: [graphql/types.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L30) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md index 9fe78a572b..37ddf93d0d 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMData.md @@ -6,6 +6,6 @@ # Type Alias: IMData -> **IMData**: `Record`\<`string`, [`IMDataEntity`](IMDataEntity.md)\> +> **IMData** = `Record`\<`string`, [`IMDataEntity`](IMDataEntity.md)\> -Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) +Defined in: [graphql/types.ts:138](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L138) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md index 04813d3002..96725b9155 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/IMDataEntity.md @@ -6,16 +6,22 @@ # Type Alias: IMDataEntity -> **IMDataEntity**: `object` +> **IMDataEntity** = `object` -Defined in: [graphql/types.ts:141](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L141) +Defined in: [graphql/types.ts:133](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L133) -## Type declaration +## Properties ### served > **served**: `number` +Defined in: [graphql/types.ts:134](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L134) + +*** + ### solved > **solved**: `number` + +Defined in: [graphql/types.ts:135](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L135) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md index bf4a21515f..8780ce7efd 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/KVStoreData.md @@ -6,32 +6,54 @@ # Type Alias: KVStoreData -> **KVStoreData**: `object` +> **KVStoreData** = `object` -Defined in: [graphql/types.ts:165](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L165) +Defined in: [graphql/types.ts:157](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L157) -## Type declaration +## Properties ### address > **address**: `string` +Defined in: [graphql/types.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L159) + +*** + ### block > **block**: `number` +Defined in: [graphql/types.ts:163](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L163) + +*** + ### id > **id**: `string` +Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) + +*** + ### key > **key**: `string` +Defined in: [graphql/types.ts:160](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L160) + +*** + ### timestamp > **timestamp**: `Date` +Defined in: [graphql/types.ts:162](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L162) + +*** + ### value > **value**: `string` + +Defined in: [graphql/types.ts:161](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L161) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md index 183cb8fc7b..64b2e63133 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/PaymentStatistics.md @@ -6,12 +6,14 @@ # Type Alias: PaymentStatistics -> **PaymentStatistics**: `object` +> **PaymentStatistics** = `object` -Defined in: [graphql/types.ts:113](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L113) +Defined in: [graphql/types.ts:105](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L105) -## Type declaration +## Properties ### dailyPaymentsData > **dailyPaymentsData**: [`DailyPaymentData`](DailyPaymentData.md)[] + +Defined in: [graphql/types.ts:106](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L106) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md b/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md deleted file mode 100644 index 411724cd7c..0000000000 --- a/docs/sdk/typescript/graphql/types/type-aliases/PayoutData.md +++ /dev/null @@ -1,33 +0,0 @@ -[**@human-protocol/sdk**](../../../README.md) - -*** - -[@human-protocol/sdk](../../../modules.md) / [graphql/types](../README.md) / PayoutData - -# Type Alias: PayoutData - -> **PayoutData**: `object` - -Defined in: [graphql/types.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L25) - -## Type declaration - -### amount - -> **amount**: `string` - -### createdAt - -> **createdAt**: `string` - -### escrowAddress - -> **escrowAddress**: `string` - -### id - -> **id**: `string` - -### recipient - -> **recipient**: `string` diff --git a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md index 1c754efa3c..abb41fb55f 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/RewardAddedEventData.md @@ -6,24 +6,38 @@ # Type Alias: RewardAddedEventData -> **RewardAddedEventData**: `object` +> **RewardAddedEventData** = `object` -Defined in: [graphql/types.ts:76](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L76) +Defined in: [graphql/types.ts:68](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L68) -## Type declaration +## Properties ### amount > **amount**: `string` +Defined in: [graphql/types.ts:72](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L72) + +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [graphql/types.ts:69](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L69) + +*** + ### slasher > **slasher**: `string` +Defined in: [graphql/types.ts:71](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L71) + +*** + ### staker > **staker**: `string` + +Defined in: [graphql/types.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L70) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md index 05c2380ae1..52ab27fbf9 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/StatusEvent.md @@ -6,24 +6,38 @@ # Type Alias: StatusEvent -> **StatusEvent**: `object` +> **StatusEvent** = `object` -Defined in: [graphql/types.ts:158](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L158) +Defined in: [graphql/types.ts:150](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L150) -## Type declaration +## Properties ### chainId > **chainId**: [`ChainId`](../../../enums/enumerations/ChainId.md) +Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) + +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [graphql/types.ts:152](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L152) + +*** + ### status > **status**: `string` +Defined in: [graphql/types.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L153) + +*** + ### timestamp > **timestamp**: `number` + +Defined in: [graphql/types.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L151) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md index 1e57acbfdd..74d99dda6a 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/TaskStatistics.md @@ -6,12 +6,14 @@ # Type Alias: TaskStatistics -> **TaskStatistics**: `object` +> **TaskStatistics** = `object` -Defined in: [graphql/types.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L154) +Defined in: [graphql/types.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L146) -## Type declaration +## Properties ### dailyTasksData > **dailyTasksData**: [`DailyTaskData`](DailyTaskData.md)[] + +Defined in: [graphql/types.ts:147](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L147) diff --git a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md index 60ffd457ee..bcf440fac5 100644 --- a/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md +++ b/docs/sdk/typescript/graphql/types/type-aliases/WorkerStatistics.md @@ -6,12 +6,14 @@ # Type Alias: WorkerStatistics -> **WorkerStatistics**: `object` +> **WorkerStatistics** = `object` -Defined in: [graphql/types.ts:102](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L102) +Defined in: [graphql/types.ts:94](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L94) -## Type declaration +## Properties ### dailyWorkersData > **dailyWorkersData**: [`DailyWorkerData`](DailyWorkerData.md)[] + +Defined in: [graphql/types.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts#L95) diff --git a/docs/sdk/typescript/interfaces/README.md b/docs/sdk/typescript/interfaces/README.md index efff08ad39..e7046c38a1 100644 --- a/docs/sdk/typescript/interfaces/README.md +++ b/docs/sdk/typescript/interfaces/README.md @@ -8,6 +8,7 @@ ## Interfaces +- [IEscrow](interfaces/IEscrow.md) - [IEscrowConfig](interfaces/IEscrowConfig.md) - [IEscrowsFilter](interfaces/IEscrowsFilter.md) - [IHMTHoldersParams](interfaces/IHMTHoldersParams.md) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrow.md b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md new file mode 100644 index 0000000000..6406bbc853 --- /dev/null +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrow.md @@ -0,0 +1,161 @@ +[**@human-protocol/sdk**](../../README.md) + +*** + +[@human-protocol/sdk](../../modules.md) / [interfaces](../README.md) / IEscrow + +# Interface: IEscrow + +Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) + +## Properties + +### address + +> **address**: `string` + +Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) + +*** + +### amountPaid + +> **amountPaid**: `string` + +Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) + +*** + +### balance + +> **balance**: `string` + +Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) + +*** + +### chainId + +> **chainId**: `number` + +Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) + +*** + +### count + +> **count**: `string` + +Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) + +*** + +### createdAt + +> **createdAt**: `string` + +Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) + +*** + +### exchangeOracle? + +> `optional` **exchangeOracle**: `string` + +Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) + +*** + +### factoryAddress + +> **factoryAddress**: `string` + +Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) + +*** + +### finalResultsUrl? + +> `optional` **finalResultsUrl**: `string` + +Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) + +*** + +### id + +> **id**: `string` + +Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) + +*** + +### intermediateResultsUrl? + +> `optional` **intermediateResultsUrl**: `string` + +Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) + +*** + +### launcher + +> **launcher**: `string` + +Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) + +*** + +### manifestHash? + +> `optional` **manifestHash**: `string` + +Defined in: [interfaces.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L77) + +*** + +### manifestUrl? + +> `optional` **manifestUrl**: `string` + +Defined in: [interfaces.ts:78](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L78) + +*** + +### recordingOracle? + +> `optional` **recordingOracle**: `string` + +Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) + +*** + +### reputationOracle? + +> `optional` **reputationOracle**: `string` + +Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) + +*** + +### status + +> **status**: `string` + +Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) + +*** + +### token + +> **token**: `string` + +Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) + +*** + +### totalFundedAmount + +> **totalFundedAmount**: `string` + +Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md index 0683a22619..d31f5f0eff 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowConfig.md @@ -6,7 +6,7 @@ # Interface: IEscrowConfig -Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L79) +Defined in: [interfaces.ts:101](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L101) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:79](https://github.com/humanprotocol/human-protocol/b > **exchangeOracle**: `string` -Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L82) +Defined in: [interfaces.ts:104](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L104) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:82](https://github.com/humanprotocol/human-protocol/b > **exchangeOracleFee**: `bigint` -Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L85) +Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:85](https://github.com/humanprotocol/human-protocol/b > **manifestHash**: `string` -Defined in: [interfaces.ts:87](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L87) +Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:87](https://github.com/humanprotocol/human-protocol/b > **manifestUrl**: `string` -Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L86) +Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:86](https://github.com/humanprotocol/human-protocol/b > **recordingOracle**: `string` -Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L80) +Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:80](https://github.com/humanprotocol/human-protocol/b > **recordingOracleFee**: `bigint` -Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L83) +Defined in: [interfaces.ts:105](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L105) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:83](https://github.com/humanprotocol/human-protocol/b > **reputationOracle**: `string` -Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L81) +Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) *** @@ -70,4 +70,4 @@ Defined in: [interfaces.ts:81](https://github.com/humanprotocol/human-protocol/b > **reputationOracleFee**: `bigint` -Defined in: [interfaces.ts:84](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L84) +Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) diff --git a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md index add8356780..0bef7e56bf 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IEscrowsFilter.md @@ -6,7 +6,7 @@ # Interface: IEscrowsFilter -Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L67) +Defined in: [interfaces.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L89) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:67](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L76) +Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:76](https://github.com/humanprotocol/human-protocol/b > `optional` **exchangeOracle**: `string` -Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L71) +Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:71](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L74) +Defined in: [interfaces.ts:96](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L96) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:74](https://github.com/humanprotocol/human-protocol/b > `optional` **jobRequesterId**: `string` -Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L72) +Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:72](https://github.com/humanprotocol/human-protocol/b > `optional` **launcher**: `string` -Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L68) +Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:68](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -82,7 +82,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **recordingOracle**: `string` -Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L70) +Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) *** @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:70](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationOracle**: `string` -Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L69) +Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) *** @@ -98,7 +98,7 @@ Defined in: [interfaces.ts:69](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **status**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md) -Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L73) +Defined in: [interfaces.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L95) *** @@ -118,4 +118,4 @@ Defined in: [interfaces.ts:73](https://github.com/humanprotocol/human-protocol/b > `optional` **to**: `Date` -Defined in: [interfaces.ts:75](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L75) +Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) diff --git a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md index 20e651e721..9c4097219f 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md +++ b/docs/sdk/typescript/interfaces/interfaces/IHMTHoldersParams.md @@ -6,7 +6,7 @@ # Interface: IHMTHoldersParams -Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L102) +Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:102](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L103) +Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:103](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md index d7afd90199..65d7fb2001 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKVStore.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKVStore.md @@ -6,7 +6,7 @@ # Interface: IKVStore -Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) +Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/ > **key**: `string` -Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) +Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) +Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) diff --git a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md index 66e2c69336..fe1c0e7104 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md +++ b/docs/sdk/typescript/interfaces/interfaces/IKeyPair.md @@ -6,7 +6,7 @@ # Interface: IKeyPair -Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L90) +Defined in: [interfaces.ts:112](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L112) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:90](https://github.com/humanprotocol/human-protocol/b > **passphrase**: `string` -Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L93) +Defined in: [interfaces.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L115) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:93](https://github.com/humanprotocol/human-protocol/b > **privateKey**: `string` -Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L91) +Defined in: [interfaces.ts:113](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L113) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:91](https://github.com/humanprotocol/human-protocol/b > **publicKey**: `string` -Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L92) +Defined in: [interfaces.ts:114](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L114) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:92](https://github.com/humanprotocol/human-protocol/b > `optional` **revocationCertificate**: `string` -Defined in: [interfaces.ts:94](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L94) +Defined in: [interfaces.ts:116](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L116) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperator.md b/docs/sdk/typescript/interfaces/interfaces/IOperator.md index 79945ef14c..66175a367e 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperator.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperator.md @@ -6,7 +6,7 @@ # Interface: IOperator -Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) +Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L9) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:9](https://github.com/humanprotocol/human-protocol/bl > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) +Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L11) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:11](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) *** @@ -94,7 +94,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string`[] -Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) +Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L26) *** @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:26](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) *** @@ -110,7 +110,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) *** @@ -118,7 +118,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) *** @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) *** @@ -142,7 +142,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `string`[] -Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) +Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L29) *** @@ -150,7 +150,7 @@ Defined in: [interfaces.ts:29](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) *** @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) *** @@ -166,7 +166,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) *** @@ -174,7 +174,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) *** @@ -182,4 +182,4 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md index b27a089c01..a3dc14f782 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorSubgraph.md @@ -6,7 +6,7 @@ # Interface: IOperatorSubgraph -Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) +Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L34) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:34](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) +Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L12) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:12](https://github.com/humanprotocol/human-protocol/b > **amountJobsProcessed**: `bigint` -Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) +Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L19) #### Inherited from @@ -42,7 +42,7 @@ Defined in: [interfaces.ts:19](https://github.com/humanprotocol/human-protocol/b > **amountLocked**: `bigint` -Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) +Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L14) #### Inherited from @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:14](https://github.com/humanprotocol/human-protocol/b > **amountSlashed**: `bigint` -Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) +Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L17) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:17](https://github.com/humanprotocol/human-protocol/b > **amountStaked**: `bigint` -Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) +Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L13) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:13](https://github.com/humanprotocol/human-protocol/b > **amountWithdrawn**: `bigint` -Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) +Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L16) #### Inherited from @@ -90,7 +90,7 @@ Defined in: [interfaces.ts:16](https://github.com/humanprotocol/human-protocol/b > `optional` **category**: `string` -Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) +Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L31) #### Inherited from @@ -102,7 +102,7 @@ Defined in: [interfaces.ts:31](https://github.com/humanprotocol/human-protocol/b > `optional` **fee**: `bigint` -Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) +Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L21) #### Inherited from @@ -114,7 +114,7 @@ Defined in: [interfaces.ts:21](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) +Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L10) #### Inherited from @@ -126,7 +126,7 @@ Defined in: [interfaces.ts:10](https://github.com/humanprotocol/human-protocol/b > `optional` **jobTypes**: `string` -Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) +Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L36) *** @@ -134,7 +134,7 @@ Defined in: [interfaces.ts:36](https://github.com/humanprotocol/human-protocol/b > **lockedUntilTimestamp**: `bigint` -Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) +Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L15) #### Inherited from @@ -146,7 +146,7 @@ Defined in: [interfaces.ts:15](https://github.com/humanprotocol/human-protocol/b > `optional` **name**: `string` -Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) +Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L30) #### Inherited from @@ -158,7 +158,7 @@ Defined in: [interfaces.ts:30](https://github.com/humanprotocol/human-protocol/b > `optional` **publicKey**: `string` -Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) +Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L22) #### Inherited from @@ -170,7 +170,7 @@ Defined in: [interfaces.ts:22](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationInstructions**: `string` -Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) +Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L28) #### Inherited from @@ -182,7 +182,7 @@ Defined in: [interfaces.ts:28](https://github.com/humanprotocol/human-protocol/b > `optional` **registrationNeeded**: `boolean` -Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) +Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L27) #### Inherited from @@ -194,7 +194,7 @@ Defined in: [interfaces.ts:27](https://github.com/humanprotocol/human-protocol/b > `optional` **reputationNetworks**: `object`[] -Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) +Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L37) #### address @@ -206,7 +206,7 @@ Defined in: [interfaces.ts:37](https://github.com/humanprotocol/human-protocol/b > **reward**: `bigint` -Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) +Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L18) #### Inherited from @@ -218,7 +218,7 @@ Defined in: [interfaces.ts:18](https://github.com/humanprotocol/human-protocol/b > `optional` **role**: `string` -Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) +Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L20) #### Inherited from @@ -230,7 +230,7 @@ Defined in: [interfaces.ts:20](https://github.com/humanprotocol/human-protocol/b > `optional` **url**: `string` -Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) +Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L25) #### Inherited from @@ -242,7 +242,7 @@ Defined in: [interfaces.ts:25](https://github.com/humanprotocol/human-protocol/b > `optional` **webhookUrl**: `string` -Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) +Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L23) #### Inherited from @@ -254,7 +254,7 @@ Defined in: [interfaces.ts:23](https://github.com/humanprotocol/human-protocol/b > `optional` **website**: `string` -Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) +Defined in: [interfaces.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L24) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md index 90e83d1034..4cd03b92c6 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IOperatorsFilter.md @@ -6,7 +6,7 @@ # Interface: IOperatorsFilter -Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) +Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L40) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:40](https://github.com/humanprotocol/human-protocol/b > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) +Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L41) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:41](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **minAmountStaked**: `number` -Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) +Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L43) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:43](https://github.com/humanprotocol/human-protocol/b > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) +Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L44) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:44](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **roles**: `string`[] -Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) +Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L42) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:42](https://github.com/humanprotocol/human-protocol/b > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/IPagination.md b/docs/sdk/typescript/interfaces/interfaces/IPagination.md index 18e9db9eb6..75baa60993 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPagination.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPagination.md @@ -6,7 +6,7 @@ # Interface: IPagination -Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) +Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) ## Extended by @@ -25,7 +25,7 @@ Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) *** @@ -33,7 +33,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) *** @@ -41,4 +41,4 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) diff --git a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md index d324186adb..42e26b2ae7 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IPayoutFilter.md @@ -6,7 +6,7 @@ # Interface: IPayoutFilter -Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L106) +Defined in: [interfaces.ts:128](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L128) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:106](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L107) +Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:107](https://github.com/humanprotocol/human-protocol/ > `optional` **escrowAddress**: `string` -Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L108) +Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:108](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:110](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L110) +Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:110](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **recipient**: `string` -Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L109) +Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) *** @@ -74,7 +74,7 @@ Defined in: [interfaces.ts:109](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:111](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L111) +Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md index a78f347469..5d52f9d6ed 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetwork.md @@ -6,7 +6,7 @@ # Interface: IReputationNetwork -Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) +Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L47) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:47](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) *** @@ -30,4 +30,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperator`](IOperator.md)[] -Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) +Defined in: [interfaces.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L50) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md index 79bb41371a..00e8cb3037 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReputationNetworkSubgraph.md @@ -6,7 +6,7 @@ # Interface: IReputationNetworkSubgraph -Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) +Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L53) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:53](https://github.com/humanprotocol/human-protocol/b > **address**: `string` -Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) +Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L49) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:49](https://github.com/humanprotocol/human-protocol/b > **id**: `string` -Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) +Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L48) #### Inherited from @@ -42,4 +42,4 @@ Defined in: [interfaces.ts:48](https://github.com/humanprotocol/human-protocol/b > **operators**: [`IOperatorSubgraph`](IOperatorSubgraph.md)[] -Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) +Defined in: [interfaces.ts:55](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L55) diff --git a/docs/sdk/typescript/interfaces/interfaces/IReward.md b/docs/sdk/typescript/interfaces/interfaces/IReward.md index dbf06c2f1f..72428ebceb 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IReward.md +++ b/docs/sdk/typescript/interfaces/interfaces/IReward.md @@ -6,7 +6,7 @@ # Interface: IReward -Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) +Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L4) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:4](https://github.com/humanprotocol/human-protocol/bl > **amount**: `bigint` -Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) +Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L6) *** @@ -22,4 +22,4 @@ Defined in: [interfaces.ts:6](https://github.com/humanprotocol/human-protocol/bl > **escrowAddress**: `string` -Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) +Defined in: [interfaces.ts:5](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L5) diff --git a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md index 85c8c655a6..ba7080d45c 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatisticsFilter.md @@ -6,7 +6,7 @@ # Interface: IStatisticsFilter -Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L97) +Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:97](https://github.com/humanprotocol/human-protocol/b > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L98) +Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:98](https://github.com/humanprotocol/human-protocol/b > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -50,7 +50,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L99) +Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) diff --git a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md index d57093ca0d..ded6770a37 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IStatusEventFilter.md @@ -6,7 +6,7 @@ # Interface: IStatusEventFilter -Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) +Defined in: [interfaces.ts:191](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L191) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) +Defined in: [interfaces.ts:192](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L192) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **from**: `Date` -Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) +Defined in: [interfaces.ts:194](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L194) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/ > `optional` **launcher**: `string` -Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) +Defined in: [interfaces.ts:196](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L196) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **statuses**: [`EscrowStatus`](../../types/enumerations/EscrowStatus.md)[] -Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) +Defined in: [interfaces.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L193) *** @@ -86,4 +86,4 @@ Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/ > `optional` **to**: `Date` -Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) +Defined in: [interfaces.ts:195](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L195) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md index b3408ebfb9..f4c9e9b5ba 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransaction.md @@ -6,7 +6,7 @@ # Interface: ITransaction -Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L129) +Defined in: [interfaces.ts:151](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L151) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:129](https://github.com/humanprotocol/human-protocol/ > **block**: `bigint` -Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L130) +Defined in: [interfaces.ts:152](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L152) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:130](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L138) +Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:138](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L132) +Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:132](https://github.com/humanprotocol/human-protocol/ > **internalTransactions**: [`InternalTransaction`](InternalTransaction.md)[] -Defined in: [interfaces.ts:140](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L140) +Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:140](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L136) +Defined in: [interfaces.ts:158](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L158) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:136](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L137) +Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) *** @@ -62,7 +62,7 @@ Defined in: [interfaces.ts:137](https://github.com/humanprotocol/human-protocol/ > **timestamp**: `bigint` -Defined in: [interfaces.ts:134](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L134) +Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) *** @@ -70,7 +70,7 @@ Defined in: [interfaces.ts:134](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L133) +Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) *** @@ -78,7 +78,7 @@ Defined in: [interfaces.ts:133](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:139](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L139) +Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) *** @@ -86,7 +86,7 @@ Defined in: [interfaces.ts:139](https://github.com/humanprotocol/human-protocol/ > **txHash**: `string` -Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L131) +Defined in: [interfaces.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L153) *** @@ -94,4 +94,4 @@ Defined in: [interfaces.ts:131](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:135](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L135) +Defined in: [interfaces.ts:157](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L157) diff --git a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md index 3fa146d5b4..48c918b5b7 100644 --- a/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/ITransactionsFilter.md @@ -6,7 +6,7 @@ # Interface: ITransactionsFilter -Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) +Defined in: [interfaces.ts:165](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L165) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) +Defined in: [interfaces.ts:166](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L166) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/ > `optional` **endBlock**: `number` -Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) +Defined in: [interfaces.ts:168](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L168) *** @@ -34,7 +34,15 @@ Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/ > `optional` **endDate**: `Date` -Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) +Defined in: [interfaces.ts:170](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L170) + +*** + +### escrow? + +> `optional` **escrow**: `string` + +Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) *** @@ -42,7 +50,7 @@ Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -54,7 +62,15 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **fromAddress**: `string` -Defined in: [interfaces.ts:149](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L149) +Defined in: [interfaces.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L171) + +*** + +### method? + +> `optional` **method**: `string` + +Defined in: [interfaces.ts:173](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L173) *** @@ -62,7 +78,7 @@ Defined in: [interfaces.ts:149](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -74,7 +90,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from @@ -86,7 +102,7 @@ Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/ > `optional` **startBlock**: `number` -Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) +Defined in: [interfaces.ts:167](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L167) *** @@ -94,7 +110,7 @@ Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/ > `optional` **startDate**: `Date` -Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) +Defined in: [interfaces.ts:169](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L169) *** @@ -102,4 +118,12 @@ Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/ > `optional` **toAddress**: `string` -Defined in: [interfaces.ts:150](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L150) +Defined in: [interfaces.ts:172](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L172) + +*** + +### token? + +> `optional` **token**: `string` + +Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorker.md b/docs/sdk/typescript/interfaces/interfaces/IWorker.md index 11a8fa9ba5..e089425555 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorker.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorker.md @@ -6,7 +6,7 @@ # Interface: IWorker -Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L174) +Defined in: [interfaces.ts:199](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L199) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:174](https://github.com/humanprotocol/human-protocol/ > **address**: `string` -Defined in: [interfaces.ts:176](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L176) +Defined in: [interfaces.ts:201](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L201) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:176](https://github.com/humanprotocol/human-protocol/ > **id**: `string` -Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L175) +Defined in: [interfaces.ts:200](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L200) *** @@ -30,12 +30,12 @@ Defined in: [interfaces.ts:175](https://github.com/humanprotocol/human-protocol/ > **payoutCount**: `number` -Defined in: [interfaces.ts:178](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L178) +Defined in: [interfaces.ts:203](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L203) *** -### totalAmountReceived +### totalHMTAmountReceived -> **totalAmountReceived**: `number` +> **totalHMTAmountReceived**: `number` -Defined in: [interfaces.ts:177](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L177) +Defined in: [interfaces.ts:202](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L202) diff --git a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md index 14a31aaf66..ee156bb3f3 100644 --- a/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md +++ b/docs/sdk/typescript/interfaces/interfaces/IWorkersFilter.md @@ -6,7 +6,7 @@ # Interface: IWorkersFilter -Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) +Defined in: [interfaces.ts:206](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L206) ## Extends @@ -18,7 +18,7 @@ Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/ > `optional` **address**: `string` -Defined in: [interfaces.ts:183](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L183) +Defined in: [interfaces.ts:208](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L208) *** @@ -26,7 +26,7 @@ Defined in: [interfaces.ts:183](https://github.com/humanprotocol/human-protocol/ > **chainId**: [`ChainId`](../../enums/enumerations/ChainId.md) -Defined in: [interfaces.ts:182](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L182) +Defined in: [interfaces.ts:207](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L207) *** @@ -34,7 +34,7 @@ Defined in: [interfaces.ts:182](https://github.com/humanprotocol/human-protocol/ > `optional` **first**: `number` -Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L154) +Defined in: [interfaces.ts:179](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L179) #### Inherited from @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:154](https://github.com/humanprotocol/human-protocol/ > `optional` **orderBy**: `string` -Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) +Defined in: [interfaces.ts:209](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L209) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/ > `optional` **orderDirection**: [`OrderDirection`](../../enums/enumerations/OrderDirection.md) -Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L156) +Defined in: [interfaces.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L181) #### Inherited from @@ -66,7 +66,7 @@ Defined in: [interfaces.ts:156](https://github.com/humanprotocol/human-protocol/ > `optional` **skip**: `number` -Defined in: [interfaces.ts:155](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L155) +Defined in: [interfaces.ts:180](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L180) #### Inherited from diff --git a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md index 8775833e43..7aea173e31 100644 --- a/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md +++ b/docs/sdk/typescript/interfaces/interfaces/InternalTransaction.md @@ -6,7 +6,7 @@ # Interface: InternalTransaction -Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L119) +Defined in: [interfaces.ts:141](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L141) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:119](https://github.com/humanprotocol/human-protocol/ > `optional` **escrow**: `string` -Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L125) +Defined in: [interfaces.ts:147](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L147) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:125](https://github.com/humanprotocol/human-protocol/ > **from**: `string` -Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L120) +Defined in: [interfaces.ts:142](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L142) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:120](https://github.com/humanprotocol/human-protocol/ > **method**: `string` -Defined in: [interfaces.ts:123](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L123) +Defined in: [interfaces.ts:145](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L145) *** @@ -38,7 +38,7 @@ Defined in: [interfaces.ts:123](https://github.com/humanprotocol/human-protocol/ > `optional` **receiver**: `string` -Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L124) +Defined in: [interfaces.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L146) *** @@ -46,7 +46,7 @@ Defined in: [interfaces.ts:124](https://github.com/humanprotocol/human-protocol/ > **to**: `string` -Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L121) +Defined in: [interfaces.ts:143](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L143) *** @@ -54,7 +54,7 @@ Defined in: [interfaces.ts:121](https://github.com/humanprotocol/human-protocol/ > `optional` **token**: `string` -Defined in: [interfaces.ts:126](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L126) +Defined in: [interfaces.ts:148](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L148) *** @@ -62,4 +62,4 @@ Defined in: [interfaces.ts:126](https://github.com/humanprotocol/human-protocol/ > **value**: `string` -Defined in: [interfaces.ts:122](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L122) +Defined in: [interfaces.ts:144](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L144) diff --git a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md index e0fd825cf4..5b1b553d62 100644 --- a/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md +++ b/docs/sdk/typescript/interfaces/interfaces/StakerInfo.md @@ -6,7 +6,7 @@ # Interface: StakerInfo -Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L159) +Defined in: [interfaces.ts:184](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L184) ## Properties @@ -14,7 +14,7 @@ Defined in: [interfaces.ts:159](https://github.com/humanprotocol/human-protocol/ > **lockedAmount**: `bigint` -Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L161) +Defined in: [interfaces.ts:186](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L186) *** @@ -22,7 +22,7 @@ Defined in: [interfaces.ts:161](https://github.com/humanprotocol/human-protocol/ > **lockedUntil**: `bigint` -Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L162) +Defined in: [interfaces.ts:187](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L187) *** @@ -30,7 +30,7 @@ Defined in: [interfaces.ts:162](https://github.com/humanprotocol/human-protocol/ > **stakedAmount**: `bigint` -Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L160) +Defined in: [interfaces.ts:185](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L185) *** @@ -38,4 +38,4 @@ Defined in: [interfaces.ts:160](https://github.com/humanprotocol/human-protocol/ > **withdrawableAmount**: `bigint` -Defined in: [interfaces.ts:163](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L163) +Defined in: [interfaces.ts:188](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts#L188) diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md index 5e7a7d8eef..29a0802e56 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreClient.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreClient.md @@ -6,7 +6,7 @@ # Class: KVStoreClient -Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) +Defined in: [kvstore.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L99) ## Introduction @@ -82,11 +82,11 @@ const kvstoreClient = await KVStoreClient.build(provider); ## Constructors -### new KVStoreClient() +### Constructor -> **new KVStoreClient**(`runner`, `networkData`): [`KVStoreClient`](KVStoreClient.md) +> **new KVStoreClient**(`runner`, `networkData`): `KVStoreClient` -Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) +Defined in: [kvstore.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L108) **KVStoreClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the KVStore contract #### Returns -[`KVStoreClient`](KVStoreClient.md) +`KVStoreClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,11 +118,11 @@ The network information required to connect to the KVStore contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -130,19 +130,19 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) ## Methods ### set() -> **set**(`key`, `value`, `txOptions`?): `Promise`\<`void`\> +> **set**(`key`, `value`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) +Defined in: [kvstore.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L171) This function sets a key-value pair associated with the address that submits the transaction. @@ -194,9 +194,9 @@ await kvstoreClient.set('Role', 'RecordingOracle'); ### setBulk() -> **setBulk**(`keys`, `values`, `txOptions`?): `Promise`\<`void`\> +> **setBulk**(`keys`, `values`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) +Defined in: [kvstore.ts:214](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L214) This function sets key-value pairs in bulk associated with the address that submits the transaction. @@ -250,9 +250,9 @@ await kvstoreClient.setBulk(keys, values); ### setFileUrlAndHash() -> **setFileUrlAndHash**(`url`, `urlKey`, `txOptions`?): `Promise`\<`void`\> +> **setFileUrlAndHash**(`url`, `urlKey`, `txOptions?`): `Promise`\<`void`\> -Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) +Defined in: [kvstore.ts:257](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L257) Sets a URL value for the address that submits the transaction, and its hash. @@ -303,9 +303,9 @@ await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url'); ### build() -> `static` **build**(`runner`): `Promise`\<[`KVStoreClient`](KVStoreClient.md)\> +> `static` **build**(`runner`): `Promise`\<`KVStoreClient`\> -Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) +Defined in: [kvstore.ts:126](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L126) Creates an instance of KVStoreClient from a runner. @@ -319,7 +319,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`KVStoreClient`](KVStoreClient.md)\> +`Promise`\<`KVStoreClient`\> - An instance of KVStoreClient diff --git a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md index b2256eac5b..e1869bfefb 100644 --- a/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md +++ b/docs/sdk/typescript/kvstore/classes/KVStoreUtils.md @@ -6,7 +6,7 @@ # Class: KVStoreUtils -Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) +Defined in: [kvstore.ts:318](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L318) ## Introduction @@ -41,13 +41,13 @@ const KVStoreAddresses = await KVStoreUtils.getKVStoreData( ## Constructors -### new KVStoreUtils() +### Constructor -> **new KVStoreUtils**(): [`KVStoreUtils`](KVStoreUtils.md) +> **new KVStoreUtils**(): `KVStoreUtils` #### Returns -[`KVStoreUtils`](KVStoreUtils.md) +`KVStoreUtils` ## Methods @@ -55,7 +55,7 @@ const KVStoreAddresses = await KVStoreUtils.getKVStoreData( > `static` **get**(`chainId`, `address`, `key`): `Promise`\<`string`\> -Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) +Defined in: [kvstore.ts:389](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L389) Gets the value of a key-value pair in the KVStore using the subgraph. @@ -116,7 +116,7 @@ console.log(value); > `static` **getFileUrlAndVerifyHash**(`chainId`, `address`, `urlKey`): `Promise`\<`string`\> -Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) +Defined in: [kvstore.ts:436](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L436) Gets the URL value of the given entity, and verifies its hash. @@ -164,7 +164,7 @@ console.log(url); > `static` **getKVStoreData**(`chainId`, `address`): `Promise`\<[`IKVStore`](../../interfaces/interfaces/IKVStore.md)[]\> -Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) +Defined in: [kvstore.ts:337](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L337) This function returns the KVStore data for a given address. @@ -211,7 +211,7 @@ console.log(kvStoreData); > `static` **getPublicKey**(`chainId`, `address`): `Promise`\<`string`\> -Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) +Defined in: [kvstore.ts:496](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/kvstore.ts#L496) Gets the public key of the given entity, and verifies its hash. diff --git a/docs/sdk/typescript/operator/classes/OperatorUtils.md b/docs/sdk/typescript/operator/classes/OperatorUtils.md index 9e675b0bd4..ae01680de8 100644 --- a/docs/sdk/typescript/operator/classes/OperatorUtils.md +++ b/docs/sdk/typescript/operator/classes/OperatorUtils.md @@ -6,17 +6,17 @@ # Class: OperatorUtils -Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) +Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L27) ## Constructors -### new OperatorUtils() +### Constructor -> **new OperatorUtils**(): [`OperatorUtils`](OperatorUtils.md) +> **new OperatorUtils**(): `OperatorUtils` #### Returns -[`OperatorUtils`](OperatorUtils.md) +`OperatorUtils` ## Methods @@ -24,7 +24,7 @@ Defined in: [operator.ts:27](https://github.com/humanprotocol/human-protocol/blo > `static` **getOperator**(`chainId`, `address`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)\> -Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) +Defined in: [operator.ts:43](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L43) This function returns the operator data for the given address. @@ -62,7 +62,7 @@ const operator = await OperatorUtils.getOperator(ChainId.POLYGON_AMOY, '0x62dD51 > `static` **getOperators**(`filter`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) +Defined in: [operator.ts:109](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L109) This function returns all the operator details of the protocol. @@ -95,9 +95,9 @@ const operators = await OperatorUtils.getOperators(filter); ### getReputationNetworkOperators() -> `static` **getReputationNetworkOperators**(`chainId`, `address`, `role`?): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> +> `static` **getReputationNetworkOperators**(`chainId`, `address`, `role?`): `Promise`\<[`IOperator`](../../interfaces/interfaces/IOperator.md)[]\> -Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) +Defined in: [operator.ts:190](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L190) Retrieves the reputation network operators of the specified address. @@ -141,7 +141,7 @@ const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLY > `static` **getRewards**(`chainId`, `slasherAddress`): `Promise`\<[`IReward`](../../interfaces/interfaces/IReward.md)[]\> -Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) +Defined in: [operator.ts:244](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/operator.ts#L244) This function returns information about the rewards for a given slasher address. diff --git a/docs/sdk/typescript/staking/classes/StakingClient.md b/docs/sdk/typescript/staking/classes/StakingClient.md index bd9b92b82e..17a9fd7b36 100644 --- a/docs/sdk/typescript/staking/classes/StakingClient.md +++ b/docs/sdk/typescript/staking/classes/StakingClient.md @@ -6,7 +6,7 @@ # Class: StakingClient -Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) +Defined in: [staking.ts:97](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L97) ## Introduction @@ -82,11 +82,11 @@ const stakingClient = await StakingClient.build(provider); ## Constructors -### new StakingClient() +### Constructor -> **new StakingClient**(`runner`, `networkData`): [`StakingClient`](StakingClient.md) +> **new StakingClient**(`runner`, `networkData`): `StakingClient` -Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) +Defined in: [staking.ts:108](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L108) **StakingClient constructor** @@ -106,11 +106,11 @@ The network information required to connect to the Staking contract #### Returns -[`StakingClient`](StakingClient.md) +`StakingClient` #### Overrides -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructors) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`constructor`](../../base/classes/BaseEthersClient.md#constructor) ## Properties @@ -118,7 +118,7 @@ The network information required to connect to the Staking contract > **escrowFactoryContract**: `EscrowFactory` -Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) +Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L100) *** @@ -126,11 +126,11 @@ Defined in: [staking.ts:100](https://github.com/humanprotocol/human-protocol/blo > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) +Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`networkData`](../../base/classes/BaseEthersClient.md#networkdata) *** @@ -138,11 +138,11 @@ Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/1f > `protected` **runner**: `ContractRunner` -Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) +Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11) #### Inherited from -[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner-1) +[`BaseEthersClient`](../../base/classes/BaseEthersClient.md).[`runner`](../../base/classes/BaseEthersClient.md#runner) *** @@ -150,7 +150,7 @@ Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/1f > **stakingContract**: `Staking` -Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) +Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L99) *** @@ -158,15 +158,15 @@ Defined in: [staking.ts:99](https://github.com/humanprotocol/human-protocol/blob > **tokenContract**: `HMToken` -Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) +Defined in: [staking.ts:98](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L98) ## Methods ### approveStake() -> **approveStake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **approveStake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) +Defined in: [staking.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L193) This function approves the staking contract to transfer a specified amount of tokens when the user stakes. It increases the allowance for the staking contract. @@ -213,7 +213,7 @@ await stakingClient.approveStake(amount); > **getStakerInfo**(`stakerAddress`): `Promise`\<[`StakerInfo`](../../interfaces/interfaces/StakerInfo.md)\> -Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) +Defined in: [staking.ts:435](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L435) Retrieves comprehensive staking information for a staker. @@ -247,9 +247,9 @@ console.log(stakingInfo.tokensStaked); ### slash() -> **slash**(`slasher`, `staker`, `escrowAddress`, `amount`, `txOptions`?): `Promise`\<`void`\> +> **slash**(`slasher`, `staker`, `escrowAddress`, `amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) +Defined in: [staking.ts:373](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L373) This function reduces the allocated amount by a staker in an escrow and transfers those tokens to the reward pool. This allows the slasher to claim them later. @@ -312,9 +312,9 @@ await stakingClient.slash('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd ### stake() -> **stake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **stake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) +Defined in: [staking.ts:247](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L247) This function stakes a specified amount of tokens on a specific network. @@ -362,9 +362,9 @@ await stakingClient.stake(amount); ### unstake() -> **unstake**(`amount`, `txOptions`?): `Promise`\<`void`\> +> **unstake**(`amount`, `txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) +Defined in: [staking.ts:291](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L291) This function unstakes tokens from staking contract. The unstaked tokens stay locked for a period of time. @@ -411,9 +411,9 @@ await stakingClient.unstake(amount); ### withdraw() -> **withdraw**(`txOptions`?): `Promise`\<`void`\> +> **withdraw**(`txOptions?`): `Promise`\<`void`\> -Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) +Defined in: [staking.ts:336](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L336) This function withdraws unstaked and non-locked tokens from staking contract to the user wallet. @@ -453,9 +453,9 @@ await stakingClient.withdraw(); ### build() -> `static` **build**(`runner`): `Promise`\<[`StakingClient`](StakingClient.md)\> +> `static` **build**(`runner`): `Promise`\<`StakingClient`\> -Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) +Defined in: [staking.ts:136](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/staking.ts#L136) Creates an instance of StakingClient from a Runner. @@ -469,7 +469,7 @@ The Runner object to interact with the Ethereum network #### Returns -`Promise`\<[`StakingClient`](StakingClient.md)\> +`Promise`\<`StakingClient`\> - An instance of StakingClient diff --git a/docs/sdk/typescript/statistics/classes/StatisticsClient.md b/docs/sdk/typescript/statistics/classes/StatisticsClient.md index 3dd493b5e5..4ec52d9ef6 100644 --- a/docs/sdk/typescript/statistics/classes/StatisticsClient.md +++ b/docs/sdk/typescript/statistics/classes/StatisticsClient.md @@ -6,7 +6,7 @@ # Class: StatisticsClient -Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) +Defined in: [statistics.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L58) ## Introduction @@ -41,11 +41,11 @@ const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]); ## Constructors -### new StatisticsClient() +### Constructor -> **new StatisticsClient**(`networkData`): [`StatisticsClient`](StatisticsClient.md) +> **new StatisticsClient**(`networkData`): `StatisticsClient` -Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) +Defined in: [statistics.ts:67](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L67) **StatisticsClient constructor** @@ -59,7 +59,7 @@ The network information required to connect to the Statistics contract #### Returns -[`StatisticsClient`](StatisticsClient.md) +`StatisticsClient` ## Properties @@ -67,7 +67,7 @@ The network information required to connect to the Statistics contract > **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md) -Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) +Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L59) *** @@ -75,7 +75,7 @@ Defined in: [statistics.ts:59](https://github.com/humanprotocol/human-protocol/b > **subgraphUrl**: `string` -Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) +Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L60) ## Methods @@ -83,7 +83,7 @@ Defined in: [statistics.ts:60](https://github.com/humanprotocol/human-protocol/b > **getEscrowStatistics**(`filter`): `Promise`\<[`EscrowStatistics`](../../graphql/types/type-aliases/EscrowStatistics.md)\> -Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) +Defined in: [statistics.ts:120](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L120) This function returns the statistical data of escrows. @@ -149,7 +149,7 @@ const escrowStatisticsApril = await statisticsClient.getEscrowStatistics({ > **getHMTDailyData**(`filter`): `Promise`\<[`DailyHMTData`](../../graphql/types/type-aliases/DailyHMTData.md)[]\> -Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) +Defined in: [statistics.ts:478](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L478) This function returns the statistical data of HMToken day by day. @@ -214,7 +214,7 @@ console.log('HMT statistics from 5/8 - 6/8:', hmtStatisticsRange); > **getHMTHolders**(`params`): `Promise`\<[`HMTHolder`](../../graphql/types/type-aliases/HMTHolder.md)[]\> -Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) +Defined in: [statistics.ts:407](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L407) This function returns the holders of the HMToken with optional filters and ordering. @@ -257,7 +257,7 @@ console.log('HMT holders:', hmtHolders.map((h) => ({ > **getHMTStatistics**(): `Promise`\<[`HMTStatistics`](../../graphql/types/type-aliases/HMTStatistics.md)\> -Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) +Defined in: [statistics.ts:364](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L364) This function returns the statistical data of HMToken. @@ -296,7 +296,7 @@ console.log('HMT statistics:', { > **getPaymentStatistics**(`filter`): `Promise`\<[`PaymentStatistics`](../../graphql/types/type-aliases/PaymentStatistics.md)\> -Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) +Defined in: [statistics.ts:300](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L300) This function returns the statistical data of payments. @@ -380,7 +380,7 @@ console.log( > **getWorkerStatistics**(`filter`): `Promise`\<[`WorkerStatistics`](../../graphql/types/type-aliases/WorkerStatistics.md)\> -Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) +Defined in: [statistics.ts:204](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/statistics.ts#L204) This function returns the statistical data of workers. diff --git a/docs/sdk/typescript/storage/classes/StorageClient.md b/docs/sdk/typescript/storage/classes/StorageClient.md index 6204af8592..4fd294967f 100644 --- a/docs/sdk/typescript/storage/classes/StorageClient.md +++ b/docs/sdk/typescript/storage/classes/StorageClient.md @@ -6,7 +6,7 @@ # Class: ~~StorageClient~~ -Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) +Defined in: [storage.ts:63](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L63) ## Deprecated @@ -57,11 +57,11 @@ const storageClient = new StorageClient(params, credentials); ## Constructors -### new StorageClient() +### Constructor -> **new StorageClient**(`params`, `credentials`?): [`StorageClient`](StorageClient.md) +> **new StorageClient**(`params`, `credentials?`): `StorageClient` -Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) +Defined in: [storage.ts:73](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L73) **Storage client constructor** @@ -81,7 +81,7 @@ Optional. Cloud storage access data. If credentials are not provided - use anony #### Returns -[`StorageClient`](StorageClient.md) +`StorageClient` ## Methods @@ -89,7 +89,7 @@ Optional. Cloud storage access data. If credentials are not provided - use anony > **bucketExists**(`bucket`): `Promise`\<`boolean`\> -Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) +Defined in: [storage.ts:262](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L262) This function checks if a bucket exists. @@ -133,7 +133,7 @@ const exists = await storageClient.bucketExists('bucket-name'); > **downloadFiles**(`keys`, `bucket`): `Promise`\<`any`[]\> -Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) +Defined in: [storage.ts:112](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L112) This function downloads files from a bucket. @@ -181,7 +181,7 @@ const files = await storageClient.downloadFiles(keys, 'bucket-name'); > **listObjects**(`bucket`): `Promise`\<`string`[]\> -Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) +Defined in: [storage.ts:292](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L292) This function lists all file names contained in the bucket. @@ -225,7 +225,7 @@ const fileNames = await storageClient.listObjects('bucket-name'); > **uploadFiles**(`files`, `bucket`): `Promise`\<[`UploadFile`](../../types/type-aliases/UploadFile.md)[]\> -Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) +Defined in: [storage.ts:198](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L198) This function uploads files to a bucket. @@ -278,7 +278,7 @@ const uploadedFiles = await storageClient.uploadFiles(files, 'bucket-name'); > `static` **downloadFileFromUrl**(`url`): `Promise`\<`any`\> -Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) +Defined in: [storage.ts:146](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/storage.ts#L146) This function downloads files from a URL. diff --git a/docs/sdk/typescript/transaction/classes/TransactionUtils.md b/docs/sdk/typescript/transaction/classes/TransactionUtils.md index e6031b2f4d..77470e7087 100644 --- a/docs/sdk/typescript/transaction/classes/TransactionUtils.md +++ b/docs/sdk/typescript/transaction/classes/TransactionUtils.md @@ -6,17 +6,17 @@ # Class: TransactionUtils -Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) +Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L18) ## Constructors -### new TransactionUtils() +### Constructor -> **new TransactionUtils**(): [`TransactionUtils`](TransactionUtils.md) +> **new TransactionUtils**(): `TransactionUtils` #### Returns -[`TransactionUtils`](TransactionUtils.md) +`TransactionUtils` ## Methods @@ -24,10 +24,26 @@ Defined in: [transaction.ts:18](https://github.com/humanprotocol/human-protocol/ > `static` **getTransaction**(`chainId`, `hash`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)\> -Defined in: [transaction.ts:34](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L34) +Defined in: [transaction.ts:50](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L50) This function returns the transaction data for the given hash. +```ts +type ITransaction = { + block: bigint; + txHash: string; + from: string; + to: string; + timestamp: bigint; + value: string; + method: string; + receiver?: string; + escrow?: string; + token?: string; + internalTransactions: InternalTransaction[]; +}; +``` + #### Parameters ##### chainId @@ -62,7 +78,7 @@ const transaction = await TransactionUtils.getTransaction(ChainId.POLYGON, '0x62 > `static` **getTransactions**(`filter`): `Promise`\<[`ITransaction`](../../interfaces/interfaces/ITransaction.md)[]\> -Defined in: [transaction.ts:109](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L109) +Defined in: [transaction.ts:132](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/transaction.ts#L132) This function returns all transaction details based on the provided filter. @@ -75,6 +91,9 @@ interface ITransactionsFilter { chainId: ChainId; // List of chain IDs to query. fromAddress?: string; // (Optional) The address from which transactions are sent. toAddress?: string; // (Optional) The address to which transactions are sent. + method?: string; // (Optional) The method of the transaction to filter by. + escrow?: string; // (Optional) The escrow address to filter transactions. + token?: string; // (Optional) The token address to filter transactions. startDate?: Date; // (Optional) The start date to filter transactions (inclusive). endDate?: Date; // (Optional) The end date to filter transactions (inclusive). startBlock?: number; // (Optional) The start block number to filter transactions (inclusive). @@ -87,13 +106,17 @@ interface ITransactionsFilter { ```ts type ITransaction = { - block: number; + block: bigint; txHash: string; from: string; to: string; - timestamp: number; + timestamp: bigint; value: string; method: string; + receiver?: string; + escrow?: string; + token?: string; + internalTransactions: InternalTransaction[]; }; ``` diff --git a/docs/sdk/typescript/types/enumerations/EscrowStatus.md b/docs/sdk/typescript/types/enumerations/EscrowStatus.md index d0e0362ce2..716cac332f 100644 --- a/docs/sdk/typescript/types/enumerations/EscrowStatus.md +++ b/docs/sdk/typescript/types/enumerations/EscrowStatus.md @@ -6,7 +6,7 @@ # Enumeration: EscrowStatus -Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) +Defined in: [types.ts:8](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L8) Enum for escrow statuses. @@ -16,7 +16,7 @@ Enum for escrow statuses. > **Cancelled**: `5` -Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) +Defined in: [types.ts:32](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L32) Escrow is cancelled. @@ -26,7 +26,7 @@ Escrow is cancelled. > **Complete**: `4` -Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) +Defined in: [types.ts:28](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L28) Escrow is finished. @@ -36,7 +36,7 @@ Escrow is finished. > **Launched**: `0` -Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) +Defined in: [types.ts:12](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L12) Escrow is launched. @@ -46,7 +46,7 @@ Escrow is launched. > **Paid**: `3` -Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) +Defined in: [types.ts:24](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L24) Escrow is fully paid. @@ -56,7 +56,7 @@ Escrow is fully paid. > **Partial**: `2` -Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) +Defined in: [types.ts:20](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L20) Escrow is partially paid out. @@ -66,6 +66,6 @@ Escrow is partially paid out. > **Pending**: `1` -Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) +Defined in: [types.ts:16](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L16) Escrow is funded, and waiting for the results to be submitted. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md index 8d4fd28d84..8cdbec8abc 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowCancel.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowCancel.md @@ -6,22 +6,28 @@ # Type Alias: EscrowCancel -> **EscrowCancel**: `object` +> **EscrowCancel** = `object` -Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) +Defined in: [types.ts:145](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L145) Represents the response data for an escrow cancellation. -## Type declaration +## Properties ### amountRefunded > **amountRefunded**: `bigint` +Defined in: [types.ts:153](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L153) + The amount refunded in the escrow cancellation. +*** + ### txHash > **txHash**: `string` +Defined in: [types.ts:149](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L149) + The hash of the transaction associated with the escrow cancellation. diff --git a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md index cc8658ac8c..8706f5b8a6 100644 --- a/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md +++ b/docs/sdk/typescript/types/type-aliases/EscrowWithdraw.md @@ -6,28 +6,38 @@ # Type Alias: EscrowWithdraw -> **EscrowWithdraw**: `object` +> **EscrowWithdraw** = `object` -Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) +Defined in: [types.ts:159](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L159) Represents the response data for an escrow withdrawal. -## Type declaration +## Properties ### amountWithdrawn > **amountWithdrawn**: `bigint` +Defined in: [types.ts:171](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L171) + The amount withdrawn from the escrow. +*** + ### tokenAddress > **tokenAddress**: `string` +Defined in: [types.ts:167](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L167) + The address of the token used for the withdrawal. +*** + ### txHash > **txHash**: `string` +Defined in: [types.ts:163](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L163) + The hash of the transaction associated with the escrow withdrawal. diff --git a/docs/sdk/typescript/types/type-aliases/NetworkData.md b/docs/sdk/typescript/types/type-aliases/NetworkData.md index 159e72044f..a2276446b6 100644 --- a/docs/sdk/typescript/types/type-aliases/NetworkData.md +++ b/docs/sdk/typescript/types/type-aliases/NetworkData.md @@ -6,76 +6,118 @@ # Type Alias: NetworkData -> **NetworkData**: `object` +> **NetworkData** = `object` -Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) +Defined in: [types.ts:95](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L95) Network data -## Type declaration +## Properties ### chainId > **chainId**: `number` +Defined in: [types.ts:99](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L99) + Network chain id +*** + ### factoryAddress > **factoryAddress**: `string` +Defined in: [types.ts:115](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L115) + Escrow Factory contract address +*** + ### hmtAddress > **hmtAddress**: `string` +Defined in: [types.ts:111](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L111) + HMT Token contract address +*** + ### kvstoreAddress > **kvstoreAddress**: `string` +Defined in: [types.ts:123](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L123) + KVStore contract address +*** + ### oldFactoryAddress > **oldFactoryAddress**: `string` +Defined in: [types.ts:139](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L139) + Old Escrow Factory contract address +*** + ### oldSubgraphUrl > **oldSubgraphUrl**: `string` +Defined in: [types.ts:135](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L135) + Old subgraph URL +*** + ### scanUrl > **scanUrl**: `string` +Defined in: [types.ts:107](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L107) + Network scanner URL +*** + ### stakingAddress > **stakingAddress**: `string` +Defined in: [types.ts:119](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L119) + Staking contract address +*** + ### subgraphUrl > **subgraphUrl**: `string` +Defined in: [types.ts:127](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L127) + Subgraph URL +*** + ### subgraphUrlApiKey > **subgraphUrlApiKey**: `string` +Defined in: [types.ts:131](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L131) + Subgraph URL API key +*** + ### title > **title**: `string` +Defined in: [types.ts:103](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L103) + Network title diff --git a/docs/sdk/typescript/types/type-aliases/Payout.md b/docs/sdk/typescript/types/type-aliases/Payout.md index 66df79f1a1..d366f1118f 100644 --- a/docs/sdk/typescript/types/type-aliases/Payout.md +++ b/docs/sdk/typescript/types/type-aliases/Payout.md @@ -6,40 +6,58 @@ # Type Alias: Payout -> **Payout**: `object` +> **Payout** = `object` -Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) +Defined in: [types.ts:177](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L177) Represents a payout from an escrow. -## Type declaration +## Properties ### amount > **amount**: `bigint` +Defined in: [types.ts:193](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L193) + The amount paid to the recipient. +*** + ### createdAt > **createdAt**: `number` +Defined in: [types.ts:197](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L197) + The timestamp when the payout was created (in UNIX format). +*** + ### escrowAddress > **escrowAddress**: `string` +Defined in: [types.ts:185](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L185) + The address of the escrow associated with the payout. +*** + ### id > **id**: `string` +Defined in: [types.ts:181](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L181) + Unique identifier of the payout. +*** + ### recipient > **recipient**: `string` +Defined in: [types.ts:189](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L189) + The address of the recipient who received the payout. diff --git a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md index ad1b794aec..c87013b209 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageCredentials.md +++ b/docs/sdk/typescript/types/type-aliases/StorageCredentials.md @@ -6,26 +6,32 @@ # Type Alias: ~~StorageCredentials~~ -> `readonly` **StorageCredentials**: `object` +> `readonly` **StorageCredentials** = `object` -Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) +Defined in: [types.ts:40](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L40) AWS/GCP cloud storage access data -## Type declaration +## Deprecated + +StorageClient is deprecated. Use Minio.Client directly. + +## Properties ### ~~accessKey~~ > **accessKey**: `string` +Defined in: [types.ts:44](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L44) + Access Key +*** + ### ~~secretKey~~ > **secretKey**: `string` -Secret Key - -## Deprecated +Defined in: [types.ts:48](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L48) -StorageClient is deprecated. Use Minio.Client directly. +Secret Key diff --git a/docs/sdk/typescript/types/type-aliases/StorageParams.md b/docs/sdk/typescript/types/type-aliases/StorageParams.md index d86df41951..87f599ea09 100644 --- a/docs/sdk/typescript/types/type-aliases/StorageParams.md +++ b/docs/sdk/typescript/types/type-aliases/StorageParams.md @@ -6,36 +6,50 @@ # Type Alias: ~~StorageParams~~ -> **StorageParams**: `object` +> **StorageParams** = `object` -Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) +Defined in: [types.ts:54](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L54) -## Type declaration +## Deprecated + +StorageClient is deprecated. Use Minio.Client directly. + +## Properties ### ~~endPoint~~ > **endPoint**: `string` +Defined in: [types.ts:58](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L58) + Request endPoint +*** + ### ~~port?~~ > `optional` **port**: `number` +Defined in: [types.ts:70](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L70) + TCP/IP port number. Default value set to 80 for HTTP and 443 for HTTPs +*** + ### ~~region?~~ > `optional` **region**: `string` +Defined in: [types.ts:66](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L66) + Region +*** + ### ~~useSSL~~ > **useSSL**: `boolean` -Enable secure (HTTPS) access. Default value set to false +Defined in: [types.ts:62](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L62) -## Deprecated - -StorageClient is deprecated. Use Minio.Client directly. +Enable secure (HTTPS) access. Default value set to false diff --git a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md index ed7f7a1bd4..a98655afd0 100644 --- a/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md +++ b/docs/sdk/typescript/types/type-aliases/TransactionLikeWithNonce.md @@ -6,9 +6,9 @@ # Type Alias: TransactionLikeWithNonce -> **TransactionLikeWithNonce**: `TransactionLike` & `object` +> **TransactionLikeWithNonce** = `TransactionLike` & `object` -Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) +Defined in: [types.ts:200](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L200) ## Type declaration diff --git a/docs/sdk/typescript/types/type-aliases/UploadFile.md b/docs/sdk/typescript/types/type-aliases/UploadFile.md index 29759d4af4..7862bb8c22 100644 --- a/docs/sdk/typescript/types/type-aliases/UploadFile.md +++ b/docs/sdk/typescript/types/type-aliases/UploadFile.md @@ -6,28 +6,38 @@ # Type Alias: UploadFile -> `readonly` **UploadFile**: `object` +> `readonly` **UploadFile** = `object` -Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/1fed10bebf38e474662f3001345d050ccf6fda2f/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) +Defined in: [types.ts:77](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L77) Upload file data -## Type declaration +## Properties ### hash > **hash**: `string` +Defined in: [types.ts:89](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L89) + Hash of uploaded object key +*** + ### key > **key**: `string` +Defined in: [types.ts:81](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L81) + Uploaded object key +*** + ### url > **url**: `string` +Defined in: [types.ts:85](https://github.com/humanprotocol/human-protocol/blob/9da418b6962e251427442717195921599d2815f2/packages/sdk/typescript/human-protocol-sdk/src/types.ts#L85) + Uploaded object URL diff --git a/package.json b/package.json index 4bb0c41bee..e101aba252 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,12 @@ "lint": "yarn workspaces foreach --all -p run lint", "build:core": "yarn workspace @human-protocol/core build", "build:sdk": "yarn workspace @human-protocol/sdk build", - "build:libs": "yarn build:core && yarn build:sdk" + "build:libs": "yarn build:core && yarn build:sdk", + "docker:infra-up": "make -C ./docker-setup -f Makefile.dev infra-up", + "docker:infra-stop": "make -C ./docker-setup -f Makefile.dev infra-stop", + "docker:infra-down": "make -C ./docker-setup -f Makefile.dev infra-down", + "docker:web3-up": "make -C ./docker-setup -f Makefile.dev web3-up", + "docker:web3-down": "make -C ./docker-setup -f Makefile.dev web3-down" }, "workspaces": [ "packages/**" diff --git a/packages/apps/dashboard/client/.env.example b/packages/apps/dashboard/client/.env.example index 62ebf481d3..7308b99ba5 100644 --- a/packages/apps/dashboard/client/.env.example +++ b/packages/apps/dashboard/client/.env.example @@ -1,22 +1,26 @@ -# link to api -VITE_API_URL= -# links to navbar items -VITE_NAVBAR_LINK_GITBOOK= -VITE_NAVBAR_LINK_FAUCETS= -VITE_NAVBAR_LINK_HUMAN_WEBSITE= -VITE_NAVBAR_LINK_LAUNCH_JOBS= -VITE_NAVBAR_LINK_WORK_AND_EARN= -# link to button on 'Role details' page -VITE_HUMANPROTOCOL_CORE_ARCHITECTURE= -# links to footer socials -VITE_FOOTER_LINK_GITHUB= -VITE_FOOTER_LINK_DISCORD= -VITE_FOOTER_LINK_X= -VITE_FOOTER_LINK_TELEGRAM= -VITE_FOOTER_LINK_LINKEDIN= -# other footer links -VITE_FOOTER_LINK_TERMS_OF_SERVICE= -VITE_FOOTER_LINK_PRIVACY_POLICY= -VITE_FOOTER_LINK_HUMAN_PROTOCOL= +# General +VITE_API_URL=http://0.0.0.0:5006 +VITE_ENABLED_CHAIN_IDS=97,80002,11155111 + +# Links to navbar items +VITE_NAVBAR_LINK_GITBOOK=https://docs.humanprotocol.org/ +VITE_NAVBAR_LINK_FAUCETS=https://faucet.humanprotocol.org +VITE_NAVBAR_LINK_HUMAN_WEBSITE=https://humanprotocol.org/ +VITE_NAVBAR_LINK_LAUNCH_JOBS=https://job-launcher.humanprotocol.org/ +VITE_NAVBAR_LINK_WORK_AND_EARN=https://app.humanprotocol.org/ + +# Link to button on 'Role details' page +VITE_HUMANPROTOCOL_CORE_ARCHITECTURE=https://docs.humanprotocol.org/hub/human-tech-docs/architecture + +# Links to footer socials +VITE_FOOTER_LINK_GITHUB=https://github.com/humanprotocol/human-protocol +VITE_FOOTER_LINK_DISCORD=https://discord.com/invite/5sHfvE8y8p +VITE_FOOTER_LINK_X=https://x.com/intent/follow?screen_name=human_protocol +VITE_FOOTER_LINK_TELEGRAM=https://t.me/human_protocol_community +VITE_FOOTER_LINK_LINKEDIN=https://www.linkedin.com/company/human-protocol + +# Other footer links +VITE_FOOTER_LINK_TERMS_OF_SERVICE=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_PRIVACY_POLICY=https://humanprotocol.org/privacy-policy +VITE_FOOTER_LINK_HUMAN_PROTOCOL=https://humanprotocol.org/ -VITE_ENABLED_CHAIN_IDS= diff --git a/packages/apps/dashboard/client/.eslintrc.cjs b/packages/apps/dashboard/client/.eslintrc.cjs deleted file mode 100644 index 071a19765f..0000000000 --- a/packages/apps/dashboard/client/.eslintrc.cjs +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - 'plugin:react-hooks/recommended', - ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], - rules: { - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, -}; diff --git a/packages/apps/dashboard/client/.gitignore b/packages/apps/dashboard/client/.gitignore index a547bf36d8..adc48a4b49 100644 --- a/packages/apps/dashboard/client/.gitignore +++ b/packages/apps/dashboard/client/.gitignore @@ -17,6 +17,7 @@ dist-ssr !.vscode/extensions.json .idea .DS_Store +.eslintcache *.suo *.ntvs* *.njsproj diff --git a/packages/apps/dashboard/client/eslint.config.js b/packages/apps/dashboard/client/eslint.config.js new file mode 100644 index 0000000000..dcf3e17b34 --- /dev/null +++ b/packages/apps/dashboard/client/eslint.config.js @@ -0,0 +1,99 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import reactPlugin from 'eslint-plugin-react'; +import reactHooksPlugin from 'eslint-plugin-react-hooks'; +import prettierPlugin from 'eslint-plugin-prettier'; +import importPlugin from 'eslint-plugin-import'; +import globals from 'globals'; + +export default tseslint.config( + { + ignores: ['dist/', 'tsconfig.json'], + }, + eslint.configs.recommended, + tseslint.configs.recommended, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + ecmaVersion: 2022, + sourceType: 'module', + parser: tseslint.parser, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + projectService: true, + }, + globals: { + ...globals.browser, + ...globals.es2022, + }, + }, + plugins: { + react: reactPlugin, + 'react-hooks': reactHooksPlugin, + prettier: prettierPlugin, + import: importPlugin, + }, + settings: { + react: { + version: 'detect', + }, + 'import/resolver': { + typescript: { + alwaysTryTypes: true, + }, + }, + }, + rules: { + 'react/prop-types': 'off', + 'react/display-name': 'off', + 'react/react-in-jsx-scope': 'off', + 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/rules-of-hooks': 'error', + 'import/order': [ + 'error', + { + 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], + 'pathGroups': [ + { + 'pattern': 'react', + 'group': 'external', + 'position': 'before' + } + ], + 'pathGroupsExcludedImportTypes': ['react'], + 'newlines-between': 'always', + 'alphabetize': { + 'order': 'asc', + 'caseInsensitive': true + } + } + ], + 'import/no-duplicates': 'error', + 'import/no-unresolved': 'error', + '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }], + '@typescript-eslint/no-explicit-any': 'error', + 'no-console': ['error', { allow: ['warn', 'error'] }], + quotes: [ + 'error', + 'single', + { + avoidEscape: true, + }, + ], + 'no-restricted-imports': [ + 'error', + { + paths: [ + { + name: 'lodash', + message: + 'Please import only specific modules from lodash to reduce bundle size. Instead of import {compact} from `lodash`, import compact from lodash/compact', + }, + ], + }, + ], + }, + } +); diff --git a/packages/apps/dashboard/client/index.html b/packages/apps/dashboard/client/index.html index c533b6ac6b..3b1a160e05 100644 --- a/packages/apps/dashboard/client/index.html +++ b/packages/apps/dashboard/client/index.html @@ -18,6 +18,6 @@
- + diff --git a/packages/apps/dashboard/client/package.json b/packages/apps/dashboard/client/package.json index 90e9fa80b2..8e0eef6f20 100644 --- a/packages/apps/dashboard/client/package.json +++ b/packages/apps/dashboard/client/package.json @@ -9,10 +9,12 @@ "clean": "tsc --build --clean && rm -rf dist", "start": "vite", "build": "tsc --build && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "lint": "yarn typecheck && eslint . --report-unused-disable-directives --max-warnings 0", + "lint:fix": "eslint . --fix", "preview": "vite preview", "vercel-build": "yarn workspace human-protocol build:libs && yarn build", - "test": "exit 0" + "test": "exit 0", + "typecheck": "tsc --noEmit" }, "dependencies": { "@emotion/react": "^11.11.4", @@ -44,18 +46,29 @@ "zustand": "^4.5.4" }, "devDependencies": { + "@eslint/js": "^9.27.0", "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", "@vitejs/plugin-react": "^4.2.1", - "eslint": "^8.57.0", - "eslint-plugin-react-hooks": "^5.1.0", + "eslint": "^9.27.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-prettier": "^5.4.0", + "eslint-plugin-react": "^7.37.5", + "eslint-plugin-react-hooks": "^5.2.0", "eslint-plugin-react-refresh": "^0.4.11", + "globals": "^16.2.0", "prettier": "^3.4.2", "sass": "^1.85.0", "typescript": "^5.6.3", - "vite": "^6.2.4", - "vite-plugin-svgr": "^4.2.0" + "typescript-eslint": "^8.33.0", + "vite": "^6.2.4" + }, + "lint-staged": { + "*.{ts,tsx}": [ + "prettier --write", + "eslint --cache --fix" + ] } } diff --git a/packages/apps/dashboard/client/src/assets/styles/favicon.ico b/packages/apps/dashboard/client/public/favicon.ico similarity index 100% rename from packages/apps/dashboard/client/src/assets/styles/favicon.ico rename to packages/apps/dashboard/client/public/favicon.ico diff --git a/packages/apps/dashboard/client/public/vite.svg b/packages/apps/dashboard/client/public/vite.svg deleted file mode 100644 index c200287f03..0000000000 --- a/packages/apps/dashboard/client/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/App.css b/packages/apps/dashboard/client/src/App.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/apps/dashboard/client/src/App.tsx b/packages/apps/dashboard/client/src/App.tsx deleted file mode 100644 index 5ed277c1f9..0000000000 --- a/packages/apps/dashboard/client/src/App.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React from 'react'; -import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; -import Home from '@pages/Home'; -import Graph from '@pages/Graph'; -import SearchResults from '@pages/SearchResults'; -import { LeaderBoard } from '@pages/Leaderboard'; - -const App: React.FC = () => { - return ( - - - } /> - } /> - } /> - } /> - Not find} /> - - - ); -}; - -export default App; diff --git a/packages/apps/dashboard/client/src/app/AppRoutes.tsx b/packages/apps/dashboard/client/src/app/AppRoutes.tsx new file mode 100644 index 0000000000..866ee88553 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/AppRoutes.tsx @@ -0,0 +1,26 @@ +import { FC } from 'react'; + +import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'; + +import GraphPage from '@/pages/graph'; +import HomePage from '@/pages/home'; +import LeaderboardPage from '@/pages/leaderboard'; +import SearchResultsPage from '@/pages/searchResults'; + +import { ROUTES } from './config/routes'; + +const AppRoutes: FC = () => { + return ( + + + } /> + } /> + } /> + } /> + Not found} /> + + + ); +}; + +export default AppRoutes; diff --git a/packages/apps/dashboard/client/src/app/config/routes.ts b/packages/apps/dashboard/client/src/app/config/routes.ts new file mode 100644 index 0000000000..9990f8335a --- /dev/null +++ b/packages/apps/dashboard/client/src/app/config/routes.ts @@ -0,0 +1,6 @@ +export const ROUTES = { + HOME: '/', + LEADERBOARD: '/leaderboard', + GRAPH: '/graph', + SEARCH: '/search/:chainId/:address', +} as const; diff --git a/packages/apps/dashboard/client/src/main.tsx b/packages/apps/dashboard/client/src/app/index.tsx similarity index 63% rename from packages/apps/dashboard/client/src/main.tsx rename to packages/apps/dashboard/client/src/app/index.tsx index 6d62a8b395..04a926ce42 100644 --- a/packages/apps/dashboard/client/src/main.tsx +++ b/packages/apps/dashboard/client/src/app/index.tsx @@ -1,26 +1,25 @@ import React from 'react'; + +import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import ReactDOM from 'react-dom/client'; -import { ThemeProvider } from '@mui/material/styles'; -import CssBaseline from '@mui/material/CssBaseline'; -import theme from './theme'; -import App from './App'; -import '@assets/styles/main.scss'; + +import AppRoutes from './AppRoutes'; +import ThemeProvider from './providers/ThemeProvider'; +import './styles/main.scss'; import 'simplebar-react/dist/simplebar.min.css'; -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; const queryClient = new QueryClient({ defaultOptions: { mutations: { retry: 0 }, - queries: { retry: 0 }, + queries: { retry: 0, refetchOnWindowFocus: false }, }, }); ReactDOM.createRoot(document.getElementById('root')!).render( - - + - + diff --git a/packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx b/packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx new file mode 100644 index 0000000000..82045f6af2 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/providers/ThemeProvider.tsx @@ -0,0 +1,74 @@ +import { + FC, + PropsWithChildren, + useCallback, + useEffect, + useMemo, + useState, +} from 'react'; + +import { + CssBaseline, + PaletteMode, + ThemeProvider as MuiThemeProvider, +} from '@mui/material'; + +import { createAppTheme } from '@/shared/ui/theme'; + +const THEME_STORAGE_KEY = 'dashboard-app-theme-mode'; +const RELEASE_DARK_MODE = false; // TODO: remove this once we release the dark mode + +const ThemeProvider: FC = ({ children }) => { + const [mode, setMode] = useState(() => { + if (!RELEASE_DARK_MODE) return 'light'; + + const savedMode = localStorage.getItem(THEME_STORAGE_KEY) as PaletteMode; + if (savedMode) return savedMode; + + if ( + window.matchMedia && + window.matchMedia('(prefers-color-scheme: dark)').matches + ) { + return 'dark'; + } + return 'light'; + }); + + useEffect(() => { + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + const handleChange = (e: MediaQueryListEvent) => { + setMode(e.matches ? 'dark' : 'light'); + }; + + mediaQuery.addEventListener('change', handleChange); + return () => mediaQuery.removeEventListener('change', handleChange); + }, []); + + useEffect(() => { + localStorage.setItem(THEME_STORAGE_KEY, mode); + }, [mode]); + + const toggleColorMode = useCallback(() => { + setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light')); + }, []); + + const theme = useMemo(() => createAppTheme(mode), [mode]); + + const extendedTheme = useMemo( + () => ({ + ...theme, + isDarkMode: mode === 'dark', + toggleColorMode, + }), + [theme, mode, toggleColorMode] + ); + + return ( + + + {children} + + ); +}; + +export default ThemeProvider; diff --git a/packages/apps/dashboard/client/src/app/styles/_const.scss b/packages/apps/dashboard/client/src/app/styles/_const.scss new file mode 100644 index 0000000000..2f3774c914 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/styles/_const.scss @@ -0,0 +1,5 @@ +$maWhite: #F6F7FE; +$primary: #320A8D; +$white: #fff; +$secondary: #6309FF; +$skyOpacity: #DADEF0CC; \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/assets/styles/_graph-swipper.scss b/packages/apps/dashboard/client/src/app/styles/_graph-swipper.scss similarity index 74% rename from packages/apps/dashboard/client/src/assets/styles/_graph-swipper.scss rename to packages/apps/dashboard/client/src/app/styles/_graph-swipper.scss index 4176d2fffd..70b3f74ea0 100644 --- a/packages/apps/dashboard/client/src/assets/styles/_graph-swipper.scss +++ b/packages/apps/dashboard/client/src/app/styles/_graph-swipper.scss @@ -1,5 +1,9 @@ .swiper-button-next, .swiper-button-prev { - top: 35% + top: 50%; + + @media (max-width: 900px) { + top: 30%; + } } .swiper-button-next::after, .swiper-button-prev::after { diff --git a/packages/apps/dashboard/client/src/app/styles/_home-page.scss b/packages/apps/dashboard/client/src/app/styles/_home-page.scss new file mode 100644 index 0000000000..e0c55f0895 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/styles/_home-page.scss @@ -0,0 +1,7 @@ +.home-page-search { + margin-top: 24px; +} + +.home-page-leaderboard { + margin-top: 60px; +} diff --git a/packages/apps/dashboard/client/src/assets/styles/_page-wrapper.scss b/packages/apps/dashboard/client/src/app/styles/_page-wrapper.scss similarity index 54% rename from packages/apps/dashboard/client/src/assets/styles/_page-wrapper.scss rename to packages/apps/dashboard/client/src/app/styles/_page-wrapper.scss index 6891dda980..647bdf1945 100644 --- a/packages/apps/dashboard/client/src/assets/styles/_page-wrapper.scss +++ b/packages/apps/dashboard/client/src/app/styles/_page-wrapper.scss @@ -1,32 +1,23 @@ .page-wrapper { + display: flex; + flex-direction: column; margin: 0 56px; - min-height: calc(100vh - 206px); - border-bottom-left-radius: 20px; - border-bottom-right-radius: 20px; - display: flex; - flex-direction: column; - padding: 14px 0; - height: 100vh; + padding: 0; + min-height: 100dvh; @media (max-width: 1280px) { - border-radius: 0; - height: auto; + margin: 0 24px; } .container { margin: auto; padding: 30px 80px 100px; - @media (max-width: 1100px) { - padding: 30px 16px; + @media (max-width: 1200px) { + padding: 24px 16px; } } - @media (max-width: 1280px) { - min-height: calc(100vh - 386px); - margin: 0 24px; - } - @media (max-width: 600px) { margin: 0; } @@ -36,11 +27,15 @@ z-index: 10; border-radius: 20px; background-size: 100% 100%; - background: linear-gradient(to bottom, $primary 252px, $maWhite 1px); + background: linear-gradient(to bottom, $primary 252px, $maWhite 0px); + + @media (max-width: 900px) { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } @media (max-width: 600px) { - border-top-left-radius: 0; - border-top-right-radius: 0; + border-radius: 0; } } diff --git a/packages/apps/dashboard/client/src/app/styles/_search.scss b/packages/apps/dashboard/client/src/app/styles/_search.scss new file mode 100644 index 0000000000..c687f453c0 --- /dev/null +++ b/packages/apps/dashboard/client/src/app/styles/_search.scss @@ -0,0 +1,24 @@ +.search { + position: relative; + width: 920px; + max-width: 100%; + border: 1px solid; + border-color: $skyOpacity; + border-radius: 13px; + + #search-bar{ + width: 100%; + border-radius: 8px; + line-height: 24px; + + &:focus, &:focus-visible { + border-color: $secondary; + outline: none; + } + &:-webkit-autofill { + -webkit-text-fill-color: $primary; + box-shadow: 0 0 0px 1000px $white inset; + } + + } +} diff --git a/packages/apps/dashboard/client/src/assets/styles/_shadow-icon.scss b/packages/apps/dashboard/client/src/app/styles/_shadow-icon.scss similarity index 73% rename from packages/apps/dashboard/client/src/assets/styles/_shadow-icon.scss rename to packages/apps/dashboard/client/src/app/styles/_shadow-icon.scss index bf50fc4162..3dfec75db9 100644 --- a/packages/apps/dashboard/client/src/assets/styles/_shadow-icon.scss +++ b/packages/apps/dashboard/client/src/app/styles/_shadow-icon.scss @@ -1,9 +1,13 @@ .shadow-icon{ display: flex; + align-items: center; gap: 16px; - height: 90px; + height: 78px; + &__icon { - width: 65px; + width: 66px; + height: 100%; + padding: 6px; display: flex; justify-content: center; align-items: center; @@ -14,14 +18,12 @@ height: 130px; } span{ - padding-top: 20px; font-size: 28px; font-weight: 600; } - @media (max-width: 400px) { + @media (max-width: 600px) { span { - padding-top: 30px; font-size: 20px; font-weight: 500; } diff --git a/packages/apps/dashboard/client/src/assets/styles/main.scss b/packages/apps/dashboard/client/src/app/styles/main.scss similarity index 60% rename from packages/apps/dashboard/client/src/assets/styles/main.scss rename to packages/apps/dashboard/client/src/app/styles/main.scss index e1848c1a11..2ddc2cf6e3 100644 --- a/packages/apps/dashboard/client/src/assets/styles/main.scss +++ b/packages/apps/dashboard/client/src/app/styles/main.scss @@ -1,10 +1,6 @@ @import 'const'; -@import 'header'; @import 'page-wrapper'; -@import 'footer'; @import 'home-page'; @import 'search'; @import 'shadow-icon'; -@import 'breadcrumbs'; -@import 'nothing-found'; @import "graph-swipper"; diff --git a/packages/apps/dashboard/client/src/assets/bing.png b/packages/apps/dashboard/client/src/assets/bing.png deleted file mode 100644 index c1eab49c16..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/bing.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/bitfinex.png b/packages/apps/dashboard/client/src/assets/bitfinex.png deleted file mode 100644 index 2908ffb464..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/bitfinex.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/coinlist.png b/packages/apps/dashboard/client/src/assets/coinlist.png deleted file mode 100644 index 68b8e6110c..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/coinlist.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/ethereum.png b/packages/apps/dashboard/client/src/assets/ethereum.png deleted file mode 100644 index fcd17dba96..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/ethereum.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/exchange.png b/packages/apps/dashboard/client/src/assets/exchange.png deleted file mode 100644 index d48b1b3d00..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/exchange.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/gate.png b/packages/apps/dashboard/client/src/assets/gate.png deleted file mode 100644 index ff63264f50..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/gate.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/human.png b/packages/apps/dashboard/client/src/assets/human.png deleted file mode 100644 index c42b6b71cc..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/human.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/icons/binance.svg b/packages/apps/dashboard/client/src/assets/icons/binance.svg deleted file mode 100644 index ab171b13dd..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/binance.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/celo.svg b/packages/apps/dashboard/client/src/assets/icons/celo.svg deleted file mode 100644 index 6fa2e074a4..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/celo.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/discord.svg b/packages/apps/dashboard/client/src/assets/icons/discord.svg deleted file mode 100644 index 079c049929..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/discord.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/ethereum.svg b/packages/apps/dashboard/client/src/assets/icons/ethereum.svg deleted file mode 100644 index aaafc35867..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/ethereum.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg deleted file mode 100644 index 5452044828..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/exchange-oracle.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg b/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg deleted file mode 100644 index 44d5e471a0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/excluded/escrow.svg +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg b/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg deleted file mode 100644 index f081e6fda0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/excluded/wallet.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/human-app.svg b/packages/apps/dashboard/client/src/assets/icons/human-app.svg deleted file mode 100644 index 9a9290e7c2..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/human-app.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg b/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg deleted file mode 100644 index 433c97afa8..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/job-launcher.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg b/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg deleted file mode 100644 index 800dd14dec..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/moonbeam.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/okx.svg b/packages/apps/dashboard/client/src/assets/icons/okx.svg deleted file mode 100644 index 515c561adf..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/okx.svg +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/polygon.svg b/packages/apps/dashboard/client/src/assets/icons/polygon.svg deleted file mode 100644 index 2dfb9ed98f..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/polygon.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg deleted file mode 100644 index e703d0b8a3..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/recording-oracle.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg b/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg deleted file mode 100644 index 69f056ede0..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/reputation-oracle.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/icons/xlayer.svg b/packages/apps/dashboard/client/src/assets/icons/xlayer.svg deleted file mode 100644 index b3c4db1cb6..0000000000 --- a/packages/apps/dashboard/client/src/assets/icons/xlayer.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/apps/dashboard/client/src/assets/lbank.png b/packages/apps/dashboard/client/src/assets/lbank.png deleted file mode 100644 index 4ebb88b9d3..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/lbank.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/logo-mobile.png b/packages/apps/dashboard/client/src/assets/logo-mobile.png deleted file mode 100644 index 34bedd58fc..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/logo-mobile.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/logo.png b/packages/apps/dashboard/client/src/assets/logo.png deleted file mode 100644 index dc273f1d30..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/logo.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/probitGlobal.png b/packages/apps/dashboard/client/src/assets/probitGlobal.png deleted file mode 100644 index acd09acf2a..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/probitGlobal.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/react.svg b/packages/apps/dashboard/client/src/assets/react.svg deleted file mode 100644 index 6c87de9bb3..0000000000 --- a/packages/apps/dashboard/client/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/assets/recording.png b/packages/apps/dashboard/client/src/assets/recording.png deleted file mode 100644 index f4daa1fff7..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/recording.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/reputation.png b/packages/apps/dashboard/client/src/assets/reputation.png deleted file mode 100644 index 23e3c8865a..0000000000 Binary files a/packages/apps/dashboard/client/src/assets/reputation.png and /dev/null differ diff --git a/packages/apps/dashboard/client/src/assets/styles/_breadcrumbs.scss b/packages/apps/dashboard/client/src/assets/styles/_breadcrumbs.scss deleted file mode 100644 index 3d21ae1cb6..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_breadcrumbs.scss +++ /dev/null @@ -1,11 +0,0 @@ -.breadcrumbs{ - display: flex; - align-items: center; - gap: 10px; - margin-bottom: 62px; - - @media(max-width: 1100px) { - margin-bottom: 24px; - } - -} diff --git a/packages/apps/dashboard/client/src/assets/styles/_const.scss b/packages/apps/dashboard/client/src/assets/styles/_const.scss deleted file mode 100644 index 8290739e30..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_const.scss +++ /dev/null @@ -1,18 +0,0 @@ -$maWhite: #F6F7FE; -$primary: #320A8D; -$white: #fff; -$sky: #858EC6; -$skyOpacity: #DADEF0CC; -$secondary: #6309FF; -$lilacSachet: #AEB4D9; -$ghostWhite: #F9FAFF; -$whiteSolid: #F6F5FC; -$groundwaterOpacity: #1406B20A; -$medium: #FFB300; -$mediumBorder: #FFD54F; -$low: #ED6C02; -$lowBorder: #ED6C0280; -$high: #0AD397; -$highBorder: #2E7D3280; -$soon: #304FFE; -$soonBorder: #8C9EFF; \ No newline at end of file diff --git a/packages/apps/dashboard/client/src/assets/styles/_footer.scss b/packages/apps/dashboard/client/src/assets/styles/_footer.scss deleted file mode 100644 index 9942d4a1d9..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_footer.scss +++ /dev/null @@ -1,72 +0,0 @@ -footer{ - min-height: 124px; - margin-top: auto; - @media(max-width: 1100px) { - padding: 0 24px; - flex-direction: column-reverse; - justify-content: center; - align-items: center; - background-color: $maWhite; - } - - .footer-wrapper { - display: flex; - padding: 32px 18px; - flex-direction: row; - justify-content: space-between; - align-items: stretch; - - @media (max-width: 1100px) { - flex-direction: column-reverse; - } - } - - .footer-link { - gap: 24px; - margin-bottom: 24px; - align-items: flex-start; - } - - .footer-icon { - justify-content: flex-start; - gap: 30px; - margin-bottom: 0; - align-items: flex-end; - - @media (max-width: 600px) { - justify-content: space-between; - align-items: flex-start; - margin-bottom: 32px; - } - - @media (max-width: 1100px) { - margin-bottom: 32px; - } - } - - .footer-link, .footer-icon{ - display: flex; - flex-wrap: wrap; - span { - cursor: pointer; - font-size: 12px; - } - svg { - font-size: 32px; - cursor: pointer; - } - } - - @media (max-width: 1100px) { - .footer-link-wrapper{ - .footer-link{ - flex-direction: column; - } - } - } - - .footer-link, .footer-icon{ - justify-content: flex-start; - align-items: flex-start; - } -} diff --git a/packages/apps/dashboard/client/src/assets/styles/_header.scss b/packages/apps/dashboard/client/src/assets/styles/_header.scss deleted file mode 100644 index 348816444b..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_header.scss +++ /dev/null @@ -1,72 +0,0 @@ -.header-toolbar { - height: 82px; - justify-content: space-between; - - .header-list-link { - display: flex; - gap: 16px; - align-items: center; - .header-link { - font-weight: 600; - padding: 6px 8px; - cursor: pointer; - font-size: 14px; - } - } - - .mobile-icon { - display: none; - } - - .logo-mobile, - .search-header-mobile { - display: none; - } - - @media (max-width: 1300px) { - .logo { - display: none; - } - .logo-mobile { - display: block; - } - } - - @media (max-width: 1280px) { - height: 62px; - .mobile-icon, - .search-header-mobile { - display: block; - } - .header-list-link, - .search-header { - display: none; - } - - .logo-mobile { - margin-left: 24px; - } - - .mobile-icon { - margin-right: 16px; - } - } -} - -.header-mobile-menu { - padding: 20px 10px; - .header-list-link { - display: flex; - gap: 16px; - flex-direction: column; - .header-link { - font-weight: 600; - padding: 6px 8px; - font-size: 14px; - } - - span { - cursor: pointer; - } - } -} diff --git a/packages/apps/dashboard/client/src/assets/styles/_home-page.scss b/packages/apps/dashboard/client/src/assets/styles/_home-page.scss deleted file mode 100644 index a6c4853400..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_home-page.scss +++ /dev/null @@ -1,189 +0,0 @@ -.home-page-header { - color: $white; - .home-page-search { - margin-top: 24px; - } -} - -.home-page-boxes { - display: flex; - gap: 24px; - margin-top: 62px; - - .home-page-box { - color: $primary; - background-color: $white; - border-radius: 16px; - padding: 24px 32px; - width: calc(38% - 24px); - - @media (max-width: 660px) { - padding: 24px 16px; - } - - .box-title { - font-size: 14px; - height: 32px; - margin-bottom: 24px; - display: flex; - align-items: center; - justify-content: space-between; - } - .box-content { - display: flex; - .count { - font-size: 20px; - font-weight: 500; - margin-top: 3px; - } - .box-icon { - margin-right: 10px; - } - } - } - - .home-page-box:first-child { - width: 24%; - } - @media (max-width: 1250px) { - flex-wrap: wrap; - .home-page-box, - .home-page-box:first-child { - width: 100%; - } - } -} - -.home-page-find { - font-size: 14px; - margin-top: 32px; - display: flex; - gap: 32px; - align-items: center; - height: 60px; - white-space: nowrap; - span { - display: flex; - align-items: center; - gap: 16px; - } - @media (max-width: 1100px) { - span { - min-width: 120px; - } - } -} - -.home-page-find-title-mobile { - margin-top: 32px; - font-size: 14px; - @media (max-width: 1100px) { - display: block; - } -} -.home-page-leaderboard { - margin-top: 60px; -} - -.home-page-table-header { - background-color: $whiteSolid; - height: 72px; - color: #320a8d; - text-transform: uppercase; - border: 0; - margin-bottom: 15px; - - th { - font-size: 12px; - } - .icon-table { - display: flex; - align-items: center; - gap: 8px; - } -} - -.home-page-table-row { - td { - padding: 32px 16px; - font-size: 16px; - } - - .icon-table { - background-color: $groundwaterOpacity; - display: flex; - align-items: center; - justify-content: center; - border-radius: 10px; - width: 52px; - height: 52px; - } - - .reputation-table { - padding: 4px 8px; - border-radius: 16px; - font-size: 13px; - display: inline; - } - - .reputation-table-medium { - color: $medium; - border: 1px solid $mediumBorder; - } - - .reputation-table-low { - color: $low; - border: 1px solid $lowBorder; - } - - .reputation-table-high { - color: $high; - border: 1px solid $highBorder; - } - .reputation-table-soon { - color: $soon; - border: 1px solid $soonBorder; - } - - &:hover { - transition: opacity 8ms; - opacity: 0.8; - } -} - -#network-select { - svg { - display: none; - } -} - -.select-item { - display: flex; - gap: 10px; -} - -.mobile-select { - width: 270px; - background-color: $whiteSolid; - padding: 10px; - display: none; - margin-bottom: 20px; - @media (max-width: 1100px) { - display: block; - } -} - -.table-filter-select { - @media (max-width: 1100px) { - div { - display: none; - } - } - .mobile-title { - display: none; - font-weight: 400; - @media (max-width: 1100px) { - display: block; - } - } -} diff --git a/packages/apps/dashboard/client/src/assets/styles/_nothing-found.scss b/packages/apps/dashboard/client/src/assets/styles/_nothing-found.scss deleted file mode 100644 index 4730145a62..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_nothing-found.scss +++ /dev/null @@ -1,16 +0,0 @@ -.nothing-found-title{ - font-size: 34px; - font-weight: 600; -} - -.nothing-found-desc{ - font-size: 16px; - margin-top: 30px; -} - -.nothing-found-link{ - color: $secondary; - margin-left: 10px; - margin-top: 20px; - font-weight: 600; -} diff --git a/packages/apps/dashboard/client/src/assets/styles/_search.scss b/packages/apps/dashboard/client/src/assets/styles/_search.scss deleted file mode 100644 index 014fe3047c..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/_search.scss +++ /dev/null @@ -1,86 +0,0 @@ -.search, .search-white{ - position: relative; - width: 920px; - max-width: 100%; - border: 1px solid #DADEF0CC; - border-radius: 13px; - - - #search-bar{ - width: 100%; - border-radius: 8px; - line-height: 24px; - - &:focus, &:focus-visible { - border-color: $secondary; - outline: none; - } - &:-webkit-autofill { - -webkit-text-fill-color: $primary; - box-shadow: 0 0 0px 1000px $white inset; - } - - } - - .search-close{ - cursor: pointer; - } - - .search-button{ - background-color: $secondary; - border-radius: 8px; - svg{ - font-size: 32px; - } - &:hover{ - background-color: $primary; - } - } -} - -.search-results-bar { - display: block; - -} - -.search-white{ - width: 500px; - max-width: 25%; - - .search-button{ - padding: 4px; - background: #1406B214; - svg{ - font-size: 24px; - } - &:hover{ - background-color: $secondary; - svg{ - color: $white; - } - } - } - - #search-bar{ - padding: 8px 0; - - } - @media (max-width: 1150px) { - max-width: 20%; - } - - @media (max-width: 1280px) { - max-width: 100%; - - #search-bar{ - padding: 12px 0; - } - } -} - -@media (max-width: 1280px) { - - .search-white{ - padding: 8px 0; - } -} diff --git a/packages/apps/dashboard/client/src/assets/styles/color-palette.ts b/packages/apps/dashboard/client/src/assets/styles/color-palette.ts deleted file mode 100644 index 0d1b0e298e..0000000000 --- a/packages/apps/dashboard/client/src/assets/styles/color-palette.ts +++ /dev/null @@ -1,69 +0,0 @@ -export const colorPalette = { - white: '#F9FAFF', - whiteBackground: '#FFF', - whiteSolid: '#F6F5FC', - skyOpacity: '#DADEF0CC', - link: '#0000EE', - linkHover: '#1406B2', - linkVisited: '#551A8B', - primary: { - main: '#320a8d', - light: '#320a8d', - }, - secondary: { - main: '#6309ff', - light: '#1406B280', - dark: '#14062b', - }, - info: { - main: '#eeeeee', - light: '#f5f5f5', - dark: '#bdbdbd', - }, - success: { - main: '#0AD397', - light: '#2E7D3280', - }, - warning: { - main: '#FFB300', - light: '#FFD54F', - }, - error: { - main: '#FFB300', - light: '#F20D5F', - }, - fog: { - main: '#858EC6', - light: '#CBCFE6', - dark: '#E5E7F3', - }, - overlay: { - light: '#1406B20A', - }, - sky: { - main: '#858ec6', - light: '#858ec6', - dark: '#858ec6', - contrastText: '#858ec6', - }, - ocean: { - main: '#304FFE', - light: '#8C9EFF', - dark: '#03A9F4', - }, - orange: { - main: '#ED6C02', - light: '#ED6C0280', - }, - textSecondary: { - main: '#858ec6', - light: '#858ec6', - dark: '#858ec6', - contrastText: '#858ec6', - }, - table: { - main: '#FFFFFF01', - selected: '#1406B21F', - secondary: '#1406B20A', - }, -} as const; diff --git a/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx b/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx deleted file mode 100644 index 18bb584207..0000000000 --- a/packages/apps/dashboard/client/src/components/Breadcrumbs/Breadcrumbs.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { FC } from 'react'; -import Typography from '@mui/material/Typography'; -import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; -import { useNavigate } from 'react-router-dom'; - -const Breadcrumbs: FC<{ title?: string }> = ({ title }) => { - const navigate = useNavigate(); - return ( -
- { - navigate('/'); - }} - component="span" - fontSize={16} - sx={{ textDecoration: 'unset', cursor: 'pointer' }} - color="text.secondary" - > - Dashboard - - - - {title} - -
- ); -}; - -export default Breadcrumbs; diff --git a/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts b/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts deleted file mode 100644 index 3ff68ca589..0000000000 --- a/packages/apps/dashboard/client/src/components/Breadcrumbs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Breadcrumbs'; diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx b/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx deleted file mode 100644 index ccca5b6c96..0000000000 --- a/packages/apps/dashboard/client/src/components/Charts/CustomChartTooltip.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { TooltipProps } from 'recharts'; -import Card from '@mui/material/Card'; -import Box from '@mui/material/Box'; -import { Grid, Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; -import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; -import { colorPalette } from '@assets/styles/color-palette'; -import { formatDate } from '@helpers/formatDate'; -import { GraphPageChartDataConfigObject } from '@components/Charts/AreaChart'; -import { NumericFormat } from 'react-number-format'; - -const renderTitle = (title: string) => { - const currentTitle: GraphPageChartDataConfigObject = { - totalTransactionAmount: 'Transfer Amount', - totalTransactionCount: 'Transactions Count', - solved: 'Number of Tasks', - dailyUniqueReceivers: 'Unique Receivers', - dailyUniqueSenders: 'Unique Senders', - }; - return currentTitle[title as keyof GraphPageChartDataConfigObject]; -}; - -const CustomChartTooltip = ({ - payload, - label, - active, -}: TooltipProps) => { - if (active) { - return ( - - - - {formatDate(label, 'MMMM DD, YYYY')} - - {payload?.map((elem) => ( - - - - - - {renderTitle(elem.name ?? '')} - - - - - - {' '} - {elem.name === 'totalTransactionAmount' ? 'HMT' : ''} - - - - ))} - - - ); - } - return null; -}; - -export default CustomChartTooltip; diff --git a/packages/apps/dashboard/client/src/components/Charts/index.ts b/packages/apps/dashboard/client/src/components/Charts/index.ts deleted file mode 100644 index 52e979682c..0000000000 --- a/packages/apps/dashboard/client/src/components/Charts/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './AreaChart'; -export * from './CustomChartTooltip'; -export * from './CustomXAxisTick'; -export * from './ToggleCharts'; diff --git a/packages/apps/dashboard/client/src/components/Clipboard/index.ts b/packages/apps/dashboard/client/src/components/Clipboard/index.ts deleted file mode 100644 index cea243dcd0..0000000000 --- a/packages/apps/dashboard/client/src/components/Clipboard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Clipboard'; diff --git a/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx b/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx deleted file mode 100644 index 781ad47b0f..0000000000 --- a/packages/apps/dashboard/client/src/components/CustomTooltip/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from './CustomTooltip'; diff --git a/packages/apps/dashboard/client/src/components/DataEntry/index.ts b/packages/apps/dashboard/client/src/components/DataEntry/index.ts deleted file mode 100644 index b2655c7380..0000000000 --- a/packages/apps/dashboard/client/src/components/DataEntry/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './DatePicker'; -export * from './ToggleButtons'; diff --git a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx b/packages/apps/dashboard/client/src/components/Footer/Footer.tsx deleted file mode 100644 index f89a3f7dcd..0000000000 --- a/packages/apps/dashboard/client/src/components/Footer/Footer.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { FC } from 'react'; -import Typography from '@mui/material/Typography'; -import TwitterIcon from '@mui/icons-material/Twitter'; -import LinkedInIcon from '@mui/icons-material/LinkedIn'; -import GitHubIcon from '@mui/icons-material/GitHub'; -import TelegramIcon from '@mui/icons-material/Telegram'; -import DiscordIcon from '@components/Icons/DiscordIcon'; -import { colorPalette } from '@assets/styles/color-palette'; -import { env } from '@helpers/env'; - -const Footer: FC = () => { - const handleClick = (url: string) => { - window.open(url, '_blank'); - }; - - return ( -
-
-
-
- handleClick(env.VITE_FOOTER_LINK_PRIVACY_POLICY)} - > - Privacy Policy - - handleClick(env.VITE_FOOTER_LINK_TERMS_OF_SERVICE)} - > - Terms of Service - - handleClick(env.VITE_FOOTER_LINK_HUMAN_PROTOCOL)} - > - HUMAN Protocol - -
- - © 2021 HPF. HUMAN Protocol® is a registered trademark - -
-
- handleClick(env.VITE_FOOTER_LINK_GITHUB)} - /> - handleClick(env.VITE_FOOTER_LINK_DISCORD)} - /> - handleClick(env.VITE_FOOTER_LINK_X)} - /> - handleClick(env.VITE_FOOTER_LINK_TELEGRAM)} - /> - handleClick(env.VITE_FOOTER_LINK_LINKEDIN)} - /> -
-
-
- ); -}; - -export default Footer; diff --git a/packages/apps/dashboard/client/src/components/Footer/index.ts b/packages/apps/dashboard/client/src/components/Footer/index.ts deleted file mode 100644 index be92134c1b..0000000000 --- a/packages/apps/dashboard/client/src/components/Footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Footer'; diff --git a/packages/apps/dashboard/client/src/components/Header/Header.tsx b/packages/apps/dashboard/client/src/components/Header/Header.tsx deleted file mode 100644 index 97db534fe9..0000000000 --- a/packages/apps/dashboard/client/src/components/Header/Header.tsx +++ /dev/null @@ -1,156 +0,0 @@ -import { FC, useState } from 'react'; -import clsx from 'clsx'; -import Toolbar from '@mui/material/Toolbar'; -import Button from '@mui/material/Button'; -import IconButton from '@mui/material/IconButton'; -import MenuIcon from '@mui/icons-material/Menu'; -import Drawer from '@mui/material/Drawer'; -import Box from '@mui/material/Box'; -import Link from '@mui/material/Link'; -import { env } from '@helpers/env'; -import { useNavigate } from 'react-router-dom'; -import { LogoBlockIcon } from '@components/Icons/LogoBlockIcon'; -import { LogoBlockIconMobile } from '@components/Icons/LogoBlockIconMobile'; -import CloseIcon from '@mui/icons-material/Close'; - -const Header: FC = () => { - const navigate = useNavigate(); - const [open, setState] = useState(false); - - const handleClick = (url: string) => { - window.open(url, '_blank'); - }; - - const toggleDrawer = (open: boolean) => { - setState(open); - }; - - return ( - - { - navigate('/'); - }} - underline="none" - sx={{ - ':hover': { - cursor: 'pointer', - }, - }} - > - - - - - - - - -
- handleClick(env.VITE_NAVBAR_LINK_GITBOOK)} - > - GitBook - - handleClick(env.VITE_NAVBAR_LINK_FAUCETS)} - > - Faucet - - handleClick(env.VITE_NAVBAR_LINK_HUMAN_WEBSITE)} - > - HUMAN Website - - - -
- - toggleDrawer(true)} - > - - - - toggleDrawer(false)} - PaperProps={{ - sx: { - width: '80%', - }, - }} - > - - - toggleDrawer(false)} /> - - -
-
- handleClick(env.VITE_NAVBAR_LINK_GITBOOK)} - > - GitBook - -
-
- handleClick(env.VITE_NAVBAR_LINK_FAUCETS)} - > - Faucet - -
-
- handleClick(env.VITE_NAVBAR_LINK_HUMAN_WEBSITE)} - > - HUMAN Website - -
- - -
-
-
-
- ); -}; - -export default Header; diff --git a/packages/apps/dashboard/client/src/components/Header/index.ts b/packages/apps/dashboard/client/src/components/Header/index.ts deleted file mode 100644 index 579f1ac23f..0000000000 --- a/packages/apps/dashboard/client/src/components/Header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Header'; diff --git a/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx b/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx deleted file mode 100644 index c4836609fc..0000000000 --- a/packages/apps/dashboard/client/src/components/Home/FormatNumber.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { NumericFormat } from 'react-number-format'; - -export const FormatNumber = ({ - value, -}: { - value: number | string | undefined | null; -}) => { - return ( - - ); -}; -export const FormatNumberWithDecimals = ({ - value, -}: { - value: number | string | undefined | null; -}) => { - if (value && Number(value) < 1) { - return {value}; - } - return ( - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx b/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx deleted file mode 100644 index 0b2327b214..0000000000 --- a/packages/apps/dashboard/client/src/components/Home/SmallGraph.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { - AreaChart, - Area, - XAxis, - YAxis, - CartesianGrid, - Tooltip, - ResponsiveContainer, - TooltipProps, -} from 'recharts'; -import Card from '@mui/material/Card'; -import { colorPalette } from '@assets/styles/color-palette'; -import Box from '@mui/material/Box'; -import { Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; -import ToggleButtons from '@components/DataEntry/ToggleButtons'; -import { Fragment } from 'react'; -import { formatDate } from '@helpers/formatDate'; -import { formatNumber } from '@helpers/formatNumber'; - -const CustomSmallChartTooltip = ({ - payload, - active, -}: TooltipProps) => { - if (active) { - return ( - - - {payload?.map((elem) => ( - - - {formatDate(elem.payload.date, 'MMMM DD, YYYY')} - - - {elem.value ? elem.value.toLocaleString('en-US') : ''} - - - ))} - - - ); - } - return null; -}; - -interface SmallGraphProps { - graphData: { - date: string; - value: number; - }[]; - title: string; -} - -const SmallGraph = ({ title, graphData }: SmallGraphProps) => { - return ( - <> - - - - - - - - - formatDate(value, 'DD MMMM')} - tick={{ dy: 10 }} - tickSize={0} - /> - - - } /> - - - - - - {title} - - - - - ); -}; - -export default SmallGraph; diff --git a/packages/apps/dashboard/client/src/components/Home/index.ts b/packages/apps/dashboard/client/src/components/Home/index.ts deleted file mode 100644 index 7117ca0dc1..0000000000 --- a/packages/apps/dashboard/client/src/components/Home/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './SmallGraph'; -export * from './GraphSwiper'; diff --git a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx deleted file mode 100644 index 2a1473418b..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/AvalancheIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { FC } from 'react'; - -export const AvalancheIcon: FC = (props) => { - return ( - - - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx deleted file mode 100644 index 08d77b3a59..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/CeloIcon.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { FC } from 'react'; - -export const CeloIcon: FC = (props) => { - return ( - - - - - - ); -}; - -export default CeloIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx deleted file mode 100644 index 7bf42a3377..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/MoonbaseAlphaIcon.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { FC } from 'react'; - -export const MoonbaseAlphaIcon: FC = (props) => { - return ( - - - - - - - - - - - - - - - - - - ); -}; - -export default MoonbaseAlphaIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx deleted file mode 100644 index 085f24f1d2..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/MoonbeamIcon.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { FC } from 'react'; - -export const MoonbeamIcon: FC = (props) => { - return ( - - - - ); -}; - -export default MoonbeamIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx b/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx deleted file mode 100644 index b6b213e57d..0000000000 --- a/packages/apps/dashboard/client/src/components/Icons/XLayerIcon.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; -import { FC } from 'react'; - -export const XLayerIcon: FC = (props) => { - return ( - - - - - - - - - - - - - - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx b/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx deleted file mode 100644 index 583bebae24..0000000000 --- a/packages/apps/dashboard/client/src/components/NetworkIcon/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import EthereumIcon from '@components/Icons/EthereumIcon'; -import BinanceSmartChainIcon from '@components/Icons/BinanceSmartChainIcon'; -import PolygonIcon from '@components/Icons/PolygonIcon'; -import MoonbeamIcon from '@components/Icons/MoonbeamIcon'; -import MoonbaseAlphaIcon from '@components/Icons/MoonbaseAlphaIcon'; -import CeloIcon from '@assets/icons/celo.svg'; -import { XLayerIcon } from '@components/Icons/XLayerIcon'; -import HumanIcon from '@components/Icons/HumanIcon'; -import { AvalancheIcon } from '@components/Icons/AvalancheIcon'; - -export const NetworkIcon = ({ chainId }: { chainId: number }) => { - const icon = (() => { - switch (chainId) { - case 1: - case 4: - case 5: - case 11155111: - return ; - case 56: - case 97: - return ; - case 137: - case 80001: - case 80002: - return ; - case 1284: - return ; - case 1287: - return ; - case 42220: - case 44787: - return ; - case 195: - case 196: - return ; - case 43113: - case 43114: - return ; - default: - return ; - } - })(); - - return <>{icon}; -}; diff --git a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx b/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx deleted file mode 100644 index aee9c6aef8..0000000000 --- a/packages/apps/dashboard/client/src/components/NothingFound/NothingFound.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { FC } from 'react'; -import Link from '@mui/material/Link'; - -const NothingFound: FC = () => { - return ( - <> -
Nothing found :(
-
- We couldn't find anything within this criteria. -
- Please search by wallet address or escrow address. -
- -
Back Home
- - - ); -}; - -export default NothingFound; diff --git a/packages/apps/dashboard/client/src/components/NothingFound/index.ts b/packages/apps/dashboard/client/src/components/NothingFound/index.ts deleted file mode 100644 index 3a4c58b3b9..0000000000 --- a/packages/apps/dashboard/client/src/components/NothingFound/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './NothingFound'; diff --git a/packages/apps/dashboard/client/src/components/PageWrapper/index.ts b/packages/apps/dashboard/client/src/components/PageWrapper/index.ts deleted file mode 100644 index ee1a8716a0..0000000000 --- a/packages/apps/dashboard/client/src/components/PageWrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './PageWrapper'; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx b/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx deleted file mode 100644 index 8a91684560..0000000000 --- a/packages/apps/dashboard/client/src/components/SearchResults/TitleSectionWrapper.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import Stack from '@mui/material/Stack'; -import IconButton from '@mui/material/IconButton'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import Typography from '@mui/material/Typography'; -import { colorPalette } from '@assets/styles/color-palette'; -import CustomTooltip from '@components/CustomTooltip'; - -const TitleSectionWrapper = ({ - title, - children, - tooltip, -}: { - title: string; - children: React.ReactNode; - tooltip?: { - description: string; - }; -}) => { - return ( - - {tooltip ? ( - - - - - - - {title} - - ) : ( - - {title} - - )} - {children} - - ); -}; - -export default TitleSectionWrapper; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/index.ts b/packages/apps/dashboard/client/src/components/SearchResults/index.ts deleted file mode 100644 index 46e0669dbc..0000000000 --- a/packages/apps/dashboard/client/src/components/SearchResults/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './TitleSectionWrapper'; diff --git a/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts b/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts deleted file mode 100644 index fbddef1da6..0000000000 --- a/packages/apps/dashboard/client/src/components/ShadowIcon/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './ShadowIcon'; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx deleted file mode 100644 index e1699a869a..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/AddressCell.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import AbbreviateClipboard from '@components/SearchResults/AbbreviateClipboard'; -import { Box } from '@mui/material'; - -export const AddressCell = ({ - chainId, - address, -}: { - chainId: string; - address: string; -}) => ( - - - -); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx deleted file mode 100644 index 32b40e4831..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ChainCell.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Typography } from '@mui/material'; -import { NetworkIcon } from '@components/NetworkIcon'; -import { getNetwork } from '@utils/config/networks'; - -export const ChainCell = ({ chainId }: { chainId: number }) => ( - - - {getNetwork(chainId)?.name} - -); diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx deleted file mode 100644 index 6c81ee7511..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/EntityIcon.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { ExchangeOracleIcon } from '@components/Icons/ExchangeOracleIcon'; -import HumanIcon from '@components/Icons/HumanIcon'; -import { JobLauncher } from '@components/Icons/JobLauncher'; -import { RecordingOracle } from '@components/Icons/RecordingOracle'; -import { ReputationOracle } from '@components/Icons/ReputationOracle'; -import { Role } from '@human-protocol/sdk'; - -export const EntityIcon: React.FC<{ role: string }> = ({ role }) => { - switch (role) { - case Role.JobLauncher: - return ; - case Role.RecordingOracle: - return ; - case Role.ReputationOracle: - return ; - case Role.ExchangeOracle: - return ; - default: - return ; - } -}; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx deleted file mode 100644 index 7ace7dc2af..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/ReputationLabel.tsx +++ /dev/null @@ -1,36 +0,0 @@ -export const ReputationLabel: React.FC<{ reputation: string }> = ({ - reputation, -}) => { - switch (reputation) { - case 'High': - return ( -
- {reputation} -
- ); - case 'Medium': - return ( -
- {reputation} -
- ); - case 'Low': - return ( -
- {reputation} -
- ); - case 'Coming soon': - return ( -
- {reputation} -
- ); - default: - return ( -
- Coming soon -
- ); - } -}; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx deleted file mode 100644 index 56a154a708..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/RoleCell.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { Box, Typography } from '@mui/material'; -import { Launch as LaunchIcon } from '@mui/icons-material'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { Link } from 'react-router-dom'; -import { EntityIcon } from './EntityIcon'; -import { CaseConverter } from '@utils/case-converter'; - -const Wrapper = ({ - children, - websiteUrl, -}: React.PropsWithChildren<{ websiteUrl?: string }>) => { - return websiteUrl ? ( - - {children} - - ) : ( - <>{children} - ); -}; - -export const RoleCell = ({ - role, - websiteUrl, - name, -}: { - role: string; - websiteUrl?: string; - name?: string; -}) => { - const { - mobile: { isMobile }, - } = useBreakPoints(); - const humanReadableRole = CaseConverter.convertSnakeToHumanReadable(role); - return ( - - - - {!isMobile && } - - - - {name ?? humanReadableRole} - - {websiteUrl ? : null} - - {name && role ? ( - - {humanReadableRole} - - ) : null} - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx deleted file mode 100644 index 33e4fc4f3e..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDataGrid.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import { Box, Typography } from '@mui/material'; -import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'; -import { LeaderBoardData } from '@services/api/use-leaderboard-details'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import CustomTooltip from '@components/CustomTooltip'; -import { colorPalette } from '@assets/styles/color-palette'; -import { useMemo } from 'react'; - -import { RoleCell } from '../components/RoleCell'; -import { AddressCell } from '../components/AddressCell'; -import { ChainCell } from '../components/ChainCell'; -import { SelectNetwork } from '../components/SelectNetwork'; -import { TextCell } from '../components/TextCell'; -import { CategoryCell } from '../components/CategoryCell'; - -export const useDataGrid = (data: LeaderBoardData) => { - const { - filterParams: { chainId }, - } = useLeaderboardSearch(); - - const { - mobile: { isMobile }, - } = useBreakPoints(); - const formattedData = useMemo(() => { - return data.map((row, idx) => { - return { - ...row, - id: `${row.address}${row.chainId}`, - rowIndex: idx, - }; - }); - }, [data]); - - const visibleRows = useMemo(() => { - if (chainId !== -1) { - return formattedData.filter((elem) => elem.chainId === chainId); - } - - return formattedData; - }, [formattedData, chainId]); - - const columns: GridColDef<(typeof visibleRows)[number]>[] = useMemo( - () => [ - { - field: 'role', - sortable: false, - flex: isMobile ? 0.8 : 1.5, - minWidth: isMobile ? 100 : 360, - headerClassName: isMobile - ? 'home-page-table-header pinned-column--header' - : 'home-page-table-header', - cellClassName: isMobile ? 'pinned-column--cell' : '', - renderHeader: () => ( - - Role - - ), - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - { - field: 'address', - sortable: false, - flex: 1, - minWidth: 150, - headerClassName: 'home-page-table-header', - renderHeader: () => ( - - - - - - Address - - - ), - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - { - field: 'amountStaked', - flex: 1, - minWidth: 130, - headerClassName: 'home-page-table-header', - renderHeader: () => ( - - - - - - Stake - - - ), - valueFormatter: (value: string) => { - return `${value} HMT`; - }, - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - { - field: 'chainId', - headerName: 'Network', - flex: isMobile ? 1 : 1.5, - sortable: false, - minWidth: isMobile ? 150 : 245, - headerClassName: 'home-page-table-header', - renderHeader: () => { - return ( - <> - {isMobile ? ( - - Network - - ) : ( - - )} - - ); - }, - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - { - field: 'category', - minWidth: 200, - headerName: 'Category', - headerClassName: 'home-page-table-header', - renderHeader: () => ( - - Category - - ), - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - { - field: 'fee', - minWidth: 150, - headerName: 'Operator Fee', - headerClassName: 'home-page-table-header', - renderHeader: () => ( - - Operator Fee - - ), - valueFormatter: (value: string | null) => { - if (value == null) { - return ''; - } - - return `${value}%`; - }, - renderCell: (params: GridRenderCellParams) => ( - - ), - }, - ], - [isMobile] - ); - - return { - columns, - visibleRows, - }; -}; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx deleted file mode 100644 index 94386e4bdb..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/hooks/useDatagridOptions.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import { Typography } from '@mui/material'; -import { - GridColDef, - GridRenderCellParams, - GridSortModel, - GridCallbackDetails, - GridValidRowModel, -} from '@mui/x-data-grid'; -import { GridApiCommunity } from '@mui/x-data-grid/models/api/gridApiCommunity'; -import { useMemo, useCallback, MutableRefObject } from 'react'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; - -interface IColPossibleOptions { - isRowIdx?: boolean; - pinnedColumnName?: string; -} - -interface IProps extends IColPossibleOptions { - columns: GridColDef[]; - apiRef: MutableRefObject; -} - -export function useDatagridOptions({ - apiRef, - columns, - isRowIdx, - pinnedColumnName, -}: IProps) { - const { - mobile: { isMobile }, - } = useBreakPoints(); - - const handlePinnedColOption = useCallback( - (cols: GridColDef[]) => - cols.map((col) => - col.field === pinnedColumnName - ? { - ...col, - headerClassName: isMobile - ? 'home-page-table-header pinned-column--header' - : 'home-page-table-header', - cellClassName: isMobile ? 'pinned-column--cell' : '', - } - : col - ), - [isMobile, pinnedColumnName] - ); - - const handleRowOrderNum = useCallback( - (cols: GridColDef[]) => { - return isMobile - ? cols - : [ - { - field: 'rowIndex', - headerName: '', - width: 30, - headerClassName: 'home-page-table-header', - sortable: false, - renderCell: (params: GridRenderCellParams) => { - return ( - - {params.value + 1} - - ); - }, - }, - ...cols, - ]; - }, - [isMobile] - ); - - const handleColumnOptions = useCallback( - (cols: GridColDef[]) => { - let colsWithOptions = cols; - if (isRowIdx) { - colsWithOptions = handleRowOrderNum(colsWithOptions); - } - if (pinnedColumnName) { - colsWithOptions = handlePinnedColOption(colsWithOptions); - } - - return colsWithOptions; - }, - [handlePinnedColOption, handleRowOrderNum, isRowIdx, pinnedColumnName] - ); - - const handleSortModelChange = useCallback( - (_model: GridSortModel, details: GridCallbackDetails) => { - apiRef.current.applySorting(); - const sortedRows = details.api.getSortedRows(); - sortedRows.forEach((row, index) => { - apiRef.current.updateRows([{ ...row, rowIndex: index }]); - }); - }, - [apiRef] - ); - - const pinnedColSx = { - '& .pinned-column--header': { - position: 'sticky', - left: 0, - zIndex: 1000, - transform: 'translateZ(0)', - }, - '& .pinned-column--cell': { - position: 'sticky', - left: 0, - zIndex: 1000, - background: '#fff', - transform: 'translateZ(0)', - borderRight: isMobile ? '1px solid rgb(224, 224, 224)' : '', - }, - }; - - const customizedColumns: GridColDef[] = useMemo( - () => handleColumnOptions(columns), - [columns, handleColumnOptions] - ); - - return { - customizedColumns, - handleSortModelChange, - pinnedColSx, - }; -} diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx deleted file mode 100644 index 40b5a20ea5..0000000000 --- a/packages/apps/dashboard/client/src/features/Leaderboard/index.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { colorPalette } from '@assets/styles/color-palette'; -import Paper from '@mui/material/Paper'; -import TableContainer from '@mui/material/TableContainer'; -import { LeaderBoardData } from '@services/api/use-leaderboard-details'; -import { useNavigate } from 'react-router-dom'; -import SimpleBar from 'simplebar-react'; -import { SelectNetwork } from './components/SelectNetwork'; -import { DataGridWrapper } from './components/DataGridWrapper'; -import { Button, Typography } from '@mui/material'; - -export type LeaderboardCommonProps = { - data: LeaderBoardData | undefined; - status: 'success' | 'error' | 'pending'; - error: unknown; -}; - -export const Leaderboard = ({ - data, - status, - error, - viewAllBanner, -}: LeaderboardCommonProps & { - viewAllBanner?: boolean; -}) => { - const navigate = useNavigate(); - return ( - -
- -
- - - - {viewAllBanner ? ( - - ) : null} -
- ); -}; diff --git a/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts b/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts new file mode 100644 index 0000000000..b6e27a522d --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/api/useChartData.ts @@ -0,0 +1,113 @@ +import { useMemo } from 'react'; + +import { useQuery, keepPreviousData } from '@tanstack/react-query'; +import dayjs from 'dayjs'; +import { useDebounce } from 'use-debounce'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { + hcaptchaDailyStatsSchema, + HcaptchaDailyStats, +} from '../model/hcaptchaDailyStatsSchema'; +import { + hmtDailyStatsSchema, + HMTDailyStats, +} from '../model/hmtDailyStatsSchema'; + +export type ChartData = (HMTDailyStats & Omit)[]; + +const mergeResponses = ( + hcaptchaStatsResults: HcaptchaDailyStats[], + hmtStatsResults: HMTDailyStats[] +): ChartData => { + const allDates = Array.from( + new Set([ + ...hcaptchaStatsResults.map(({ date }) => date), + ...hmtStatsResults.map(({ date }) => date), + ]) + ).sort((a, b) => (dayjs(a).isBefore(dayjs(b)) ? -1 : 1)); + + const hcaptchaStatsResultsMap = new Map(); + const hmtStatsResultsMap = new Map(); + + hcaptchaStatsResults.forEach((entry) => { + hcaptchaStatsResultsMap.set(entry.date, entry); + }); + + hmtStatsResults.forEach((entry) => { + hmtStatsResultsMap.set(entry.date, entry); + }); + + return allDates.map((date) => { + const hmtStatsEntry: HMTDailyStats = hmtStatsResultsMap.get(date) || { + dailyUniqueReceivers: 0, + dailyUniqueSenders: 0, + date: date, + totalTransactionAmount: 0, + totalTransactionCount: 0, + }; + + const hcaptchaStatsEntry: HcaptchaDailyStats = hcaptchaStatsResultsMap.get( + date + ) || { + date: date, + solved: 0, + }; + + return { ...hmtStatsEntry, ...hcaptchaStatsEntry }; + }); +}; + +const DEBOUNCE_MS = 300; + +const useChartData = (from: dayjs.Dayjs, to: dayjs.Dayjs) => { + const queryParams = useMemo( + () => ({ + from: from.format('YYYY-MM-DD'), + to: to.format('YYYY-MM-DD'), + }), + [from, to] + ); + + const [debouncedQueryParams] = useDebounce(queryParams, DEBOUNCE_MS); + + return useQuery({ + queryFn: async () => { + const { data: hmtDailyStats } = await httpClient.get( + apiPaths.hmtDailyStats.path, + { + params: debouncedQueryParams, + } + ); + const { data: hcaptchDailyStats } = await httpClient.get( + apiPaths.hcaptchaStatsDaily.path, + { + params: debouncedQueryParams, + } + ); + + const validHmtDailyStats = validateResponse( + hmtDailyStats, + hmtDailyStatsSchema + ); + + const validHcaptchaGeneralStats = validateResponse( + hcaptchDailyStats, + hcaptchaDailyStatsSchema + ); + + return mergeResponses( + validHcaptchaGeneralStats.results, + validHmtDailyStats.results + ); + }, + staleTime: DEBOUNCE_MS, + queryKey: ['useChartData', debouncedQueryParams], + placeholderData: keepPreviousData, + }); +}; + +export default useChartData; diff --git a/packages/apps/dashboard/client/src/features/graph/index.ts b/packages/apps/dashboard/client/src/features/graph/index.ts new file mode 100644 index 0000000000..9cb08db244 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/index.ts @@ -0,0 +1 @@ +export { default } from './ui/AreaChart'; diff --git a/packages/apps/dashboard/client/src/helpers/formatDate.ts b/packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts similarity index 52% rename from packages/apps/dashboard/client/src/helpers/formatDate.ts rename to packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts index d2cf178433..eee127a6ab 100644 --- a/packages/apps/dashboard/client/src/helpers/formatDate.ts +++ b/packages/apps/dashboard/client/src/features/graph/lib/formatDate.ts @@ -1,5 +1,7 @@ import dayjs from 'dayjs'; -export const formatDate = (date: string, dateFormat?: string) => { +const formatDate = (date: string, dateFormat?: string) => { return dayjs(new Date(date)).format(dateFormat ?? 'dd/MM/yyyy'); }; + +export default formatDate; diff --git a/packages/apps/dashboard/client/src/helpers/formatNumber.ts b/packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts similarity index 72% rename from packages/apps/dashboard/client/src/helpers/formatNumber.ts rename to packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts index 029a6ae604..c4a391b9d8 100644 --- a/packages/apps/dashboard/client/src/helpers/formatNumber.ts +++ b/packages/apps/dashboard/client/src/features/graph/lib/formatNumber.ts @@ -1,4 +1,4 @@ -export const formatNumber = (number: number) => { +const formatNumber = (number: number) => { if (number >= 1000000) { return `${(number / 1000000).toFixed()} M`; } @@ -9,3 +9,5 @@ export const formatNumber = (number: number) => { return `${number.toString()}`; }; + +export default formatNumber; diff --git a/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts b/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts new file mode 100644 index 0000000000..6b8d16a1ac --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/model/hcaptchaDailyStatsSchema.ts @@ -0,0 +1,18 @@ +import { z } from 'zod'; + +export const hcaptchaDailyStatsSchema = z.object({ + from: z.string().optional(), + to: z.string().optional(), + results: z.array( + z.object({ + solved: z.number(), + date: z.string(), + }) + ), +}); + +export type HcaptchaDailyStatsResponse = z.infer< + typeof hcaptchaDailyStatsSchema +>; + +export type HcaptchaDailyStats = HcaptchaDailyStatsResponse['results'][number]; diff --git a/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts b/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts new file mode 100644 index 0000000000..5e4a86629a --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/model/hmtDailyStatsSchema.ts @@ -0,0 +1,29 @@ +import { z } from 'zod'; + +export const hmtDailyStatsSchema = z.object({ + from: z.string().optional(), + to: z.string().optional(), + results: z.array( + z.object({ + totalTransactionAmount: z.string().transform((value, ctx) => { + const valueAsNumber = Number(value); + if (Number.isNaN(valueAsNumber)) { + ctx.addIssue({ + path: ['totalTransactionAmount'], + code: z.ZodIssueCode.custom, + }); + } + + return valueAsNumber / 10 ** 18; + }), + totalTransactionCount: z.number(), + dailyUniqueSenders: z.number(), + dailyUniqueReceivers: z.number(), + date: z.string(), + }) + ), +}); + +export type HMTDailyStatsResponse = z.output; + +export type HMTDailyStats = HMTDailyStatsResponse['results'][number]; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx b/packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts similarity index 85% rename from packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx rename to packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts index abe615113f..7755ed615d 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-graph-page-chart-params.tsx +++ b/packages/apps/dashboard/client/src/features/graph/store/useChartParamsStore.ts @@ -3,35 +3,35 @@ import { create } from 'zustand'; const MINIMAL_DATE_FOR_DATE_PICKER = '2021-04-06'; -export type GraphPageChartPeriodName = '1W' | '1M' | '6M' | '1Y' | 'ALL'; +export type GraphPageChartPeriodName = '24H' | '1W' | '2W' | '1M' | 'ALL'; export type TimePeriod = { value: Dayjs; name: GraphPageChartPeriodName; }; +const oneDayAgo = dayjs().subtract(1, 'day'); const oneWeekAgo = dayjs().subtract(1, 'week'); +const twoWeeksAgo = dayjs().subtract(2, 'weeks'); const oneMonthAgo = dayjs().subtract(1, 'month'); -const sixMonthsAgo = dayjs().subtract(6, 'months'); -const oneYearAgo = dayjs().subtract(1, 'year'); export const initialAllTime = dayjs(MINIMAL_DATE_FOR_DATE_PICKER); export const TIME_PERIOD_OPTIONS: TimePeriod[] = [ { - value: oneWeekAgo, - name: '1W', + value: oneDayAgo, + name: '24H', }, { - value: oneMonthAgo, - name: '1M', + value: oneWeekAgo, + name: '1W', }, { - value: sixMonthsAgo, - name: '6M', + value: twoWeeksAgo, + name: '2W', }, { - value: oneYearAgo, - name: '1Y', + value: oneMonthAgo, + name: '1M', }, { value: initialAllTime, @@ -58,7 +58,7 @@ const INITIAL_RANGE_PARAMS = { to: dayjs(), }; -export const useGraphPageChartParams = create((set) => ({ +const useChartParamsStore = create((set) => ({ dateRangeParams: INITIAL_RANGE_PARAMS, selectedTimePeriod: '1W', setFromDate: (fromDate: Dayjs | null) => { @@ -95,6 +95,7 @@ export const useGraphPageChartParams = create((set) => ({ dateRangeParams: { ...state.dateRangeParams, from: timePeriod.value, + to: dayjs(), }, }; }); @@ -115,3 +116,5 @@ export const useGraphPageChartParams = create((set) => ({ })); }, })); + +export default useChartParamsStore; diff --git a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx b/packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx similarity index 83% rename from packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx index 4300ff5fe8..73a297367d 100644 --- a/packages/apps/dashboard/client/src/components/Charts/AreaChart.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/AreaChart.tsx @@ -1,3 +1,9 @@ +import { FC, useEffect, useRef, useState } from 'react'; + +import { Typography, useTheme } from '@mui/material'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import dayjs, { Dayjs } from 'dayjs'; import { CartesianGrid, Tooltip, @@ -7,39 +13,36 @@ import { Area, ResponsiveContainer, } from 'recharts'; -import CustomChartTooltip from './CustomChartTooltip'; -import { useEffect, useRef, useState } from 'react'; -import Card from '@mui/material/Card'; -import { Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; -import CustomXAxisTick from '@components/Charts/CustomXAxisTick'; -import DatePicker from '@components/DataEntry/DatePicker'; -import ToggleButtons from '@components/DataEntry/ToggleButtons'; -import dayjs, { Dayjs } from 'dayjs'; -import ToggleCharts from '@components/Charts/ToggleCharts'; -import { formatNumber } from '@helpers/formatNumber'; -import { - GraphPageChartData, - useGraphPageChartData, -} from '@services/api/use-graph-page-chart-data'; -import { + +import DatePicker from '@/shared/ui/DatePicker'; + +import useChartData, { ChartData } from '../api/useChartData'; +import formatNumber from '../lib/formatNumber'; +import useChartParamsStore, { initialAllTime, - useGraphPageChartParams, -} from '@utils/hooks/use-graph-page-chart-params'; +} from '../store/useChartParamsStore'; + +import ChartTooltip from './ChartTooltip'; +import CustomXAxisTick from './CustomXAxisTick'; +import ToggleButtons from './ToggleButtons'; +import ToggleCharts from './ToggleCharts'; -export type GraphPageChartDataConfigObject = Partial< - Record +export type ChartDataConfigObject = Partial< + Record >; -const CHECKED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { +type AreaChartProps = { + changeDateOnScroll?: boolean; +}; + +const CHECKED_CHARTS_DEFAULT_STATE: ChartDataConfigObject = { totalTransactionAmount: true, totalTransactionCount: true, solved: true, dailyUniqueReceivers: true, dailyUniqueSenders: true, }; -const HOVERED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { +const HOVERED_CHARTS_DEFAULT_STATE: ChartDataConfigObject = { totalTransactionAmount: false, totalTransactionCount: false, solved: false, @@ -48,12 +51,12 @@ const HOVERED_CHARTS_DEFAULT_STATE: GraphPageChartDataConfigObject = { }; type SumOfNumericChartDataProperties = Record< - keyof Omit, + keyof Omit, number >; const sumNumericProperties = ( - chartData: GraphPageChartData + chartData: ChartData ): SumOfNumericChartDataProperties => { return chartData.reduce( (acc, chartEntry) => { @@ -74,19 +77,16 @@ const sumNumericProperties = ( ); }; -export const AreaChart = ({ - changeDateOnScroll = false, -}: { - changeDateOnScroll?: boolean; -}) => { - const { data } = useGraphPageChartData(); - const chartData = data || []; +const AreaChart: FC = ({ changeDateOnScroll = false }) => { const { setFromDate, setToDate, clearTimePeriod, dateRangeParams: { from, to }, - } = useGraphPageChartParams(); + } = useChartParamsStore(); + const { data } = useChartData(from, to); + const theme = useTheme(); + const chartData = data || []; const sum = sumNumericProperties(chartData); const [checkedCharts, setCheckedCharts] = useState( CHECKED_CHARTS_DEFAULT_STATE @@ -155,16 +155,17 @@ export const AreaChart = ({ return ( @@ -298,24 +299,24 @@ export const AreaChart = ({ tick={{ dx: -10 }} tickSize={0} axisLine={false} - stroke={colorPalette.fog.main} + stroke={theme.palette.fog.main} /> } height={50} - stroke={colorPalette.fog.dark} + stroke={theme.palette.fog.dark} tickSize={20} dataKey="date" tickMargin={10} /> - } /> + } /> {checkedCharts.totalTransactionAmount && ( @@ -324,7 +325,7 @@ export const AreaChart = ({ @@ -333,7 +334,7 @@ export const AreaChart = ({ @@ -342,7 +343,7 @@ export const AreaChart = ({ @@ -351,7 +352,7 @@ export const AreaChart = ({ @@ -360,10 +361,10 @@ export const AreaChart = ({ @@ -410,3 +411,5 @@ export const AreaChart = ({ ); }; + +export default AreaChart; diff --git a/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx new file mode 100644 index 0000000000..a1c474da5b --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/ui/ChartTooltip.tsx @@ -0,0 +1,85 @@ +import { FC } from 'react'; + +import FiberManualRecordIcon from '@mui/icons-material/FiberManualRecord'; +import { Grid, Typography } from '@mui/material'; +import Box from '@mui/material/Box'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import { TooltipProps } from 'recharts'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import formatDate from '../lib/formatDate'; + +import { ChartDataConfigObject } from './AreaChart'; + +const renderTitle = (title: string) => { + const currentTitle: ChartDataConfigObject = { + totalTransactionAmount: 'Transfer Amount', + totalTransactionCount: 'Transactions Count', + solved: 'Number of Tasks', + dailyUniqueReceivers: 'Unique Receivers', + dailyUniqueSenders: 'Unique Senders', + }; + return currentTitle[title as keyof ChartDataConfigObject]; +}; + +const ChartTooltip: FC> = ({ + payload, + label, + active, +}) => { + if (!active) return null; + + return ( + + + + {formatDate(label, 'MMMM DD, YYYY')} + + {payload?.map((elem) => ( + + + + + + {renderTitle(elem.name ?? '')} + + + + + + {' '} + {elem.name === 'totalTransactionAmount' ? 'HMT' : ''} + + + + ))} + + + ); +}; + +export default ChartTooltip; diff --git a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx b/packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx similarity index 75% rename from packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx index 364f711fe6..7d351507c6 100644 --- a/packages/apps/dashboard/client/src/components/Charts/CustomXAxisTick.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/CustomXAxisTick.tsx @@ -1,15 +1,18 @@ -import { colorPalette } from '@assets/styles/color-palette'; +import { useTheme } from '@mui/material'; // @ts-expect-error -- import error, but this type work property import { ContentRenderer } from 'recharts'; -import { formatDate } from '@helpers/formatDate'; + +import formatDate from '../lib/formatDate'; const CustomXAxisTick = ({ x, y, payload }: ContentRenderer) => { + const theme = useTheme(); + return ( { - const { data } = useGraphPageChartData(); - const { revertToInitialParams } = useGraphPageChartParams(); +import useChartData from '../api/useChartData'; +import useChartParamsStore from '../store/useChartParamsStore'; + +import SmallGraph from './SmallGraph'; + +const GraphSwiper: FC = () => { + const { + revertToInitialParams, + dateRangeParams: { from, to }, + } = useChartParamsStore(); + const { data } = useChartData(from, to); useEffect(() => { revertToInitialParams(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + }, [revertToInitialParams]); const transactionHistoryData = (data || []).map( ({ totalTransactionCount, date }) => ({ diff --git a/packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx b/packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx new file mode 100644 index 0000000000..f03d15b7d0 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/graph/ui/SmallGraph.tsx @@ -0,0 +1,148 @@ +import { FC, Fragment } from 'react'; + +import { useTheme } from '@mui/material'; +import Box from '@mui/material/Box'; +import Card from '@mui/material/Card'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; +import { + AreaChart, + Area, + XAxis, + YAxis, + CartesianGrid, + Tooltip, + ResponsiveContainer, + TooltipProps, +} from 'recharts'; + +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; + +import formatDate from '../lib/formatDate'; +import formatNumber from '../lib/formatNumber'; + +import ToggleButtons from './ToggleButtons'; + +const CustomSmallChartTooltip: FC> = ({ + payload, + active, +}) => { + if (!active) return null; + + return ( + + + {payload?.map((elem) => ( + + + {formatDate(elem.payload.date, 'MMMM DD, YYYY')} + + + {elem.value ? elem.value.toLocaleString('en-US') : ''} + + + ))} + + + ); +}; + +type SmallGraphProps = { + graphData: { + date: string; + value: number; + }[]; + title: string; +}; + +const GraphSettings = ({ title }: { title: string }) => ( + + + {title} + + + +); + +const SmallGraph: FC = ({ title, graphData }) => { + const isMobile = useIsMobile(); + const theme = useTheme(); + + return ( + <> + {!isMobile && } + + + + + + + + + formatDate(value, 'DD MMMM')} + tick={{ dy: 10 }} + tickSize={0} + /> + + + } /> + + + + {isMobile && } + + ); +}; + +export default SmallGraph; diff --git a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx similarity index 51% rename from packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx index 808d5ec296..9ef5a320b4 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/ToggleButtons.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/ToggleButtons.tsx @@ -1,30 +1,38 @@ -import ToggleButton from '@mui/material/ToggleButton'; -import Typography from '@mui/material/Typography'; import { styled } from '@mui/material'; +import Button from '@mui/material/Button'; +import ToggleButton from '@mui/material/ToggleButton'; import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; -import { colorPalette } from '@assets/styles/color-palette'; -import { +import dayjs from 'dayjs'; + +import useChartParamsStore, { TIME_PERIOD_OPTIONS, TimePeriod, - useGraphPageChartParams, -} from '@utils/hooks/use-graph-page-chart-params'; +} from '../store/useChartParamsStore'; -export const StyledToggleButtonGroup = styled(ToggleButtonGroup)({ - '.MuiToggleButtonGroup-grouped': { - border: 'none', - borderRadius: 4, - width: 50, - color: colorPalette.primary.main, - }, -}); +export const StyledToggleButtonGroup = styled(ToggleButtonGroup)( + ({ theme }) => ({ + gap: 8, + '.MuiToggleButtonGroup-grouped': { + border: 'none', + borderRadius: 4, + minWidth: 'unset', + width: 47, + height: 30, + color: theme.palette.primary.main, + }, + }) +); const ToggleButtons = () => { const { setTimePeriod, selectedTimePeriod, dateRangeParams } = - useGraphPageChartParams(); + useChartParamsStore(); const checkIfSelected = (element: TimePeriod) => { if (element.name !== 'ALL') { - return element.value.isSame(dateRangeParams.from); + return ( + element.value.isSame(dateRangeParams.from) && + dateRangeParams.to.isSame(dayjs(), 'day') + ); } }; @@ -35,29 +43,25 @@ const ToggleButtons = () => { exclusive > {TIME_PERIOD_OPTIONS.map((elem) => ( - { - setTimePeriod(elem); - }} - selected={checkIfSelected(elem)} + ))} ); diff --git a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx b/packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx similarity index 83% rename from packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx rename to packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx index 94dc0314d4..b699b14f8d 100644 --- a/packages/apps/dashboard/client/src/components/Charts/ToggleCharts.tsx +++ b/packages/apps/dashboard/client/src/features/graph/ui/ToggleCharts.tsx @@ -1,8 +1,10 @@ +import { FC } from 'react'; + import { FormControlLabel, FormGroup, Typography } from '@mui/material'; -import Stack from '@mui/material/Stack'; import Checkbox from '@mui/material/Checkbox'; -import { colorPalette } from '@assets/styles/color-palette'; -import { FormatNumber } from '@components/Home/FormatNumber'; +import Stack from '@mui/material/Stack'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; interface ToggleChartsProps { handleChange: (event: React.ChangeEvent) => void; @@ -17,12 +19,12 @@ interface ToggleChartsProps { }[]; } -const ToggleCharts = ({ +const ToggleCharts: FC = ({ handleChange, chartOptions, onMouseLeave, onMouseEnter, -}: ToggleChartsProps) => { +}) => { return ( {elem.title} - {elem.amount ? : ''} + {elem.amount ? : 0} {elem.name === 'totalTransactionAmount' && elem.isAreaChart && ( HMT diff --git a/packages/apps/dashboard/client/src/features/home/api/useGeneralStats.ts b/packages/apps/dashboard/client/src/features/home/api/useGeneralStats.ts new file mode 100644 index 0000000000..c1c3c85238 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/api/useGeneralStats.ts @@ -0,0 +1,22 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { generalStatsResponseSchema } from '../model/generalStats'; + +const useGeneralStats = () => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.generalStats.path); + + const validResponse = validateResponse(data, generalStatsResponseSchema); + + return validResponse; + }, + queryKey: ['useGeneralStats'], + }); +}; + +export default useGeneralStats; diff --git a/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts b/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts new file mode 100644 index 0000000000..afd902db3f --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/api/useHcaptchaGeneralStats.ts @@ -0,0 +1,25 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { hcaptchaGeneralStatsResponseSchema } from '../model/hcaptchaGeneralStats'; + +const useHcaptchaGeneralStats = () => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.hcaptchaGeneralStats.path); + + const validResponse = validateResponse( + data, + hcaptchaGeneralStatsResponseSchema + ); + + return validResponse; + }, + queryKey: ['useHcaptchaGeneralStats'], + }); +}; + +export default useHcaptchaGeneralStats; diff --git a/packages/apps/dashboard/client/src/features/home/model/generalStats.ts b/packages/apps/dashboard/client/src/features/home/model/generalStats.ts new file mode 100644 index 0000000000..367015e609 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/model/generalStats.ts @@ -0,0 +1,8 @@ +import { z } from 'zod'; + +export const generalStatsResponseSchema = z.object({ + totalHolders: z.number(), + totalTransactions: z.number(), +}); + +export type GeneralStats = z.infer; diff --git a/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts b/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts new file mode 100644 index 0000000000..28e0722769 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/model/hcaptchaGeneralStats.ts @@ -0,0 +1,9 @@ +import { z } from 'zod'; + +export const hcaptchaGeneralStatsResponseSchema = z.object({ + solved: z.number(), +}); + +export type HcaptchaGeneralStats = z.infer< + typeof hcaptchaGeneralStatsResponseSchema +>; diff --git a/packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx b/packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx new file mode 100644 index 0000000000..5adbc00b5f --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/ui/HmtPrice.tsx @@ -0,0 +1,21 @@ +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; + +import useHmtPrice from '@/shared/api/useHmtPrice'; + +const HmtPrice = () => { + const { data, isError, isPending, isSuccess } = useHmtPrice(); + + return ( + + HMT Price + + {isSuccess && `$${data}`} + {isPending && '...'} + {isError && 'No data'} + + + ); +}; + +export default HmtPrice; diff --git a/packages/apps/dashboard/client/src/features/home/ui/Holders.tsx b/packages/apps/dashboard/client/src/features/home/ui/Holders.tsx new file mode 100644 index 0000000000..ed62824cce --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/ui/Holders.tsx @@ -0,0 +1,23 @@ +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useGeneralStats from '../api/useGeneralStats'; + +const Holders = () => { + const { data, isSuccess, isPending, isError } = useGeneralStats(); + + return ( + + Holders + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} + + + ); +}; + +export default Holders; diff --git a/packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx b/packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx new file mode 100644 index 0000000000..715d56712c --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/ui/TotalNumberOfTasks.tsx @@ -0,0 +1,23 @@ +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useHcaptchaGeneralStats from '../api/useHcaptchaGeneralStats'; + +const TotalNumberOfTasks = () => { + const { data, isError, isPending, isSuccess } = useHcaptchaGeneralStats(); + + return ( + + Total Number of Tasks + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} + + + ); +}; + +export default TotalNumberOfTasks; diff --git a/packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx b/packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx new file mode 100644 index 0000000000..5bd9a31a0c --- /dev/null +++ b/packages/apps/dashboard/client/src/features/home/ui/TotalTransactions.tsx @@ -0,0 +1,23 @@ +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; + +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +import useGeneralStats from '../api/useGeneralStats'; + +const TotalTransactions = () => { + const { data, isError, isPending, isSuccess } = useGeneralStats(); + + return ( + + Total Transactions + + {isSuccess && } + {isPending && '...'} + {isError && 'No data'} + + + ); +}; + +export default TotalTransactions; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts b/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts new file mode 100644 index 0000000000..6c2e3a4457 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/api/useLeaderboardDetails.ts @@ -0,0 +1,28 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { leaderboardResponseSchema } from '../model/leaderboardSchema'; + +const useLeaderboardDetails = (chainId: number, first?: number) => { + return useQuery({ + queryFn: async () => { + if (chainId === -1) { + return []; + } + + const { data } = await httpClient.get(apiPaths.leaderboardDetails.path, { + params: { chainId, first }, + }); + + const validResponse = validateResponse(data, leaderboardResponseSchema); + + return validResponse; + }, + queryKey: ['useLeaderboardDetails', chainId, first], + }); +}; + +export default useLeaderboardDetails; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/index.ts b/packages/apps/dashboard/client/src/features/leaderboard/index.ts new file mode 100644 index 0000000000..9959a98e9f --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Leaderboard'; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts b/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts new file mode 100644 index 0000000000..03bb6609f7 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/model/leaderboardSchema.ts @@ -0,0 +1,48 @@ +import { z } from 'zod'; + +export const reputationSchema = z.unknown().transform((value) => { + try { + const knownReputation = z + .union([z.literal('Low'), z.literal('Medium'), z.literal('High')]) + .parse(value); + + return knownReputation; + } catch (error) { + console.error(error); + return 'Unknown'; + } +}); + +export type Reputation = z.infer; + +const leaderboardEntity = z.object({ + address: z.string(), + role: z.string(), + amountStaked: z + .string() + .transform((value, ctx) => { + const valueAsNumber = Number(value); + + if (Number.isNaN(valueAsNumber)) { + ctx.addIssue({ + path: ['amountStaked'], + code: z.ZodIssueCode.custom, + }); + } + + return valueAsNumber / 10 ** 18; + }) + .nullable(), + reputation: reputationSchema, + fee: z.number().nullable(), + jobTypes: z.array(z.string()).nullable(), + url: z.string().nullable(), + website: z.string().nullable(), + chainId: z.number(), + name: z.string().nullable(), + category: z.string().nullable(), +}); + +export const leaderboardResponseSchema = z.array(leaderboardEntity); +export type LeaderboardEntity = z.infer; +export type LeaderboardData = z.infer; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts b/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts new file mode 100644 index 0000000000..7b8d2b28c5 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/store/useLeaderboardFiltersStore.ts @@ -0,0 +1,15 @@ +import { create } from 'zustand'; + +type LeaderboardFiltersStore = { + chainId: number; + setChainId: (chainId: number) => void; +}; + +const useLeaderboardFiltersStore = create((set) => ({ + chainId: -1, + setChainId: (chainId) => { + set({ chainId }); + }, +})); + +export default useLeaderboardFiltersStore; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx new file mode 100644 index 0000000000..f2935aa8fa --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/AddressCell.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; + +import { ChainId } from '@human-protocol/sdk'; +import Box from '@mui/material/Box'; + +import AbbreviateClipboard from '@/shared/ui/AbbreviateClipboard'; + +type Props = { + chainId: ChainId; + address: string; +}; + +const AddressCell: FC = ({ chainId, address }) => ( + + + +); + +export default AddressCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx similarity index 54% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx index 36d3f78d17..aff8549534 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/CategoryCell.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/CategoryCell.tsx @@ -1,17 +1,11 @@ -import { Chip } from '@mui/material'; +import { FC } from 'react'; -interface CategoryCellProps { - value?: string; -} +import Box from '@mui/material/Box'; +import Chip from '@mui/material/Chip'; -export const CategoryCell = ({ value }: CategoryCellProps) => - value?.length ? ( - - ) : null; +type CategoryCellProps = { + value?: string; +}; const getCategoryLabel = (category: string) => { switch (category) { @@ -34,3 +28,16 @@ const getCategoryColor = (category: string) => { return 'default'; } }; + +const CategoryCell: FC = ({ value }) => + value?.length ? ( + + + + ) : null; + +export default CategoryCell; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx new file mode 100644 index 0000000000..028b9dcaf2 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/ChainCell.tsx @@ -0,0 +1,29 @@ +import { FC } from 'react'; + +import { ChainId } from '@human-protocol/sdk'; +import Typography from '@mui/material/Typography'; + +import { getNetwork } from '@/shared/lib/networks'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; + +type Props = { + chainId: ChainId; +}; + +const ChainCell: FC = ({ chainId }) => ( + + + {getNetwork(chainId)?.name} + +); + +export default ChainCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx similarity index 56% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx index 53283c7ada..bc71c3b905 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/DataGridWrapper.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/DataGridWrapper.tsx @@ -1,56 +1,50 @@ -import { LeaderBoardData } from '@services/api/use-leaderboard-details'; -import { Box, Typography } from '@mui/material'; -import { handleErrorMessage } from '@services/handle-error-message'; -import Loader from '@components/Loader'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { DataGrid, useGridApiRef } from '@mui/x-data-grid'; +import { FC } from 'react'; -import { useDataGrid } from '../hooks/useDataGrid'; -import { useDatagridOptions } from '../hooks/useDatagridOptions'; +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; +import { DataGrid } from '@mui/x-data-grid'; -export const DataGridWrapper = ({ - data = [], - status, - error, -}: { - data: LeaderBoardData | undefined; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import Loader from '@/shared/ui/Loader'; + +import { LeaderboardData } from '../model/leaderboardSchema'; +import useDataGrid from '../ui/useDataGrid'; + +type Props = { + data: LeaderboardData | undefined; status: 'success' | 'error' | 'pending'; error: unknown; -}) => { - const apiRef = useGridApiRef(); - const { columns, visibleRows } = useDataGrid(data); - const { customizedColumns, handleSortModelChange, pinnedColSx } = - useDatagridOptions<(typeof visibleRows)[number]>({ - apiRef, - columns, - isRowIdx: true, - pinnedColumnName: 'role', - }); - const { - mobile: { isMobile }, - } = useBreakPoints(); +}; + +const DataGridWrapper: FC = ({ data = [], status, error }) => { + const { columns, rows } = useDataGrid(data); + const isMobile = useIsMobile(); - const tableIsEmpty = status === 'success' && visibleRows.length === 0; + const tableIsEmpty = status === 'success' && rows.length === 0; const tableMinHeight = status === 'success' && !tableIsEmpty ? 'unset' : 300; return ( ({ + top: 4, + bottom: 0, + })} loading={status === 'pending'} - rows={visibleRows} - columns={customizedColumns} - autosizeOptions={{ - expand: true, - }} - onSortModelChange={handleSortModelChange} slots={{ noRowsOverlay() { if (status === 'error') { @@ -72,38 +66,30 @@ export const DataGridWrapper = ({ return ; }, }} - rowHeight={125} - columnHeaderHeight={72} sx={{ position: 'relative', border: 0, - marginBottom: '16px', + mb: 2, '& .MuiDataGrid-cell': { borderTop: 'none', - padding: '0 8px', + p: 2, overflow: 'visible !important', }, - '& .MuiDataGrid-row': { - borderTop: isMobile ? '15px solid rgb(255, 255, 255)' : '', - }, '& .MuiDataGrid-row:hover': { background: 'rgba(20, 6, 178, 0.04)', }, - '& .MuiDataGrid-cell:focus': { - outline: 'none', - }, - '& .MuiDataGrid-cell:focus-within': { + '& .MuiDataGrid-cell:focus, & .MuiDataGrid-cell:focus-within': { outline: 'none', }, '& .MuiDataGrid-columnSeparator--sideRight': { display: 'none', }, '& .MuiDataGrid-columnHeader': { - padding: '0 16px', + fontSize: '12px', + p: 2, overflow: 'visible !important', - }, - '& .MuiDataGrid-columnHeader:hover': { - color: 'rgb(133, 142, 198)', + textTransform: 'uppercase', + bgcolor: 'white.light', }, '& .MuiDataGrid-row--borderBottom .MuiDataGrid-withBorderColor': { borderColor: 'transparent', @@ -116,6 +102,7 @@ export const DataGridWrapper = ({ }, '& .MuiDataGrid-columnHeaderTitleContainer': { overflow: 'unset', + whiteSpace: 'normal', }, '& .MuiDataGrid-columnHeader:focus': { outline: 'none', @@ -123,13 +110,13 @@ export const DataGridWrapper = ({ '& .MuiDataGrid-virtualScroller': { position: 'relative', }, - '& .MuiDataGrid-filler': { + '& .MuiDataGrid-filler, & .MuiDataGrid-cellEmpty': { display: 'none', }, - ...pinnedColSx, }} - getRowClassName={() => 'home-page-table-row'} /> ); }; + +export default DataGridWrapper; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx new file mode 100644 index 0000000000..baea7f9a8b --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/Leaderboard.tsx @@ -0,0 +1,58 @@ +import { FC } from 'react'; + +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import { useNavigate } from 'react-router-dom'; + +import useLeaderboardDetails from '../api/useLeaderboardDetails'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; + +import DataGridWrapper from './DataGridWrapper'; +import SelectNetwork from './SelectNetwork'; + +type Props = { + viewAllBanner?: boolean; + first?: number; +}; + +const Leaderboard: FC = ({ viewAllBanner, first }) => { + const navigate = useNavigate(); + const { chainId } = useLeaderboardFiltersStore(); + const { data, status, error } = useLeaderboardDetails(chainId, first); + + return ( + + + + + + {viewAllBanner ? ( + + ) : null} + + ); +}; + +export default Leaderboard; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx new file mode 100644 index 0000000000..f65a2a7da4 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/RoleCell.tsx @@ -0,0 +1,79 @@ +import { FC, PropsWithChildren } from 'react'; + +import { Launch as LaunchIcon } from '@mui/icons-material'; +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; +import { Link } from 'react-router-dom'; + +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import convertSnakeToHumanReadable from '@/shared/lib/convertSnakeToHumanReadable'; +import EntityIcon from '@/shared/ui/EntityIcon'; + +type WrapperProps = { + websiteUrl?: string; +}; + +type Props = { + rank: number; + role: string; + websiteUrl?: string; + name?: string; +}; + +const Wrapper: FC> = ({ + websiteUrl, + children, +}) => { + return websiteUrl ? ( + + {children} + + ) : ( + <>{children} + ); +}; + +const RoleCell: FC = ({ rank, role, websiteUrl, name }) => { + const isMobile = useIsMobile(); + const humanReadableRole = convertSnakeToHumanReadable(role); + const formattedName = name ? name.split(' ')[0] : null; + + return ( + + + + + {rank} + + + + + + {formattedName ?? humanReadableRole} + + {websiteUrl ? : null} + + {name && role ? ( + + {humanReadableRole} + + ) : null} + + + + + ); +}; + +export default RoleCell; diff --git a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx similarity index 79% rename from packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx rename to packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx index dfc9488530..555c9a8b3a 100644 --- a/packages/apps/dashboard/client/src/features/Leaderboard/components/SelectNetwork.tsx +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/SelectNetwork.tsx @@ -1,22 +1,22 @@ -import Select, { SelectChangeEvent } from '@mui/material/Select'; +import { useEffect } from 'react'; + +import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; import FormControl from '@mui/material/FormControl'; import InputLabel from '@mui/material/InputLabel'; import MenuItem from '@mui/material/MenuItem'; -import Box from '@mui/material/Box'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; -import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { NetworkIcon } from '@components/NetworkIcon'; -import CircularProgress from '@mui/material/CircularProgress'; -import { useEffect } from 'react'; +import Select, { SelectChangeEvent } from '@mui/material/Select'; -export const SelectNetwork = () => { - const { - setChainId, - filterParams: { chainId }, - } = useLeaderboardSearch(); +import useFilteredNetworks from '@/shared/api/useFilteredNetworks'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; + +const SelectNetwork = () => { + const { chainId, setChainId } = useLeaderboardFiltersStore(); const { filteredNetworks, isLoading } = useFilteredNetworks(); + const isMobile = useIsMobile(); useEffect(() => { if (chainId === -1 && filteredNetworks.length > 0) { @@ -24,10 +24,6 @@ export const SelectNetwork = () => { } }, [chainId, filteredNetworks, setChainId]); - const { - mobile: { isMobile }, - } = useBreakPoints(); - const handleChange = (event: SelectChangeEvent) => { const value = Number(event.target.value); setChainId(value); @@ -59,6 +55,11 @@ export const SelectNetwork = () => { value={chainId === -1 ? '' : chainId} label="By Network" onChange={handleChange} + sx={{ + '& #network-select svg': { + display: 'none', + }, + }} > {filteredNetworks.map((network) => ( ( +const TextCell: FC = ({ value }) => ( ( {value} ); + +export default TextCell; diff --git a/packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx b/packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx new file mode 100644 index 0000000000..f2e2f630f2 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/leaderboard/ui/useDataGrid.tsx @@ -0,0 +1,164 @@ +import { useMemo } from 'react'; + +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Box from '@mui/material/Box'; +import Typography from '@mui/material/Typography'; +import { GridColDef, GridRenderCellParams } from '@mui/x-data-grid'; + +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; + +import { LeaderboardData } from '../model/leaderboardSchema'; +import useLeaderboardFiltersStore from '../store/useLeaderboardFiltersStore'; + +import AddressCell from './AddressCell'; +import CategoryCell from './CategoryCell'; +import ChainCell from './ChainCell'; +import RoleCell from './RoleCell'; +import SelectNetwork from './SelectNetwork'; +import TextCell from './TextCell'; + +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const useDataGrid = (data: LeaderboardData) => { + const { chainId } = useLeaderboardFiltersStore(); + const isMobile = useIsMobile(); + + const formattedData = useMemo(() => { + return data.map((row, idx) => { + return { + ...row, + id: `${row.address}${row.chainId}`, + rowIndex: idx, + }; + }); + }, [data]); + + const rows = useMemo(() => { + if (chainId !== -1) { + return formattedData.filter((elem) => elem.chainId === chainId); + } + + return formattedData; + }, [formattedData, chainId]); + + const columns: GridColDef[] = useMemo( + () => [ + { + field: 'role', + flex: 1.5, + minWidth: isMobile ? 250 : 340, + sortable: false, + renderHeader: () => Role, + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + { + field: 'address', + sortable: false, + flex: 1, + minWidth: isMobile ? 180 : 260, + renderHeader: () => ( + + + Address + + ), + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + { + field: 'amountStaked', + sortable: false, + flex: 1, + minWidth: isMobile ? 130 : 260, + renderHeader: () => ( + + + Stake + + ), + valueFormatter: (value: string) => { + return `${value} HMT`; + }, + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + { + field: 'chainId', + headerName: 'Network', + flex: isMobile ? 1 : 1.5, + minWidth: isMobile ? 130 : 245, + renderHeader: () => { + return ( + <> + {isMobile ? ( + Network + ) : ( + + )} + + ); + }, + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + { + field: 'category', + sortable: false, + minWidth: isMobile ? 180 : 260, + headerName: 'Category', + renderHeader: () => Category, + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + { + field: 'fee', + sortable: false, + minWidth: isMobile ? 100 : 130, + headerName: 'Operator Fee', + renderHeader: () => ( + + Operator Fee + + ), + valueFormatter: (value: string | null) => { + if (value == null) { + return ''; + } + + return `${value}%`; + }, + renderCell: (params: GridRenderCellParams) => ( + + ), + }, + ], + [isMobile] + ); + + return { + columns, + rows, + }; +}; + +export default useDataGrid; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts new file mode 100644 index 0000000000..547adb1331 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useAddressDetails.ts @@ -0,0 +1,29 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { addressDetailsResponseSchema } from '../model/addressDetailsSchema'; + +const useAddressDetails = (chainId: number, address: string) => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.addressDetails.path}/${address}`, + { params: { chainId: chainId || -1 } } + ); + + const validResponse = validateResponse( + data, + addressDetailsResponseSchema + ); + + return validResponse; + }, + queryKey: ['useAddressDetails', address, chainId], + enabled: !!chainId && !!address, + }); +}; + +export default useAddressDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts new file mode 100644 index 0000000000..2c946b1b69 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useEscrowDetails.ts @@ -0,0 +1,79 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { paginatedEscrowDetailsSchema } from '../model/escrowDetailsSchema'; + +type Props = { + role: string | null; + chainId: number; + address: string; + page: number; + lastPageIndex: number | undefined; + setLastPageIndex: (lastPageIndex: number | undefined) => void; + params: { + skip: number; + first: number; + }; +}; + +const useEscrowDetails = ({ + role, + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, +}: Props) => { + const dto = { + chainId, + role, + skip: params.skip, + first: params.first, + }; + + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.escrowDetails.path}/${address}`, + { params: dto } + ); + + const validResponse = validateResponse( + data, + paginatedEscrowDetailsSchema + ); + + // check if last page + if (lastPageIndex === undefined) { + const { data: lastPageCheckData } = await httpClient.get( + `${apiPaths.escrowDetails.path}/${address}`, + { + params: { + ...dto, + skip: dto.skip + validResponse.results.length, + first: 1, + }, + } + ); + const validLastPageCheckData = validateResponse( + lastPageCheckData, + paginatedEscrowDetailsSchema + ); + + if (validLastPageCheckData.results.length === 0) { + setLastPageIndex(page + 1); + } + } + + return validResponse; + }, + queryKey: ['useEscrowDetails', address, dto], + enabled: !!chainId && !!address, + }); +}; + +export default useEscrowDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts new file mode 100644 index 0000000000..056bb530ee --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useKvStoreData.ts @@ -0,0 +1,26 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { kvstoreDataSchema } from '../model/kvStoreDataSchema'; + +const useKvstoreData = (chainId: number, address: string) => { + return useQuery({ + queryKey: ['kvstoreData', address], + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.kvstore.path}/${address}`, + { params: { chain_id: chainId || -1 } } + ); + + const validResponse = validateResponse(data, kvstoreDataSchema); + + return validResponse; + }, + enabled: !!chainId && !!address, + }); +}; + +export default useKvstoreData; diff --git a/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts b/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts new file mode 100644 index 0000000000..eee96a4a69 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/api/useTransactionDetails.ts @@ -0,0 +1,78 @@ +import { useQuery } from '@tanstack/react-query'; + +import apiPaths from '@/shared/api/apiPaths'; +import httpClient from '@/shared/api/httpClient'; +import validateResponse from '@/shared/lib/validateResponse'; + +import { paginatedTransactionDetailsSchema } from '../model/transactionDetailsSchema'; + +type Props = { + chainId: number; + address: string; + page: number; + lastPageIndex: number | undefined; + setLastPageIndex: (lastPageIndex: number | undefined) => void; + params: { + skip: number; + first: number; + }; +}; + +const useTransactionDetails = ({ + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, +}: Props) => { + const dto = { + chainId, + skip: params.skip, + first: params.first, + }; + + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get( + `${apiPaths.transactionDetails.path}/${address}`, + { + params: dto, + } + ); + + const validResponse = validateResponse( + data, + paginatedTransactionDetailsSchema + ); + + // check if last page + if (lastPageIndex === undefined) { + const { data: lastPageCheckData } = await httpClient.get( + `${apiPaths.transactionDetails.path}/${address}`, + { + params: { + ...dto, + skip: dto.skip + validResponse.results.length, + first: 1, + }, + } + ); + const validLastPageCheckData = validateResponse( + lastPageCheckData, + paginatedTransactionDetailsSchema + ); + + if (validLastPageCheckData.results.length === 0) { + setLastPageIndex(page + 1); + } + } + + return validResponse; + }, + queryKey: ['useTransactionDetails', address, dto], + enabled: !!chainId && !!address, + }); +}; + +export default useTransactionDetails; diff --git a/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts b/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts new file mode 100644 index 0000000000..342dc03695 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/hooks/usePagination.ts @@ -0,0 +1,66 @@ +import { useCallback, useState } from 'react'; + +type PaginationState = { + params: { + first: number; + skip: number; + }; + pagination: { + page: number; + pageSize: number; + lastPageIndex?: number; + }; + setNextPage: () => void; + setPrevPage: () => void; + setPageSize: (pageSize: number) => void; + setLastPageIndex: (lastPageIndex: number | undefined) => void; +}; + +const INITIAL_PAGE_SIZE = 10; + +const usePagination = (): PaginationState => { + const [page, setPage] = useState(0); + const [pageSize, setPageSize] = useState(INITIAL_PAGE_SIZE); + const [lastPageIndex, setLastPageIndex] = useState(); + + const skip = page * pageSize; + + const setNextPage = useCallback(() => { + setPage((prev) => prev + 1); + }, []); + + const setPrevPage = useCallback(() => { + setPage((prev) => Math.max(0, prev - 1)); + }, []); + + const handleSetPageSize = useCallback((newPageSize: number) => { + setPageSize(newPageSize); + setPage(0); + setLastPageIndex(undefined); + }, []); + + const handleSetLastPageIndex = useCallback( + (newLastPageIndex: number | undefined) => { + setLastPageIndex(newLastPageIndex); + }, + [] + ); + + return { + params: { + first: pageSize, + skip, + }, + pagination: { + page, + pageSize, + lastPageIndex, + }, + setNextPage, + setPrevPage, + setPageSize: handleSetPageSize, + setLastPageIndex: handleSetLastPageIndex, + }; +}; + +export default usePagination; diff --git a/packages/apps/dashboard/client/src/features/searchResults/index.ts b/packages/apps/dashboard/client/src/features/searchResults/index.ts new file mode 100644 index 0000000000..5d2cfb86b4 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/index.ts @@ -0,0 +1 @@ +export { default } from './ui/SearchResults'; diff --git a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx b/packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts similarity index 70% rename from packages/apps/dashboard/client/src/services/api/use-address-details.tsx rename to packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts index 258b3588cc..42d7f3881d 100644 --- a/packages/apps/dashboard/client/src/services/api/use-address-details.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts @@ -1,11 +1,7 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { validateResponse } from '../validate-response'; -import { reputationSchema } from '@services/api/use-leaderboard-details'; import { Role } from '@human-protocol/sdk'; +import { z } from 'zod'; + +import { reputationSchema } from '@/features/leaderboard/model/leaderboardSchema'; const transformOptionalTokenAmount = ( value: string | undefined | null, @@ -29,6 +25,12 @@ const walletSchema = z.object({ chainId: z.number(), address: z.string(), balance: z.string().transform(transformOptionalTokenAmount), + amountStaked: z.string().transform(transformOptionalTokenAmount), + amountLocked: z.string().transform(transformOptionalTokenAmount), + amountWithdrawable: z.string().transform(transformOptionalTokenAmount), + reputation: reputationSchema, + totalHMTAmountReceived: z.string().transform(transformOptionalTokenAmount), + payoutCount: z.number().or(z.string()), }); export type AddressDetailsWallet = z.infer; @@ -62,7 +64,7 @@ const escrowSchema = z.object({ finalResultsUrl: z.string().nullable(), }); -export type AddressDetailsEscrowSchema = z.infer; +export type AddressDetailsEscrow = z.infer; const operatorSchema = z.object({ chainId: z.number(), @@ -78,6 +80,10 @@ const operatorSchema = z.object({ .nullable(), amountStaked: z.string().optional().transform(transformOptionalTokenAmount), amountLocked: z.string().optional().transform(transformOptionalTokenAmount), + amountWithdrawable: z + .string() + .optional() + .transform(transformOptionalTokenAmount), lockedUntilTimestamp: z.string().optional(), reputation: reputationSchema, fee: z.number(), @@ -89,32 +95,10 @@ const operatorSchema = z.object({ export type AddressDetailsOperator = z.infer; -const addressDetailsResponseSchema = z.object({ +export const addressDetailsResponseSchema = z.object({ wallet: z.optional(walletSchema), escrow: z.optional(escrowSchema), operator: z.optional(operatorSchema), }); export type AddressDetails = z.infer; - -export function useAddressDetails() { - const { filterParams } = useWalletSearch(); - - return useQuery({ - queryFn: async () => { - const address = filterParams.address || '0x0'; - const { data } = await httpService.get( - `${apiPaths.addressDetails.path}/${address}`, - { params: { chainId: filterParams.chainId || -1 } } - ); - - const validResponse = validateResponse( - data, - addressDetailsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useAddressDetails', filterParams.address, filterParams.chainId], - }); -} diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts new file mode 100644 index 0000000000..2299f070b5 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/escrowDetailsSchema.ts @@ -0,0 +1,21 @@ +import { z } from 'zod'; + +const escrowDetailsSchema = z.object({ + chainId: z.number(), + address: z.string(), + status: z.string(), +}); + +export type EscrowDetails = z.infer; + +export const paginatedEscrowDetailsSchema = z.object({ + address: z.string(), + chainId: z.number(), + first: z.number(), + skip: z.number(), + results: z.array(escrowDetailsSchema), +}); + +export type PaginatedEscrowDetails = z.infer< + typeof paginatedEscrowDetailsSchema +>; diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts new file mode 100644 index 0000000000..35c8f60378 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/kvStoreDataSchema.ts @@ -0,0 +1,10 @@ +import { z } from 'zod'; + +export const kvstoreDataSchema = z.array( + z.object({ + key: z.string(), + value: z.string(), + }) +); + +export type KvstoreData = z.infer; diff --git a/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts b/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts new file mode 100644 index 0000000000..810967e0f2 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/model/transactionDetailsSchema.ts @@ -0,0 +1,36 @@ +import { z } from 'zod'; + +const internalTransactionSchema = z.object({ + from: z.string(), + to: z.string(), + value: z.string(), + method: z.string(), + receiver: z.string().nullable(), + escrow: z.string().nullable(), + token: z.string().nullable(), +}); + +const transactionDetailsSchema = z.object({ + txHash: z.string(), + method: z.string(), + from: z.string(), + to: z.string(), + receiver: z.string().nullable(), + block: z.number(), + value: z.string(), + internalTransactions: z.array(internalTransactionSchema), +}); + +export type TransactionDetails = z.infer; + +export const paginatedTransactionDetailsSchema = z.object({ + address: z.string(), + chainId: z.number(), + first: z.number(), + skip: z.number(), + results: z.array(transactionDetailsSchema), +}); + +export type PaginatedTransactionDetails = z.infer< + typeof paginatedTransactionDetailsSchema +>; diff --git a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx similarity index 78% rename from packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx index da3bc72a74..7d4c256570 100644 --- a/packages/apps/dashboard/client/src/components/Clipboard/Clipboard.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/Clipboard.tsx @@ -1,24 +1,27 @@ +import { FC, useState } from 'react'; + +import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import Card from '@mui/material/Card'; +import IconButton from '@mui/material/IconButton'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; -import IconButton from '@mui/material/IconButton'; -import ContentCopyIcon from '@mui/icons-material/ContentCopy'; -import { colorPalette } from '@assets/styles/color-palette'; -import CustomTooltip from '@components/CustomTooltip'; -import { useState } from 'react'; -interface ClipboardProps { +import CustomTooltip from '@/shared/ui/CustomTooltip'; + +type ClipboardProps = { value: string; -} +}; -const Clipboard = ({ value }: ClipboardProps) => { +const Clipboard: FC = ({ value }) => { const [tooltipOpen, setTooltipOpen] = useState(false); return ( @@ -29,7 +32,7 @@ const Clipboard = ({ value }: ClipboardProps) => { justifyContent="space-between" > { diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx new file mode 100644 index 0000000000..8801d5d77a --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/EscrowAddress.tsx @@ -0,0 +1,121 @@ +import { FC } from 'react'; + +import Chip from '@mui/material/Chip'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import { AddressDetailsEscrow } from '../model/addressDetailsSchema'; + +import HmtBalance from './HmtBalance'; +import TitleSectionWrapper from './TitleSectionWrapper'; + +type Props = { + data: AddressDetailsEscrow; +}; + +const EscrowAddress: FC = ({ data }) => { + const { + token, + balance, + factoryAddress, + totalFundedAmount, + amountPaid, + status, + launcher, + exchangeOracle, + recordingOracle, + reputationOracle, + } = data; + return ( + + + + {token} + + {balance !== undefined && balance !== null ? ( + + + + ) : null} + + {factoryAddress} + + + + {totalFundedAmount} + + HMT + + + + + + {amountPaid} + + HMT + + + + + + + + + + + {launcher} + + + + + {exchangeOracle} + + + + {recordingOracle} + + + + {reputationOracle} + + + + ); +}; + +export default EscrowAddress; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx new file mode 100644 index 0000000000..aa4f482b53 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtBalance.tsx @@ -0,0 +1,47 @@ +import { FC } from 'react'; + +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import useHmtPrice from '@/shared/api/useHmtPrice'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; + +type Props = { + balance?: number | null; +}; + +const HmtBalance: FC = ({ balance }) => { + const { data, isError, isPending } = useHmtPrice(); + const isMobile = useIsMobile(); + + if (isError) { + return N/A; + } + + if (isPending) { + return ...; + } + + const _balance = + Number(balance) < 1 ? Number(balance) * 1e18 : Number(balance); + const balanceInDollars = balance ? (_balance * data).toFixed(2) : 0; + + return ( + + + + + + {`HMT($${balanceInDollars})`} + + + ); +}; + +export default HmtBalance; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/HmtPrice.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtPrice.tsx new file mode 100644 index 0000000000..be07a28276 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/HmtPrice.tsx @@ -0,0 +1,22 @@ +import { Typography, Stack } from '@mui/material'; + +import useHmtPrice from '@/shared/api/useHmtPrice'; + +const HmtPrice = () => { + const { data, isError, isPending, isSuccess } = useHmtPrice(); + + return ( + + + $ + + + {isError && 'N/A'} + {isPending && '...'} + {isSuccess && data} + + + ); +}; + +export default HmtPrice; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx new file mode 100644 index 0000000000..ea51fc7548 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/KvStore.tsx @@ -0,0 +1,59 @@ +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useKvstoreData from '../api/useKvStoreData'; + +const KVStore = () => { + const { chainId, address } = useGlobalFiltersStore(); + const { data } = useKvstoreData(chainId, address); + + if (data?.length === 0) { + return null; + } + + return ( + + + KV Store + + + + + + Key + Value + + + + {data?.map((row) => ( + + {row.key} + {row.value} + + ))} + +
+
+
+ ); +}; + +export default KVStore; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx new file mode 100644 index 0000000000..0eb637f207 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/NothingFound.tsx @@ -0,0 +1,22 @@ +import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; + +const NothingFound = () => { + return ( + <> + Nothing found :( + + We couldn't find anything within this criteria. +
+ Please search by wallet address or escrow address. +
+ + + Back Home + + + + ); +}; + +export default NothingFound; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx new file mode 100644 index 0000000000..9f47bdbbc8 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorAddress.tsx @@ -0,0 +1,215 @@ +import { FC } from 'react'; + +import { Role } from '@human-protocol/sdk'; +import Box from '@mui/material/Box'; +import Chip from '@mui/material/Chip'; +import Link from '@mui/material/Link'; +import List from '@mui/material/List'; +import ListItem from '@mui/material/ListItem'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import { env } from '@/shared/config/env'; +import EntityIcon from '@/shared/ui/EntityIcon'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import { AddressDetailsOperator } from '../model/addressDetailsSchema'; + +import HmtBalance from './HmtBalance'; +import HmtPrice from './HmtPrice'; +import KVStore from './KvStore'; +import EscrowsTable from './OperatorEscrows/EscrowsTable'; +import ReputationScore from './ReputationScore'; +import StakeInfo from './StakeInfo'; +import TitleSectionWrapper from './TitleSectionWrapper'; + +type RoleInfoProps = { + title: string; + points: string[]; + role: string; +}; + +const RoleInformation: FC = ({ title, points, role }) => { + return ( + + + + {title} + + + {points.map((elem, idx) => ( + + {elem} + + ))} + + + ); +}; + +const renderRoleDetailsInfo = (role: string | null) => { + if (!role) { + return null; + } + + const roleDetailsInfo: Partial< + Record + > = { + [Role.ReputationOracle]: { + title: 'Reputation Oracle', + points: [ + 'The Reputation Oracle is the trust engine of HUMAN Protocol.', + 'It cross-checks validated solutions from the Recording Oracle, adjusts reputation scores, and manages payments.', + "It's the final seal of quality and trust within the ecosystem.", + ], + }, + [Role.RecordingOracle]: { + title: 'Recording Oracle', + points: [ + 'The Recording Oracle is where task solutions get the green light.', + 'It is storing, and recording task solutions on the blockchain.', + "From quality checks to reputation adjustments, it's the assurance you need for dependable results.", + ], + }, + [Role.ExchangeOracle]: { + title: 'Exchange Oracle', + points: [ + "The Exchange Oracle is the HUMAN Protocol's powerhouse, directing tasks to skilled workers and ensuring smooth communication.", + 'It validates solutions, provides job updates, and handles cancellations, streamlining the job lifecycle.', + ], + }, + [Role.JobLauncher]: { + title: 'Job Launcher', + points: [ + 'The Job Launcher is a tool that allows anybody to create and launch jobs, to be distributed as tasks through the HUMAN App.', + ], + }, + }; + + const details = roleDetailsInfo[role]; + + if (!details) { + return null; + } + + return ( + + ); +}; + +const OperatorAddress = ({ data }: { data: AddressDetailsOperator }) => { + const { + balance, + role, + reputation, + amountJobsProcessed, + amountStaked, + amountLocked, + amountWithdrawable, + url, + fee, + jobTypes, + } = data; + + return ( + <> + + + Overview + {env.VITE_HUMANPROTOCOL_CORE_ARCHITECTURE && ( + + )} + + + + + + + + + + + + + {renderRoleDetailsInfo(role)} + + {url && ( + + + {url} + + + )} + {jobTypes && jobTypes?.length > 0 && ( + + + {jobTypes.map((jobType) => ( + + ))} + + + )} + {fee && ( + + {fee}% + + )} + + {amountJobsProcessed} + + + + + + + + + ); +}; +export default OperatorAddress; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx new file mode 100644 index 0000000000..02c973e230 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTable.tsx @@ -0,0 +1,82 @@ +import { FC } from 'react'; + +import Table from '@mui/material/Table'; +import TableContainer from '@mui/material/TableContainer'; +import TableFooter from '@mui/material/TableFooter'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useEscrowDetails from '../../api/useEscrowDetails'; +import usePagination from '../../hooks/usePagination'; +import TablePagination from '../TablePagination'; + +import EscrowsTableBody from './EscrowsTableBody'; + +type Props = { + role: string | null; +}; + +const EscrowsTable: FC = ({ role }) => { + const { chainId, address } = useGlobalFiltersStore(); + const { + pagination: { page, pageSize, lastPageIndex }, + params, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, + } = usePagination(); + const { data, isLoading, error } = useEscrowDetails({ + role, + chainId, + address, + page, + lastPageIndex, + params, + setLastPageIndex, + }); + + return ( + + + Escrows + + + + + + + + + + + + +
+
+
+ ); +}; + +export default EscrowsTable; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx new file mode 100644 index 0000000000..34cbef9bdd --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBody.tsx @@ -0,0 +1,72 @@ +import { FC } from 'react'; + +import { TableRow } from '@mui/material'; +import CircularProgress from '@mui/material/CircularProgress'; +import Link from '@mui/material/Link'; +import MuiTableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; + +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; + +import { PaginatedEscrowDetails } from '../../model/escrowDetailsSchema'; + +import EscrowsTableBodyContainer from './EscrowsTableBodyContainer'; + +type Props = { + data: PaginatedEscrowDetails | undefined; + isLoading: boolean; + error: Error | null; +}; + +const EscrowsTableBody: FC = ({ data, isLoading, error }) => { + const { chainId } = useGlobalFiltersStore(); + + if (isLoading) { + return ( + + + + ); + } + + if (error) { + return ( + +
{handleErrorMessage(error)}
+
+ ); + } + + if (!data?.results.length) { + return ( + +
No escrows launched yet
+
+ ); + } + + return ( + + {data.results.map((elem, idx) => ( + + + + {elem.address} + + + + ))} + + ); +}; + +export default EscrowsTableBody; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx similarity index 69% rename from packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx index 764084e4cd..fe7f2c329e 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/OperatorEscrows/EscrowsTableBodyContainer.tsx @@ -1,11 +1,9 @@ +import { FC, PropsWithChildren } from 'react'; + +import Grid from '@mui/material/Grid'; import MuiTableBody from '@mui/material/TableBody'; -import { Grid } from '@mui/material'; -export const EscrowsTableBodyContainer = ({ - children, -}: { - children: JSX.Element; -}) => { +const EscrowsTableBodyContainer: FC = ({ children }) => { return ( ); }; + +export default EscrowsTableBodyContainer; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx new file mode 100644 index 0000000000..6dc9a20c09 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/ReputationScore.tsx @@ -0,0 +1,62 @@ +import { Chip, useTheme } from '@mui/material'; + +type Reputation = 'High' | 'Medium' | 'Low' | 'Unknown'; + +type Props = { + reputation: Reputation; +}; + +type ReputationAttributes = { + title: string; + colors: { title: string; border: string }; +}; + +const ReputationScore = ({ reputation }: Props) => { + const theme = useTheme(); + + const reputationAttributes: Record = { + High: { + title: 'High', + colors: { + title: theme.palette.success.main, + border: theme.palette.success.light, + }, + }, + Medium: { + title: 'Medium', + colors: { + title: theme.palette.warning.main, + border: theme.palette.warning.light, + }, + }, + Low: { + title: 'Low', + colors: { + title: theme.palette.orange.main, + border: theme.palette.orange.light, + }, + }, + Unknown: { + title: 'Coming soon', + colors: { + title: theme.palette.ocean.main, + border: theme.palette.ocean.light, + }, + }, + }; + + const colors = reputationAttributes[reputation].colors; + + return ( + + ); +}; + +export default ReputationScore; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx new file mode 100644 index 0000000000..e9b30182a3 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/SearchResults.tsx @@ -0,0 +1,170 @@ +import { useEffect, useState } from 'react'; + +import { Stack } from '@mui/material'; +import { AxiosError } from 'axios'; +import { useLocation, useParams } from 'react-router-dom'; + +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import { getNetwork } from '@/shared/lib/networks'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import EscrowAddressIcon from '@/shared/ui/icons/EscrowAddressIcon'; +import WalletIcon from '@/shared/ui/icons/WalletIcon'; +import Loader from '@/shared/ui/Loader'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; + +import useAddressDetails from '../api/useAddressDetails'; +import { AddressDetails } from '../model/addressDetailsSchema'; + +import Clipboard from './Clipboard'; +import EscrowAddress from './EscrowAddress'; +import NothingFound from './NothingFound'; +import OperatorAddress from './OperatorAddress'; +import WalletAddress from './WalletAddress'; +import WalletTransactionsTable from './WalletTransactionsTable'; + +enum ParamsStatus { + LOADING = 'loading', + ERROR = 'error', + SUCCESS = 'success', +} + +const renderCurrentResultType = ( + addressDetails: AddressDetails, + tokenId: string | undefined +) => { + const type = Object.keys(addressDetails)[0] as + | keyof AddressDetails + | undefined; + + const renderType: Record< + keyof AddressDetails, + { title: string; icon: JSX.Element } + > = { + operator: { + title: 'Wallet Address', + icon: , + }, + escrow: { + title: 'Escrow Address', + icon: , + }, + wallet: { + title: 'Wallet Address', + icon: , + }, + }; + + if (type == null) { + return null; + } + + return ( + <> + + + + ); +}; + +const ResultError = ({ error }: { error: unknown }) => { + if (error instanceof AxiosError && error.response?.status === 400) { + return ( + + + + ); + } + return {handleErrorMessage(error)}; +}; + +const SearchResults = () => { + const [paramsStatus, setParamsStatus] = useState( + ParamsStatus.LOADING + ); + const location = useLocation(); + const { chainId: urlChainId, address: urlAddress } = useParams(); + const { address, chainId, setAddress, setChainId } = useGlobalFiltersStore(); + const { data, status, error } = useAddressDetails(chainId, address); + + useEffect(() => { + setParamsStatus(ParamsStatus.LOADING); + }, [location]); + + useEffect(() => { + if (paramsStatus === ParamsStatus.SUCCESS) return; + if (urlAddress) { + setAddress(urlAddress); + } else { + setParamsStatus(ParamsStatus.ERROR); + return; + } + const chainIdFromUrl = Number(urlChainId); + if ( + !Number.isNaN(chainIdFromUrl) && + chainIdFromUrl && + getNetwork(chainIdFromUrl) + ) { + setChainId(chainIdFromUrl); + } else { + setParamsStatus(ParamsStatus.ERROR); + } + }, [ + address, + chainId, + paramsStatus, + setAddress, + setChainId, + urlAddress, + urlChainId, + ]); + + useEffect(() => { + if (address && chainId && paramsStatus !== ParamsStatus.SUCCESS) { + setParamsStatus(ParamsStatus.SUCCESS); + } + }, [address, chainId, paramsStatus]); + + if ( + paramsStatus === ParamsStatus.LOADING || + (status === 'pending' && !data) + ) { + return ; + } + + if (paramsStatus === ParamsStatus.ERROR) { + return Something went wrong; + } + + if (status === 'error') { + return ; + } + + const showTransactions = !!data.wallet || !!data.operator; + + const walletData = + data.wallet || + (data.operator && data.operator.role === null ? data.operator : undefined); + + return ( + <> + + {renderCurrentResultType(data, address)} + + + {data.operator && data.operator.role ? ( + + ) : null} + {walletData ? : null} + {data.escrow && } + {showTransactions && } + + ); +}; + +export default SearchResults; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx new file mode 100644 index 0000000000..449d26c9ea --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/StakeInfo.tsx @@ -0,0 +1,80 @@ +import { FC } from 'react'; + +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +type Props = { + amountStaked?: number | null; + amountLocked?: number | null; + amountWithdrawable?: number | null; +}; + +const renderAmount = (amount: number | null | undefined, isMobile: boolean) => { + return ( + + + + + + HMT + + + ); +}; + +const StakeInfo: FC = ({ + amountStaked, + amountLocked, + amountWithdrawable, +}) => { + const isMobile = useIsMobile(); + if (!amountStaked && !amountLocked && !amountWithdrawable) return null; + + return ( + + + Stake Info + + + {Number.isFinite(amountStaked) && ( + + + Staked Tokens + + {renderAmount(amountStaked, isMobile)} + + )} + {Number.isFinite(amountLocked) && ( + + + Locked Tokens + + {renderAmount(amountLocked, isMobile)} + + )} + {Number.isFinite(amountWithdrawable) && ( + + + Withdrawable Tokens + + {renderAmount(amountWithdrawable, isMobile)} + + )} + + + ); +}; + +export default StakeInfo; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx new file mode 100644 index 0000000000..a0611b80ee --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/TablePagination.tsx @@ -0,0 +1,92 @@ +import { FC, useEffect } from 'react'; + +import { TablePagination as MuiTablePagination } from '@mui/material'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; + +type Props = { + page: number; + pageSize: number; + resultsLength: number; + lastPageIndex: number | undefined; + isDataLoading: boolean | undefined; + setPageSize: (pageSize: number) => void; + setNextPage: () => void; + setPrevPage: () => void; + setLastPageIndex: (lastPageIndex: number | undefined) => void; +}; + +const TablePagination: FC = ({ + page, + pageSize, + resultsLength, + lastPageIndex, + isDataLoading, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, +}) => { + const { chainId, address } = useGlobalFiltersStore(); + + useEffect(() => { + if ( + resultsLength !== undefined && + resultsLength === 0 && + page > 0 && + !isDataLoading + ) { + setLastPageIndex(page); + setPrevPage(); + } + }, [resultsLength, page, setLastPageIndex, setPrevPage, isDataLoading]); + + useEffect(() => { + setLastPageIndex(undefined); + }, [address, chainId, setLastPageIndex]); + + useEffect(() => { + return () => { + setPageSize(10); + }; + }, [setPageSize]); + + return ( + {}} + page={page} + component="td" + rowsPerPage={pageSize} + onRowsPerPageChange={(event) => { + setPageSize(Number(event.target.value)); + }} + rowsPerPageOptions={[5, 10]} + labelDisplayedRows={({ from, to }) => { + const effectiveTo = resultsLength ? from + resultsLength - 1 : to; + return `${from}–${effectiveTo}`; + }} + slotProps={{ + actions: { + nextButton: { + onClick: () => { + setNextPage(); + }, + disabled: + lastPageIndex !== undefined && + (page === lastPageIndex || lastPageIndex - 1 === page), + }, + previousButton: { + onClick: () => { + setPrevPage(); + }, + }, + }, + }} + /> + ); +}; + +export default TablePagination; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx new file mode 100644 index 0000000000..3eacd67706 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/TitleSectionWrapper.tsx @@ -0,0 +1,52 @@ +import { FC, PropsWithChildren } from 'react'; + +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import { SxProps } from '@mui/material'; +import Box from '@mui/material/Box'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import CustomTooltip from '@/shared/ui/CustomTooltip'; + +type Props = { + title: string; + tooltip?: string; + sx?: SxProps; +}; + +const TitleSectionWrapper: FC> = ({ + title, + tooltip, + sx, + children, +}) => { + return ( + + {tooltip ? ( + + + + + {title} + + ) : ( + + {title} + + )} + + {children} + + + ); +}; + +export default TitleSectionWrapper; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx new file mode 100644 index 0000000000..5275c53c20 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx @@ -0,0 +1,87 @@ +import { FC } from 'react'; + +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; + +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import FormattedNumber from '@/shared/ui/FormattedNumber'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import { + AddressDetailsOperator, + AddressDetailsWallet, +} from '../model/addressDetailsSchema'; + +import HmtBalance from './HmtBalance'; +import HmtPrice from './HmtPrice'; +import KVStore from './KvStore'; +import ReputationScore from './ReputationScore'; +import StakeInfo from './StakeInfo'; +import TitleSectionWrapper from './TitleSectionWrapper'; + +type Props = { + data: AddressDetailsWallet | AddressDetailsOperator; +}; + +const WalletAddress: FC = ({ data }) => { + const { + balance, + amountStaked, + amountLocked, + reputation, + amountWithdrawable, + } = data; + const isMobile = useIsMobile(); + const isWallet = 'totalHMTAmountReceived' in data; + + return ( + <> + + + Overview + + + + + + + + + + {isWallet && ( + + + + + + HMT + + + )} + + + + + + ); +}; + +export default WalletAddress; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx similarity index 58% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx index 1bc9c3a454..d2122d76cb 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBody.tsx @@ -1,43 +1,31 @@ -import React, { useEffect, useState } from 'react'; -import TableRow from '@mui/material/TableRow'; -import TableCell from '@mui/material/TableCell'; -import MuiTableBody from '@mui/material/TableBody'; -import Box from '@mui/material/Box'; -import IconButton from '@mui/material/IconButton'; -import CircularProgress from '@mui/material/CircularProgress'; +import { FC, useState } from 'react'; + import AddCircleIcon from '@mui/icons-material/AddCircle'; +import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import RemoveCircleIcon from '@mui/icons-material/RemoveCircle'; -import AbbreviateClipboard from '@components/SearchResults/AbbreviateClipboard'; -import { colorPalette } from '@assets/styles/color-palette'; +import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; +import IconButton from '@mui/material/IconButton'; +import MuiTableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableRow from '@mui/material/TableRow'; -import { TransactionTableCellMethod } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod'; -import { TransactionTableCellValue } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue'; -import { useTransactionDetails } from '@services/api/use-transaction-details'; -import { TransactionsTableBodyContainer } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer'; -import { handleErrorMessage } from '@services/handle-error-message'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; +import handleErrorMessage from '@/shared/lib/handleErrorMessage'; +import AbbreviateClipboard from '@/shared/ui/AbbreviateClipboard'; -export const TransactionsTableBody: React.FC = () => { - const { data, isPending, isError, error } = useTransactionDetails(); - const { filterParams } = useWalletSearch(); - const { - setLastPageIndex, - setPrevPage, - pagination: { page }, - } = useTransactionDetailsDto(); +import { PaginatedTransactionDetails } from '../../model/transactionDetailsSchema'; - useEffect(() => { - if (data?.results.length === 0) { - setLastPageIndex(page); - setPrevPage(); - } - }, [data?.results, page, setLastPageIndex, setPrevPage]); +import TransactionsTableBodyContainer from './TransactionsTableBodyContainer'; +import TransactionsTableCellMethod from './TransactionsTableCellMethod'; +import TransactionsTableCellValue from './TransactionsTableCellValue'; - useEffect(() => { - setLastPageIndex(undefined); - }, [filterParams.address, filterParams.chainId, setLastPageIndex]); +type Props = { + data: PaginatedTransactionDetails | undefined; + isLoading: boolean; + error: Error | null; +}; +const TransactionsTableBody: FC = ({ data, isLoading, error }) => { const [expandedRows, setExpandedRows] = useState>({}); const toggleRow = (idx: number) => { @@ -47,7 +35,7 @@ export const TransactionsTableBody: React.FC = () => { })); }; - if (isPending) { + if (isLoading) { return ( @@ -55,7 +43,7 @@ export const TransactionsTableBody: React.FC = () => { ); } - if (isError) { + if (error) { return (
{handleErrorMessage(error)}
@@ -63,7 +51,7 @@ export const TransactionsTableBody: React.FC = () => { ); } - if (!data.results.length) { + if (!data?.results.length) { return (
No data
@@ -79,13 +67,13 @@ export const TransactionsTableBody: React.FC = () => { key={idx} sx={{ backgroundColor: expandedRows[idx] - ? colorPalette.table.selected - : colorPalette.table.main, + ? 'table.selected' + : 'table.main', }} > - + {elem.internalTransactions.length > 0 && ( toggleRow(idx)} size="small"> {expandedRows[idx] ? ( @@ -100,7 +88,7 @@ export const TransactionsTableBody: React.FC = () => { - + { /> - {' '} - + + + + {elem.block} - + {elem.internalTransactions?.map((internalTx, internalIdx) => ( - + { /> - + + + + - + ))} @@ -156,3 +155,5 @@ export const TransactionsTableBody: React.FC = () => {
); }; + +export default TransactionsTableBody; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx similarity index 71% rename from packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx rename to packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx index 04d9275011..133bb36a0f 100644 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBodyContainer.tsx +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableBodyContainer.tsx @@ -1,10 +1,10 @@ +import { FC, PropsWithChildren } from 'react'; + +import Grid from '@mui/material/Grid'; import MuiTableBody from '@mui/material/TableBody'; -import { Grid } from '@mui/material'; -export const TransactionsTableBodyContainer = ({ +const TransactionsTableBodyContainer: FC = ({ children, -}: { - children: JSX.Element; }) => { return ( @@ -26,3 +26,5 @@ export const TransactionsTableBodyContainer = ({ ); }; + +export default TransactionsTableBodyContainer; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx new file mode 100644 index 0000000000..ac8d85d7ec --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellMethod.tsx @@ -0,0 +1,101 @@ +import Chip from '@mui/material/Chip'; +import { useTheme } from '@mui/material/styles'; + +type PaletteColorKey = + | 'primary' + | 'secondary' + | 'error' + | 'warning' + | 'info' + | 'success'; +type PaletteShadeKey = 'main' | 'light' | 'dark'; + +const methodAttributes: Record< + string, + { color: { text: string; border: string } } +> = { + withdraw: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + cancel: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + stake: { + color: { + text: 'success.main', + border: 'success.light', + }, + }, + unstake: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + slash: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + stakeWithdrawn: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + withdrawFees: { + color: { + text: 'error.main', + border: 'error.light', + }, + }, + approve: { + color: { + text: 'warning.main', + border: 'warning.light', + }, + }, + complete: { + color: { + text: 'success.main', + border: 'success.light', + }, + }, +}; + +const TransactionsTableCellMethod = ({ method }: { method: string }) => { + const theme = useTheme(); + const currentStatusColors = methodAttributes[method]?.color || { + text: 'primary.main', + border: 'primary.light', + }; + + const getColorFromTheme = (colorString: string) => { + const [color, shade] = colorString.split('.') as [ + PaletteColorKey, + PaletteShadeKey, + ]; + return theme.palette[color][shade]; + }; + + return ( + + ); +}; + +export default TransactionsTableCellMethod; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx new file mode 100644 index 0000000000..4c031b002c --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableCellValue.tsx @@ -0,0 +1,49 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Typography from '@mui/material/Typography'; + +import useHmtPrice from '@/shared/api/useHmtPrice'; +import formatHmtDecimals from '@/shared/lib/formatHmtDecimals'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; + +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const TransactionsTableCellValue = ({ + value, + method, +}: { + value: string; + method: string; +}) => { + const { isError, isPending } = useHmtPrice(); + + if (isError) { + return N/A; + } + + if (isPending) { + return ...; + } + + return ( + + {formatHmtDecimals(value)} + + HMT + + {method === 'approve' && ( + + )} + + ); +}; + +export default TransactionsTableCellValue; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx new file mode 100644 index 0000000000..060380626b --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactions/TransactionsTableHead.tsx @@ -0,0 +1,70 @@ +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Stack from '@mui/material/Stack'; +import TableCell from '@mui/material/TableCell'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; + +import CustomTooltip from '@/shared/ui/CustomTooltip'; + +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const TransactionsTableHead = () => { + return ( + + + + + Transaction Hash + + + + + + Method + + + + From + To + + + Block + + + + + + Value + + + + + + ); +}; + +export default TransactionsTableHead; diff --git a/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx new file mode 100644 index 0000000000..2dbe0da623 --- /dev/null +++ b/packages/apps/dashboard/client/src/features/searchResults/ui/WalletTransactionsTable.tsx @@ -0,0 +1,90 @@ +import Table from '@mui/material/Table'; +import TableContainer from '@mui/material/TableContainer'; +import TableFooter from '@mui/material/TableFooter'; +import TableRow from '@mui/material/TableRow'; +import Typography from '@mui/material/Typography'; +import SimpleBar from 'simplebar-react'; + +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import SectionWrapper from '@/shared/ui/SectionWrapper'; + +import useTransactionDetails from '../api/useTransactionDetails'; +import usePagination from '../hooks/usePagination'; + +import TablePagination from './TablePagination'; +import TransactionsTableBody from './WalletTransactions/TransactionsTableBody'; +import TransactionsTableHead from './WalletTransactions/TransactionsTableHead'; + +const WalletTransactionsTable = () => { + const { chainId, address } = useGlobalFiltersStore(); + const { + pagination: { page, pageSize, lastPageIndex }, + params, + setPageSize, + setNextPage, + setPrevPage, + setLastPageIndex, + } = usePagination(); + const { data, isLoading, error } = useTransactionDetails({ + chainId, + address, + page, + lastPageIndex, + setLastPageIndex, + params, + }); + + return ( + + + Transactions + + + + + + +
+
+ + + + + + +
+
+
+ ); +}; + +export default WalletTransactionsTable; diff --git a/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts b/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts deleted file mode 100644 index 45feadaf9d..0000000000 --- a/packages/apps/dashboard/client/src/helpers/abbreviateValue.ts +++ /dev/null @@ -1,12 +0,0 @@ -const abbreviateValue = (value: string | null) => { - if (value) { - const first3Letters = value.slice(0, 5); - const last5Letters = value.slice(-5); - - return `${first3Letters}...${last5Letters}`; - } - - return null; -}; - -export default abbreviateValue; diff --git a/packages/apps/dashboard/client/src/helpers/index.ts b/packages/apps/dashboard/client/src/helpers/index.ts deleted file mode 100644 index f2f42df6a9..0000000000 --- a/packages/apps/dashboard/client/src/helpers/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'src/helpers/abbreviateValue'; diff --git a/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts b/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts deleted file mode 100644 index 8b4e86d412..0000000000 --- a/packages/apps/dashboard/client/src/helpers/isValidEVMAddress.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const isValidEVMAddress = (input: string): boolean => { - const evmRegex = /^0x[a-fA-F0-9]{40}$/; - return evmRegex.test(input); -}; diff --git a/packages/apps/dashboard/client/src/index.css b/packages/apps/dashboard/client/src/index.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/apps/dashboard/client/src/pages/Graph/Graph.tsx b/packages/apps/dashboard/client/src/pages/Graph/Graph.tsx deleted file mode 100644 index 0441976ec4..0000000000 --- a/packages/apps/dashboard/client/src/pages/Graph/Graph.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { AreaChart } from '@components/Charts'; -import { useEffect } from 'react'; -import PageWrapper from '@components/PageWrapper'; -import Breadcrumbs from '@components/Breadcrumbs'; -import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params'; - -const Graph = () => { - const { revertToInitialParams } = useGraphPageChartParams(); - - useEffect(() => { - revertToInitialParams(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return ( - - - - - ); -}; - -export default Graph; diff --git a/packages/apps/dashboard/client/src/pages/Graph/index.ts b/packages/apps/dashboard/client/src/pages/Graph/index.ts deleted file mode 100644 index 8c491e7e8c..0000000000 --- a/packages/apps/dashboard/client/src/pages/Graph/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Graph'; diff --git a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx b/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx deleted file mode 100644 index 20b9474c58..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/HMTPrice.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { useHMTPrice } from '../../services/api/use-hmt-price'; -import Typography from '@mui/material/Typography'; - -export function HMTPrice() { - const { data, status } = useHMTPrice(); - return ( -
- - HMT Price - -
- {status === 'success' && `$${data.hmtPrice}`} - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
- ); -} diff --git a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx b/packages/apps/dashboard/client/src/pages/Home/Holders.tsx deleted file mode 100644 index d72698569e..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/Holders.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { FormatNumber } from '@components/Home/FormatNumber'; -import Typography from '@mui/material/Typography'; -import { useGeneralStats } from '@services/api/use-general-stats'; - -export function Holders() { - const { data, status } = useGeneralStats(); - - return ( -
- - Holders - -
- {status === 'success' && } - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
- ); -} diff --git a/packages/apps/dashboard/client/src/pages/Home/Home.tsx b/packages/apps/dashboard/client/src/pages/Home/Home.tsx deleted file mode 100644 index 8082578b9f..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/Home.tsx +++ /dev/null @@ -1,132 +0,0 @@ -import PageWrapper from '@components/PageWrapper'; -import SearchBar from '@components/SearchBar/SearchBar'; -import ShadowIcon from '@components/ShadowIcon'; -import Typography from '@mui/material/Typography'; -import Button from '@mui/material/Button'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import Divider from '@mui/material/Divider'; -import { Link } from 'react-router-dom'; -import { Leaderboard } from './Leaderboard'; -import GraphSwiper from '@components/Home/GraphSwiper'; -import { HMTPrice } from '@pages/Home/HMTPrice'; -import { TotalNumberOfTasks } from '@pages/Home/TotalNumberOfTasks'; -import { Holders } from '@pages/Home/Holders'; -import { TotalTransactions } from '@pages/Home/TotalTransactions'; -import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { colorPalette } from '@assets/styles/color-palette'; -import CustomTooltip from '@components/CustomTooltip'; - -const Home: React.FC = () => { - const { - mobile: { isMobile }, - } = useBreakPoints(); - return ( - -
- - All HUMAN activity. In one place. - - -
-
-
-
Token
-
-
- - - -
- -
- -
-
- - - -
- -
-
-
-
- Data Overview - -
-
-
- - - -
- -
- -
-
- - - -
- -
-
-
- -
-
- } - /> - -
- ); -}; - -export default Home; diff --git a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx b/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx deleted file mode 100644 index 532e9788ff..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/Leaderboard.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; -import { Leaderboard as LeaderboardFeature } from '../../features/Leaderboard'; - -export const Leaderboard = () => { - const { data, status, error } = useLeaderboardDetails(4); - - return ( - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx b/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx deleted file mode 100644 index 26a8bb850d..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/TotalNumberOfTasks.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { useHcaptchaGeneralStats } from '@services/api/use-hcaptcha-general-stats'; -import Typography from '@mui/material/Typography'; -import { FormatNumber } from '@components/Home/FormatNumber'; - -export function TotalNumberOfTasks() { - const { data, status } = useHcaptchaGeneralStats(); - - return ( -
- - Total Number of Tasks - -
- {status === 'success' && } - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
- ); -} diff --git a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx b/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx deleted file mode 100644 index 82bf49cab7..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/TotalTransactions.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { FormatNumber } from '@components/Home/FormatNumber'; -import Typography from '@mui/material/Typography'; -import { useGeneralStats } from '@services/api/use-general-stats'; - -export function TotalTransactions() { - const { data, status } = useGeneralStats(); - - return ( -
- - Total Transactions - -
- {status === 'success' && ( - - )} - {status === 'pending' && '...'} - {status === 'error' && 'No data'} -
-
- ); -} diff --git a/packages/apps/dashboard/client/src/pages/Home/index.ts b/packages/apps/dashboard/client/src/pages/Home/index.ts deleted file mode 100644 index 41e08eefd0..0000000000 --- a/packages/apps/dashboard/client/src/pages/Home/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './Home'; diff --git a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx b/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx deleted file mode 100644 index 1a2a7f2d48..0000000000 --- a/packages/apps/dashboard/client/src/pages/Leaderboard/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Breadcrumbs from '@components/Breadcrumbs'; -import PageWrapper from '@components/PageWrapper'; -import ShadowIcon from '@components/ShadowIcon'; -import { Leaderboard } from '../../features/Leaderboard/index'; -import { useLeaderboardDetails } from '@services/api/use-leaderboard-details'; -import { LeaderboardIcon } from '@components/Icons/LeaderboardIcon'; - -export const LeaderBoard = () => { - const { data, status, error } = useLeaderboardDetails(); - - return ( - - - } - /> - - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx deleted file mode 100644 index 2a774f6b9c..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/EscrowAddress.tsx +++ /dev/null @@ -1,149 +0,0 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; -import Box from '@mui/material/Box'; -import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; -import TitleSectionWrapper from '@components/SearchResults'; -import { AddressDetailsEscrowSchema } from '@services/api/use-address-details'; -import { HMTBalance } from '@pages/SearchResults/EscrowAddress/HMTBalance'; - -const EscrowAddress = ({ - data: { - token, - balance, - factoryAddress, - totalFundedAmount, - amountPaid, - status, - launcher, - exchangeOracle, - recordingOracle, - reputationOracle, - }, -}: { - data: AddressDetailsEscrowSchema; -}) => { - return ( - - - - {token} - - {balance !== undefined && balance !== null ? ( - - - - ) : null} - - {factoryAddress} - - - - {totalFundedAmount} - - HMT - - - - - - {amountPaid} - - HMT - - - - - - - - {status} - - - - - - - {launcher} - - - - - {exchangeOracle} - - - - {recordingOracle} - - - - {reputationOracle} - - - - ); -}; - -export default EscrowAddress; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx deleted file mode 100644 index 839e28393a..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/HMTBalance.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { colorPalette } from '@assets/styles/color-palette'; -import Stack from '@mui/material/Stack'; -import Typography from '@mui/material/Typography'; -import { useHMTPrice } from '@services/api/use-hmt-price'; - -export const HMTBalance = ({ HMTBalance }: { HMTBalance: number }) => { - const { data, isError, isPending } = useHMTPrice(); - - if (isError) { - return N/A; - } - - if (isPending) { - return ...; - } - const HMTBalanceInDollars = HMTBalance * data.hmtPrice; - - return ( - - {HMTBalance} - - {`HMT($${HMTBalanceInDollars.toFixed(2)})`} - - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts deleted file mode 100644 index b7ba591a2c..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/EscrowAddress/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './EscrowAddress'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx deleted file mode 100644 index 24f69c717a..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetails.tsx +++ /dev/null @@ -1,391 +0,0 @@ -import Card from '@mui/material/Card'; -import Typography from '@mui/material/Typography'; -import Box from '@mui/material/Box'; -import { colorPalette } from '@assets/styles/color-palette'; -import Stack from '@mui/material/Stack'; -import IconButton from '@mui/material/IconButton'; -import ReputationOracleIcon from '@assets/icons/reputation-oracle.svg'; -import ExchangeOracleIcon from '@assets/icons/exchange-oracle.svg'; -import JobLauncherIcon from '@assets/icons/job-launcher.svg'; -import RecordingOracleIcon from '@assets/icons/recording-oracle.svg'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; -import { getNetwork } from '@utils/config/networks'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { RoleDetailsEscrowsTable } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable'; -import { Reputation } from '@services/api/use-leaderboard-details'; -import { env } from '@helpers/env'; -import { FormatNumberWithDecimals } from '@components/Home/FormatNumber'; -import CustomTooltip from '@components/CustomTooltip'; -import { Role } from '@human-protocol/sdk'; - -interface RoleInfoProps { - title: string; - points: string[]; -} - -const RoleInformation = ({ title, points }: RoleInfoProps) => { - return ( - - {title} -
    - {points.map((elem, idx) => ( -
  • - {elem} -
  • - ))} -
-
- ); -}; - -const RenderRoleDetailsInfo = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { - if (!role) { - return null; - } - - const roleDetailsInfo: Partial< - Record - > = { - [Role.ReputationOracle]: { - title: 'Reputation Oracle', - points: [ - 'The Reputation Oracle is the trust engine of HUMAN Protocol.', - 'It cross-checks validated solutions from the Recording Oracle, adjusts reputation scores, and manages payments.', - "It's the final seal of quality and trust within the ecosystem.", - ], - }, - [Role.RecordingOracle]: { - title: 'Recording Oracle', - points: [ - 'The Recording Oracle is where task solutions get the green light.', - 'It is storing, and recording task solutions on the blockchain.', - "From quality checks to reputation adjustments, it's the assurance you need for dependable results.", - ], - }, - [Role.ExchangeOracle]: { - title: 'Exchange Oracle', - points: [ - "The Exchange Oracle is the HUMAN Protocol's powerhouse, directing tasks to skilled workers and ensuring smooth communication.", - 'It validates solutions, provides job updates, and handles cancellations, streamlining the job lifecycle.', - ], - }, - [Role.JobLauncher]: { - title: 'Job Launcher', - points: [ - 'The Job Launcher is a tool that allows anybody to create and launch jobs, to be distributed as tasks through the HUMAN App.', - ], - }, - }; - - const details = roleDetailsInfo[role]; - - if (!details) { - return null; - } - - return ; -}; - -const renderReputationTitle = (reputation: Reputation) => { - const reputationAttributes: Record< - Reputation, - { title: string; colors: { title: string; border: string } } - > = { - High: { - title: 'High', - colors: { - title: colorPalette.success.main, - border: colorPalette.success.light, - }, - }, - Medium: { - title: 'Medium', - colors: { - title: colorPalette.warning.main, - border: colorPalette.warning.light, - }, - }, - - Low: { - title: 'Low', - colors: { - title: colorPalette.orange.main, - border: colorPalette.orange.light, - }, - }, - Unknown: { - title: 'Coming soon', - colors: { - title: colorPalette.ocean.main, - border: colorPalette.ocean.light, - }, - }, - }; - - const colors = reputationAttributes[reputation].colors; - - return ( - - - {reputationAttributes[reputation].title} - - - ); -}; - -const renderRoleIcon = (role: AddressDetailsOperator['role']) => { - if (!role) return null; - const roleIcons = { - [Role.ReputationOracle]: , - [Role.ExchangeOracle]: , - [Role.JobLauncher]: , - [Role.RecordingOracle]: , - }; - - return roleIcons[role]; -}; - -const RoleDetails = ({ - data: { - role, - chainId, - reputation, - amountJobsProcessed, - amountStaked, - amountLocked, - }, -}: { - data: AddressDetailsOperator; -}) => { - const { filterParams } = useWalletSearch(); - - return ( - <> - - - - Overview - - {env.VITE_HUMANPROTOCOL_CORE_ARCHITECTURE ? ( - - - HUMAN Protocol core architecture - - - ) : null} - - - - - Role - - - {renderRoleIcon(role)} - - - - - - Network - - - {getNetwork(chainId)?.name || ''} - - - - - - - - - - Reputation Score - - {renderReputationTitle(reputation)} - - - - Jobs Launched - - {amountJobsProcessed} - - - - - - - - Stake Info - - - - {amountStaked !== undefined && amountStaked !== null ? ( - - - Tokens Staked - - - - - - - HMT - - - - ) : null} - {amountLocked !== undefined && amountLocked !== null ? ( - - - Tokens Locked - - - - - - - HMT - - - - ) : null} - - - - {filterParams.address && filterParams.chainId ? ( - - ) : null} - - ); -}; -export default RoleDetails; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx deleted file mode 100644 index 9a01f47b1c..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/RoleDetailsEscrowsTable.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import Card from '@mui/material/Card'; -import Typography from '@mui/material/Typography'; -import Box from '@mui/material/Box'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; -import TableContainer from '@mui/material/TableContainer'; -import Table from '@mui/material/Table'; -import { EscrowsTableBody } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody'; -import TablePagination from '@mui/material/TablePagination'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { useEscrowDetails } from '@services/api/use-escrows-details'; -import TableHead from '@mui/material/TableHead'; -import TableRow from '@mui/material/TableRow'; -import { Stack } from '@mui/material'; - -export const RoleDetailsEscrowsTable = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { - const { data } = useEscrowDetails({ role }); - const { - pagination: { page, pageSize, lastPageIndex }, - setPageSize, - setNextPage, - setPrevPage, - } = useEscrowDetailsDto(); - - return ( - - - - Escrows - - - - - - - -
-
- - {}} - page={page} - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - component="div" - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || lastPageIndex - 1 === page), - }, - previousButton: { - onClick: () => { - setPrevPage(); - }, - }, - }, - }} - /> - -
-
- ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx deleted file mode 100644 index 153f8c0c76..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBody.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import TableCell from '@mui/material/TableCell'; -import MuiTableBody from '@mui/material/TableBody'; -import { useEffect } from 'react'; -import { handleErrorMessage } from '@services/handle-error-message'; -import CircularProgress from '@mui/material/CircularProgress'; -import { EscrowsTableBodyContainer } from '@pages/SearchResults/RoleDetails/RoleDetailsEscrows/tableComponents/EscrowsTableBodyContainer'; -import { useEscrowDetails } from '@services/api/use-escrows-details'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useNavigate } from 'react-router-dom'; -import { Stack, TableRow } from '@mui/material'; -import Link from '@mui/material/Link'; - -export const EscrowsTableBody = ({ - role, -}: { - role: AddressDetailsOperator['role']; -}) => { - const navigate = useNavigate(); - const { filterParams } = useWalletSearch(); - const { data, isPending, isError, error } = useEscrowDetails({ role }); - const { - setLastPageIndex, - setPrevPage, - pagination: { page }, - } = useEscrowDetailsDto(); - - useEffect(() => { - if (data?.results.length === 0) { - setLastPageIndex(page); - setPrevPage(); - } - }, [data?.results, page, setLastPageIndex, setPrevPage]); - - useEffect(() => { - setLastPageIndex(undefined); - }, [filterParams.address, filterParams.chainId, setLastPageIndex]); - - if (isPending) { - return ( - - - - ); - } - - if (isError) { - return ( - -
{handleErrorMessage(error)}
-
- ); - } - - if (!data.results.length) { - return ( - -
No escrows launched yet
-
- ); - } - - return ( - - {data.results.map((elem, idx) => ( - - - { - e.stopPropagation(); - e.preventDefault(); - navigate(`/search/${filterParams.chainId}/${elem.address}`); - }} - > - - {elem.address} - - - - - ))} - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts deleted file mode 100644 index 6c3987e4fa..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/RoleDetails/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './RoleDetails'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx deleted file mode 100644 index 9c3db5f7f4..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/SearchResults.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import PageWrapper from '@components/PageWrapper'; -import Stack from '@mui/material/Stack'; -import ShadowIcon from '@components/ShadowIcon'; -import Clipboard from '@components/Clipboard'; -import { useEffect, useState } from 'react'; -import { useLocation, useParams } from 'react-router-dom'; -import EscrowAddress from '@pages/SearchResults/EscrowAddress'; -import WalletAddress from '@pages/SearchResults/WalletAddress'; -import NothingFound from '@components/NothingFound'; -import Breadcrumbs from '@components/Breadcrumbs'; -import SearchBar from '@components/SearchBar/SearchBar'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import Loader from '@components/Loader'; -import { getNetwork } from '@utils/config/networks'; -import { - AddressDetails, - AddressDetailsWallet, - useAddressDetails, -} from '@services/api/use-address-details'; -import { handleErrorMessage } from '@services/handle-error-message'; -import RoleDetails from '@pages/SearchResults/RoleDetails/RoleDetails'; -import { AxiosError } from 'axios'; -import { WalletIcon } from '@components/Icons/WalletIcon'; -import { EscrowAddressIcon } from '@components/Icons/EscrowAddressIcon'; - -const renderCurrentResultType = ( - addressDetails: AddressDetails, - tokenId: string | undefined -) => { - const type = Object.keys(addressDetails)[0] as - | keyof AddressDetails - | undefined; - - const renderType: Record< - keyof AddressDetails, - { title: string; icon: JSX.Element } - > = { - operator: { - title: 'Wallet Address', - icon: , - }, - escrow: { - title: 'Escrow Address', - icon: , - }, - wallet: { - title: 'Wallet Address', - icon: , - }, - }; - - if (type == null) { - return null; - } - - return ( - <> - - - - ); -}; - -const ResultError = ({ error }: { error: unknown }) => { - if (error instanceof AxiosError && error.response?.status === 400) { - return ( - - - - ); - } - return {handleErrorMessage(error)}; -}; - -const Results = () => { - const { data, status, error } = useAddressDetails(); - const { filterParams } = useWalletSearch(); - - if (status === 'pending' && !data) { - return ; - } - - if (status === 'error') { - return ; - } - - const selectedWalletData: AddressDetailsWallet | undefined = - data.wallet || - (data.operator && data.operator.role === null ? data.operator : undefined); - - return ( - <> - - {renderCurrentResultType(data, filterParams.address)} - - - {data.operator && data.operator.role ? ( - - ) : null} - {selectedWalletData ? : null} - {data.escrow ? : null} - - ); -}; - -const SearchResults = () => { - const location = useLocation(); - const { chainId: urlChainId, address: urlAddress } = useParams(); - const { - setAddress, - setChainId, - filterParams: { chainId, address }, - } = useWalletSearch(); - const [paramsStatus, setParamsStatus] = useState< - 'loading' | 'error' | 'success' - >('loading'); - - useEffect(() => { - setParamsStatus('loading'); - }, [location]); - - useEffect(() => { - if (paramsStatus === 'success') return; - if (urlAddress) { - setAddress(urlAddress); - } else { - setParamsStatus('error'); - return; - } - const chainIdFromUrl = Number(urlChainId); - if ( - !Number.isNaN(chainIdFromUrl) && - chainIdFromUrl && - getNetwork(chainIdFromUrl) - ) { - setChainId(chainIdFromUrl); - } else { - setParamsStatus('error'); - } - }, [ - address, - chainId, - paramsStatus, - setAddress, - setChainId, - urlAddress, - urlChainId, - ]); - - useEffect(() => { - if (address && chainId && paramsStatus !== 'success') { - setParamsStatus('success'); - } - }, [address, chainId, paramsStatus]); - - return ( - - - - {paramsStatus === 'loading' && } - {paramsStatus === 'error' && ( - Something went wrong - )} - {paramsStatus === 'success' && } - - ); -}; - -export default SearchResults; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx deleted file mode 100644 index c127024544..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddress.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; -import Stack from '@mui/material/Stack'; -import TitleSectionWrapper from '@components/SearchResults'; -import { colorPalette } from '@assets/styles/color-palette'; -import { AddressDetailsWallet } from '@services/api/use-address-details'; -import { useHMTPrice } from '@services/api/use-hmt-price'; -import { WalletAddressTransactionsTable } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { NumericFormat } from 'react-number-format'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; - -const HmtPrice = () => { - const { - data: hmtPrice, - isError: isHmtPriceError, - isPending: isHmtPricePending, - } = useHMTPrice(); - - if (isHmtPriceError) { - return N/A; - } - - if (isHmtPricePending) { - return ...; - } - - return ( - - - - <>{hmtPrice.hmtPrice} - - - $ - - - - ); -}; - -const WalletAddress = ({ - data: { balance }, -}: { - data: AddressDetailsWallet; -}) => { - const { filterParams } = useWalletSearch(); - const { mobile } = useBreakPoints(); - - return ( - <> - - - - - - - - - HMT - - - - - - - - {filterParams.address && filterParams.chainId ? ( - - ) : null} - - ); -}; - -export default WalletAddress; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx deleted file mode 100644 index 62992706eb..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/WalletAddressTransactionsTable.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import Typography from '@mui/material/Typography'; -import Card from '@mui/material/Card'; -import TableContainer from '@mui/material/TableContainer'; -import Table from '@mui/material/Table'; -import SimpleBar from 'simplebar-react'; -import TablePagination from '@mui/material/TablePagination'; -import { TransactionsTableHead } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead'; -import { TransactionsTableBody } from '@pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableBody'; -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; -import { TableFooter } from '@mui/material'; -import { useTransactionDetails } from '@services/api/use-transaction-details'; - -export const WalletAddressTransactionsTable = () => { - const { data } = useTransactionDetails(); - const { - pagination: { page, pageSize, lastPageIndex }, - setPageSize, - setNextPage, - setPrevPage, - } = useTransactionDetailsDto(); - - return ( - - - Transactions - - - - - - - - - {}} - page={page} - component="td" - rowsPerPage={pageSize} - onRowsPerPageChange={(event) => { - setPageSize(Number(event.target.value)); - }} - rowsPerPageOptions={[5, 10]} - labelDisplayedRows={({ from, to }) => { - const effectiveTo = data?.results - ? from + data.results.length - 1 - : to; - return `${from}–${effectiveTo}`; - }} - slotProps={{ - actions: { - nextButton: { - onClick: () => { - setNextPage(); - }, - disabled: - lastPageIndex !== undefined && - (page === lastPageIndex || - lastPageIndex - 1 === page), - }, - previousButton: { - onClick: () => { - setPrevPage(); - }, - }, - }, - }} - /> - - -
-
-
-
- ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx deleted file mode 100644 index 9480c5cd7d..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellMethod.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { colorPalette } from '@assets/styles/color-palette'; -import Box from '@mui/material/Box/Box'; -import Typography from '@mui/material/Typography'; -import { capitalize } from '@mui/material'; - -export const TransactionTableCellMethod = ({ method }: { method: string }) => { - const methodAttributes: Record< - string, - { color: { text: string; border: string } } - > = { - withdraw: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - cancel: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - stake: { - color: { - text: colorPalette.success.main, - border: colorPalette.success.light, - }, - }, - unstake: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - slash: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - stakeWithdrawn: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - withdrawFees: { - color: { - text: colorPalette.error.main, - border: colorPalette.error.light, - }, - }, - approve: { - color: { - text: colorPalette.warning.main, - border: colorPalette.warning.light, - }, - }, - complete: { - color: { - text: colorPalette.success.main, - border: colorPalette.success.light, - }, - }, - }; - - const currentStatusColors = methodAttributes[method]?.color || { - text: colorPalette.primary.main, - border: colorPalette.primary.light, - }; - - return ( - - - {capitalize(method)} - - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx deleted file mode 100644 index 6e18d806de..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/cells/TransactionTableCellValue.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { formatHMTDecimals } from '@helpers/formatHMTDecimals'; -import Typography from '@mui/material/Typography'; -import { useHMTPrice } from '@services/api/use-hmt-price'; - -export const TransactionTableCellValue = ({ value }: { value: string }) => { - const { isError, isPending } = useHMTPrice(); - - if (isError) { - return N/A; - } - - if (isPending) { - return ...; - } - - return ( - - {formatHMTDecimals(value)} - HMT - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx deleted file mode 100644 index 24d5723e1d..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/WalletAddressTransactions/tableComponents/TransactionsTableHead.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import Typography from '@mui/material/Typography'; -import Stack from '@mui/material/Stack'; -import { colorPalette } from '@assets/styles/color-palette'; -import TableHead from '@mui/material/TableHead'; -import TableRow from '@mui/material/TableRow'; -import TableCell from '@mui/material/TableCell'; -import IconButton from '@mui/material/IconButton'; -import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; -import CustomTooltip from '@components/CustomTooltip'; - -export const TransactionsTableHead = () => { - return ( - - - - - - - - - - - Transaction Hash - - - - - - - - - - - Method - - - - From - - - To - - - - - - - - - Block - - - - - - - - - - Value - - - - - ); -}; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts deleted file mode 100644 index f9385021f9..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/WalletAddress/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './WalletAddress'; diff --git a/packages/apps/dashboard/client/src/pages/SearchResults/index.ts b/packages/apps/dashboard/client/src/pages/SearchResults/index.ts deleted file mode 100644 index 43ac09d5da..0000000000 --- a/packages/apps/dashboard/client/src/pages/SearchResults/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './SearchResults'; diff --git a/packages/apps/dashboard/client/src/pages/graph/index.ts b/packages/apps/dashboard/client/src/pages/graph/index.ts new file mode 100644 index 0000000000..375e4a10e9 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/graph/index.ts @@ -0,0 +1 @@ +export { default } from './ui/GraphPage'; diff --git a/packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx b/packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx new file mode 100644 index 0000000000..fb598362b4 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/graph/ui/GraphPage.tsx @@ -0,0 +1,23 @@ +import { useEffect } from 'react'; + +import AreaChart from '@/features/graph'; +import useChartParamsStore from '@/features/graph/store/useChartParamsStore'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import PageWrapper from '@/widgets/page-wrapper'; + +const Graph = () => { + const { revertToInitialParams } = useChartParamsStore(); + + useEffect(() => { + revertToInitialParams(); + }, [revertToInitialParams]); + + return ( + + + + + ); +}; + +export default Graph; diff --git a/packages/apps/dashboard/client/src/pages/home/index.ts b/packages/apps/dashboard/client/src/pages/home/index.ts new file mode 100644 index 0000000000..6648d3e441 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/home/index.ts @@ -0,0 +1 @@ +export { default } from './ui/HomePage'; diff --git a/packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx b/packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx new file mode 100644 index 0000000000..a92bd05c73 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/home/ui/HomePage.tsx @@ -0,0 +1,134 @@ +import { FC } from 'react'; + +import HelpOutlineIcon from '@mui/icons-material/HelpOutline'; +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Divider from '@mui/material/Divider'; +import styled from '@mui/material/styles/styled'; +import Typography from '@mui/material/Typography'; +import Grid from '@mui/material/Unstable_Grid2'; +import { Link } from 'react-router-dom'; + +import GraphSwiper from '@/features/graph/ui/GraphSwiper'; +import HmtPrice from '@/features/home/ui/HmtPrice'; +import Holders from '@/features/home/ui/Holders'; +import TotalNumberOfTasks from '@/features/home/ui/TotalNumberOfTasks'; +import TotalTransactions from '@/features/home/ui/TotalTransactions'; +import Leaderboard from '@/features/leaderboard'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; +import LeaderboardIcon from '@/shared/ui/icons/LeaderboardIcon'; +import SearchBar from '@/shared/ui/SearchBar'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; +import PageWrapper from '@/widgets/page-wrapper'; + +const CardWrapper = styled(Grid)(({ theme }) => ({ + display: 'flex', + background: theme.palette.white.main, + borderRadius: '16px', + padding: '24px 32px', + [theme.breakpoints.up('md')]: { + height: 300, + }, + [theme.breakpoints.down('md')]: { + height: 'auto', + }, +})); + +const InfoTooltip = ({ title }: { title: string }) => ( + + + +); + +const renderViewChartsButton = (show: boolean) => { + if (show) { + return ( + + ); + } else { + return null; + } +}; + +const HomePage: FC = () => { + const isMobile = useIsMobile(); + + return ( + + + All HUMAN activity. In one place. + + + + + + Token + + + + + + + + + + + + + + + + + Data Overview (All networks) + + {renderViewChartsButton(!isMobile)} + + + + + + + + + + + + + + + + {renderViewChartsButton(isMobile)} + + + + } + /> + + + ); +}; + +export default HomePage; diff --git a/packages/apps/dashboard/client/src/pages/leaderboard/index.ts b/packages/apps/dashboard/client/src/pages/leaderboard/index.ts new file mode 100644 index 0000000000..1ffb7778d2 --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/leaderboard/index.ts @@ -0,0 +1 @@ +export { default } from './ui/LeaderboardPage'; diff --git a/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx b/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx new file mode 100644 index 0000000000..c50eb67e7f --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/leaderboard/ui/LeaderboardPage.tsx @@ -0,0 +1,21 @@ +import Leaderboard from '@/features/leaderboard'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import LeaderboardIcon from '@/shared/ui/icons/LeaderboardIcon'; +import ShadowIcon from '@/shared/ui/ShadowIcon'; +import PageWrapper from '@/widgets/page-wrapper'; + +const LeaderboardPage = () => { + return ( + + + } + /> + + + ); +}; + +export default LeaderboardPage; diff --git a/packages/apps/dashboard/client/src/pages/searchResults/index.ts b/packages/apps/dashboard/client/src/pages/searchResults/index.ts new file mode 100644 index 0000000000..6d66d62fbc --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/searchResults/index.ts @@ -0,0 +1 @@ +export { default } from './ui/SearchResultsPage'; diff --git a/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx b/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx new file mode 100644 index 0000000000..02ae0f5ffc --- /dev/null +++ b/packages/apps/dashboard/client/src/pages/searchResults/ui/SearchResultsPage.tsx @@ -0,0 +1,15 @@ +import SearchResults from '@/features/searchResults'; +import Breadcrumbs from '@/shared/ui/Breadcrumbs'; +import SearchBar from '@/shared/ui/SearchBar'; +import PageWrapper from '@/widgets/page-wrapper'; + +const SearchResultsPage = () => { + return ( + + + + + + ); +}; +export default SearchResultsPage; diff --git a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx b/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx deleted file mode 100644 index f724d3cea8..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-escrows-details.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { validateResponse } from '@services/validate-response'; -import { useEscrowDetailsDto } from '@utils/hooks/use-escrows-details-dto'; -import { AddressDetailsOperator } from '@services/api/use-address-details'; - -const escrowDetailsSuccessResponseSchema = z.object({ - chainId: z.number(), - address: z.string(), - status: z.string(), -}); - -export type TransactionDetails = z.infer< - typeof escrowDetailsSuccessResponseSchema ->; - -const paginatedEscrowsDetailsSuccessResponseSchema = z.object({ - address: z.string(), - chainId: z.number(), - first: z.number(), - skip: z.number(), - results: z.array(escrowDetailsSuccessResponseSchema), -}); - -export type PaginatedEscrowDetails = z.infer< - typeof paginatedEscrowsDetailsSuccessResponseSchema ->; - -export interface PaginatedEscrowsDetailsDto { - skip: number; - first: number; - chainId: number; - role: AddressDetailsOperator['role']; -} - -export function useEscrowDetails({ - role, -}: { - role: AddressDetailsOperator['role']; -}) { - const { filterParams } = useWalletSearch(); - const { - setLastPageIndex, - pagination: { page, lastPageIndex }, - params, - } = useEscrowDetailsDto(); - - const dto: PaginatedEscrowsDetailsDto = { - chainId: filterParams.chainId, - skip: params.skip, - first: params.first, - role, - }; - - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - `${apiPaths.escrowDetails.path}/${filterParams.address}`, - { - params: dto, - } - ); - - const validResponse = validateResponse( - data, - paginatedEscrowsDetailsSuccessResponseSchema - ); - - // check if last page - if (lastPageIndex === undefined) { - const { data: lastPageCheckData } = await httpService.get( - `${apiPaths.escrowDetails.path}/${filterParams.address}`, - { - params: { - ...dto, - skip: dto.skip + validResponse.results.length, - first: 1, - }, - } - ); - const validLastPageCheckData = validateResponse( - lastPageCheckData, - paginatedEscrowsDetailsSuccessResponseSchema - ); - - if (validLastPageCheckData.results.length === 0) { - setLastPageIndex(page + 1); - } - } - - return validResponse; - }, - queryKey: ['useEscrowDetails', filterParams.address, dto], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx deleted file mode 100644 index 244e21cde8..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-general-stats.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; - -const successGeneralStatsResponseSchema = z.object({ - totalHolders: z.number(), - totalTransactions: z.number(), -}); - -export type GeneralStats = z.infer; - -export function useGeneralStats() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get(apiPaths.generalStats.path); - - const validResponse = validateResponse( - data, - successGeneralStatsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useGeneralStats'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx b/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx deleted file mode 100644 index b08cd17b31..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-graph-page-chart-data.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { useQuery, keepPreviousData } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; -import { useGraphPageChartParams } from '@utils/hooks/use-graph-page-chart-params'; -import { useDebounce } from 'use-debounce'; -import { useMemo } from 'react'; -import dayjs from 'dayjs'; - -const hmtDailyStatSchemaResponseSchema = z.object({ - from: z.string().optional(), - to: z.string().optional(), - results: z.array( - z.object({ - totalTransactionAmount: z.string().transform((value, ctx) => { - const valueAsNumber = Number(value); - if (Number.isNaN(valueAsNumber)) { - ctx.addIssue({ - path: ['totalTransactionAmount'], - code: z.ZodIssueCode.custom, - }); - } - - return valueAsNumber / 10 ** 18; - }), - totalTransactionCount: z.number(), - dailyUniqueSenders: z.number(), - dailyUniqueReceivers: z.number(), - date: z.string(), - }) - ), -}); - -export type HMTDailyStatsResponse = z.output< - typeof hmtDailyStatSchemaResponseSchema ->; -export type HMTDailyStat = HMTDailyStatsResponse['results'][number]; - -const hcaptchaDailyStatsResponseSchema = z.object({ - from: z.string().optional(), - to: z.string().optional(), - results: z.array( - z.object({ - solved: z.number(), - date: z.string(), - }) - ), -}); - -export type HcaptchaDailyStatsResponse = z.infer< - typeof hcaptchaDailyStatsResponseSchema ->; -export type HcaptchaDailyStat = HcaptchaDailyStatsResponse['results'][number]; - -export type GraphPageChartData = (HMTDailyStat & - Omit)[]; - -const mergeResponses = ( - hcaptchaStatsResults: HcaptchaDailyStat[], - hmtStatsResults: HMTDailyStat[] -): GraphPageChartData => { - const allDates = Array.from( - new Set([ - ...hcaptchaStatsResults.map(({ date }) => date), - ...hmtStatsResults.map(({ date }) => date), - ]) - ).sort((a, b) => (dayjs(a).isBefore(dayjs(b)) ? -1 : 1)); - - const hcaptchaStatsResultsMap = new Map(); - const hmtStatsResultsMap = new Map(); - - hcaptchaStatsResults.forEach((entry) => { - hcaptchaStatsResultsMap.set(entry.date, entry); - }); - - hmtStatsResults.forEach((entry) => { - hmtStatsResultsMap.set(entry.date, entry); - }); - return allDates.map((date) => { - const hmtStatsEntry: HMTDailyStat = hmtStatsResultsMap.get(date) || { - dailyUniqueReceivers: 0, - dailyUniqueSenders: 0, - date: date, - totalTransactionAmount: 0, - totalTransactionCount: 0, - }; - - const hcaptchaStatsEntry: HcaptchaDailyStat = hcaptchaStatsResultsMap.get( - date - ) || { - date: date, - solved: 0, - }; - return { ...hmtStatsEntry, ...hcaptchaStatsEntry }; - }); -}; - -const DEBOUNCE_MS = 300; - -export function useGraphPageChartData() { - const { dateRangeParams } = useGraphPageChartParams(); - const queryParams = useMemo( - () => ({ - from: dateRangeParams.from.format('YYYY-MM-DD'), - to: dateRangeParams.to.format('YYYY-MM-DD'), - }), - [dateRangeParams.from, dateRangeParams.to] - ); - - const [debouncedQueryParams] = useDebounce(queryParams, DEBOUNCE_MS); - - return useQuery({ - queryFn: async () => { - const { data: hmtDailyStats } = await httpService.get( - apiPaths.hmtDailyStats.path, - { - params: debouncedQueryParams, - } - ); - const { data: hcaptchDailyStats } = await httpService.get( - apiPaths.hcaptchaStatsDaily.path, - { - params: debouncedQueryParams, - } - ); - - const validHmtDailyStats = validateResponse( - hmtDailyStats, - hmtDailyStatSchemaResponseSchema - ); - - const validHcaptchaGeneralStats = validateResponse( - hcaptchDailyStats, - hcaptchaDailyStatsResponseSchema - ); - - return mergeResponses( - validHcaptchaGeneralStats.results, - validHmtDailyStats.results - ); - }, - staleTime: DEBOUNCE_MS, - queryKey: ['useGraphPageChartData', debouncedQueryParams], - placeholderData: keepPreviousData, - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx b/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx deleted file mode 100644 index 64d9e27aeb..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-hcaptcha-general-stats.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; - -const successHcaptchaGeneralStatsResponseSchema = z.object({ - solved: z.number(), -}); - -export type HcaptchaGeneralStats = z.infer< - typeof successHcaptchaGeneralStatsResponseSchema ->; - -export function useHcaptchaGeneralStats() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - apiPaths.hcaptchaGeneralStats.path - ); - - const validResponse = validateResponse( - data, - successHcaptchaGeneralStatsResponseSchema - ); - - return validResponse; - }, - queryKey: ['useHcaptchaGeneralStats'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx b/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx deleted file mode 100644 index 78232607d3..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-hmt-price.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; - -const successHMTPriceResponseSchema = z.object({ - hmtPrice: z.number(), -}); - -export type HMTPrice = z.infer; - -export function useHMTPrice() { - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get(apiPaths.statsHmtPrice.path); - - const validResponse = validateResponse( - data, - successHMTPriceResponseSchema - ); - - return validResponse; - }, - queryKey: ['useHMTPrice'], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx b/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx deleted file mode 100644 index 39390eea7c..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-leaderboard-details.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { validateResponse } from '@services/validate-response'; -import { useLeaderboardSearch } from '@utils/hooks/use-leaderboard-search'; - -export const reputationSchema = z.unknown().transform((value) => { - try { - const knownReputation = z - .union([z.literal('Low'), z.literal('Medium'), z.literal('High')]) - .parse(value); - - return knownReputation; - } catch (error) { - return 'Unknown'; - } -}); - -export type Reputation = z.infer; - -const leaderBoardEntity = z.object({ - address: z.string(), - role: z.string(), - amountStaked: z - .string() - .transform((value, ctx) => { - const valueAsNumber = Number(value); - - if (Number.isNaN(valueAsNumber)) { - ctx.addIssue({ - path: ['amountStaked'], - code: z.ZodIssueCode.custom, - }); - } - - return valueAsNumber / 10 ** 18; - }) - .nullable(), - reputation: reputationSchema, - fee: z.number().nullable(), - jobTypes: z.array(z.string()).nullable(), - url: z.string().nullable(), - website: z.string().nullable(), - chainId: z.number(), - name: z.string().nullable(), - category: z.string().nullable(), -}); - -export const leaderBoardSuccessResponseSchema = z.array(leaderBoardEntity); -export type LeaderBoardEntity = z.infer; -export type LeaderBoardData = z.infer; - -export function useLeaderboardDetails(first?: number) { - const { - filterParams: { chainId }, - } = useLeaderboardSearch(); - - return useQuery({ - queryFn: async () => { - if (chainId === -1) { - return []; - } - - const { data } = await httpService.get(apiPaths.leaderboardDetails.path, { - params: { chainId, first }, - }); - - const validResponse = validateResponse( - data, - leaderBoardSuccessResponseSchema - ); - - return validResponse; - }, - queryKey: ['useLeaderboardDetails', chainId, first], - }); -} diff --git a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx b/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx deleted file mode 100644 index a5d06bb1fd..0000000000 --- a/packages/apps/dashboard/client/src/services/api/use-transaction-details.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { z } from 'zod'; -import { httpService } from '../http-service'; -import { apiPaths } from '../api-paths'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; -import { useTransactionDetailsDto } from '@utils/hooks/use-transactions-details-dto'; -import { validateResponse } from '@services/validate-response'; - -const internalTransactionSchema = z.object({ - from: z.string(), - to: z.string(), - value: z.string(), - method: z.string(), - receiver: z.string().nullable(), - escrow: z.string().nullable(), - token: z.string().nullable(), -}); -const transactionDetailsSuccessResponseSchema = z.object({ - txHash: z.string(), - method: z.string(), - from: z.string(), - to: z.string(), - receiver: z.string().nullable(), - block: z.number(), - value: z.string(), - internalTransactions: z.array(internalTransactionSchema), -}); - -export type TransactionDetails = z.infer< - typeof transactionDetailsSuccessResponseSchema ->; - -const paginatedTransactionDetailsSuccessResponseSchema = z.object({ - address: z.string(), - chainId: z.number(), - first: z.number(), - skip: z.number(), - results: z.array(transactionDetailsSuccessResponseSchema), -}); - -export type PaginatedTransactionDetails = z.infer< - typeof paginatedTransactionDetailsSuccessResponseSchema ->; - -export interface PaginatedTransactionDetailsDto { - skip: number; - first: number; - chainId: number; -} - -export function useTransactionDetails() { - const { filterParams } = useWalletSearch(); - const { - params, - pagination: { lastPageIndex, page }, - setLastPageIndex, - } = useTransactionDetailsDto(); - - const dto: PaginatedTransactionDetailsDto = { - chainId: filterParams.chainId, - skip: params.skip, - first: params.first, - }; - - return useQuery({ - queryFn: async () => { - const { data } = await httpService.get( - `${apiPaths.transactionDetails.path}/${filterParams.address}`, - { - params: dto, - } - ); - - const validResponse = validateResponse( - data, - paginatedTransactionDetailsSuccessResponseSchema - ); - - // check if last page - if (lastPageIndex === undefined) { - const { data: lastPageCheckData } = await httpService.get( - `${apiPaths.transactionDetails.path}/${filterParams.address}`, - { - params: { - ...dto, - skip: dto.skip + validResponse.results.length, - first: 1, - }, - } - ); - const validLastPageCheckData = validateResponse( - lastPageCheckData, - paginatedTransactionDetailsSuccessResponseSchema - ); - - if (validLastPageCheckData.results.length === 0) { - setLastPageIndex(page + 1); - } - } - - return validResponse; - }, - queryKey: ['useTransactionDetails', filterParams.address, dto], - }); -} diff --git a/packages/apps/dashboard/client/src/services/http-service.ts b/packages/apps/dashboard/client/src/services/http-service.ts deleted file mode 100644 index 3795426495..0000000000 --- a/packages/apps/dashboard/client/src/services/http-service.ts +++ /dev/null @@ -1,6 +0,0 @@ -import axios from 'axios'; -import { env } from '../helpers/env'; - -export const httpService = axios.create({ - baseURL: env.VITE_API_URL, -}); diff --git a/packages/apps/dashboard/client/src/services/api-paths.ts b/packages/apps/dashboard/client/src/shared/api/apiPaths.ts similarity index 86% rename from packages/apps/dashboard/client/src/services/api-paths.ts rename to packages/apps/dashboard/client/src/shared/api/apiPaths.ts index 656a08c685..8bff832b59 100644 --- a/packages/apps/dashboard/client/src/services/api-paths.ts +++ b/packages/apps/dashboard/client/src/shared/api/apiPaths.ts @@ -1,4 +1,4 @@ -export const apiPaths = { +const apiPaths = { hcaptchaGeneralStats: { path: '/stats/hcaptcha/general', }, @@ -29,4 +29,9 @@ export const apiPaths = { enabledChains: { path: '/networks/operating', }, + kvstore: { + path: '/details/kvstore', + }, } as const; + +export default apiPaths; diff --git a/packages/apps/dashboard/client/src/shared/api/httpClient.ts b/packages/apps/dashboard/client/src/shared/api/httpClient.ts new file mode 100644 index 0000000000..0a222e29e8 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/api/httpClient.ts @@ -0,0 +1,9 @@ +import axios from 'axios'; + +import { env } from '@/shared/config/env'; + +const httpClient = axios.create({ + baseURL: env.VITE_API_URL, +}); + +export default httpClient; diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts b/packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts similarity index 67% rename from packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts rename to packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts index 752b65b58b..861b903ca0 100644 --- a/packages/apps/dashboard/client/src/utils/hooks/use-filtered-networks.ts +++ b/packages/apps/dashboard/client/src/shared/api/useFilteredNetworks.ts @@ -1,13 +1,16 @@ +import { useMemo } from 'react'; + import { useQuery } from '@tanstack/react-query'; import { z } from 'zod'; -import { networks as allNetworks } from '@utils/config/networks'; -import { httpService } from '@services/http-service'; -import { apiPaths } from '@services/api-paths'; -import { useMemo } from 'react'; + +import { networks as allNetworks } from '@/shared/lib/networks'; + +import apiPaths from './apiPaths'; +import httpClient from './httpClient'; const enabledChainsSchema = z.array(z.number()); -export const useFilteredNetworks = () => { +const useFilteredNetworks = () => { const { data: enabledChains, isLoading, @@ -15,7 +18,7 @@ export const useFilteredNetworks = () => { } = useQuery({ queryKey: ['enabledChains'], queryFn: async () => { - const response = await httpService.get(apiPaths.enabledChains.path); + const response = await httpClient.get(apiPaths.enabledChains.path); return enabledChainsSchema.parse(response.data); }, }); @@ -28,3 +31,5 @@ export const useFilteredNetworks = () => { return { filteredNetworks, isLoading, error }; }; + +export default useFilteredNetworks; diff --git a/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts b/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts new file mode 100644 index 0000000000..ad74d8cf2a --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/api/useHmtPrice.ts @@ -0,0 +1,28 @@ +import { useQuery } from '@tanstack/react-query'; +import { z } from 'zod'; + +import validateResponse from '@/shared/lib/validateResponse'; + +import apiPaths from './apiPaths'; +import httpClient from './httpClient'; + +const hmtPriceResponseSchema = z.object({ + hmtPrice: z.number(), +}); + +export type HmtPrice = z.infer; + +const useHmtPrice = () => { + return useQuery({ + queryFn: async () => { + const { data } = await httpClient.get(apiPaths.statsHmtPrice.path); + + const validResponse = validateResponse(data, hmtPriceResponseSchema); + + return validResponse.hmtPrice; + }, + queryKey: ['useHmtPrice'], + }); +}; + +export default useHmtPrice; diff --git a/packages/apps/dashboard/client/src/helpers/env.ts b/packages/apps/dashboard/client/src/shared/config/env.ts similarity index 100% rename from packages/apps/dashboard/client/src/helpers/env.ts rename to packages/apps/dashboard/client/src/shared/config/env.ts diff --git a/packages/apps/dashboard/client/src/shared/hooks/useBreakpoints.tsx b/packages/apps/dashboard/client/src/shared/hooks/useBreakpoints.tsx new file mode 100644 index 0000000000..d024c42b44 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/hooks/useBreakpoints.tsx @@ -0,0 +1,54 @@ +import useMediaQuery from '@mui/material/useMediaQuery'; + +type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; + +export const breakpoints = { + xs: '(max-width: 600px)', + sm: '(min-width: 601px) and (max-width: 900px)', + md: '(min-width: 901px) and (max-width: 1200px)', + lg: '(min-width: 1201px) and (max-width: 1536px)', + xl: '(min-width: 1537px)', +} as const; + +export type BreakpointResult = { + [K in Breakpoint]: { + isActive: boolean; + mediaQuery: string; + }; +}; + +const useBreakpoints = (): BreakpointResult => { + const matchesXs = useMediaQuery(breakpoints.xs); + const matchesSm = useMediaQuery(breakpoints.sm); + const matchesMd = useMediaQuery(breakpoints.md); + const matchesLg = useMediaQuery(breakpoints.lg); + const matchesXl = useMediaQuery(breakpoints.xl); + + return { + xs: { + isActive: matchesXs, + mediaQuery: `@media ${breakpoints.xs}`, + }, + sm: { + isActive: matchesSm, + mediaQuery: `@media ${breakpoints.sm}`, + }, + md: { + isActive: matchesMd, + mediaQuery: `@media ${breakpoints.md}`, + }, + lg: { + isActive: matchesLg, + mediaQuery: `@media ${breakpoints.lg}`, + }, + xl: { + isActive: matchesXl, + mediaQuery: `@media ${breakpoints.xl}`, + }, + }; +}; + +export const useIsMobile = () => { + const { xs, sm } = useBreakpoints(); + return xs.isActive || sm.isActive; +}; diff --git a/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts b/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts new file mode 100644 index 0000000000..39cfa892b0 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/abbreviateAddress.ts @@ -0,0 +1,12 @@ +const abbreviateAddress = (address: string | null) => { + if (address) { + const first3Letters = address.slice(0, 5); + const last5Letters = address.slice(-5); + + return `${first3Letters}...${last5Letters}`; + } + + return null; +}; + +export default abbreviateAddress; diff --git a/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts b/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts new file mode 100644 index 0000000000..ea4b8843ed --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/convertSnakeToHumanReadable.ts @@ -0,0 +1,8 @@ +const convertSnakeToHumanReadable = (string: string) => { + return string + .split('_') + .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(' '); +}; + +export default convertSnakeToHumanReadable; diff --git a/packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts b/packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts similarity index 87% rename from packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts rename to packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts index 8a6adfd05b..c0610ad83b 100644 --- a/packages/apps/dashboard/client/src/helpers/formatHMTDecimals.ts +++ b/packages/apps/dashboard/client/src/shared/lib/formatHmtDecimals.ts @@ -1,6 +1,6 @@ import { formatEther } from 'ethers'; -export const formatHMTDecimals = (value: string) => { +const formatHmtDecimals = (value: string) => { const formattedValue = Number(formatEther(value)); if (Number.isInteger(formattedValue)) { @@ -22,3 +22,5 @@ export const formatHMTDecimals = (value: string) => { ? formattedValue.toFixed(4) : formattedValue.toString(); }; + +export default formatHmtDecimals; diff --git a/packages/apps/dashboard/client/src/services/handle-error-message.ts b/packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts similarity index 76% rename from packages/apps/dashboard/client/src/services/handle-error-message.ts rename to packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts index 4e69c870ac..ff81428b80 100644 --- a/packages/apps/dashboard/client/src/services/handle-error-message.ts +++ b/packages/apps/dashboard/client/src/shared/lib/handleErrorMessage.ts @@ -1,7 +1,7 @@ import { AxiosError } from 'axios'; import { ZodError } from 'zod'; -export function handleErrorMessage(unknownError: unknown): string { +const handleErrorMessage = (unknownError: unknown): string => { if (unknownError instanceof AxiosError) { return unknownError.message; } @@ -15,4 +15,6 @@ export function handleErrorMessage(unknownError: unknown): string { } return 'Something went wrong'; -} +}; + +export default handleErrorMessage; diff --git a/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts b/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts new file mode 100644 index 0000000000..375c45011b --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/lib/isValidEvmAddress.ts @@ -0,0 +1,6 @@ +const isValidEVMAddress = (input: string): boolean => { + const evmRegex = /^0x[a-fA-F0-9]{40}$/; + return evmRegex.test(input); +}; + +export default isValidEVMAddress; diff --git a/packages/apps/dashboard/client/src/utils/config/networks.ts b/packages/apps/dashboard/client/src/shared/lib/networks.ts similarity index 95% rename from packages/apps/dashboard/client/src/utils/config/networks.ts rename to packages/apps/dashboard/client/src/shared/lib/networks.ts index bb1839642d..68d850c418 100644 --- a/packages/apps/dashboard/client/src/utils/config/networks.ts +++ b/packages/apps/dashboard/client/src/shared/lib/networks.ts @@ -1,6 +1,7 @@ import type { Chain } from 'viem/chains'; import * as chains from 'viem/chains'; -import { env } from '@helpers/env'; + +import { env } from '@/shared/config/env'; //TODO: temporal fix. Should be fetched from API. https://github.com/humanprotocol/human-protocol/issues/2855 const ENABLED_CHAIN_IDS = env.VITE_ENABLED_CHAIN_IDS; diff --git a/packages/apps/dashboard/client/src/services/validate-response.ts b/packages/apps/dashboard/client/src/shared/lib/validateResponse.ts similarity index 76% rename from packages/apps/dashboard/client/src/services/validate-response.ts rename to packages/apps/dashboard/client/src/shared/lib/validateResponse.ts index a1c2b642a3..d2c74bed9c 100644 --- a/packages/apps/dashboard/client/src/services/validate-response.ts +++ b/packages/apps/dashboard/client/src/shared/lib/validateResponse.ts @@ -1,6 +1,6 @@ import { ZodError, type z } from 'zod'; -export const validateResponse = ( +const validateResponse = ( object: unknown, zodObject: T ): z.infer => { @@ -12,10 +12,12 @@ export const validateResponse = ( console.error('Unexpected response'); if (error instanceof ZodError) { error.issues.forEach((issue) => { - console.log(issue); + console.error(issue); }); } console.error(error); throw error; } }; + +export default validateResponse; diff --git a/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts b/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts new file mode 100644 index 0000000000..0bfeef257c --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/store/useGlobalFiltersStore.ts @@ -0,0 +1,21 @@ +import { create } from 'zustand'; + +type GlobalFiltersStore = { + address: string; + chainId: number; + setAddress: (address: string) => void; + setChainId: (chainId: number) => void; +}; + +const useGlobalFiltersStore = create((set) => ({ + address: '', + chainId: -1, + setAddress: (address) => { + set({ address }); + }, + setChainId: (chainId) => { + set({ chainId }); + }, +})); + +export default useGlobalFiltersStore; diff --git a/packages/apps/dashboard/client/src/services/global.type.ts b/packages/apps/dashboard/client/src/shared/types/global.type.ts similarity index 100% rename from packages/apps/dashboard/client/src/services/global.type.ts rename to packages/apps/dashboard/client/src/shared/types/global.type.ts index 0555a1e485..8046969074 100644 --- a/packages/apps/dashboard/client/src/services/global.type.ts +++ b/packages/apps/dashboard/client/src/shared/types/global.type.ts @@ -1,5 +1,5 @@ -import type { ZodError } from 'zod'; import type { AxiosError } from 'axios'; +import type { ZodError } from 'zod'; export type ResponseError = AxiosError | Error | ZodError | null; diff --git a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx b/packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx similarity index 80% rename from packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx rename to packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx index 22abd401aa..83c1e14638 100644 --- a/packages/apps/dashboard/client/src/components/SearchResults/AbbreviateClipboard.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/AbbreviateClipboard/index.tsx @@ -1,13 +1,14 @@ -import Stack from '@mui/material/Stack'; -import Typography from '@mui/material/Typography'; -import abbreviateValue from '@helpers/abbreviateValue'; -import IconButton from '@mui/material/IconButton'; +import { useState } from 'react'; + import ContentCopyIcon from '@mui/icons-material/ContentCopy'; -import { colorPalette } from '@assets/styles/color-palette'; import { Link } from '@mui/material'; +import IconButton from '@mui/material/IconButton'; +import Stack from '@mui/material/Stack'; +import Typography from '@mui/material/Typography'; import { useNavigate } from 'react-router-dom'; -import { useState } from 'react'; -import CustomTooltip from '@components/CustomTooltip'; + +import abbreviateAddress from '@/shared/lib/abbreviateAddress'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; interface AbbreviateClipboardProps { value: string; @@ -19,10 +20,11 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { return ( {link ? ( @@ -41,13 +43,17 @@ const AbbreviateClipboard = ({ value, link }: AbbreviateClipboardProps) => { underline="none" sx={{ zIndex: 1, + color: 'text.primary', + '&:visited': { + color: 'text.primary', + }, }} > - {abbreviateValue(value)} + {abbreviateAddress(value)} ) : ( - <>{abbreviateValue(value)} + <>{abbreviateAddress(value)} )} { diff --git a/packages/apps/dashboard/client/src/shared/ui/Breadcrumbs/index.tsx b/packages/apps/dashboard/client/src/shared/ui/Breadcrumbs/index.tsx new file mode 100644 index 0000000000..2858ae7b4d --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/Breadcrumbs/index.tsx @@ -0,0 +1,29 @@ +import { FC } from 'react'; + +import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; +import Box from '@mui/material/Box'; +import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; +import { Link as RouterLink } from 'react-router-dom'; + +const Breadcrumbs: FC<{ title?: string }> = ({ title }) => { + return ( + + + Dashboard + + + {title} + + ); +}; + +export default Breadcrumbs; diff --git a/packages/apps/dashboard/client/src/components/CustomTooltip/CustomTooltip.tsx b/packages/apps/dashboard/client/src/shared/ui/CustomTooltip/index.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/CustomTooltip/CustomTooltip.tsx rename to packages/apps/dashboard/client/src/shared/ui/CustomTooltip/index.tsx diff --git a/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx b/packages/apps/dashboard/client/src/shared/ui/DatePicker/index.tsx similarity index 89% rename from packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx rename to packages/apps/dashboard/client/src/shared/ui/DatePicker/index.tsx index a53e3d65f1..1ec5ff700f 100644 --- a/packages/apps/dashboard/client/src/components/DataEntry/DatePicker.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/DatePicker/index.tsx @@ -1,3 +1,6 @@ +import { Dispatch, SetStateAction, useState } from 'react'; + +import Typography from '@mui/material/Typography'; import { DatePickerProps, LocalizationProvider, @@ -5,15 +8,12 @@ import { } from '@mui/x-date-pickers'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { DatePicker as DatePickerMui } from '@mui/x-date-pickers/DatePicker'; -import type { Dayjs } from 'dayjs'; -import { Dispatch, SetStateAction, useState } from 'react'; -import Typography from '@mui/material/Typography'; import { BaseSingleInputFieldProps, DateValidationError, FieldSection, } from '@mui/x-date-pickers/models'; -import { colorPalette } from '@assets/styles/color-palette'; +import type { Dayjs } from 'dayjs'; interface CustomDateFieldProps extends UseDateFieldProps, @@ -41,7 +41,8 @@ const CustomDateField = ({ aria-label={ariaLabel} onClick={() => setOpen((prevState) => !prevState)} sx={{ - borderBottom: `1px solid ${colorPalette.primary.main}`, + borderBottom: '1px solid', + borderColor: 'primary.main', lineHeight: 2.5, '&:hover': { cursor: 'pointer', @@ -57,8 +58,8 @@ interface CustomDatePickerProps { props: Omit, 'open' | 'onOpen' | 'onClose'>; } -const CustomDaterPicker = ({ props }: CustomDatePickerProps) => { - const [open, setOpen] = useState(false); +const CustomDatePicker = ({ props }: CustomDatePickerProps) => { + const [open, setOpen] = useState(false); return ( { return ( - = ({ role }) => { + switch (role) { + case Role.JobLauncher: + return ; + case Role.RecordingOracle: + return ; + case Role.ReputationOracle: + return ; + case Role.ExchangeOracle: + return ; + default: + return ; + } +}; + +export default EntityIcon; diff --git a/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx b/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx new file mode 100644 index 0000000000..43f4a848dd --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/FormattedNumber/index.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; + +import { NumericFormat } from 'react-number-format'; + +type Props = { + value: number | string | undefined | null; + decimalScale?: number; +}; + +const FormattedNumber: FC = ({ value, decimalScale = 9 }) => { + return ( + + ); +}; + +export default FormattedNumber; diff --git a/packages/apps/dashboard/client/src/components/Loader/index.tsx b/packages/apps/dashboard/client/src/shared/ui/Loader/index.tsx similarity index 100% rename from packages/apps/dashboard/client/src/components/Loader/index.tsx rename to packages/apps/dashboard/client/src/shared/ui/Loader/index.tsx index 138a5965e9..332a816e3b 100644 --- a/packages/apps/dashboard/client/src/components/Loader/index.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/Loader/index.tsx @@ -1,5 +1,5 @@ -import CircularProgress from '@mui/material/CircularProgress'; import Box from '@mui/material/Box'; +import CircularProgress from '@mui/material/CircularProgress'; const Loader = ({ height = '100vh', diff --git a/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx b/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx new file mode 100644 index 0000000000..5126ad866e --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/NetworkIcon/index.tsx @@ -0,0 +1,26 @@ +import { ChainId } from '@human-protocol/sdk'; + +import BinanceSmartChainIcon from '@/shared/ui/icons/BinanceSmartChainIcon'; +import EthereumIcon from '@/shared/ui/icons/EthereumIcon'; +import HumanIcon from '@/shared/ui/icons/HumanIcon'; +import PolygonIcon from '@/shared/ui/icons/PolygonIcon'; + +export const NetworkIcon = ({ chainId }: { chainId: ChainId }) => { + const icon = (() => { + switch (chainId) { + case 1: + case 11155111: + return ; + case 56: + case 97: + return ; + case 137: + case 80002: + return ; + default: + return ; + } + })(); + + return <>{icon}; +}; diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx b/packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx similarity index 63% rename from packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx rename to packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx index 60b49386ca..939908955f 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/SearchBar/index.tsx @@ -1,9 +1,7 @@ import { FC, useCallback, useEffect, useState } from 'react'; -import clsx from 'clsx'; -import { useNavigate } from 'react-router-dom'; -import IconButton from '@mui/material/IconButton'; -import SearchIcon from '@mui/icons-material/Search'; + import CloseIcon from '@mui/icons-material/Close'; +import SearchIcon from '@mui/icons-material/Search'; import { InputAdornment, TextField, @@ -12,14 +10,20 @@ import { Grid, MenuItem, Box, - Tooltip, CircularProgress, + useTheme, } from '@mui/material'; -import { colorPalette } from '@assets/styles/color-palette'; -import { useFilteredNetworks } from '@utils/hooks/use-filtered-networks'; -import { useBreakPoints } from '@utils/hooks/use-is-mobile'; -import { NetworkIcon } from '@components/NetworkIcon'; -import { useWalletSearch } from '@utils/hooks/use-wallet-search'; +import IconButton from '@mui/material/IconButton'; +import clsx from 'clsx'; +import { useNavigate } from 'react-router-dom'; + +import useFilteredNetworks from '@/shared/api/useFilteredNetworks'; +import { useIsMobile } from '@/shared/hooks/useBreakpoints'; +import isValidEvmAddress from '@/shared/lib/isValidEvmAddress'; +import useGlobalFiltersStore from '@/shared/store/useGlobalFiltersStore'; +import CustomTooltip from '@/shared/ui/CustomTooltip'; +import { NetworkIcon } from '@/shared/ui/NetworkIcon'; + import { endAdornmentInputAdornmentSx, startAdornmentInputAdornmentSx, @@ -28,55 +32,51 @@ import { muiTextFieldInputPropsSx, muiTextFieldSx, gridSx, -} from './SearchBar.styles'; -import { isValidEVMAddress } from '../../helpers/isValidEVMAddress'; +} from './styles'; -interface SearchBarProps { +type SearchBarProps = { className?: string; initialInputValue?: string; -} +}; const SearchBar: FC = ({ className = '', initialInputValue = '', }) => { - const { mobile } = useBreakPoints(); + const isMobile = useIsMobile(); const { filteredNetworks, isLoading } = useFilteredNetworks(); - const { filterParams, setChainId, setAddress } = useWalletSearch(); + const { address, chainId, setChainId, setAddress } = useGlobalFiltersStore(); const navigate = useNavigate(); const [inputValue, setInputValue] = useState(initialInputValue); const [error, setError] = useState(null); const [focus, setFocus] = useState(false); + const theme = useTheme(); useEffect(() => { - setInputValue(filterParams.address); - }, [filterParams.address]); + setInputValue(address); + }, [address]); useEffect(() => { - if ( - !isLoading && - filteredNetworks.length > 0 && - filterParams.chainId === -1 - ) { + if (!isLoading && filteredNetworks.length > 0 && chainId === -1) { setChainId(filteredNetworks[0].id); } - }, [filteredNetworks, isLoading, filterParams.chainId, setChainId]); + }, [filteredNetworks, isLoading, chainId, setChainId]); const navigateToAddress = useCallback(() => { - if (!isValidEVMAddress(inputValue)) { + if (!isValidEvmAddress(inputValue)) { setError('Invalid EVM address.'); return; } setAddress(inputValue); - navigate(`/search/${filterParams.chainId}/${inputValue}`); - }, [inputValue, filterParams.chainId, navigate, setAddress]); + navigate(`/search/${chainId}/${inputValue}`); + }, [inputValue, chainId, navigate, setAddress]); const handleInputChange = (event: React.ChangeEvent) => { const value = event.target.value; setInputValue(value); - if (isValidEVMAddress(value)) { + if (isValidEvmAddress(value)) { setError(null); } else if (value.length > 0) { setError('Invalid EVM address. Must start with 0x and be 42 characters.'); @@ -102,21 +102,20 @@ const SearchBar: FC = ({ if (isLoading) return ; const renderEmptyValue = ( - Network + + Network + ); const renderSelectedValue = ( n.id === filterParams.chainId)?.id || -1 - } + chainId={filteredNetworks.find((n) => n.id === chainId)?.id || -1} />
- {mobile.isMobile || filterParams.chainId === -1 + {isMobile || chainId === -1 ? null - : filteredNetworks.find((n) => n.id === filterParams.chainId)?.name || - ''} + : filteredNetworks.find((n) => n.id === chainId)?.name || ''}
); @@ -133,32 +132,31 @@ const SearchBar: FC = ({ error={!!error} helperText={error} fullWidth - sx={muiTextFieldSx(mobile)} + sx={muiTextFieldSx(isMobile)} InputProps={{ sx: muiTextFieldInputPropsSx( - focus ? colorPalette.secondary.main : colorPalette.skyOpacity + theme, + focus ? theme.palette.secondary.main : theme.palette.sky.dark ), startAdornment: ( - value={filterParams.chainId} + value={chainId} displayEmpty - sx={muiSelectSx(mobile)} + sx={muiSelectSx(theme)} onChange={handleSelectChange} renderValue={() => - filterParams.chainId === -1 - ? renderEmptyValue - : renderSelectedValue + chainId === -1 ? renderEmptyValue : renderSelectedValue } > {filteredNetworks.map((network) => ( @@ -173,33 +171,32 @@ const SearchBar: FC = ({ - + - + ), }} diff --git a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts b/packages/apps/dashboard/client/src/shared/ui/SearchBar/styles.ts similarity index 62% rename from packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts rename to packages/apps/dashboard/client/src/shared/ui/SearchBar/styles.ts index 228cd04a4c..b9555739e1 100644 --- a/packages/apps/dashboard/client/src/components/SearchBar/SearchBar.styles.ts +++ b/packages/apps/dashboard/client/src/shared/ui/SearchBar/styles.ts @@ -1,4 +1,4 @@ -import { colorPalette } from '@assets/styles/color-palette'; +import { Theme } from '@mui/material/styles'; export const endAdornmentInputAdornmentSx = { display: 'flex', @@ -7,11 +7,11 @@ export const endAdornmentInputAdornmentSx = { gap: '0.7rem', }; -export const startAdornmentInputAdornmentSx = { +export const startAdornmentInputAdornmentSx = (theme: Theme) => ({ height: '100%', - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, marginLeft: '1rem', -}; +}); export const gridSx = { display: 'flex', @@ -22,11 +22,8 @@ export const gridSx = { overflow: 'hidden', }; -export const muiSelectSx = (mobile: { - isMobile: boolean; - mediaQuery: string; -}) => ({ - backgroundColor: `${colorPalette.white}`, +export const muiSelectSx = (theme: Theme) => ({ + backgroundColor: theme.palette.white.contrastText, width: 'unset', fontSize: '16px', boxShadow: 'none', @@ -38,12 +35,9 @@ export const muiSelectSx = (mobile: { '& .MuiSelect-select': { padding: 0, paddingRight: '24px', - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, border: 0, }, - [mobile.mediaQuery]: { - width: 'unset', - }, }); export const menuItemSx = (isSelected: boolean) => ({ @@ -52,30 +46,28 @@ export const menuItemSx = (isSelected: boolean) => ({ backgroundColor: isSelected ? 'rgba(50, 10, 141, 0.08)' : 'inherit', }); -export const muiTextFieldInputPropsSx = (borderColor: string) => ({ +export const muiTextFieldInputPropsSx = ( + theme: Theme, + borderColor: string +) => ({ width: '100%', height: '100%', borderRadius: '10px', border: `1px solid ${borderColor}`, - backgroundColor: `${colorPalette.white}`, + backgroundColor: theme.palette.white.contrastText, fontSize: 'inherit', 'input::placeholder': { - color: `${colorPalette.sky.main}`, + color: theme.palette.sky.main, opacity: 1, }, padding: '0 5px', }); -export const muiTextFieldSx = (mobile: { - isMobile: boolean; - mediaQuery: string; -}) => ({ +export const muiTextFieldSx = (isMobile: boolean) => ({ fontSize: '16px', '& .MuiOutlinedInput-root': { '& input': { - [mobile.mediaQuery]: { - padding: '12px 0px', - }, + padding: isMobile ? '12px 0px' : '16px 0px', }, '& fieldset': { border: 'none', diff --git a/packages/apps/dashboard/client/src/shared/ui/SectionWrapper/index.tsx b/packages/apps/dashboard/client/src/shared/ui/SectionWrapper/index.tsx new file mode 100644 index 0000000000..df126af5fe --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/SectionWrapper/index.tsx @@ -0,0 +1,23 @@ +import { FC, PropsWithChildren } from 'react'; + +import Card from '@mui/material/Card'; + +const SectionWrapper: FC = ({ children }) => { + return ( + + {children} + + ); +}; + +export default SectionWrapper; diff --git a/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/ShadowIcon/index.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/ShadowIcon/index.tsx index a01fb875a4..cf79aebfe8 100644 --- a/packages/apps/dashboard/client/src/components/ShadowIcon/ShadowIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/ShadowIcon/index.tsx @@ -1,4 +1,5 @@ import { FC } from 'react'; + import clsx from 'clsx'; const ShadowIcon: FC<{ diff --git a/packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx index 5620a6e72d..4e99f7ee6a 100644 --- a/packages/apps/dashboard/client/src/components/Icons/BinanceSmartChainIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/BinanceSmartChainIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const BinanceSmartChainIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const BinanceSmartChainIcon: FC = (props) => { return ( = (props) => { + return ( + + + + ); +}; + +export default DarkModeIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/DiscordIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/DiscordIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/DiscordIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/DiscordIcon.tsx index 7aefd29e27..459685c6d5 100644 --- a/packages/apps/dashboard/client/src/components/Icons/DiscordIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/DiscordIcon.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; const DiscordIcon: React.FC = (props) => { diff --git a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx similarity index 98% rename from packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx index a8c8776d97..fe065f746d 100644 --- a/packages/apps/dashboard/client/src/components/Icons/EscrowAddressIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/EscrowAddressIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const EscrowAddressIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const EscrowAddressIcon: FC = (props) => { return ( = (props) => { ); }; + +export default EscrowAddressIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx similarity index 94% rename from packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx index 381b049142..61e39522cf 100644 --- a/packages/apps/dashboard/client/src/components/Icons/EthereumIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/EthereumIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const EthereumIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const EthereumIcon: FC = (props) => { return ( diff --git a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx similarity index 93% rename from packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx index e6b53725ee..f4fd72d70d 100644 --- a/packages/apps/dashboard/client/src/components/Icons/ExchangeOracleIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/ExchangeOracleIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const ExchangeOracleIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const ExchangeOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default ExchangeOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx similarity index 97% rename from packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx index b80c2b36d0..90581b56c1 100644 --- a/packages/apps/dashboard/client/src/components/Icons/HumanIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/HumanIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const HumanIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const HumanIcon: FC = (props) => { return ( = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const JobLauncherIcon: FC = (props) => { return ( = (props) => { ); }; + +export default JobLauncherIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx similarity index 98% rename from packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx index 35f51ba3e9..585a217543 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LeaderboardIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LeaderboardIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const LeaderboardIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const LeaderboardIcon: FC = (props) => { return ( = (props) => { ); }; + +export default LeaderboardIcon; diff --git a/packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx new file mode 100644 index 0000000000..5e8866c7f8 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LightModeIcon.tsx @@ -0,0 +1,16 @@ +import { FC } from 'react'; + +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const LightModeIcon: FC = (props) => { + return ( + + + + ); +}; + +export default LightModeIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx index 8509d09523..ea6291608a 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const LogoBlockIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const LogoBlockIcon: FC = (props) => { return ( = (props) => { ); }; + +export default LogoBlockIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx index 51f2953567..1fdf5e9d2c 100644 --- a/packages/apps/dashboard/client/src/components/Icons/LogoBlockIconMobile.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/LogoBlockIconMobile.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const LogoBlockIconMobile: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const LogoBlockIconMobile: FC = (props) => { return ( = (props) => { ); }; + +export default LogoBlockIconMobile; diff --git a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx similarity index 97% rename from packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx index 26ef262294..0eb1c1ef40 100644 --- a/packages/apps/dashboard/client/src/components/Icons/PolygonIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/PolygonIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const PolygonIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const PolygonIcon: FC = (props) => { return ( = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const RecordingOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default RecordingOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx similarity index 95% rename from packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx index 0355384782..67639b7fca 100644 --- a/packages/apps/dashboard/client/src/components/Icons/ReputationOracle.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/ReputationOracleIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const ReputationOracle: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const ReputationOracleIcon: FC = (props) => { return ( = (props) => { ); }; + +export default ReputationOracleIcon; diff --git a/packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx b/packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx similarity index 99% rename from packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx rename to packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx index bdcb1f3b6a..d8f159c4fa 100644 --- a/packages/apps/dashboard/client/src/components/Icons/WalletIcon.tsx +++ b/packages/apps/dashboard/client/src/shared/ui/icons/WalletIcon.tsx @@ -1,7 +1,8 @@ -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; import { FC } from 'react'; -export const WalletIcon: FC = (props) => { +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; + +const WalletIcon: FC = (props) => { return ( = (props) => { ); }; + +export default WalletIcon; diff --git a/packages/apps/dashboard/client/src/shared/ui/theme/index.tsx b/packages/apps/dashboard/client/src/shared/ui/theme/index.tsx new file mode 100644 index 0000000000..56307ab400 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/theme/index.tsx @@ -0,0 +1,382 @@ +import { CSSProperties } from 'react'; + +import { Shadows } from '@mui/material'; +import { createTheme } from '@mui/material/styles'; +import { + PaletteColorOptions, + PaletteColor, +} from '@mui/material/styles/createPalette'; + +import { lightPalette, darkPalette } from './palette'; + +declare module '@mui/material/Typography' { + interface TypographyPropsVariantOverrides { + tooltip: true; + body3: true; + } +} + +declare module '@mui/material/styles' { + interface Theme { + toggleColorMode: () => void; + isDarkMode: boolean; + } + interface ThemeOptions { + toggleColorMode?: () => void; + isDarkMode?: boolean; + } + interface TypographyVariants { + tooltip: CSSProperties; + body3: CSSProperties; + } + interface TypographyVariantsOptions { + tooltip?: CSSProperties; + body3?: CSSProperties; + } + interface Palette { + sky: PaletteColor; + white: PaletteColor; + fog: PaletteColor; + ocean: PaletteColor; + orange: PaletteColor; + overlay: string; + link: { + main: string; + hover: string; + visited: string; + }; + table: { + main: string; + selected: string; + secondary: string; + }; + } + interface PaletteOptions { + sky?: PaletteColorOptions; + white?: PaletteColorOptions; + fog?: PaletteColorOptions; + ocean?: PaletteColorOptions; + orange?: PaletteColorOptions; + overlay?: string; + link?: { + main: string; + hover: string; + visited: string; + }; + table?: { + main: string; + selected: string; + secondary: string; + }; + } +} + +declare module '@mui/material/Button' { + interface ButtonPropsColorOverrides { + sky: true; + white: true; + fog: true; + } +} + +declare module '@mui/material/IconButton' { + interface IconButtonPropsColorOverrides { + sky: true; + white: true; + fog: true; + } +} + +declare module '@mui/material/SvgIcon' { + interface SvgIconPropsColorOverrides { + sky: true; + white: true; + fog: true; + } +} + +export const createAppTheme = (mode: 'light' | 'dark') => { + return createTheme({ + palette: { + mode, + ...(mode === 'light' ? lightPalette : darkPalette), + }, + typography: { + fontFamily: 'Inter, Arial, sans-serif', + h1: { + fontSize: 32, + }, + h2: { + fontSize: 34, + fontWeight: 600, + }, + h3: { + fontSize: 24, + fontWeight: 600, + lineHeight: '150%', + '@media (max-width:900px)': { + fontSize: 20, + fontWeight: 500, + lineHeight: '160%', + letterSpacing: '0.15px', + }, + }, + h4: { + fontSize: 20, + fontWeight: 500, + }, + h5: { + fontSize: 18, + fontWeight: 600, + lineHeight: '160%', + letterSpacing: '0.15px', + }, + h6: { + fontSize: 20, + fontWeight: 500, + }, + body1: { + fontSize: 16, + fontWeight: 400, + lineHeight: '150%', + letterSpacing: '0.15px', + }, + body2: { + fontSize: 14, + fontWeight: 400, + lineHeight: '20px', + letterSpacing: '0.17px', + }, + body3: { + fontSize: '12px', + fontWeight: 400, + lineHeight: '19.92px', + letterSpacing: '0.4px', + }, + subtitle1: { + fontSize: 16, + fontWeight: 400, + lineHeight: '175%', + letterSpacing: '0.15px', + }, + subtitle2: { + fontSize: 14, + fontWeight: 600, + lineHeight: '21.9px', + letterSpacing: '0.1px', + }, + caption: { + fontSize: 12, + fontWeight: 400, + lineHeight: 5 / 3, + letterSpacing: 0.4, + }, + tooltip: { + fontSize: 10, + fontWeight: 500, + lineHeight: '14px', + }, + }, + shadows: [ + ...createTheme({}).shadows.map((shadow, i) => { + if (i === 2) { + return '0px 3px 1px -2px #e9ebfa, 0px 2px 2px 0px rgba(233, 235, 250, 0.50), 0px 1px 5px 0px rgba(233, 235, 250, 0.20)'; + } + return shadow; + }), + ] as Shadows, + components: { + MuiButton: { + styleOverrides: { + root: { + fontWeight: 600, + letterSpacing: '0.1px', + textTransform: 'none', + }, + sizeSmall: { + padding: '4px 10px', + fontSize: '13px', + lineHeight: '22px', + }, + sizeMedium: { + padding: '6px 16px', + fontSize: '14px', + lineHeight: '24px', + }, + sizeLarge: { + padding: '8px 22px', + fontSize: '15px', + lineHeight: '26px', + }, + }, + }, + MuiChip: { + styleOverrides: { + root: { + padding: '4px', + borderRadius: 16, + }, + label: { + fontFamily: 'Roboto', + padding: '3px 6px', + fontSize: '13px', + lineHeight: '18px', + letterSpacing: '0.16px', + fontWeight: 400, + }, + }, + }, + MuiTooltip: { + styleOverrides: { + tooltip: ({ theme }) => ({ + backgroundColor: theme.palette.secondary.main, + color: theme.palette.white.light, + }), + arrow: ({ theme }) => ({ + color: theme.palette.secondary.main, + }), + }, + }, + MuiIconButton: { + styleOverrides: { + sizeMedium: ({ theme }) => ({ + color: theme.palette.primary.main, + }), + }, + }, + MuiSelect: { + styleOverrides: { + root: ({ theme }) => ({ + borderRadius: 4, + borderWidth: 2, + color: theme.palette.primary.main, + '& .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + borderWidth: 2, + }, + '&:hover .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + }, + '&.Mui-focused .MuiOutlinedInput-notchedOutline': { + borderColor: theme.palette.primary.main, + }, + '& .MuiSvgIcon-root': { + color: theme.palette.primary.main, + }, + }), + }, + }, + MuiTypography: { + styleOverrides: { + root: { + wordBreak: 'break-word', + }, + }, + }, + MuiOutlinedInput: { + styleOverrides: { + root: ({ theme }) => ({ + backgroundColor: theme.palette.white.contrastText, + }), + }, + }, + MuiMenuItem: { + styleOverrides: { + root: { + '&:hover': { + backgroundColor: '#1406B207', + }, + }, + }, + }, + MuiTableHead: { + styleOverrides: { + root: { + '& .MuiTableCell-root': { + fontFamily: 'Roboto', + fontSize: '14px', + fontWeight: 500, + lineHeight: '24px', + letterSpacing: '0.17px', + }, + }, + }, + }, + MuiTablePagination: { + styleOverrides: { + toolbar: { + '@media (max-width: 440px)': { + display: 'grid', + gridTemplateColumns: '1fr 3fr 2fr', + gridTemplateRows: 'auto auto', + gridAutoFlow: 'row', + }, + }, + selectLabel: ({ theme }) => ({ + '@media (max-width: 440px)': { + gridColumn: '2 / 3', + gridRow: '1', + whiteSpace: 'nowrap', + color: theme.palette.fog.main, + justifySelf: 'end', + marginBottom: '17px', + position: 'relative', + right: '-38px', + }, + '&:focus': { + background: 'inherit', + }, + }), + input: { + '@media (max-width: 440px)': { + gridColumn: '3 / 3', + gridRow: '1', + marginRight: '8px', + width: '48px', + justifySelf: 'flex-end', + }, + }, + select: { + '&:focus': { + background: 'inherit', + }, + }, + displayedRows: { + '@media (max-width: 440px)': { + gridColumn: '2 / 3', + gridRow: '2', + justifySelf: 'end', + position: 'relative', + right: '-12px', + }, + }, + actions: { + '@media (max-width: 440px)': { + gridColumn: '3 / 3', + gridRow: '2', + justifySelf: 'end', + marginLeft: 0, + minWidth: '90px', + }, + button: { + marginLeft: '5px', + }, + }, + }, + }, + MuiLink: { + styleOverrides: { + root: ({ theme }) => ({ + color: theme.palette.link.main, + '&:hover': { + color: theme.palette.link.hover, + }, + '&:visited': { + color: theme.palette.link.visited, + }, + }), + }, + }, + }, + }); +}; diff --git a/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts b/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts new file mode 100644 index 0000000000..7790326b36 --- /dev/null +++ b/packages/apps/dashboard/client/src/shared/ui/theme/palette.ts @@ -0,0 +1,139 @@ +export const lightPalette = { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', +}; + +export const darkPalette = { + primary: { + main: '#320a8d', + light: '#320a8d', + }, + secondary: { + main: '#6309ff', + light: '#1406B280', + dark: '#14062b', + }, + text: { + primary: '#320a8d', + secondary: '#858ec6', + }, + info: { + main: '#eeeeee', + light: '#f5f5f5', + dark: '#bdbdbd', + }, + sky: { + main: '#858ec6', + light: '#858ec6', + dark: '#dadef0cc', + contrastText: '#858ec6', + }, + white: { + main: '#ffffff', + light: '#f6f5fc', + dark: '#f6f7fe', + contrastText: '#f9faff', + }, + success: { + main: '#0ad397', + light: '#2e7d3280', + }, + warning: { + main: '#ffb300', + light: '#ffd54f', + }, + error: { + main: '#ffb300', + light: '#f20d5f', + }, + orange: { + main: '#ed6c02', + light: '#ed6c0280', + }, + ocean: { + main: '#304ffe', + light: '#8c9eff', + dark: '#03a9f4', + }, + fog: { + main: '#858ec6', + light: '#cbcfe6', + dark: '#e5e7f3', + }, + link: { + main: '#0000ee', + hover: '#1406b2', + visited: '#551a8b', + }, + table: { + main: '#ffffff01', + selected: '#1406b21f', + secondary: '#1406b20a', + }, + overlay: '#1406b20a', +}; diff --git a/packages/apps/dashboard/client/src/theme.tsx b/packages/apps/dashboard/client/src/theme.tsx deleted file mode 100644 index 955fb4009c..0000000000 --- a/packages/apps/dashboard/client/src/theme.tsx +++ /dev/null @@ -1,362 +0,0 @@ -import { createTheme } from '@mui/material/styles'; -import { - PaletteColorOptions, - PaletteColor, -} from '@mui/material/styles/createPalette'; -import { ThemeOptions } from '@mui/material'; -import { colorPalette } from '@assets/styles/color-palette'; -import { CSSProperties } from 'react'; - -declare module '@mui/material/Typography' { - interface TypographyPropsVariantOverrides { - ['Components/Button Small']: true; - ['Components/Button Large']: true; - ['Components/Chip']: true; - ['Components/Table Header']: true; - ['H6-Mobile']: true; - body3: true; - } -} - -declare module '@mui/material/styles' { - interface TypographyVariants { - ['Components/Button Small']: CSSProperties; - ['Components/Button Large']: CSSProperties; - ['Components/Chip']: CSSProperties; - ['Components/Table Header']: CSSProperties; - ['H6-Mobile']: CSSProperties; - body3: CSSProperties; - } - - // allow configuration using `createTheme` - interface TypographyVariantsOptions { - ['Components/Button Small']?: CSSProperties; - ['Components/Button Large']?: CSSProperties; - ['Components/Chip']?: CSSProperties; - ['Components/Table Header']?: CSSProperties; - ['H6-Mobile']: CSSProperties; - body3?: CSSProperties; - } -} - -declare module '@mui/material/styles' { - interface Palette { - sky: PaletteColor; - white: PaletteColor; - textSecondary: PaletteColor; - } - interface PaletteOptions { - sky?: PaletteColorOptions; - white?: PaletteColorOptions; - textSecondary?: PaletteColorOptions; - } -} - -declare module '@mui/material/Button' { - interface ButtonPropsColorOverrides { - sky: true; - white: true; - textSecondary: true; - } -} - -declare module '@mui/material/IconButton' { - interface IconButtonPropsColorOverrides { - sky: true; - white: true; - textSecondary: true; - } -} - -declare module '@mui/material/SvgIcon' { - interface SvgIconPropsColorOverrides { - sky: true; - white: true; - textSecondary: true; - } -} - -const theme: ThemeOptions = createTheme({ - palette: { - primary: { - main: colorPalette.primary.main, - light: colorPalette.primary.light, - }, - info: { - main: colorPalette.info.main, - light: colorPalette.info.light, - dark: colorPalette.info.dark, - }, - secondary: { - main: colorPalette.secondary.main, - light: colorPalette.secondary.light, - }, - text: { - primary: colorPalette.primary.main, - secondary: colorPalette.fog.main, - }, - sky: { - main: colorPalette.sky.main, - light: colorPalette.sky.light, - dark: colorPalette.sky.dark, - contrastText: colorPalette.sky.contrastText, - }, - white: { - main: '#fff', - light: '#fff', - dark: '#fff', - contrastText: '#fff', - }, - textSecondary: colorPalette.textSecondary, - }, - typography: { - fontFamily: 'Inter, Arial, sans-serif', - h1: { - fontSize: 32, - }, - h2: { - fontSize: 34, - fontWeight: 600, - }, - h3: { - fontSize: 24, - fontWeight: 500, - '@media (max-width:600px)': { - fontSize: 20, - }, - }, - h4: { - fontSize: 20, - fontWeight: 500, - }, - h5: { - fontSize: 18, - fontWeight: 600, - }, - h6: { - fontSize: 20, - fontWeight: 500, - }, - 'H6-Mobile': { - fontSize: '20px', - fontWeight: 500, - lineHeight: '32px', - letterSpacing: '0.15px', - textAlign: 'left', - }, - body1: { - fontSize: 16, - fontWeight: 400, - }, - body2: { - fontSize: 14, - fontWeight: 500, - }, - body3: { - fontSize: '12px', - fontWeight: 400, - lineHeight: '19.92px', - letterSpacing: '0.4px', - textAlign: 'left', - }, - 'Components/Button Small': { - fontSize: '13px', - fontWeight: 600, - lineHeight: '22px', - letterSpacing: '0.1px', - textAlign: 'left', - }, - 'Components/Button Large': { - fontSize: '15px', - fontWeight: 600, - lineHeight: '26px', - letterSpacing: '0.1px', - textAlign: 'left', - }, - 'Components/Chip': { - fontSize: '13px', - fontWeight: 400, - lineHeight: '18px', - letterSpacing: '0.16px', - textAlign: 'left', - }, - 'Components/Table Header': { - fontFamily: 'Roboto', - fontSize: '14px', - fontWeight: 500, - lineHeight: '24px', - letterSpacing: '0.17px', - textAlign: 'left', - }, - subtitle1: { - fontSize: 12, - }, - subtitle2: { - fontSize: 14, - fontWeight: 600, - lineHeight: '21.9px', - }, - caption: { - fontSize: 10, - }, - }, - components: { - MuiButton: { - styleOverrides: { - root: { - fontWeight: 600, - textTransform: 'none', - }, - }, - }, - MuiToolbar: { - styleOverrides: { - root: { - '@media (min-width:1280px)': { - paddingX: 56, - }, - }, - }, - }, - MuiTooltip: { - styleOverrides: { - tooltip: { - backgroundColor: colorPalette.secondary.main, - color: colorPalette.whiteSolid, - }, - arrow: { - color: colorPalette.secondary.main, - }, - }, - }, - MuiIconButton: { - styleOverrides: { - sizeMedium: { - color: colorPalette.primary.main, - }, - }, - }, - MuiSelect: { - styleOverrides: { - root: { - borderRadius: 4, - borderWidth: 2, - color: colorPalette.primary.main, - '& .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, - borderWidth: 2, - }, - '&:hover .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, - }, - '&.Mui-focused .MuiOutlinedInput-notchedOutline': { - borderColor: colorPalette.primary.main, - }, - '& .MuiSvgIcon-root': { - color: colorPalette.primary.main, - }, - }, - }, - }, - MuiTypography: { - styleOverrides: { - root: { - wordBreak: 'break-word', - }, - }, - }, - MuiOutlinedInput: { - styleOverrides: { - root: { - backgroundColor: colorPalette.white, - }, - }, - }, - MuiMenuItem: { - styleOverrides: { - root: { - '&:hover': { - backgroundColor: '#1406B207', - }, - }, - }, - }, - MuiTablePagination: { - styleOverrides: { - toolbar: { - '@media (max-width: 440px)': { - display: 'grid', - gridTemplateColumns: '1fr 3fr 2fr', - gridTemplateRows: 'auto auto', - gridAutoFlow: 'row', - }, - }, - selectLabel: { - '@media (max-width: 440px)': { - gridColumn: '2 / 3', - gridRow: '1', - whiteSpace: 'nowrap', - color: colorPalette.fog.main, - justifySelf: 'end', - marginBottom: `17px`, - position: 'relative', - right: '-38px', - }, - '&:focus': { - background: 'inherit', - }, - }, - input: { - '@media (max-width: 440px)': { - gridColumn: '3 / 3', - gridRow: '1', - marginRight: '8px', - width: '48px', - justifySelf: 'flex-end', - }, - }, - select: { - '&:focus': { - background: 'inherit', - }, - }, - displayedRows: { - '@media (max-width: 440px)': { - gridColumn: '2 / 3', - gridRow: '2', - justifySelf: 'end', - position: 'relative', - right: '-12px', - }, - }, - actions: { - '@media (max-width: 440px)': { - gridColumn: '3 / 3', - gridRow: '2', - justifySelf: 'end', - marginLeft: 0, - minWidth: '90px', - }, - button: { - marginLeft: '5px', - }, - }, - }, - }, - MuiLink: { - styleOverrides: { - root: { - color: colorPalette.link, - '&:hover': { - color: `${colorPalette.linkHover}!important`, - }, - '&:visited': { - color: colorPalette.linkVisited, - }, - }, - }, - }, - }, -}); - -export default theme; diff --git a/packages/apps/dashboard/client/src/utils/case-converter.ts b/packages/apps/dashboard/client/src/utils/case-converter.ts deleted file mode 100644 index d17b45eaf0..0000000000 --- a/packages/apps/dashboard/client/src/utils/case-converter.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class CaseConverter { - static convertSnakeToHumanReadable(string: string): string { - return string - .split('_') - .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) - .join(' '); - } -} diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts b/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts deleted file mode 100644 index deabad31bf..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-escrows-details-dto.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { create } from 'zustand'; - -export interface EscrowDetailsDto { - params: { - first: number; - skip: number; - }; - pagination: { - page: number; - pageSize: number; - lastPageIndex?: number; - }; - setNextPage: () => void; - setPrevPage: () => void; - setPageSize: (pageSize: number) => void; - setLastPageIndex: (lastPageIndex: number | undefined) => void; -} - -const INITIAL_PAGE_SIZE = 10; - -export const useEscrowDetailsDto = create((set) => ({ - params: { - first: INITIAL_PAGE_SIZE, - skip: 0, - }, - pagination: { - page: 0, - pageSize: INITIAL_PAGE_SIZE, - lastPage: false, - }, - setNextPage() { - set((state) => { - const nextPage = state.pagination.page + 1; - const newSkip = nextPage * state.params.first; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: nextPage, - }, - }; - }); - }, - setPrevPage() { - set((state) => { - const prevPage = - state.pagination.page === 0 ? 0 : state.pagination.page - 1; - const offSetPages = prevPage === 0 ? 0 : state.pagination.page - 1; - const newSkip = state.params.first * offSetPages; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: prevPage, - }, - }; - }); - }, - setPageSize(pageSize: number) { - set((state) => { - return { - ...state, - pagination: { - lastPage: false, - page: 0, - pageSize: pageSize, - }, - params: { - ...state.params, - first: pageSize, - skip: 0, - }, - }; - }); - }, - setLastPageIndex(lastPageIndex: number | undefined) { - set((state) => { - return { - ...state, - pagination: { - ...state.pagination, - lastPageIndex, - }, - }; - }); - }, -})); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx b/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx deleted file mode 100644 index b0c520f018..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-is-mobile.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import useMediaQuery from '@mui/material/useMediaQuery'; - -const breakpoints = { - mobile: `(max-width: 1100px)`, -}; - -export function useBreakPoints() { - const matchesMobile = useMediaQuery(breakpoints.mobile); - return { - mobile: { - isMobile: matchesMobile, - mediaQuery: `@media ${breakpoints.mobile}`, - }, - }; -} diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts b/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts deleted file mode 100644 index f470ac22b9..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-leaderboard-search.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { create } from 'zustand'; - -export interface LeaderboardSearchStore { - filterParams: { - chainId: number; - }; - setChainId: (chainId: number) => void; -} - -export const useLeaderboardSearch = create((set) => ({ - filterParams: { - chainId: -1, - }, - setChainId: (chainId) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - chainId, - }, - })); - }, -})); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts b/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts deleted file mode 100644 index ce4219c922..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-transactions-details-dto.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { create } from 'zustand'; - -export interface TransactionDetailsDto { - params: { - first: number; - skip: number; - }; - pagination: { - page: number; - pageSize: number; - lastPageIndex?: number; - }; - setNextPage: () => void; - setPrevPage: () => void; - setPageSize: (pageSize: number) => void; - setLastPageIndex: (lastPageIndex: number | undefined) => void; -} - -const INITIAL_PAGE_SIZE = 10; - -export const useTransactionDetailsDto = create( - (set) => ({ - params: { - first: INITIAL_PAGE_SIZE, - skip: 0, - }, - pagination: { - page: 0, - pageSize: INITIAL_PAGE_SIZE, - lastPage: false, - }, - setNextPage() { - set((state) => { - const nextPage = state.pagination.page + 1; - const newSkip = nextPage * state.params.first; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: nextPage, - }, - }; - }); - }, - setPrevPage() { - set((state) => { - const prevPage = - state.pagination.page === 0 ? 0 : state.pagination.page - 1; - const offSetPages = prevPage === 0 ? 0 : state.pagination.page - 1; - const newSkip = state.params.first * offSetPages; - - return { - ...state, - params: { - ...state.params, - skip: newSkip, - }, - pagination: { - ...state.pagination, - page: prevPage, - }, - }; - }); - }, - setPageSize(pageSize: number) { - set((state) => { - return { - ...state, - pagination: { - lastPage: false, - page: 0, - pageSize: pageSize, - }, - params: { - ...state.params, - first: pageSize, - skip: 0, - }, - }; - }); - }, - setLastPageIndex(lastPageIndex: number | undefined) { - set((state) => { - return { - ...state, - pagination: { - ...state.pagination, - lastPageIndex, - }, - }; - }); - }, - }) -); diff --git a/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts b/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts deleted file mode 100644 index 6ff0ec5092..0000000000 --- a/packages/apps/dashboard/client/src/utils/hooks/use-wallet-search.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { create } from 'zustand'; - -export interface WalletSearchStore { - filterParams: { - address: string; - chainId: number; - }; - setAddress: (address: string) => void; - setChainId: (chainId: number) => void; -} - -export const useWalletSearch = create((set) => ({ - filterParams: { - address: '', - chainId: -1, - }, - setAddress: (address) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - address, - }, - })); - }, - setChainId: (chainId) => { - set((state) => ({ - filterParams: { - ...state.filterParams, - chainId, - }, - })); - }, -})); diff --git a/packages/apps/dashboard/client/src/widgets/footer/index.ts b/packages/apps/dashboard/client/src/widgets/footer/index.ts new file mode 100644 index 0000000000..95b6a1947f --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/footer/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Footer'; diff --git a/packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx b/packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx new file mode 100644 index 0000000000..1695d72ed0 --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/footer/ui/Footer.tsx @@ -0,0 +1,133 @@ +import { FC } from 'react'; + +import GitHubIcon from '@mui/icons-material/GitHub'; +import LinkedInIcon from '@mui/icons-material/LinkedIn'; +import TelegramIcon from '@mui/icons-material/Telegram'; +import TwitterIcon from '@mui/icons-material/Twitter'; +import { IconButton, styled } from '@mui/material'; +import Box from '@mui/material/Box'; +import Link from '@mui/material/Link'; +import Typography from '@mui/material/Typography'; + +import { env } from '@/shared/config/env'; +import DiscordIcon from '@/shared/ui/icons/DiscordIcon'; + +const StyledLink = styled(Link)(({ theme }) => ({ + textDecoration: 'none', + color: theme.palette.text.secondary, + '&:visited': { + color: theme.palette.text.secondary, + }, +})); + +const SocialMediaIconButton = styled(IconButton)(({ theme }) => ({ + padding: 0, + color: theme.palette.text.secondary, + + '&:hover': { + background: 'none', + color: 'inherit', + }, + '& > svg': { + fontSize: '32px', + }, +})); + +const Footer: FC = () => { + const handleClick = (url: string) => { + window.open(url, '_blank'); + }; + + return ( + + + + + + Privacy Policy + + + Terms of Service + + + HUMAN Protocol + + + + © 2021 HPF. HUMAN Protocol® is a registered trademark + + + + handleClick(env.VITE_FOOTER_LINK_GITHUB)} + > + + + handleClick(env.VITE_FOOTER_LINK_DISCORD)} + > + + + handleClick(env.VITE_FOOTER_LINK_X)} + > + + + handleClick(env.VITE_FOOTER_LINK_TELEGRAM)} + > + + + handleClick(env.VITE_FOOTER_LINK_LINKEDIN)} + > + + + + + + ); +}; + +export default Footer; diff --git a/packages/apps/dashboard/client/src/widgets/header/index.ts b/packages/apps/dashboard/client/src/widgets/header/index.ts new file mode 100644 index 0000000000..529d6ba12a --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/header/index.ts @@ -0,0 +1 @@ +export { default } from './ui/Header'; diff --git a/packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx b/packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx new file mode 100644 index 0000000000..8b2703c8e4 --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/header/ui/Header.tsx @@ -0,0 +1,143 @@ +import { FC, useState } from 'react'; + +import CloseIcon from '@mui/icons-material/Close'; +import MenuIcon from '@mui/icons-material/Menu'; +import { Link as MuiLink } from '@mui/material'; +import AppBar from '@mui/material/AppBar'; +import Box from '@mui/material/Box'; +import Button from '@mui/material/Button'; +import Drawer from '@mui/material/Drawer'; +import IconButton from '@mui/material/IconButton'; +import styled from '@mui/material/styles/styled'; +import Toolbar from '@mui/material/Toolbar'; +import { Link } from 'react-router-dom'; + +import { env } from '@/shared/config/env'; +import LogoBlockIcon from '@/shared/ui/icons/LogoBlockIcon'; +import LogoBlockIconMobile from '@/shared/ui/icons/LogoBlockIconMobile'; + +const NavLink = styled(MuiLink)(({ theme }) => ({ + color: theme.palette.primary.main, + padding: '6px 8px', + fontSize: '14px', + fontWeight: 600, + lineHeight: '150%', + cursor: 'pointer', + textDecoration: 'none', + width: 'fit-content', +})); + +const Header: FC = () => { + const [open, setState] = useState(false); + + const handleClick = (url: string) => { + window.open(url, '_blank'); + }; + + const toggleDrawer = (open: boolean) => { + setState(open); + }; + + return ( + + + + + + + + + GitBook + Faucet + + HUMAN Website + + + + + + toggleDrawer(true)} + > + + + + toggleDrawer(false)} + PaperProps={{ + sx: { + width: '80%', + }, + }} + > + + + toggleDrawer(false)} /> + + + + GitBook + Faucet + + HUMAN Website + + + + + + + + + ); +}; + +export default Header; diff --git a/packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx b/packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx new file mode 100644 index 0000000000..7be9bd599c --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/header/ui/ThemeModeSwitch.tsx @@ -0,0 +1,18 @@ +import { FC } from 'react'; + +import { IconButton, useTheme } from '@mui/material'; + +import DarkModeIcon from '@/shared/ui/icons/DarkModeIcon'; +import LightModeIcon from '@/shared/ui/icons/LightModeIcon'; + +const ThemeModeSwitch: FC = () => { + const { isDarkMode, toggleColorMode } = useTheme(); + + return ( + + {isDarkMode ? : } + + ); +}; + +export default ThemeModeSwitch; diff --git a/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts b/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts new file mode 100644 index 0000000000..e80355c905 --- /dev/null +++ b/packages/apps/dashboard/client/src/widgets/page-wrapper/index.ts @@ -0,0 +1 @@ +export { default } from './ui/PageWrapper'; diff --git a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx b/packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx similarity index 86% rename from packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx rename to packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx index 9ae5b905a8..e4096036c4 100644 --- a/packages/apps/dashboard/client/src/components/PageWrapper/PageWrapper.tsx +++ b/packages/apps/dashboard/client/src/widgets/page-wrapper/ui/PageWrapper.tsx @@ -1,7 +1,9 @@ import { FC, PropsWithChildren } from 'react'; + import clsx from 'clsx'; -import Header from '@components/Header'; -import Footer from '@components/Footer'; + +import Footer from '@/widgets/footer'; +import Header from '@/widgets/header'; const PageWrapper: FC< PropsWithChildren<{ diff --git a/packages/apps/dashboard/client/tsconfig.json b/packages/apps/dashboard/client/tsconfig.json index f6331c83d6..6b867f9387 100644 --- a/packages/apps/dashboard/client/tsconfig.json +++ b/packages/apps/dashboard/client/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2022", "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ES2022", "skipLibCheck": true, /* Bundler mode */ @@ -12,7 +12,7 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx", + "jsx": "preserve", /* Linting */ "strict": true, @@ -21,15 +21,12 @@ "noFallthroughCasesInSwitch": true, "baseUrl": "./", "paths": { - "@components/*": ["src/components/*"], - "@helpers/*": ["src/helpers/*"], - "@assets/*": ["src/assets/*"], - "@pages/*": ["src/pages/*"], - "@api/*": ["src/api/*"], - "@utils/*": ["src/utils/*"], - "@services/*": ["src/services/*"] + "@/*": ["src/*"] } }, - "include": ["src"], - "exclude": ["./vite.config.ts"] + "include": [ + "src", + "vite.config.ts" + ], + "exclude": ["node_modules"] } diff --git a/packages/apps/dashboard/client/vite.config.ts b/packages/apps/dashboard/client/vite.config.ts index accd21e3a9..1d90c510e5 100644 --- a/packages/apps/dashboard/client/vite.config.ts +++ b/packages/apps/dashboard/client/vite.config.ts @@ -1,30 +1,20 @@ -import { defineConfig } from 'vite'; -import react from '@vitejs/plugin-react'; import * as path from 'path'; -import svgr from 'vite-plugin-svgr'; + +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ react(), - svgr({ - include: '**/*.svg', - exclude: 'src/assets/icons/excluded/**/*.svg', - }), nodePolyfills({ protocolImports: true, }), ], resolve: { alias: { - '@components': path.resolve(__dirname, './src/components'), - '@helpers': path.resolve(__dirname, './src/helpers'), - '@assets': path.resolve(__dirname, './src/assets'), - '@pages': path.resolve(__dirname, './src/pages'), - '@api': path.resolve(__dirname, './src/api'), - '@utils': path.resolve(__dirname, './src/utils'), - '@services': path.resolve(__dirname, './src/services'), + '@': path.resolve(__dirname, './src'), }, }, optimizeDeps: { @@ -36,6 +26,6 @@ export default defineConfig({ }, }, server: { - port: 3001, + port: 3004, }, }); diff --git a/packages/apps/dashboard/server/.env.example b/packages/apps/dashboard/server/.env.example index f3ac7f4f39..4d02bcd63d 100644 --- a/packages/apps/dashboard/server/.env.example +++ b/packages/apps/dashboard/server/.env.example @@ -1,36 +1,30 @@ # App -NODE_ENV=development -HOST=localhost -PORT=3000 -CORS_ENABLED= -CORS_ALLOWED_ORIGIN= -CORS_ALLOWED_HEADERS= -SUBGRAPH_API_KEY= -HMT_PRICE_SOURCE= -HMT_PRICE_SOURCE_API_KEY= -HMT_PRICE_FROM= -HMT_PRICE_TO= -HCAPTCHA_API_KEY= -HCAPTCHA_STATS_ENABLED= -NETWORK_USAGE_FILTER_MONTHS= -NETWORKS_OPERATING_CACHE_TTL= +HOST=0.0.0.0 +PORT=5006 +CORS_ENABLED=true +CORS_ALLOWED_ORIGIN=* + +# API keys +HMT_PRICE_SOURCE_API_KEY=replace_me +HCAPTCHA_API_KEY=replace_me # Redis -REDIS_HOST=localhost -REDIS_PORT=6379 -CACHE_HMT_PRICE_TTL=60 -CACHE_HMT_GENERAL_STATS_TTL=120 -HMT_PRICE_CACHE_KEY= -REPUTATION_SOURCE_URL= +REDIS_HOST=0.0.0.0 +REDIS_PORT=6380 # S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_USE_SSL= -S3_BUCKET= +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=dashboard-hcaptcha-historical-stats +S3_USE_SSL=false #Web3 -WEB3_ENV= -RPC_URL_POLYGON= +WEB3_ENV=testnet +RPC_URL_POLYGON=https://rpc-amoy.polygon.technology +RPC_URL_BSC_TESTNET=https://bsc-testnet.drpc.org +RPC_URL_SEPOLIA=https://rpc.sepolia.org + +# Reputation Oracle URL +REPUTATION_SOURCE_URL=http://0.0.0.0:5001 diff --git a/packages/apps/dashboard/server/docker-compose.yml b/packages/apps/dashboard/server/docker-compose.yml deleted file mode 100644 index 6258fe800c..0000000000 --- a/packages/apps/dashboard/server/docker-compose.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: 'dashboard-server' - -services: - redis: - image: redis:latest - container_name: dashboard-cache - ports: - - '6379:6379' - volumes: - - ./redis_data:/data \ No newline at end of file diff --git a/packages/apps/dashboard/server/src/app.module.ts b/packages/apps/dashboard/server/src/app.module.ts index 0f973c696c..6a9b8b9fb1 100644 --- a/packages/apps/dashboard/server/src/app.module.ts +++ b/packages/apps/dashboard/server/src/app.module.ts @@ -15,9 +15,10 @@ import { NetworksModule } from './modules/networks/networks.module'; @Module({ imports: [ ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], isGlobal: true, validationSchema: Joi.object({ HOST: Joi.string().required(), diff --git a/packages/apps/dashboard/server/src/modules/details/details.service.ts b/packages/apps/dashboard/server/src/modules/details/details.service.ts index 347bc759bf..361e674c10 100644 --- a/packages/apps/dashboard/server/src/modules/details/details.service.ts +++ b/packages/apps/dashboard/server/src/modules/details/details.service.ts @@ -102,8 +102,8 @@ export class DetailsService { amountWithdrawable: ethers.formatEther(stakingData.withdrawableAmount), reputation: (await this.fetchOperatorReputation(chainId, address)) .reputation, - totalAmountReceived: ethers.formatEther( - workerData?.totalAmountReceived || 0, + totalHMTAmountReceived: ethers.formatEther( + workerData?.totalHMTAmountReceived || 0, ), payoutCount: workerData?.payoutCount || 0, }); diff --git a/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts b/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts index 2864a9bc56..cb18d6fee3 100644 --- a/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts +++ b/packages/apps/dashboard/server/src/modules/details/dto/wallet.dto.ts @@ -34,7 +34,7 @@ export class WalletDto { @ApiProperty({ example: '2414.07007358932392' }) @Transform(({ value }) => value?.toString()) @IsString() - public totalAmountReceived?: string; + public totalHMTAmountReceived?: string; @ApiProperty({ example: 1234 }) @IsNumber() diff --git a/packages/apps/faucet/client/vite.config.ts b/packages/apps/faucet/client/vite.config.ts index 82dc93a9c0..3c407bc5d4 100644 --- a/packages/apps/faucet/client/vite.config.ts +++ b/packages/apps/faucet/client/vite.config.ts @@ -33,7 +33,7 @@ export default defineConfig(({ mode }) => { }, }, server: { - port: 3002, + port: 3006, }, }; }); diff --git a/packages/apps/fortune/exchange-oracle/client/.env.example b/packages/apps/fortune/exchange-oracle/client/.env.example index da2c159e02..1956902a37 100644 --- a/packages/apps/fortune/exchange-oracle/client/.env.example +++ b/packages/apps/fortune/exchange-oracle/client/.env.example @@ -1,11 +1,7 @@ -VITE_APP_EXCHANGE_ORACLE_SERVER_URL= +# General +VITE_APP_EXCHANGE_ORACLE_SERVER_URL=http://0.0.0.0:5006 +VITE_APP_WALLETCONNECT_PROJECT_ID=replace_me + +# Web3 VITE_APP_ENVIRONMENT=testnet -VITE_APP_RPC_URL_POLYGON= -VITE_APP_RPC_URL_BSC= -VITE_APP_RPC_URL_POLYGON_AMOY= -VITE_APP_RPC_URL_GOERLI= -VITE_APP_RPC_URL_SEPOLIA= -VITE_APP_RPC_URL_MOONBEAM= -VITE_APP_RPC_URL_BSC_TESTNET= -VITE_APP_RPC_URL_LOCALHOST=http://0.0.0.0:8545/ -VITE_APP_WALLETCONNECT_PROJECT_ID= \ No newline at end of file +VITE_APP_SUPPORTED_CHAINS=80002 \ No newline at end of file diff --git a/packages/apps/fortune/exchange-oracle/client/Dockerfile b/packages/apps/fortune/exchange-oracle/client/Dockerfile new file mode 100644 index 0000000000..46f448db16 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/client/Dockerfile @@ -0,0 +1,35 @@ +# Using bullseye instead of slim because it needs Python and build tools for node-gyp +FROM node:22.14-bullseye +ARG APP_PATH=packages/apps/fortune/exchange-oracle/client + +# Create app directory +WORKDIR /usr/src/app + +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk + +RUN yarn install + +# Copy base TS config that is required to build packages +COPY tsconfig.base.json ./ +# Build libs +RUN yarn build:libs + +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} +RUN yarn build + +# Start the server using the build +CMD [ "yarn", "start:prod" ] \ No newline at end of file diff --git a/packages/apps/fortune/exchange-oracle/client/package.json b/packages/apps/fortune/exchange-oracle/client/package.json index 747202275c..e6c3b2b24d 100644 --- a/packages/apps/fortune/exchange-oracle/client/package.json +++ b/packages/apps/fortune/exchange-oracle/client/package.json @@ -6,7 +6,7 @@ "scripts": { "clean": "rm -rf dist", "lint": "eslint \"**/*.{ts,tsx}\"", - "start": "vite --port 3006", + "start": "vite", "build": "vite build", "preview": "vite preview", "start:prod": "serve -s dist", @@ -27,7 +27,10 @@ ] }, "dependencies": { + "@emotion/react": "^11.11.3", + "@emotion/styled": "^11.11.0", "@human-protocol/sdk": "workspace:^", + "@mui/icons-material": "^7.0.1", "@mui/material": "^5.16.7", "@tanstack/query-sync-storage-persister": "^5.68.0", "@tanstack/react-query": "^5.67.2", diff --git a/packages/apps/fortune/exchange-oracle/client/vite.config.ts b/packages/apps/fortune/exchange-oracle/client/vite.config.ts index 147fdcb76f..9dd2c1afd3 100644 --- a/packages/apps/fortune/exchange-oracle/client/vite.config.ts +++ b/packages/apps/fortune/exchange-oracle/client/vite.config.ts @@ -25,6 +25,6 @@ export default defineConfig({ }, }, server: { - port: 3006, + port: 3003, }, }); diff --git a/packages/apps/fortune/exchange-oracle/server/.env.example b/packages/apps/fortune/exchange-oracle/server/.env.example index 4e8005d39f..90f7f08c99 100644 --- a/packages/apps/fortune/exchange-oracle/server/.env.example +++ b/packages/apps/fortune/exchange-oracle/server/.env.example @@ -1,43 +1,60 @@ # General -NODE_ENV=development -PORT= -CRON_SECRET= +HOST=0.0.0.0 +PORT=5006 # Database POSTGRES_HOST=0.0.0.0 -POSTGRES_USER=operator +POSTGRES_PORT=5433 +POSTGRES_USER=default POSTGRES_PASSWORD=qwerty -POSTGRES_DATABASE=exchange-oracle -POSTGRES_SYNC=false -POSTGRES_PORT=5432 +POSTGRES_DATABASE=exchange-oracle-fortune POSTGRES_SSL=false -POSTGRES_LOGGING='all' - # S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_USE_SSL= -S3_BUCKET= +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=fortune +S3_USE_SSL=false # Web3 -WEB3_ENV=localhost -WEB3_PRIVATE_KEY= -RPC_URL_POLYGON= -RPC_URL_BSC= -RPC_URL_POLYGON_AMOY= -RPC_URL_SEPOLIA= -RPC_URL_MOONBEAM= -RPC_URL_BSC_TESTNET= -RPC_URL_XLAYER= -RPC_URL_LOCALHOST= +WEB3_ENV=testnet +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 # PGP -PGP_ENCRYPT= -PGP_PRIVATE_KEY= -PGP_PASSPHRASE= +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +xYYEaCsZkBYJKwYBBAHaRw8BAQdA57OtWky46JfMXjUuc0Lb7DhlfLuLYIfI +j/k/vJiuL+D+CQMI2p74jVMUUM3g8z+mhvW3+G5ajp6G3kwqlwMA5GXvbPsI +AwMt8q3dT51U0FpaeFR0vzbokC/3J2yn44MrHT5W1ZaKbWLlx5QGiAqkl9D3 +ec0AwowEEBYKAD4FgmgrGZAECwkHCAmQsDLkiO/wmn8DFQgKBBYAAgECGQEC +mwMCHgEWIQStAYPfywhyBWsDk4WwMuSI7/CafwAAjXYA/AxG1Y6vL3JJnm/0 +8BpA2X1I2mAf36tfpWh79EI1YzcSAQD2Nx6hzzl+zTk9usms4iyl0ZkA5GqR +EQQggrHIZEvKCseLBGgrGZASCisGAQQBl1UBBQEBB0Cf3IqFfpNHTpIM6QQK +z9MtsKJsoaIdoBq5o65jX+v4CQMBCAf+CQMIYLeP6Ua7BsHgqKKEO4VYdHu8 +tIoEcZkDffm5NQ3BmS1c4tYp63d4jxZmkbyw3xHj6QS3D9a7IF+/R2+rrYf1 +Y0HFz1H9TSsJnuvOCf2wiMJ4BBgWCgAqBYJoKxmQCZCwMuSI7/CafwKbDBYh +BK0Bg9/LCHIFawOThbAy5Ijv8Jp/AACRFgEA0cwrCjODyF7GleZK/SHff9xn +oRSkBzq+CCaA/eqQ/ikBALfxC5M+OM7od4w9xKBThNG2M2lC4D9enGU5+cGE +BRoN +=gvnq +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=6fD8WuRhT85mxP11PfX +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -# Cron Job Secret -CRON_SECRET="cron-secret" \ No newline at end of file +xjMEaCsZkBYJKwYBBAHaRw8BAQdA57OtWky46JfMXjUuc0Lb7DhlfLuLYIfI +j/k/vJiuL+DNAMKMBBAWCgA+BYJoKxmQBAsJBwgJkLAy5Ijv8Jp/AxUICgQW +AAIBAhkBApsDAh4BFiEErQGD38sIcgVrA5OFsDLkiO/wmn8AAI12APwMRtWO +ry9ySZ5v9PAaQNl9SNpgH9+rX6Voe/RCNWM3EgEA9jceoc85fs05PbrJrOIs +pdGZAORqkREEIIKxyGRLygrOOARoKxmQEgorBgEEAZdVAQUBAQdAn9yKhX6T +R06SDOkECs/TLbCibKGiHaAauaOuY1/r+AkDAQgHwngEGBYKACoFgmgrGZAJ +kLAy5Ijv8Jp/ApsMFiEErQGD38sIcgVrA5OFsDLkiO/wmn8AAJEWAQDRzCsK +M4PIXsaV5kr9Id9/3GehFKQHOr4IJoD96pD+KQEAt/ELkz44zuh3jD3EoFOE +0bYzaULgP16cZTn5wYQFGg0= +=ppFH +-----END PGP PUBLIC KEY BLOCK-----" diff --git a/packages/apps/fortune/exchange-oracle/server/Dockerfile b/packages/apps/fortune/exchange-oracle/server/Dockerfile index 53a10f4234..2be71aa6b6 100644 --- a/packages/apps/fortune/exchange-oracle/server/Dockerfile +++ b/packages/apps/fortune/exchange-oracle/server/Dockerfile @@ -1,18 +1,35 @@ -# Base image -FROM node:18 +FROM node:22.14-slim +ARG APP_PATH=packages/apps/fortune/exchange-oracle/server # Create app directory WORKDIR /usr/src/app -# Bundle app source -COPY . . +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk -# Install app dependencies RUN yarn install + +# Copy base TS config that is required to build packages +COPY tsconfig.base.json ./ +# Build libs RUN yarn build:libs +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} # Creates a "dist" folder with the production build -RUN yarn workspace @human-protocol/fortune-exchange-oracle-server build +RUN yarn build -# Start the server using the production build -CMD [ "node", "packages/apps/fortune/exchange-oracle/server/dist/src/main.js" ] +# Start the server using the build +CMD [ "yarn", "start:prod" ] diff --git a/packages/apps/fortune/exchange-oracle/server/ENV.md b/packages/apps/fortune/exchange-oracle/server/ENV.md deleted file mode 100644 index 3a718a5cfc..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/ENV.md +++ /dev/null @@ -1,92 +0,0 @@ -# Environment Variables - -### The URL for connecting to the PostgreSQL database. -POSTGRES_URL= - -### The hostname or IP address of the PostgreSQL database server. Default: '127.0.0.1' -POSTGRES_HOST="127.0.0.1" - -### The port number on which the PostgreSQL database server is listening. Default: 5432 -POSTGRES_PORT="5432" - -### The username for authenticating with the PostgreSQL database. Default: 'operator' -POSTGRES_USER="operator" - -### The password for authenticating with the PostgreSQL database. Default: 'qwerty' -POSTGRES_PASSWORD="qwerty" - -### The name of the PostgreSQL database to connect to. Default: 'exchange-oracle' -POSTGRES_DATABASE="exchange-oracle" - -### Indicates whether to use SSL for connections to the PostgreSQL database. Default: false -POSTGRES_SSL="false" - -### The logging level for PostgreSQL operations (e.g., 'debug', 'info'). Default: 'log,info,warn,error' -POSTGRES_LOGGING="log,info,warn,error" - -### The RPC URL for the Sepolia network. -RPC_URL_SEPOLIA= - -### The RPC URL for the Polygon network. -RPC_URL_POLYGON= - -### The RPC URL for the Polygon Amoy network. -RPC_URL_POLYGON_AMOY= - -### The RPC URL for the BSC Mainnet network. -RPC_URL_BSC_MAINNET= - -### The RPC URL for the BSC Testnet network. -RPC_URL_BSC_TESTNET= - -### The RPC URL for the Localhost network. -RPC_URL_LOCALHOST= - -### Indicates whether PGP encryption should be used. Default: false -PGP_ENCRYPT="false" - -### The private key used for PGP encryption or decryption. -PGP_PRIVATE_KEY= - -### The passphrase associated with the PGP private key. -PGP_PASSPHRASE= - -### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1' -S3_ENDPOINT="127.0.0.1" - -### The port number for connecting to the S3 service. Default: 9000 -S3_PORT="9000" - -### The access key ID used to authenticate requests to the S3 service. Required -S3_ACCESS_KEY= - -### The secret access key used to authenticate requests to the S3 service. Required -S3_SECRET_KEY= - -### The name of the S3 bucket where files will be stored. Default: 'exchange' -S3_BUCKET="exchange" - -### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false -S3_USE_SSL="false" - -### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development' -NODE_ENV="development" - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The URL of the frontend application that the server will communicate with. Default: 'http://localhost:3005' -FE_URL="http://localhost:3005" - -### The maximum number of retry attempts for certain operations. Default: 5 -MAX_RETRY_COUNT="5" - -### The environment in which the Web3 application is running. Default: 'testnet' -WEB3_ENV="testnet" - -### The private key used for signing transactions. Required -WEB3_PRIVATE_KEY= - diff --git a/packages/apps/fortune/exchange-oracle/server/README.md b/packages/apps/fortune/exchange-oracle/server/README.md index 3a4ce72618..10e135d71a 100644 --- a/packages/apps/fortune/exchange-oracle/server/README.md +++ b/packages/apps/fortune/exchange-oracle/server/README.md @@ -45,11 +45,11 @@ First of all, postgres needs to be installed, please see here - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 dev devdevdev; - /usr/bin/mc mb myminio/solution; - /usr/bin/mc anonymous set public myminio/solution; - " diff --git a/packages/apps/fortune/exchange-oracle/server/package.json b/packages/apps/fortune/exchange-oracle/server/package.json index 2f71d2c961..52e07a4a4a 100644 --- a/packages/apps/fortune/exchange-oracle/server/package.json +++ b/packages/apps/fortune/exchange-oracle/server/package.json @@ -20,26 +20,37 @@ "migration:revert": "yarn build && typeorm-ts-node-commonjs migration:revert -d typeorm.config.ts", "migration:run": "yarn build && typeorm-ts-node-commonjs migration:run -d typeorm.config.ts", "migration:show": "yarn build && typeorm-ts-node-commonjs migration:show -d typeorm.config.ts", - "docker:db:up": "docker compose up -d && yarn migration:run", - "docker:db:down": "docker compose down", "test:watch": "jest --watch", "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", - "setup:local": "ts-node ./test/setup.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, "dependencies": { "@human-protocol/sdk": "workspace:*", "@nestjs/axios": "^3.1.2", "@nestjs/common": "^10.2.7", + "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.3.10", + "@nestjs/passport": "^10.0.0", + "@nestjs/platform-express": "^10.3.10", + "@nestjs/schedule": "^4.0.1", + "@nestjs/swagger": "^7.4.2", "@nestjs/terminus": "^11.0.0", "@nestjs/typeorm": "^10.0.1", + "@types/passport-jwt": "^4.0.1", "axios": "^1.3.1", + "body-parser": "^1.20.3", "class-transformer": "^0.5.1", "class-validator": "0.14.1", + "dotenv": "^16.3.2", "ethers": "~6.13.5", "joi": "^17.13.3", + "jsonwebtoken": "^9.0.2", + "minio": "7.1.3", + "passport": "^0.7.0", + "passport-jwt": "^4.0.1", "pg": "8.13.1", "reflect-metadata": "^0.2.2", "rxjs": "^7.2.0", @@ -51,9 +62,12 @@ "@nestjs/cli": "^10.3.2", "@nestjs/schematics": "^11.0.2", "@nestjs/testing": "^10.4.6", + "@types/body-parser": "^1", "@types/express": "^4.17.13", "@types/jest": "29.5.12", + "@types/jsonwebtoken": "^9.0.7", "@types/node": "22.10.5", + "@types/passport": "^0", "@types/pg": "8.11.10", "@types/supertest": "^6.0.2", "@typescript-eslint/eslint-plugin": "^5.0.0", diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts b/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts deleted file mode 100644 index 3dc3946559..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/scripts/set-manifest-url.ts +++ /dev/null @@ -1,67 +0,0 @@ -//This script reads manifest urls from the blockchain and set them in the database in the new column manifest_url - -import { EscrowClient } from '@human-protocol/sdk'; -import * as dotenv from 'dotenv'; -import { Client } from 'pg'; -import { ethers } from 'ethers'; - -dotenv.config({ - path: '.env', -}); - -const dbConfig = { - user: process.env.POSTGRES_USER, - host: process.env.POSTGRES_HOST, - database: process.env.POSTGRES_DATABASE, - password: process.env.POSTGRES_PASSWORD, - port: +process.env.POSTGRES_PORT!, - ssl: process.env.POSTGRES_SSL == 'true', -}; - -async function createProvider() { - const provider = new ethers.JsonRpcProvider(process.env.RPC_URL); - return provider; -} - -async function updateJobsWithManifestUrls() { - const client = new Client(dbConfig); - - try { - await client.connect(); - - const provider = await createProvider(); - const escrowClient = await EscrowClient.build(provider); - - console.log('Connected to the database.'); - - const res = await client.query( - 'SELECT * FROM "hmt"."jobs" WHERE manifest_url IS NULL', - ); - const jobsWithoutManifest = res.rows; - - for (const job of jobsWithoutManifest) { - const { escrow_address: escrowAddress, id } = job; - - try { - const manifestUrl = await escrowClient.getManifestUrl(escrowAddress); - - if (manifestUrl) { - await client.query( - 'UPDATE "hmt"."jobs" SET manifest_url = $1 WHERE id = $2', - [manifestUrl, id], - ); - console.log(`Updated job ${id} with manifestUrl: ${manifestUrl}`); - } - } catch (error) { - console.error(`Failed to update job ${id}:`, error); - } - } - } catch (error) { - console.error('Failed to update manifest URLs:', error); - } finally { - await client.end(); - console.log('Disconnected from the database.'); - } -} - -updateJobsWithManifestUrls(); diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts new file mode 100644 index 0000000000..8a96dfc4c9 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/server/scripts/setup-kv-store.ts @@ -0,0 +1,167 @@ +import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; +import * as Minio from 'minio'; + +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + +const SUPPORTED_JOB_TYPES = 'fortune'; +const ROLE = Role.ExchangeOracle; + +async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { + const { SERVER_URL, HOST, PORT, FEE = '1' } = process.env; + + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { + throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); + } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; + try { + new URL(serverUrl); + } catch (_noop) { + throw new Error('Invalid SERVER_URL'); + } + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; + if (!url.startsWith('http')) { + url = `http://${url}`; + } + + const fee = Number(FEE); + if (!Number.isInteger(fee) || fee < 1) { + throw new Error('Fee must be positive integer'); + } + + await kvStoreClient.setBulk( + [ + KVStoreKeys.role, + KVStoreKeys.fee, + KVStoreKeys.url, + KVStoreKeys.webhookUrl, + KVStoreKeys.jobTypes, + ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], + ); +} + +type SetupPublicKeyFileMeta = { + keyName: string; + publicKey: string; + s3Bucket: string; + s3Endpoint: string; + s3Port: string; + kvKey: string; +}; + +async function setupPublicKeyFile( + kvStoreClient: KVStoreClient, + minioClient: Minio.Client, + meta: SetupPublicKeyFileMeta, +): Promise { + const { keyName, kvKey, publicKey, s3Bucket, s3Endpoint, s3Port } = meta; + const exists = await minioClient.bucketExists(s3Bucket); + if (!exists) { + throw new Error('Bucket does not exists'); + } + + await minioClient.putObject(s3Bucket, keyName, publicKey, { + 'Content-Type': 'text/plain', + 'Cache-Control': 'no-store', + }); + /** + * Protocol is required for 'setFileUrlAndHash' + */ + const _s3Endpoint = s3Endpoint.startsWith('http') + ? s3Endpoint + : `http://${s3Endpoint}`; + const fileUrl = `${_s3Endpoint}:${s3Port}/${s3Bucket}/${keyName}`; + await kvStoreClient.setFileUrlAndHash(fileUrl, kvKey); +} + +async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const kvStoreClient = await KVStoreClient.build(wallet); + + await setupCommonValues(kvStoreClient); + + const { + S3_ENDPOINT, + S3_PORT, + S3_USE_SSL, + S3_ACCESS_KEY, + S3_SECRET_KEY, + S3_BUCKET, + } = process.env; + + if ( + [S3_ENDPOINT, S3_PORT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET].some( + (value) => !value, + ) + ) { + throw new Error('Missing S3 config value'); + } + + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + + const minioClient = new Minio.Client({ + endPoint: s3Endpoint, + port: parseInt(s3Port, 10), + useSSL: S3_USE_SSL === 'true', + accessKey: s3AccessKey, + secretKey: s3SecretKey, + }); + + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key-exco', + } = process.env; + if (PGP_ENCRYPT === 'true') { + if (!PGP_PUBLIC_KEY) { + throw new Error('PGP public key is empty'); + } + + await setupPublicKeyFile(kvStoreClient, minioClient, { + s3Endpoint, + s3Port, + s3Bucket, + publicKey: PGP_PUBLIC_KEY, + keyName: PGP_PUBLIC_KEY_FILE, + kvKey: KVStoreKeys.publicKey, + }); + } +} + +(async () => { + try { + await setup(); + process.exit(0); + } catch (error) { + console.error('Failed to setup KV.', error); + process.exit(1); + } +})(); diff --git a/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts b/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/fortune/exchange-oracle/server/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts index b2bc81423f..93f9f3f51f 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/app.module.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/app.module.ts @@ -51,9 +51,10 @@ import { HttpValidationPipe } from './common/pipes'; CronJobModule, UserModule, ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], validationSchema: envValidator, }), DatabaseModule, diff --git a/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts b/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts index 130dbabd19..7b140780c5 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/common/config/server-config.service.ts @@ -31,10 +31,10 @@ export class ServerConfigService { /** * The URL of the frontend application that the server will communicate with. - * Default: 'http://localhost:3005' + * Default: 'http://localhost:3003' */ get feURL(): string { - return this.configService.get('FE_URL', 'http://localhost:3006'); + return this.configService.get('FE_URL', 'http://localhost:3003'); } /** diff --git a/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts b/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts index b7df3e905d..7f948fddc8 100644 --- a/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts +++ b/packages/apps/fortune/exchange-oracle/server/src/common/guards/strategy/jwt.http.ts @@ -14,6 +14,11 @@ import { AuthError, ValidationError } from '../../errors'; @Injectable() export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { + // In-memory cache for public keys with expiration + private publicKeyCache: Map = + new Map(); + private cacheTTL = 24 * 60 * 60 * 1000; // 1 day + constructor(private readonly web3Service: Web3Service) { super({ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(), @@ -26,15 +31,31 @@ export class JwtHttpStrategy extends PassportStrategy(Strategy, 'jwt-http') { try { const payload = jwt.decode(rawJwtToken); const chainId = this.web3Service.getValidChains()[0]; - const signer = this.web3Service.getSigner(chainId); - - const url = await this.getFileUrlAndVerifyHash( - signer, - chainId, - (payload as any).reputation_network, - JWT_KVSTORE_KEY, - ); - const publicKey = await StorageClient.downloadFileFromUrl(url); + const address = (payload as any).reputation_network; + const cacheKey = `${chainId}-${address}`; + + const cached = this.publicKeyCache.get(cacheKey); + + let publicKey: string | undefined; + if (cached && cached.expires > Date.now()) { + publicKey = cached.value; + } else { + const signer = this.web3Service.getSigner(chainId); + const url = await this.getFileUrlAndVerifyHash( + signer, + chainId, + address, + JWT_KVSTORE_KEY, + ); + publicKey = (await StorageClient.downloadFileFromUrl( + url, + )) as string; + + this.publicKeyCache.set(cacheKey, { + value: publicKey, + expires: Date.now() + this.cacheTTL, + }); + } done(null, publicKey); } catch (error) { diff --git a/packages/apps/fortune/exchange-oracle/server/test/setup.ts b/packages/apps/fortune/exchange-oracle/server/test/setup.ts deleted file mode 100644 index 3792cdf6b3..0000000000 --- a/packages/apps/fortune/exchange-oracle/server/test/setup.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; -import { Wallet, ethers } from 'ethers'; -import * as dotenv from 'dotenv'; -import * as Minio from 'minio'; -dotenv.config({ path: '.env.local' }); - -export async function setup(): Promise { - const privateKey = process.env.WEB3_PRIVATE_KEY; - if (!privateKey) { - throw new Error('Private key is empty'); - } - const provider = new ethers.JsonRpcProvider('http://0.0.0.0:8545'); - const wallet = new Wallet(privateKey, provider); - - const kvStoreClient = await KVStoreClient.build(wallet); - await kvStoreClient.setBulk( - [ - KVStoreKeys.role, - KVStoreKeys.fee, - KVStoreKeys.webhookUrl, - KVStoreKeys.url, - KVStoreKeys.jobTypes, - ], - [ - Role.ExchangeOracle, - '1', - 'http://localhost:5001/webhook', - 'http://localhost:5001', - 'FORTUNE', - ], - { nonce: 0 }, - ); - if (process.env.PGP_ENCRYPT && process.env.PGP_ENCRYPT === 'true') { - if (!process.env.PGP_PUBLIC_KEY) { - throw new Error('PGP public key is empty'); - } - const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT || 'localhost', - port: parseInt(process.env.S3_PORT || '9000', 10), - useSSL: process.env.S3_USE_SSL === 'true', - accessKey: process.env.S3_ACCESS_KEY || 'access-key', - secretKey: process.env.S3_SECRET_KEY || 'secret-key', - }); - const bucket = process.env.S3_BUCKET || 'bucket'; - const fileName = 'exo-pgp-public-key.txt'; - const exists = await minioClient.bucketExists(bucket); - if (!exists) { - throw new Error('Bucket does not exists'); - } - try { - await minioClient.putObject( - bucket, - fileName, - process.env.PGP_PUBLIC_KEY, - { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-store', - }, - ); - await kvStoreClient.setFileUrlAndHash( - `http://localhost:9000/bucket/${fileName}`, - KVStoreKeys.publicKey, - { nonce: 1 }, - ); - } catch (e) { - console.log(e); - } - } -} - -setup(); diff --git a/packages/apps/fortune/recording-oracle/.env.example b/packages/apps/fortune/recording-oracle/.env.example index ac59dac283..8705bc4911 100644 --- a/packages/apps/fortune/recording-oracle/.env.example +++ b/packages/apps/fortune/recording-oracle/.env.example @@ -1,29 +1,51 @@ -#General -NODE_ENV=development -HOST=localhost -PORT=5002 -SESSION_SECRET= +# General +HOST=0.0.0.0 +PORT=5007 +# S3 +S3_ENDPOINT=0.0.0.0 +S3_PORT=9000 +S3_ACCESS_KEY=human-oracle +S3_SECRET_KEY=human-oracle-s3-secret +S3_BUCKET=fortune +S3_USE_SSL=false -#Web3 -WEB3_PRIVATE_KEY= -RPC_URL_POLYGON= -RPC_URL_BSC= -RPC_URL_POLYGON_AMOY= -RPC_URL_SEPOLIA= -RPC_URL_MOONBEAM= -RPC_URL_BSC_TESTNET= -RPC_URL_LOCALHOST= +# Web3 +WEB3_PRIVATE_KEY=replace_me +RPC_URL_POLYGON_AMOY=https://rpc-amoy.polygon.technology +RPC_URL_LOCALHOST=http://0.0.0.0:8545 -# S3 -S3_ENDPOINT= -S3_PORT= -S3_ACCESS_KEY= -S3_SECRET_KEY= -S3_BUCKET= -S3_USE_SSL= +# Encryption +PGP_ENCRYPT=true +PGP_PRIVATE_KEY="-----BEGIN PGP PRIVATE KEY BLOCK----- + +xYYEaCsnrRYJKwYBBAHaRw8BAQdADWMKa+9YvRJV474d+BDsLv7a+aSkMMkR +FZOWJG1ePjT+CQMIZhNMm+tnPeTgihnx8ru0E3sqYcofEvRM9VrSIyrs/U+H +LsK5rsa+NV8Ui+9cKcmtCW4EJ12LNmTg1xYJsxQnn4eZQzSmlMkK5N61KyJ+ +zM0AwowEEBYKAD4FgmgrJ60ECwkHCAmQuTtXvy2rDmoDFQgKBBYAAgECGQEC +mwMCHgEWIQRhezz+qPdIIiGIyyS5O1e/LasOagAASiUBAL2ngIhlne91+Z7h +RHU0F4ENomy/e1S6w/gn/dVLfE1OAP9ZG9x1gksN1R1O9Fgq1WfGkHNJi/8U +DF7yO8H8sDw2D8eLBGgrJ60SCisGAQQBl1UBBQEBB0A9v5ubU6UB6C9yoUPc +Zqu8ZyQHa55VFR3figyExeVtRwMBCAf+CQMIU0kTC9Fq7ozgh/iv/ybvydCJ +pdU7fNuD2Ipb4ZfRVMrogkQLolOKgRd8468OSoNFuk4RnYkBsyafZmI4KGkG ++oroKa+1mThKi6ePu7GO/cJ4BBgWCgAqBYJoKyetCZC5O1e/LasOagKbDBYh +BGF7PP6o90giIYjLJLk7V78tqw5qAACsjwD+O/d9B6wJDDd2FRp3JmZPt/sJ +vyg2sQLiIXbjACHXCI4BALbO+tfsyeSxYiK0j67etKnFzoG+1ek1vukDdIf7 +tMcN +=qkIF +-----END PGP PRIVATE KEY BLOCK-----" +PGP_PASSPHRASE=tt8Bn946gusiJm4r5wX +# Put it here just to easily set up KV later; not needed to run +PGP_PUBLIC_KEY="-----BEGIN PGP PUBLIC KEY BLOCK----- -#Encryption -PGP_ENCRYPT= -PGP_PRIVATE_KEY= -PGP_PASSPHRASE= \ No newline at end of file +xjMEaCsnrRYJKwYBBAHaRw8BAQdADWMKa+9YvRJV474d+BDsLv7a+aSkMMkR +FZOWJG1ePjTNAMKMBBAWCgA+BYJoKyetBAsJBwgJkLk7V78tqw5qAxUICgQW +AAIBAhkBApsDAh4BFiEEYXs8/qj3SCIhiMskuTtXvy2rDmoAAEolAQC9p4CI +ZZ3vdfme4UR1NBeBDaJsv3tUusP4J/3VS3xNTgD/WRvcdYJLDdUdTvRYKtVn +xpBzSYv/FAxe8jvB/LA8Ng/OOARoKyetEgorBgEEAZdVAQUBAQdAPb+bm1Ol +AegvcqFD3GarvGckB2ueVRUd34oMhMXlbUcDAQgHwngEGBYKACoFgmgrJ60J +kLk7V78tqw5qApsMFiEEYXs8/qj3SCIhiMskuTtXvy2rDmoAAKyPAP47930H +rAkMN3YVGncmZk+3+wm/KDaxAuIhduMAIdcIjgEAts761+zJ5LFiIrSPrt60 +qcXOgb7V6TW+6QN0h/u0xw0= +=Hpds +-----END PGP PUBLIC KEY BLOCK-----" diff --git a/packages/apps/fortune/recording-oracle/Dockerfile b/packages/apps/fortune/recording-oracle/Dockerfile new file mode 100644 index 0000000000..2467774a14 --- /dev/null +++ b/packages/apps/fortune/recording-oracle/Dockerfile @@ -0,0 +1,35 @@ +FROM node:22.14-slim +ARG APP_PATH=packages/apps/fortune/recording-oracle + +# Create app directory +WORKDIR /usr/src/app + +# Copy expected yarn dist +COPY .yarn ./.yarn +COPY .yarnrc.yml ./ + +# Copy files for deps installation +COPY package.json yarn.lock ./ +COPY ${APP_PATH}/package.json ./${APP_PATH}/ + +# Some deps are referenced as "workspace:*", +# so we need to copy and build them +COPY packages/core ./packages/core +COPY packages/sdk ./packages/sdk + +RUN yarn install + +# Copy base TS config that is required to build packages +COPY tsconfig.base.json ./ +# Build libs +RUN yarn build:libs + +# Copy everything else +COPY ${APP_PATH} ./${APP_PATH} + +WORKDIR ./${APP_PATH} +# Creates a "dist" folder with the production build +RUN yarn build + +# Start the server using the build +CMD [ "yarn", "start:prod" ] diff --git a/packages/apps/fortune/recording-oracle/ENV.md b/packages/apps/fortune/recording-oracle/ENV.md deleted file mode 100644 index 705df340a2..0000000000 --- a/packages/apps/fortune/recording-oracle/ENV.md +++ /dev/null @@ -1,62 +0,0 @@ -# Environment Variables - -### The RPC URL for the Polygon network. -RPC_URL_POLYGON= - -### The RPC URL for the Polygon Amoy network. -RPC_URL_POLYGON_AMOY= - -### The RPC URL for the Sepolia network. -RPC_URL_SEPOLIA= - -### The RPC URL for the BSC Mainnet network. -RPC_URL_BSC_MAINNET= - -### The RPC URL for the BSC Testnet network. -RPC_URL_BSC_TESTNET= - -### The RPC URL for the Localhost network. -RPC_URL_LOCALHOST= - -### Indicates whether PGP encryption should be used. Default: false -PGP_ENCRYPT="false" - -### The private key used for PGP encryption or decryption. -PGP_PRIVATE_KEY= - -### The passphrase associated with the PGP private key. -PGP_PASSPHRASE= - -### The endpoint URL for connecting to the S3 service. Default: '127.0.0.1' -S3_ENDPOINT="127.0.0.1" - -### The port number for connecting to the S3 service. Default: 9000 -S3_PORT="9000" - -### The access key ID used to authenticate requests to the S3 service. Required -S3_ACCESS_KEY= - -### The secret access key used to authenticate requests to the S3 service. Required -S3_SECRET_KEY= - -### The name of the S3 bucket where files will be stored. Default: 'recording' -S3_BUCKET="recording" - -### Indicates whether to use SSL (HTTPS) for connections to the S3 service. Default: false -S3_USE_SSL="false" - -### The environment in which the server is running (e.g., 'development', 'production'). Default: 'development' -NODE_ENV="development" - -### The hostname or IP address on which the server will run. Default: 'localhost' -HOST="localhost" - -### The port number on which the server will listen for incoming connections. Default: 5000 -PORT="5000" - -### The secret key used for session encryption and validation. Default: 'session_key' -SESSION_SECRET="session_key" - -### The private key used for signing transactions. Required -WEB3_PRIVATE_KEY= - diff --git a/packages/apps/fortune/recording-oracle/docker-compose.yml b/packages/apps/fortune/recording-oracle/docker-compose.yml deleted file mode 100644 index 329fcd6ca6..0000000000 --- a/packages/apps/fortune/recording-oracle/docker-compose.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: '3.7' - -services: - minio: - container_name: minio - image: minio/minio:RELEASE.2022-05-26T05-48-41Z - ports: - - 9001:9001 - - 9000:9000 - environment: - MINIO_ROOT_USER: dev - MINIO_ROOT_PASSWORD: devdevdev - entrypoint: 'sh' - command: - -c "minio server /data --console-address ':9001'" - healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] - interval: 5s - timeout: 5s - retries: 3 - minio-mc: - container_name: minio-mc - image: minio/mc - depends_on: - minio: - condition: service_healthy - entrypoint: > - /bin/sh -c " - /usr/bin/mc config host add myminio http://minio:9000 dev devdevdev; - /usr/bin/mc mb myminio/launcher; - /usr/bin/mc anonymous set public myminio/launcher; - /usr/bin/mc mb myminio/solution; - /usr/bin/mc anonymous set public myminio/solution; - " diff --git a/packages/apps/fortune/recording-oracle/package.json b/packages/apps/fortune/recording-oracle/package.json index a2a45defba..8d18412b67 100644 --- a/packages/apps/fortune/recording-oracle/package.json +++ b/packages/apps/fortune/recording-oracle/package.json @@ -18,10 +18,8 @@ "test": "jest", "test:watch": "jest --watch", "test:cov": "jest --coverage", - "postgres": "docker compose up -d postgres", - "docker": "docker compose up -d", - "local": "docker compose down && (concurrently --hide 0 \"yarn docker\" \"yarn recording-oracle:dev\" )", - "setup:local": "ts-node ./test/setup.ts", + "setup:local": "ts-node ./scripts/setup-staking.ts && LOCAL=true yarn setup:kvstore", + "setup:kvstore": "ts-node ./scripts/setup-kv-store.ts", "generate-env-doc": "ts-node scripts/generate-env-doc.ts" }, "dependencies": { @@ -30,11 +28,16 @@ "@nestjs/common": "^10.2.7", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.3.10", + "@nestjs/platform-express": "^10.3.10", "@nestjs/swagger": "^7.4.2", "axios": "^1.3.1", "body-parser": "^1.20.2", + "class-transformer": "^0.5.1", "class-validator": "0.14.1", + "dotenv": "^16.3.2", "helmet": "^7.1.0", + "joi": "^17.13.3", + "minio": "7.1.3", "reflect-metadata": "^0.2.2", "rxjs": "^7.2.0" }, diff --git a/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts new file mode 100644 index 0000000000..99a865bd08 --- /dev/null +++ b/packages/apps/fortune/recording-oracle/scripts/setup-kv-store.ts @@ -0,0 +1,167 @@ +import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; +import * as Minio from 'minio'; + +const isLocalEnv = process.env.LOCAL === 'true'; + +let ENV_FILE_PATH = '.env'; +if (isLocalEnv) { + ENV_FILE_PATH += '.local'; +} +dotenv.config({ path: ENV_FILE_PATH }); + +const RPC_URL = isLocalEnv + ? process.env.RPC_URL_LOCALHOST + : process.env.RPC_URL_POLYGON_AMOY; + +const SUPPORTED_JOB_TYPES = 'fortune'; +const ROLE = Role.RecordingOracle; + +async function setupCommonValues(kvStoreClient: KVStoreClient): Promise { + const { SERVER_URL, HOST, PORT, FEE = '1' } = process.env; + + if (SUPPORTED_JOB_TYPES.split(',').length === 0) { + throw new Error('SUPPORTED_JOB_TYPES should be comma-separated list'); + } + + const serverUrl = SERVER_URL || `http://${HOST}:${PORT}`; + try { + new URL(serverUrl); + } catch (_noop) { + throw new Error('Invalid SERVER_URL'); + } + let url = serverUrl.endsWith('/') ? serverUrl.slice(0, -1) : serverUrl; + if (!url.startsWith('http')) { + url = `http://${url}`; + } + + const fee = Number(FEE); + if (!Number.isInteger(fee) || fee < 1) { + throw new Error('Fee must be positive integer'); + } + + await kvStoreClient.setBulk( + [ + KVStoreKeys.role, + KVStoreKeys.fee, + KVStoreKeys.url, + KVStoreKeys.webhookUrl, + KVStoreKeys.jobTypes, + ], + [ROLE, fee.toString(), url, `${url}/webhook`, SUPPORTED_JOB_TYPES], + ); +} + +type SetupPublicKeyFileMeta = { + keyName: string; + publicKey: string; + s3Bucket: string; + s3Endpoint: string; + s3Port: string; + kvKey: string; +}; + +async function setupPublicKeyFile( + kvStoreClient: KVStoreClient, + minioClient: Minio.Client, + meta: SetupPublicKeyFileMeta, +): Promise { + const { keyName, kvKey, publicKey, s3Bucket, s3Endpoint, s3Port } = meta; + const exists = await minioClient.bucketExists(s3Bucket); + if (!exists) { + throw new Error('Bucket does not exists'); + } + + await minioClient.putObject(s3Bucket, keyName, publicKey, { + 'Content-Type': 'text/plain', + 'Cache-Control': 'no-store', + }); + /** + * Protocol is required for 'setFileUrlAndHash' + */ + const _s3Endpoint = s3Endpoint.startsWith('http') + ? s3Endpoint + : `http://${s3Endpoint}`; + const fileUrl = `${_s3Endpoint}:${s3Port}/${s3Bucket}/${keyName}`; + await kvStoreClient.setFileUrlAndHash(fileUrl, kvKey); +} + +async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const kvStoreClient = await KVStoreClient.build(wallet); + + await setupCommonValues(kvStoreClient); + + const { + S3_ENDPOINT, + S3_PORT, + S3_USE_SSL, + S3_ACCESS_KEY, + S3_SECRET_KEY, + S3_BUCKET, + } = process.env; + + if ( + [S3_ENDPOINT, S3_PORT, S3_ACCESS_KEY, S3_SECRET_KEY, S3_BUCKET].some( + (value) => !value, + ) + ) { + throw new Error('Missing S3 config value'); + } + + const s3Endpoint = S3_ENDPOINT as string; + const s3Port = S3_PORT as string; + const s3AccessKey = S3_ACCESS_KEY as string; + const s3SecretKey = S3_SECRET_KEY as string; + const s3Bucket = S3_BUCKET as string; + + const minioClient = new Minio.Client({ + endPoint: s3Endpoint, + port: parseInt(s3Port, 10), + useSSL: S3_USE_SSL === 'true', + accessKey: s3AccessKey, + secretKey: s3SecretKey, + }); + + const { + PGP_ENCRYPT, + PGP_PUBLIC_KEY, + PGP_PUBLIC_KEY_FILE = 'pgp-public-key-reco', + } = process.env; + if (PGP_ENCRYPT === 'true') { + if (!PGP_PUBLIC_KEY) { + throw new Error('PGP public key is empty'); + } + + await setupPublicKeyFile(kvStoreClient, minioClient, { + s3Endpoint, + s3Port, + s3Bucket, + publicKey: PGP_PUBLIC_KEY, + keyName: PGP_PUBLIC_KEY_FILE, + kvKey: KVStoreKeys.publicKey, + }); + } +} + +(async () => { + try { + await setup(); + process.exit(0); + } catch (error) { + console.error('Failed to setup KV.', error); + process.exit(1); + } +})(); diff --git a/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts b/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts new file mode 100644 index 0000000000..8d266da004 --- /dev/null +++ b/packages/apps/fortune/recording-oracle/scripts/setup-staking.ts @@ -0,0 +1,39 @@ +import { + ChainId, + NetworkData, + NETWORKS, + StakingClient, +} from '@human-protocol/sdk'; +import { HMToken__factory } from '@human-protocol/core/typechain-types'; +import * as dotenv from 'dotenv'; +import { Wallet, ethers } from 'ethers'; + +dotenv.config({ path: '.env.local' }); + +const RPC_URL = process.env.RPC_URL_LOCALHOST || 'http://0.0.0.0:8545'; + +export async function setup(): Promise { + if (!RPC_URL) { + throw new Error('RPC url is empty'); + } + + const { WEB3_PRIVATE_KEY } = process.env; + if (!WEB3_PRIVATE_KEY) { + throw new Error('Private key is empty'); + } + + const provider = new ethers.JsonRpcProvider(RPC_URL); + const { hmtAddress: hmtTokenAddress, stakingAddress } = NETWORKS[ + ChainId.LOCALHOST + ] as NetworkData; + const wallet = new Wallet(WEB3_PRIVATE_KEY, provider); + + const hmtContract = HMToken__factory.connect(hmtTokenAddress, wallet); + const hmtTx = await hmtContract.approve(stakingAddress, 1); + await hmtTx.wait(); + + const stakingClient = await StakingClient.build(wallet); + await stakingClient.stake(BigInt(1)); +} + +setup(); diff --git a/packages/apps/fortune/recording-oracle/src/app.module.ts b/packages/apps/fortune/recording-oracle/src/app.module.ts index 9a352672b2..68951d8b53 100644 --- a/packages/apps/fortune/recording-oracle/src/app.module.ts +++ b/packages/apps/fortune/recording-oracle/src/app.module.ts @@ -33,9 +33,10 @@ import { ExceptionFilter } from './common/exceptions/exception.filter'; ], imports: [ ConfigModule.forRoot({ - envFilePath: process.env.NODE_ENV - ? `.env.${process.env.NODE_ENV as string}` - : '.env', + /** + * First value found takes precendece + */ + envFilePath: [`.env.${process.env.NODE_ENV}`, '.env.local', '.env'], validationSchema: envValidator, }), JobModule, diff --git a/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts b/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts index 5d73ebeeea..a2605048c3 100644 --- a/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts +++ b/packages/apps/fortune/recording-oracle/src/common/config/env-schema.ts @@ -5,7 +5,6 @@ export const envValidator = Joi.object({ NODE_ENV: Joi.string(), HOST: Joi.string(), PORT: Joi.string(), - SESSION_SECRET: Joi.string(), // Web3 WEB3_PRIVATE_KEY: Joi.string().required(), RPC_URL_POLYGON: Joi.string(), diff --git a/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts b/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts index 9de873ef72..037d70e5ac 100644 --- a/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts +++ b/packages/apps/fortune/recording-oracle/src/common/config/server-config.service.ts @@ -28,12 +28,4 @@ export class ServerConfigService { get port(): number { return +this.configService.get('PORT', 5002); } - - /** - * The secret key used for session encryption and validation. - * Default: 'session_key' - */ - get sessionSecret(): string { - return this.configService.get('SESSION_SECRET', 'session_key'); - } } diff --git a/packages/apps/fortune/recording-oracle/test/setup.ts b/packages/apps/fortune/recording-oracle/test/setup.ts deleted file mode 100644 index 6c9e5348be..0000000000 --- a/packages/apps/fortune/recording-oracle/test/setup.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { KVStoreClient, KVStoreKeys, Role } from '@human-protocol/sdk'; -import { Wallet, ethers } from 'ethers'; -import * as dotenv from 'dotenv'; -import * as Minio from 'minio'; -dotenv.config({ path: '.env.local' }); - -export async function setup(): Promise { - const privateKey = process.env.WEB3_PRIVATE_KEY; - if (!privateKey) { - throw new Error('Private key is empty'); - } - const provider = new ethers.JsonRpcProvider('http://0.0.0.0:8545'); - const wallet = new Wallet(privateKey, provider); - - const kvStoreClient = await KVStoreClient.build(wallet); - await kvStoreClient.setBulk( - [KVStoreKeys.role, KVStoreKeys.fee, KVStoreKeys.webhookUrl], - [Role.RecordingOracle, '1', 'http://localhost:5002/webhook'], - { - nonce: 0, - }, - ); - - if (process.env.PGP_ENCRYPT && process.env.PGP_ENCRYPT === 'true') { - if (!process.env.PGP_PUBLIC_KEY) { - throw new Error('PGP public key is empty'); - } - const minioClient = new Minio.Client({ - endPoint: process.env.S3_ENDPOINT || 'localhost', - port: parseInt(process.env.S3_PORT || '9000', 10), - useSSL: process.env.S3_USE_SSL === 'true', - accessKey: process.env.S3_ACCESS_KEY || 'access-key', - secretKey: process.env.S3_SECRET_KEY || 'secret-key', - }); - const bucket = process.env.S3_BUCKET || 'bucket'; - const fileName = 'reco-pgp-public-key.txt'; - const exists = await minioClient.bucketExists(bucket); - if (!exists) { - throw new Error('Bucket does not exists'); - } - try { - await minioClient.putObject( - bucket, - fileName, - process.env.PGP_PUBLIC_KEY, - { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-store', - }, - ); - await kvStoreClient.setFileUrlAndHash( - `http://localhost:9000/bucket/${fileName}`, - KVStoreKeys.publicKey, - { - nonce: 1, - }, - ); - } catch (e) { - // eslint-disable-next-line no-console - console.log(e); - } - } -} - -setup(); diff --git a/packages/apps/human-app/frontend/.env.example b/packages/apps/human-app/frontend/.env.example index a18d929d1d..66bd2c755b 100644 --- a/packages/apps/human-app/frontend/.env.example +++ b/packages/apps/human-app/frontend/.env.example @@ -1,64 +1,38 @@ -# api url -VITE_API_URL= #string -# link to privacy policy page -VITE_PRIVACY_POLICY_URL= #string -# link to terms of service -VITE_TERMS_OF_SERVICE_URL= #string -# link to help page -VITE_HUMAN_PROTOCOL_HELP_URL= #string -# email for "Contact Support" links -VITE_HUMAN_SUPPORT_EMAIL= #string -# link to human web page -VITE_HUMAN_PROTOCOL_URL= #string -# link to human web page in main page navbar -VITE_NAVBAR__LINK__PROTOCOL_URL= #string -# link to human web page section in main page navbar -VITE_NAVBAR__LINK__HOW_IT_WORK_URL= #string -# capthca site key for captcha other than labeling -VITE_H_CAPTCHA_SITE_KEY= #string -# HMT daily spent limit -VITE_HMT_DAILY_SPENT_LIMIT= #number -# daily solved captcha limit -VITE_DAILY_SOLVED_CAPTCHA_LIMIT= #number -# capthca url for captcha other than labeling -VITE_H_CAPTCHA_EXCHANGE_URL= #string -# capthca url for labeling -VITE_H_CAPTCHA_LABELING_BASE_URL= #string -# ID of project created with https://cloud.walletconnect.com/sign-in -VITE_WALLET_CONNECT_PROJECT_ID= #string -# Dapp name for wallet connect -VITE_DAPP_META_NAME= #string -# Dapp description for wallet connect -VITE_DAPP_META_DESCRIPTION= #string -# Dapp url for wallet connect -VITE_DAPP_META_URL= #string -# Dapp icons for wallet connect -VITE_DAPP_ICONS= #string => lists of icons eg.: icon1,icon2... +# General +VITE_API_URL=http://localhost:5002 +VITE_NETWORK=testnet -# This data will be use to add first oracle in the oracles table -# string -VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL= -# string -VITE_H_CAPTCHA_ORACLE_ROLE= -# string -VITE_H_CAPTCHA_ORACLE_ADDRESS= -# job types list string -VITE_H_CAPTCHA_ORACLE_TASK_TYPES= #string => lists of job types eg.: Image labeling, BBoxes... +# Reown project id +VITE_WALLET_CONNECT_PROJECT_ID=replace_me +VITE_DAPP_ICONS=icon1,icon2 +VITE_DAPP_META_DESCRIPTION=Complete jobs, earn HMT +VITE_DAPP_META_NAME=Human App Local +VITE_DAPP_META_URL=http://localhost:3001 -# if network is equal to 'testnet' app will use first testnet chain from .src/smart-contracts/chains.ts -# and first mainnet chain for 'mainnet' -VITE_NETWORK= # mainnet|testnet -VITE_GOVERNOR_ADDRESS= -VITE_GOVERNANCE_URL= +# hCapthca +VITE_H_CAPTCHA_EXCHANGE_URL=https://foundation-yellow-exchange.hmt.ai +VITE_H_CAPTCHA_LABELING_BASE_URL=https://foundation-yellow-accounts.hmt.ai +VITE_H_CAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001 +VITE_DAILY_SOLVED_CAPTCHA_LIMIT=0 +VITE_HMT_DAILY_SPENT_LIMIT=0 + +# hCaptcha annotation tool +VITE_H_CAPTCHA_ORACLE_ADDRESS=replace_me +VITE_H_CAPTCHA_ORACLE_ANNOTATION_TOOL=hcaptcha +VITE_H_CAPTCHA_ORACLE_ROLE=hcaptcha +VITE_H_CAPTCHA_ORACLE_TASK_TYPES=image_points,image_boxes -## Web3 setup -# set SC addresses according to https://human-protocol.gitbook.io/hub/human-tech-docs/architecture/components/smart-contracts/contract-addresses +# Other +VITE_HUMAN_PROTOCOL_HELP_URL=https://docs.humanprotocol.org/ +VITE_HUMAN_PROTOCOL_URL=https://humanprotocol.org/ +VITE_HUMAN_SUPPORT_EMAIL=support@local.app +VITE_NAVBAR__LINK__HOW_IT_WORK_URL=https://humanprotocol.org/ +VITE_NAVBAR__LINK__PROTOCOL_URL=https://humanprotocol.org/ +VITE_PRIVACY_POLICY_URL=http://local.app/privacy-policy/ +VITE_TERMS_OF_SERVICE_URL=http://local.app/terms-and-conditions/ -## other networks -# if you wish to add new network follow this instruction: -# - add your env-s set to .env file -# - add new env-s to validation schema in: ./src/shared/env.ts -# - include new valid env-s in: ./src/smart-contracts/contracts.ts -# - add chain data in: .src/smart-contracts/chains.ts +VITE_GOVERNOR_ADDRESS= +VITE_GOVERNANCE_URL= -# all new chains will be available in wallet-connect modal \ No newline at end of file +# Feature flags +VITE_FEATURE_FLAG_JOBS_DISCOVERY=true diff --git a/packages/apps/human-app/frontend/Dockerfile b/packages/apps/human-app/frontend/Dockerfile index a00aea0d4f..7bb315121b 100644 --- a/packages/apps/human-app/frontend/Dockerfile +++ b/packages/apps/human-app/frontend/Dockerfile @@ -20,7 +20,7 @@ COPY packages/sdk ./packages/sdk RUN yarn install -# Copy base TS config that is required to build pacakges +# Copy base TS config that is required to build packages COPY tsconfig.base.json ./ # Build libs RUN yarn build:libs diff --git a/packages/apps/human-app/frontend/package.json b/packages/apps/human-app/frontend/package.json index 108b24b0e6..42c9c07bd5 100644 --- a/packages/apps/human-app/frontend/package.json +++ b/packages/apps/human-app/frontend/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "scripts": { "clean": "tsc --build --clean && rm -rf dist", - "dev": "vite", + "start": "vite", "build": "tsc --build && vite build", "start:prod": "serve -s dist", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", diff --git a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx index ecb939482f..19373ee981 100644 --- a/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx +++ b/packages/apps/human-app/frontend/src/modules/governance-banner/components/governance-banner.tsx @@ -5,13 +5,13 @@ import { useTranslation } from 'react-i18next'; import { env } from '@/shared/env'; import { useColorMode } from '@/shared/contexts/color-mode'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useWorkerKycStatus } from '@/modules/worker/profile/hooks'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useActiveProposalQuery } from '../hooks/use-active-proposal-query'; export function GovernanceBanner() { const { t } = useTranslation(); const { data, isLoading, isError } = useActiveProposalQuery(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { colorPalette } = useColorMode(); const [timeRemaining, setTimeRemaining] = useState('00:00:00'); const isMobile = useIsMobile('lg'); @@ -43,7 +43,7 @@ export function GovernanceBanner() { }; }, [data?.deadline]); - if (!kycApproved || isLoading || isError || !data) { + if (!isVerificationCompleted || isLoading || isError || !data) { return null; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx index 66fce91d97..2e27f715db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hcaptcha-labeling/hcaptcha-labeling.page.tsx @@ -11,6 +11,7 @@ import { Counter } from '@/shared/components/ui/counter'; import { getErrorMessageForError } from '@/shared/errors'; import { getTomorrowDate } from '@/shared/helpers/date'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { useHCaptchaLabelingNotifications } from '@/modules/worker/hooks/use-hcaptcha-labeling-notifications'; import { useColorMode } from '@/shared/contexts/color-mode'; import { onlyDarkModeColor } from '@/shared/styles/dark-color-palette'; @@ -29,6 +30,7 @@ export function HcaptchaLabelingPage() { const { colorPalette, isDarkMode } = useColorMode(); const captchaRef = useRef(null); const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { onSuccess, onError } = useHCaptchaLabelingNotifications(); const statsColor = isDarkMode ? onlyDarkModeColor.additionalTextColor @@ -79,7 +81,7 @@ export function HcaptchaLabelingPage() { solveHCaptchaMutation({ token }); }; - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx similarity index 91% rename from packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx rename to packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx index 7abb883624..7f6663e162 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/hooks/use-kyc-notification.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/hooks/use-idv-notification.tsx @@ -5,7 +5,7 @@ import { import { getErrorMessageForError } from '@/shared/errors'; import type { ResponseError } from '@/shared/types/global.type'; -export function useKycErrorNotifications() { +export function useIdvErrorNotifications() { const { showNotification } = useNotification(); return (error: ResponseError) => { diff --git a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx index b844b46d0b..4f5aefa0db 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/jobs-discovery/jobs-discovery.page.tsx @@ -2,15 +2,15 @@ import Paper from '@mui/material/Paper'; import Grid from '@mui/material/Grid'; import { Navigate } from 'react-router-dom'; import { useIsMobile } from '@/shared/hooks/use-is-mobile'; -import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; +import { useWorkerIdentityVerificationStatus } from '@/modules/worker/profile/hooks'; import { routerPaths } from '@/router/router-paths'; import { OraclesTableJobTypesSelect, OraclesTable } from './components'; export function JobsDiscoveryPage() { const isMobile = useIsMobile(); - const { user } = useAuthenticatedUser(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); - if (user.kyc_status !== 'approved') { + if (!isVerificationCompleted) { return ; } diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts index ebfc0e1758..bc7560332f 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/index.ts @@ -1,2 +1,2 @@ -export * from './start-kyc-btn'; +export * from './start-idv-btn'; export * from './register-address-btn'; diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx new file mode 100644 index 0000000000..68f5ad06e9 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-idv-btn.tsx @@ -0,0 +1,26 @@ +import { t } from 'i18next'; +import { Button } from '@/shared/components/ui/button'; +import { useStartIdv } from '../../hooks'; + +export function StartIdvBtn() { + const { isIdvAlreadyInProgress, idvStartIsPending, startIdv } = useStartIdv(); + + if (isIdvAlreadyInProgress) { + return ( + + ); + } + + return ( + + ); +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx deleted file mode 100644 index 88c5363ecc..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/buttons/start-kyc-btn.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { t } from 'i18next'; -import { Button } from '@/shared/components/ui/button'; -import { useStartKyc } from '../../hooks'; - -export function StartKycBtn() { - const { isKYCInProgress, kycStartIsPending, startKYC } = useStartKyc(); - - if (isKYCInProgress) { - return ( - - ); - } - - return ( - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx new file mode 100644 index 0000000000..2b8b801cb6 --- /dev/null +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/identity-verification-control.tsx @@ -0,0 +1,21 @@ +import { useTranslation } from 'react-i18next'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; +import { StartIdvBtn } from './buttons'; +import { DoneLabel, ErrorLabel } from './status-labels'; + +export function IdentityVerificationControl() { + const { t } = useTranslation(); + const { status } = useWorkerIdentityVerificationStatus(); + + if (status === 'approved') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } else if (status === 'declined') { + return ( + {t('worker.profile.identityVerificationStatus')} + ); + } + + return ; +} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx deleted file mode 100644 index 21f661e3be..0000000000 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/kyc-verification-control.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useTranslation } from 'react-i18next'; -import { useWorkerKycStatus } from '../hooks'; -import { StartKycBtn } from './buttons'; -import { DoneLabel, ErrorLabel } from './status-labels'; - -export function KycVerificationControl() { - const { t } = useTranslation(); - const { kycApproved, kycDeclined, kycToComplete } = useWorkerKycStatus(); - - return ( - <> - {kycApproved && {t('worker.profile.kycCompleted')}} - {kycDeclined && ( - {t('worker.profile.kycDeclined')} - )} - {kycToComplete && } - - ); -} diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx index 9b37cf4107..56551421f6 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/profile-actions.tsx @@ -1,12 +1,12 @@ import Grid from '@mui/material/Grid'; -import { KycVerificationControl } from './kyc-verification-control'; +import { IdentityVerificationControl } from './identity-verification-control'; import { WalletConnectionControl } from './wallet-connection-control'; export function ProfileActions() { return ( - + diff --git a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx index 5159b94eba..d0268f7d7d 100644 --- a/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx +++ b/packages/apps/human-app/frontend/src/modules/worker/profile/components/wallet-connection-control.tsx @@ -3,7 +3,7 @@ import { Grid } from '@mui/material'; import { Button } from '@/shared/components/ui/button'; import { useAuthenticatedUser } from '@/modules/auth/hooks/use-authenticated-user'; import { useWalletConnect } from '@/shared/contexts/wallet-connect'; -import { useWorkerKycStatus } from '../hooks'; +import { useWorkerIdentityVerificationStatus } from '../hooks'; import { DoneLabel } from './status-labels'; import { WalletConnectDone } from './wallet-connect-done'; import { RegisterAddressBtn } from './buttons'; @@ -11,7 +11,7 @@ import { RegisterAddressBtn } from './buttons'; export function WalletConnectionControl() { const { t } = useTranslation(); const { user } = useAuthenticatedUser(); - const { kycApproved } = useWorkerKycStatus(); + const { isVerificationCompleted } = useWorkerIdentityVerificationStatus(); const { isConnected, openModal } = useWalletConnect(); const { wallet_address: walletAddress } = user; @@ -25,7 +25,7 @@ export function WalletConnectionControl() { ); } - if (kycApproved && isConnected) { + if (isVerificationCompleted && isConnected) { return ( @@ -36,7 +36,7 @@ export function WalletConnectionControl() { return (