diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..558befa --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +# Streamingfast API Token +# Get from: https://app.streamingfast.io/ +SUBSTREAMS_API_TOKEN=your-streamingfast-api-token + +# PostgreSQL Password (for local development) +POSTGRES_PASSWORD=changeme + +# PostgreSQL Port (optional, defaults to 5432) +# Use a different port if 5432 is already in use +POSTGRES_PORT=5433 diff --git a/.env.prod.example b/.env.prod.example new file mode 100644 index 0000000..cdf71c0 --- /dev/null +++ b/.env.prod.example @@ -0,0 +1,13 @@ +# Production Environment Variables for Easypanel +# Copy this to .env.prod and fill in the values + +# PostgreSQL connection (from Easypanel's built-in PostgreSQL service) +POSTGRES_HOST=your-project-postgres.internal +POSTGRES_PORT=5432 +POSTGRES_DB=tron_payments +POSTGRES_USER=postgres +POSTGRES_PASSWORD=your-secure-password-here + +# Streamingfast API Token +# Get from: https://app.streamingfast.io/ +SUBSTREAMS_API_TOKEN=your-streamingfast-api-token diff --git a/.github/workflows/deploy-to-production.yml b/.github/workflows/deploy-to-production.yml new file mode 100644 index 0000000..2690392 --- /dev/null +++ b/.github/workflows/deploy-to-production.yml @@ -0,0 +1,14 @@ +name: Deploy to production + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Webhook request + run: | + curl -X GET https://prod.request.network/api/deploy/${{ secrets.EASYPANEL_DEPLOY_KEY_PRODUCTION }} diff --git a/.github/workflows/deploy-to-staging.yml b/.github/workflows/deploy-to-staging.yml new file mode 100644 index 0000000..80705e6 --- /dev/null +++ b/.github/workflows/deploy-to-staging.yml @@ -0,0 +1,14 @@ +name: Deploy to staging + +on: + workflow_dispatch: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Webhook request + run: | + curl -X GET https://stage.request.network/api/deploy/${{ secrets.EASYPANEL_DEPLOY_KEY_STAGING }} diff --git a/.github/workflows/tron-build.yml b/.github/workflows/tron-build.yml new file mode 100644 index 0000000..6845b91 --- /dev/null +++ b/.github/workflows/tron-build.yml @@ -0,0 +1,262 @@ +name: Tron Substreams Build + +on: + pull_request: + branches: + - main + paths: + - 'tron/**' + - '.github/workflows/tron-build.yml' + push: + branches: + - main + paths: + - 'tron/**' + - '.github/workflows/tron-build.yml' + workflow_dispatch: + inputs: + run_integration_tests: + description: 'Run integration tests against live endpoints' + required: false + default: false + type: boolean + publish_package: + description: 'Build and publish package artifact' + required: false + default: false + type: boolean + +jobs: + build-and-test: + name: Build and Test Tron Substreams + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Cache Cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + tron/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('tron/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Build WASM module + working-directory: tron + run: make build + + - name: Run unit tests + working-directory: tron + run: make test + + - name: Verify build artifacts + working-directory: tron + run: | + echo "Checking build artifacts..." + if [ ! -f "target/wasm32-unknown-unknown/release/request_network_tron.wasm" ]; then + echo "ERROR: WASM file not found!" + exit 1 + fi + echo "Build artifacts verified successfully" + + integration-test-mainnet: + name: Integration Test (Mainnet) + runs-on: ubuntu-latest + needs: build-and-test + # Run on: push to main (merge) or manual trigger + # PRs only run unit tests (no API key needed) + if: | + github.event.inputs.run_integration_tests == 'true' || + github.event.inputs.publish_package == 'true' || + (github.event_name == 'push' && github.ref == 'refs/heads/main') + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Cache Cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + tron/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('tron/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install Substreams CLI + run: | + curl -sSL https://github.com/streamingfast/substreams/releases/latest/download/substreams_linux_x86_64.tar.gz | tar xz + sudo mv substreams /usr/local/bin/ + substreams --version + + - name: Build WASM module + working-directory: tron + run: make build + + - name: Package Substreams + working-directory: tron + run: make package + + - name: Verify package created + working-directory: tron + run: | + SPKG_FILE=$(ls -1 *.spkg 2>/dev/null | head -1) + if [ -z "$SPKG_FILE" ]; then + echo "ERROR: No .spkg package file found!" + exit 1 + fi + echo "✅ Package created: $SPKG_FILE" + + - name: Deploy and test against Mainnet (Streamingfast) + working-directory: tron + env: + SUBSTREAMS_API_TOKEN: ${{ secrets.SUBSTREAMS_API_TOKEN }} + run: | + echo "=== Deploying to TRON Mainnet (Streamingfast) ===" + echo "Endpoint: mainnet.tron.streamingfast.io:443" + echo "Block range: 79216121 to 79216221 (100 blocks from mainnet deployment)" + echo "" + + SPKG_FILE=$(ls -1 *.spkg | head -1) + echo "Using package: $SPKG_FILE" + + # Run substreams and capture JSON output + if ! substreams run "$SPKG_FILE" map_erc20_fee_proxy_payments \ + -e mainnet.tron.streamingfast.io:443 \ + --start-block 79216121 \ + --stop-block +100 \ + -o json 2>&1 | tee output_mainnet.log; then + echo "" + echo "❌ FAILED: Substreams command returned non-zero exit code" + echo "Output:" + cat output_mainnet.log + exit 1 + fi + + echo "" + echo "=== Validating Results ===" + + # If any payments were found, validate the structure + if grep -q '"payments"' output_mainnet.log; then + echo "✅ Payments data structure detected in output" + + # Extract and validate payment fields if present + if grep -q '"token_address"' output_mainnet.log; then + echo "✅ Payment fields present: token_address" + fi + if grep -q '"payment_reference"' output_mainnet.log; then + echo "✅ Payment fields present: payment_reference" + fi + if grep -q '"amount"' output_mainnet.log; then + echo "✅ Payment fields present: amount" + fi + else + echo "ℹ️ No payments found in block range (expected if no transactions in these blocks)" + fi + + echo "" + echo "=== Mainnet Integration Test PASSED ===" + echo "The substreams module successfully:" + echo " - Loaded WASM module" + echo " - Connected to TRON Mainnet endpoint via Streamingfast" + echo " - Processed 100 blocks without errors" + echo " - Output valid JSON structure" + + # Publish package artifact for download/deployment + publish-package: + name: Publish Mainnet Package + runs-on: ubuntu-latest + needs: [build-and-test, integration-test-mainnet] + # Publish on: push to main (merge) or manual publish selection + if: | + (github.event_name == 'push' && github.ref == 'refs/heads/main') || + github.event.inputs.publish_package == 'true' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-unknown-unknown + + - name: Cache Cargo dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + tron/target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('tron/Cargo.toml') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Install Substreams CLI + run: | + curl -sSL https://github.com/streamingfast/substreams/releases/latest/download/substreams_linux_x86_64.tar.gz | tar xz + sudo mv substreams /usr/local/bin/ + + - name: Build WASM module + working-directory: tron + run: make build + + - name: Package Substreams + working-directory: tron + run: make package + + - name: Get package info + id: package_info + working-directory: tron + run: | + SPKG_FILE=$(ls -1 *.spkg 2>/dev/null | head -1) + if [ -z "$SPKG_FILE" ]; then + echo "ERROR: No .spkg package file found!" + exit 1 + fi + echo "spkg_file=$SPKG_FILE" >> $GITHUB_OUTPUT + + VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') + echo "version=$VERSION" >> $GITHUB_OUTPUT + + echo "Package created successfully: $SPKG_FILE (version: $VERSION)" + + - name: Upload package artifact + uses: actions/upload-artifact@v4 + with: + name: request-network-tron-${{ steps.package_info.outputs.version }} + path: tron/${{ steps.package_info.outputs.spkg_file }} + retention-days: 90 + + - name: Package ready for deployment + run: | + echo "==============================================" + echo "📦 Substreams Package Ready" + echo "==============================================" + echo "" + echo "Package: ${{ steps.package_info.outputs.spkg_file }}" + echo "Version: ${{ steps.package_info.outputs.version }}" + echo "==============================================" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..65003e6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +# Rust build artifacts +target/ + +# Substreams packages (built during Docker/CI) +*.spkg + +# Substreams replay log +replay.log + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Environment +.env +.env.local diff --git a/Dockerfile.sink b/Dockerfile.sink new file mode 100644 index 0000000..4886b39 --- /dev/null +++ b/Dockerfile.sink @@ -0,0 +1,59 @@ +# Stage 1: Build the Substreams package from source +FROM rust:slim AS builder + +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Install Substreams CLI +RUN curl -sSL https://github.com/streamingfast/substreams/releases/latest/download/substreams_linux_x86_64.tar.gz | tar xz -C /usr/local/bin + +# Add WASM target +RUN rustup target add wasm32-unknown-unknown + +# Copy source code +WORKDIR /build/tron +COPY tron/ . + +# Build WASM module and package +RUN cargo build --target wasm32-unknown-unknown --release && \ + substreams pack ./substreams.yaml + +# Stage 2: Runtime image +FROM ubuntu:22.04 + +# Install dependencies +RUN apt-get update && apt-get install -y \ + ca-certificates \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Download substreams-sink-sql binary (v4.12.0) - detect architecture +ARG TARGETARCH +RUN ARCH=$(echo ${TARGETARCH:-amd64} | sed 's/amd64/x86_64/' | sed 's/arm64/arm64/') && \ + curl -sSL "https://github.com/streamingfast/substreams-sink-sql/releases/download/v4.12.0/substreams-sink-sql_linux_${ARCH}.tar.gz" -o /tmp/sink.tar.gz && \ + tar xzf /tmp/sink.tar.gz -C /usr/local/bin/ && \ + rm /tmp/sink.tar.gz && \ + chmod +x /usr/local/bin/substreams-sink-sql + +# Copy the built .spkg from builder stage and schema +COPY --from=builder /build/tron/request-network-tron-*.spkg /app/ +COPY tron/schema.sql /app/ + +WORKDIR /app + +# Environment variables (override in deployment) +ENV DSN="" +ENV SUBSTREAMS_API_TOKEN="" +# Endpoint configured via SUBSTREAMS_ENDPOINTS_CONFIG_TRON env var +ENV SUBSTREAMS_ENDPOINTS_CONFIG_TRON="mainnet.tron.streamingfast.io:443" + +# Create entrypoint script - dynamically find the .spkg file +RUN printf '#!/bin/bash\nset -e\n\nSPKG=$(ls /app/request-network-tron-*.spkg 2>/dev/null | head -1)\nif [ -z "$SPKG" ]; then\n echo "ERROR: No .spkg file found in /app/"\n exit 1\nfi\necho "Using package: $SPKG"\n\n# Setup the database schema first\necho "Setting up database schema..."\nsubstreams-sink-sql setup "$DSN" "$SPKG" || true\n\n# Run the sink\necho "Starting sink..."\nexec substreams-sink-sql run "$DSN" "$SPKG"\n' > /entrypoint.sh && \ + chmod +x /entrypoint.sh + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD pgrep substreams-sink-sql || exit 1 + +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/README.md b/README.md index 50a4456..78d80c2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,388 @@ -# payments-substream +# Request Network Payments Substream -Substream for indexing Request Network payments. +Substreams module for indexing Request Network ERC20FeeProxy payment events across multiple blockchain networks. Currently supports TRON with a multi-chain architecture ready for additional networks. + +## Prerequisites + +- [Rust](https://rustup.rs/) with `wasm32-unknown-unknown` target +- [Substreams CLI](https://substreams.streamingfast.io/getting-started/installing-the-cli) +- [Docker](https://docs.docker.com/get-docker/) and Docker Compose +- [Buf CLI](https://buf.build/product/cli) (for protobuf generation) +- [Streamingfast API Token](https://app.streamingfast.io/) + +### Install Rust WASM target + +```bash +rustup target add wasm32-unknown-unknown +``` + +### Install Substreams CLI + +```bash +# macOS +brew install streamingfast/tap/substreams + +# Linux +curl -sSL https://github.com/streamingfast/substreams/releases/latest/download/substreams_linux_x86_64.tar.gz | tar xz +sudo mv substreams /usr/local/bin/ +``` + +### Install Buf CLI + +```bash +brew install bufbuild/buf/buf +``` + +## Project Structure + +``` +payments-substream/ +├── tron/ # TRON substream module +│ ├── src/ +│ │ ├── lib.rs # Main substream logic +│ │ └── pb/ # Generated protobuf code +│ ├── proto/ +│ │ └── request/tron/v1/ +│ │ └── payments.proto # Payment message definitions +│ ├── schema.sql # PostgreSQL schema for SQL sink +│ ├── schema.graphql # GraphQL schema (for future use) +│ ├── substreams.yaml # Substream manifest +│ ├── Cargo.toml # Rust dependencies +│ └── Makefile # Build commands +├── docker-compose.yml # Local development setup +├── docker-compose.prod.yml # Production deployment (Easypanel) +├── Dockerfile.sink # SQL sink Docker image +└── .env.example # Environment variables template +``` + +## Development + +### 1. Make Changes to the Substream + +#### Modify the Rust Code + +Edit `tron/src/lib.rs` to change payment parsing logic: + +```rust +// Example: Add new field extraction +fn parse_transfer_with_reference_and_fee(...) -> Option { + // Your parsing logic here +} +``` + +#### Update Protobuf Messages + +Edit `tron/proto/request/tron/v1/payments.proto`: + +```protobuf +message Payment { + string token_address = 1; + // Add new fields here + string new_field = 13; +} +``` + +After changing `.proto` files, regenerate the Rust code: + +```bash +cd tron +make protogen +``` + +#### Update SQL Schema + +Edit `tron/schema.sql` to add new columns: + +```sql +ALTER TABLE payments ADD COLUMN new_field TEXT; +``` + +### 2. Build the Substream + +```bash +cd tron + +# Build WASM module +make build + +# Run unit tests +make test + +# Package into .spkg file +make package +``` + +### 3. Run the Stream Locally + +Test the substream against live blockchain data without a database: + +```bash +cd tron + +# Set your API token +export SUBSTREAMS_API_TOKEN="your-token-here" + +# Run against TRON mainnet (100 blocks from deployment) +substreams run ./request-network-tron-v0.1.0.spkg \ + map_erc20_fee_proxy_payments \ + -e mainnet.tron.streamingfast.io:443 \ + --start-block 79216121 \ + --stop-block +100 +``` + +#### Output Options + +```bash +# JSON output (for debugging) +substreams run ... -o json + +# Protobuf output (default) +substreams run ... -o proto +``` + +### 4. Run the Sink Locally (with PostgreSQL) + +Test the full pipeline with a local PostgreSQL database: + +#### Start Local Services + +```bash +# Create .env file +cp .env.example .env + +# Edit .env with your values +# SUBSTREAMS_API_TOKEN=your-token +# POSTGRES_PASSWORD=your-password + +# Start PostgreSQL and sink +docker compose up -d + +# View logs +docker compose logs -f sink +``` + +#### Query Local Database + +```bash +# Connect to PostgreSQL +docker exec -it tron-payments-db psql -U postgres -d tron_payments + +# Query payments +SELECT * FROM payments LIMIT 10; +SELECT chain, COUNT(*) FROM payments GROUP BY chain; +``` + +#### Stop Local Services + +```bash +docker compose down + +# Remove data volumes (fresh start) +docker compose down -v +``` + +## Configuration + +### Substream Parameters + +Parameters are configured in `tron/substreams.yaml`: + +```yaml +params: + map_erc20_fee_proxy_payments: | + mainnet_proxy_address=TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd + chain=tron +``` + +| Parameter | Description | Example | +|-----------|-------------|---------| +| `mainnet_proxy_address` | ERC20FeeProxy contract address | `TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd` | +| `chain` | Chain identifier for multi-chain support | `tron`, `ethereum`, `polygon` | + +### Environment Variables + +| Variable | Description | +|----------|-------------| +| `SUBSTREAMS_API_TOKEN` | Streamingfast API authentication token | +| `DSN` | PostgreSQL connection string | +| `POSTGRES_PASSWORD` | PostgreSQL password (local dev) | + +## Deployment + +### Deploy to Easypanel (Production) + +#### 1. Create PostgreSQL Database + +In Easypanel: +1. Create a new PostgreSQL service +2. Note the internal hostname (e.g., `shared_payments-substream-postgres`) + +#### 2. Deploy the Sink + +1. Create a new Docker Compose app pointing to this repository +2. Set compose file path: `docker-compose.prod.yml` +3. Configure environment variables: + +``` +DSN=postgres://postgres:PASSWORD@shared_payments-substream-postgres:5432/shared?sslmode=disable +SUBSTREAMS_API_TOKEN=your-streamingfast-token +``` + +4. Enable "Create .env file" checkbox +5. Deploy + +#### 3. Monitor the Sink + +Check logs in Easypanel to verify: +- Connection to Streamingfast endpoint +- Database writes (`db_flush_rate`) +- Block processing (`progress_total_processed_blocks`) + +### Manual Deployment + +```bash +# Build the Docker image +docker build -f Dockerfile.sink -t payments-sink . + +# Run with environment variables +docker run -d \ + -e DSN="postgres://user:pass@host:5432/db?sslmode=disable" \ + -e SUBSTREAMS_API_TOKEN="your-token" \ + payments-sink +``` + +## GraphQL API (Hasura) + +The PostgreSQL database is exposed via Hasura, providing a GraphQL API for the Request Network SDK to query payments. + +### Architecture + +``` +┌─────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ +│ TRON │────▶│ Substream │────▶│ PostgreSQL │────▶│ Hasura │ +│ Blockchain │ │ Sink │ │ (payments) │ │ GraphQL │ +└─────────────┘ └──────────────┘ └──────────────┘ └──────┬───────┘ + │ + ▼ + ┌──────────────┐ + │ Request SDK │ + │ (payment │ + │ detection) │ + └──────────────┘ +``` + +### GraphQL Endpoint + +- **Staging**: `https://graphql.stage.request.network/v1/graphql` +- **Production**: `https://graphql.request.network/v1/graphql` + +### Example Query + +```graphql +query GetPayments($reference: String!, $chain: String) { + payments( + where: { + payment_reference: { _eq: $reference } + chain: { _eq: $chain } + } + order_by: { block_number: asc } + ) { + id + chain + tx_hash + block_number + timestamp + token_address + from_address + to_address + amount + fee_amount + fee_address + payment_reference + contract_address + } +} +``` + +### Query by Payment Reference + +```bash +curl -X POST https://graphql.stage.request.network/v1/graphql \ + -H "Content-Type: application/json" \ + -d '{ + "query": "query { payments(where: { payment_reference: { _eq: \"0xabc123...\" } }) { tx_hash amount chain } }" + }' +``` + +### SDK Integration + +The Request Network SDK uses a custom info retriever to query the Hasura endpoint for TRON payments. See the `@requestnetwork/payment-detection` package for implementation details. + +## Multi-Chain Support + +The payments table includes a `chain` field to support multiple networks: + +```sql +SELECT chain, COUNT(*) as payments FROM payments GROUP BY chain; +``` + +### Adding a New Network + +1. Create a new substream module (e.g., `ethereum/`) +2. Configure the appropriate Streamingfast endpoint +3. Set the `chain` parameter in `substreams.yaml` +4. Deploy an additional sink pointing to the same database + +Example for Ethereum: + +```yaml +params: + map_erc20_fee_proxy_payments: | + mainnet_proxy_address=0x... + chain=ethereum +``` + +## Troubleshooting + +### Module Hash Mismatch + +If you see `cursor module hash mismatch`: + +```sql +-- Connect to PostgreSQL and reset +DROP TABLE IF EXISTS payments; +DROP TABLE IF EXISTS cursors; +``` + +Then redeploy the sink. + +### Column Does Not Exist + +Schema changes require dropping and recreating tables: + +```sql +DROP TABLE IF EXISTS payments; +DROP TABLE IF EXISTS cursors; +``` + +### DNS Resolution Issues + +Ensure services are on the same Docker network. In `docker-compose.prod.yml`: + +```yaml +networks: + easypanel: + external: true +``` + +## Streamingfast Endpoints + +| Network | Endpoint | +|---------|----------| +| TRON Mainnet | `mainnet.tron.streamingfast.io:443` | +| TRON Shasta (Testnet) | `shasta.tron.streamingfast.io:443` | +| Ethereum Mainnet | `mainnet.eth.streamingfast.io:443` | + +## License + +MIT diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..4516e0e --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,21 @@ +# Production Docker Compose for Easypanel +# Uses Easypanel's built-in PostgreSQL service for cross-app database access + +services: + sink: + build: + context: . + dockerfile: Dockerfile.sink + restart: unless-stopped + environment: + # These variables are passed through from Easypanel's environment settings + - DSN + - SUBSTREAMS_API_TOKEN + # TRON mainnet endpoint (hardcoded) + - SUBSTREAMS_ENDPOINTS_CONFIG_TRON=mainnet.tron.streamingfast.io:443 + networks: + - easypanel + +networks: + easypanel: + external: true diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..788c30c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,37 @@ +services: + # PostgreSQL Database + postgres: + image: postgres:15-alpine + container_name: tron-payments-db + restart: unless-stopped + environment: + POSTGRES_DB: tron_payments + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + volumes: + - postgres_data:/var/lib/postgresql/data + ports: + - "${POSTGRES_PORT:-5432}:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + + # Substreams SQL Sink + sink: + build: + context: . + dockerfile: Dockerfile.sink + container_name: tron-payments-sink + restart: unless-stopped + depends_on: + postgres: + condition: service_healthy + environment: + DSN: postgres://postgres:${POSTGRES_PASSWORD}@postgres:5432/tron_payments?sslmode=disable + SUBSTREAMS_API_TOKEN: ${SUBSTREAMS_API_TOKEN} + SUBSTREAMS_ENDPOINTS_CONFIG_TRON: mainnet.tron.streamingfast.io:443 + +volumes: + postgres_data: diff --git a/tron/Cargo.lock b/tron/Cargo.lock new file mode 100644 index 0000000..6f80cd4 --- /dev/null +++ b/tron/Cargo.lock @@ -0,0 +1,794 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bigdecimal" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "sha2", + "tinyvec", +] + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "pad" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ad9b889f1b12e0b9ee24db044b5129150d5eada288edc800f789928dc8c0e3" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "pest" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9eb05c21a464ea704b53158d358a31e6425db2f63a1a7312268b05fe2b75f7" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f9dbced329c441fa79d80472764b1a2c7e57123553b8519b36663a2fb234ed" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bb96d5051a78f44f43c8f712d8e810adb0ebf923fc9ed2655a7f66f63ba8ee5" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "pest_meta" +version = "2.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602113b5b5e8621770cfd490cfd90b9f84ab29bd2b0e49ad83eb6d186cef2365" +dependencies = [ + "pest", + "sha2", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 1.0.109", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost", +] + +[[package]] +name = "quote" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" + +[[package]] +name = "request-network-tron" +version = "0.1.0" +dependencies = [ + "anyhow", + "bs58", + "getrandom 0.2.17", + "hex", + "prost", + "prost-types", + "sha2", + "substreams", + "substreams-database-change", +] + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "substreams" +version = "0.5.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e47e531af83a3cbb78c627ee8232a0ac86604f11c89e34bd4b721ec41e03e5" +dependencies = [ + "anyhow", + "bigdecimal", + "hex", + "hex-literal", + "num-bigint", + "num-integer", + "num-traits", + "pad", + "pest", + "pest_derive", + "prost", + "prost-build", + "prost-types", + "substreams-macro", + "thiserror", +] + +[[package]] +name = "substreams-database-change" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed32ca6fc7fa4b7a684d3abd5bb0545aadd2df82402e7336443cdbb6f8b350c3" +dependencies = [ + "prost", + "prost-types", + "substreams", +] + +[[package]] +name = "substreams-macro" +version = "0.5.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ac77f08d723dace35739d65df8ed122f6d04e2a3e47929831d4021e3339240" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix 1.1.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" diff --git a/tron/Cargo.toml b/tron/Cargo.toml new file mode 100644 index 0000000..4b89e20 --- /dev/null +++ b/tron/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "request-network-tron" +version = "0.1.0" +edition = "2021" +repository = "https://github.com/RequestNetwork/payments-substream" +license = "MIT" +description = "Request Network TRON Substreams module for ERC20FeeProxy payment detection" + +[lib] +name = "request_network_tron" +crate-type = ["cdylib"] + +[dependencies] +substreams = "0.5" +substreams-database-change = "1.3" +prost = "0.11" +prost-types = "0.11" +hex = "0.4" +bs58 = { version = "0.5", features = ["check"] } +sha2 = "0.10" +anyhow = "1.0" + +[target.wasm32-unknown-unknown.dependencies] +getrandom = { version = "0.2", features = ["custom"] } + +[profile.release] +lto = true +opt-level = 's' +strip = "debuginfo" diff --git a/tron/Makefile b/tron/Makefile new file mode 100644 index 0000000..06ca8f2 --- /dev/null +++ b/tron/Makefile @@ -0,0 +1,29 @@ +.PHONY: build +build: + cargo build --target wasm32-unknown-unknown --release + +.PHONY: protogen +protogen: + substreams protogen ./substreams.yaml --exclude-paths="sf/substreams,google" + +.PHONY: package +package: build + substreams pack ./substreams.yaml + +# Mainnet - uses Streamingfast TRON native endpoint +.PHONY: gui +gui: build + substreams gui ./substreams.yaml map_erc20_fee_proxy_payments -e mainnet.tron.streamingfast.io:443 --start-block 79216121 + +.PHONY: run +run: build + substreams run ./substreams.yaml map_erc20_fee_proxy_payments -e mainnet.tron.streamingfast.io:443 --start-block 79216121 --stop-block +100 + +.PHONY: clean +clean: + cargo clean + rm -f *.spkg + +.PHONY: test +test: + cargo test diff --git a/tron/README.md b/tron/README.md new file mode 100644 index 0000000..8ab7a69 --- /dev/null +++ b/tron/README.md @@ -0,0 +1,131 @@ +# Request Network TRON Substreams + +This package contains a Substreams module for indexing ERC20FeeProxy payment events on the TRON blockchain. + +## Overview + +The module indexes `TransferWithReferenceAndFee` events from the deployed ERC20FeeProxy contract: + +- **Mainnet**: `TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd` (block 79216121) + +## Prerequisites + +1. **Rust toolchain** with `wasm32-unknown-unknown` target: + + ```bash + rustup target add wasm32-unknown-unknown + ``` + +2. **Substreams CLI**: + + ```bash + brew install streamingfast/tap/substreams + ``` + +3. **bs58 crate** for Base58 encoding (included in dependencies) + +## Building + +```bash +# Build the WASM module +make build + +# Generate protobuf types +make protogen + +# Package for deployment +make package +``` + +## Running Locally + +```bash +# Run with GUI for debugging +make gui + +# Run and output to console +make run +``` + +## Deployment + +> **Note**: Substreams-Powered Subgraphs are not supported for non-EVM chains like TRON. +> Use SQL sink or direct streaming for production deployments. + +### Substreams Endpoint + +- **Mainnet (Streamingfast)**: `mainnet.tron.streamingfast.io:443` + +### Option 1: SQL Sink (PostgreSQL/ClickHouse) + +1. Install the SQL sink: + ```bash + go install github.com/streamingfast/substreams-sink-sql/cmd/substreams-sink-sql@latest + ``` + +2. Build and package: + ```bash + make package + ``` + +3. Run the sink: + ```bash + substreams-sink-sql run \ + "postgres://user:password@host:5432/database?sslmode=disable" \ + ./request-network-tron-v0.1.0.spkg \ + map_erc20_fee_proxy_payments \ + -e mainnet.tron.streamingfast.io:443 + ``` + +### Option 2: Direct Streaming + +Use the Go, Rust, or JavaScript SDKs to stream data directly to your application: + +- [Go SDK](https://github.com/streamingfast/substreams-sink) +- [Rust SDK](https://github.com/streamingfast/substreams-sink-rust) +- [JavaScript SDK](https://github.com/substreams-js/substreams-js) + +### Option 3: Files/CSV + +Export data to files for batch processing: +```bash +substreams-sink-files run \ + ./request-network-tron-v0.1.0.spkg \ + map_erc20_fee_proxy_payments \ + -e mainnet.tron.streamingfast.io:443 \ + --output-path ./output +``` + +## Module Details + +### `map_erc20_fee_proxy_payments` + +Extracts payment events from TRON blocks: + +**Input**: `sf.tron.type.v1.Block` + +**Output**: `request.tron.v1.Payments` + +**Fields extracted**: + +- `token_address` - TRC20 token contract address +- `to` - Payment recipient +- `amount` - Payment amount +- `payment_reference` - Indexed payment reference (hex) +- `fee_amount` - Fee amount +- `fee_address` - Fee recipient +- `from` - Sender address +- `block` - Block number +- `timestamp` - Block timestamp (Unix seconds) +- `tx_hash` - Transaction hash +- `contract_address` - ERC20FeeProxy contract address + +## Testing + +```bash +make test +``` + +## License + +MIT diff --git a/tron/buf.gen.yaml b/tron/buf.gen.yaml new file mode 100644 index 0000000..2b4b3f2 --- /dev/null +++ b/tron/buf.gen.yaml @@ -0,0 +1,12 @@ + +version: v1 +plugins: +- plugin: buf.build/community/neoeinstein-prost:v0.4.0 + out: src/pb + opt: + - file_descriptor_set=false + +- plugin: buf.build/community/neoeinstein-prost-crate:v0.4.1 + out: src/pb + opt: + - no_features diff --git a/tron/proto/request/tron/v1/payments.proto b/tron/proto/request/tron/v1/payments.proto new file mode 100644 index 0000000..06ab1e2 --- /dev/null +++ b/tron/proto/request/tron/v1/payments.proto @@ -0,0 +1,59 @@ +syntax = "proto3"; + +package request.tron.v1; + +// A single payment event from the ERC20FeeProxy contract +message Payment { + // The token contract address (TRC20) + string token_address = 1; + + // The recipient address + string to = 2; + + // The payment amount (as string to preserve precision) + string amount = 3; + + // The indexed payment reference (hex encoded) + string payment_reference = 4; + + // The fee amount (as string to preserve precision) + string fee_amount = 5; + + // The fee recipient address + string fee_address = 6; + + // The sender address (msg.sender) + string from = 7; + + // Block number where the event was emitted + uint64 block = 8; + + // Block timestamp (Unix timestamp in seconds) + uint64 timestamp = 9; + + // Transaction hash + string tx_hash = 10; + + // The proxy contract address that emitted the event + string contract_address = 11; + + // The blockchain network identifier (e.g., "tron", "ethereum", "polygon") + string chain = 12; + + // Energy used (TRON's equivalent of gas) + string energy_used = 13; + + // Energy fee paid in SUN (TRON's smallest unit) + string energy_fee = 14; + + // Network/Bandwidth fee paid in SUN + string net_fee = 15; + + // Log index within the transaction (for uniqueness when multiple events share the same payment_reference) + uint64 log_index = 16; +} + +// Collection of payment events +message Payments { + repeated Payment payments = 1; +} diff --git a/tron/replay.log b/tron/replay.log new file mode 100644 index 0000000..ce87d9f Binary files /dev/null and b/tron/replay.log differ diff --git a/tron/schema.graphql b/tron/schema.graphql new file mode 100644 index 0000000..c693192 --- /dev/null +++ b/tron/schema.graphql @@ -0,0 +1,43 @@ +# GraphQL schema for Request Network payments (multi-chain) +# This schema is used when deploying a Substreams-powered subgraph to The Graph Network + +type Payment @entity { + "Unique identifier: chain-txHash-paymentReference" + id: ID! + + "The blockchain network identifier (e.g., tron, ethereum, polygon)" + chain: String! + + "The token contract address (TRC20/ERC20)" + tokenAddress: String! + + "The payment recipient address" + to: String! + + "The payment amount" + amount: BigInt! + + "The indexed payment reference (keccak256 hash)" + reference: Bytes! + + "The fee amount" + feeAmount: BigInt! + + "The fee recipient address" + feeAddress: String + + "The sender address" + from: String! + + "Block number" + block: Int! + + "Block timestamp (Unix seconds)" + timestamp: Int! + + "Transaction hash" + txHash: String! + + "The ERC20FeeProxy contract address" + contractAddress: String! +} diff --git a/tron/schema.sql b/tron/schema.sql new file mode 100644 index 0000000..0c68a29 --- /dev/null +++ b/tron/schema.sql @@ -0,0 +1,32 @@ +-- Schema for Request Network ERC20FeeProxy payments (multi-chain) + +CREATE TABLE IF NOT EXISTS payments ( + id TEXT PRIMARY KEY, + chain TEXT NOT NULL, + tx_hash TEXT NOT NULL, + block_number BIGINT NOT NULL, + timestamp BIGINT NOT NULL, + contract_address TEXT NOT NULL, + token_address TEXT NOT NULL, + from_address TEXT NOT NULL, + to_address TEXT NOT NULL, + amount NUMERIC NOT NULL, + fee_amount NUMERIC NOT NULL, + fee_address TEXT NOT NULL, + payment_reference TEXT NOT NULL, + energy_used TEXT, + energy_fee TEXT, + net_fee TEXT, + log_index BIGINT NOT NULL DEFAULT 0 +); + +-- Indexes for common queries +CREATE INDEX IF NOT EXISTS idx_payments_chain ON payments(chain); +CREATE INDEX IF NOT EXISTS idx_payments_tx_hash ON payments(tx_hash); +CREATE INDEX IF NOT EXISTS idx_payments_block_number ON payments(block_number); +CREATE INDEX IF NOT EXISTS idx_payments_timestamp ON payments(timestamp); +CREATE INDEX IF NOT EXISTS idx_payments_payment_reference ON payments(payment_reference); +CREATE INDEX IF NOT EXISTS idx_payments_from_address ON payments(from_address); +CREATE INDEX IF NOT EXISTS idx_payments_to_address ON payments(to_address); +CREATE INDEX IF NOT EXISTS idx_payments_token_address ON payments(token_address); +CREATE INDEX IF NOT EXISTS idx_payments_chain_block ON payments(chain, block_number); diff --git a/tron/src/lib.rs b/tron/src/lib.rs new file mode 100644 index 0000000..d795538 --- /dev/null +++ b/tron/src/lib.rs @@ -0,0 +1,477 @@ +//! Request Network TRON Substreams Module +//! +//! This module indexes TransferWithReferenceAndFee events from the ERC20FeeProxy +//! contract deployed on TRON mainnet. + +mod pb; + +use hex; +use pb::protocol::transaction_info::Log; +use pb::protocol::TriggerSmartContract; +use pb::request::tron::v1::{Payment, Payments}; +use pb::sf::tron::r#type::v1::{Block, Transaction}; +use prost::Message; +use substreams::log; +use substreams_database_change::pb::database::{table_change::Operation, DatabaseChanges}; + +/// TransferWithReferenceAndFee event signature (keccak256 hash of event signature) +/// Event: TransferWithReferenceAndFee(address,address,uint256,bytes indexed,uint256,address) +/// keccak256("TransferWithReferenceAndFee(address,address,uint256,bytes,uint256,address)") +const TRANSFER_WITH_REF_AND_FEE_TOPIC: &str = + "9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b6"; + +/// Parses a parameter value from the params string +/// Expected format: "key=value" (one per line) +fn parse_param(params: &str, key: &str) -> String { + for line in params.lines() { + let parts: Vec<&str> = line.splitn(2, '=').collect(); + if parts.len() == 2 && parts[0].trim() == key { + return parts[1].trim().to_string(); + } + } + String::new() +} + +/// Parses proxy address from the params string +fn parse_proxy_address(params: &str) -> String { + parse_param(params, "mainnet_proxy_address") +} + +/// Parses chain identifier from the params string (defaults to "tron") +fn parse_chain(params: &str) -> String { + let chain = parse_param(params, "chain"); + if chain.is_empty() { + "tron".to_string() + } else { + chain + } +} + +/// Maps TRON blocks to extract ERC20FeeProxy payment events +#[substreams::handlers::map] +fn map_erc20_fee_proxy_payments(params: String, block: Block) -> Result { + let proxy_address = parse_proxy_address(¶ms); + let chain = parse_chain(¶ms); + + let mut payments = Vec::new(); + let block_number = block.header.as_ref().map(|h| h.number).unwrap_or(0); + let block_timestamp = (block.header.as_ref().map(|h| h.timestamp).unwrap_or(0) / 1000) as u64; // Convert from ms to seconds + + for transaction in block.transactions.iter() { + // TRON tx hashes don't have 0x prefix (unlike Ethereum) + let tx_hash = hex::encode(&transaction.txid); + + // Get the transaction info to access logs + if let Some(info) = &transaction.info { + for (log_index, log_entry) in info.log.iter().enumerate() { + // Check if this log is from our proxy contract + let contract_address = base58_encode(&log_entry.address); + + if contract_address != proxy_address { + continue; + } + + // Check if this is a TransferWithReferenceAndFee event + // The first topic should be the event signature + if log_entry.topics.is_empty() { + continue; + } + + // Validate the event signature matches TransferWithReferenceAndFee + let topic0 = hex::encode(&log_entry.topics[0]); + if topic0 != TRANSFER_WITH_REF_AND_FEE_TOPIC { + continue; + } + + // Parse the event data + if let Some(payment) = parse_transfer_with_reference_and_fee( + log_entry, + &contract_address, + &tx_hash, + block_number, + block_timestamp, + transaction, + &chain, + log_index as u64, + ) { + payments.push(payment); + } + } + } + } + + Ok(Payments { payments }) +} + +/// Converts Payments to DatabaseChanges for SQL sink +#[substreams::handlers::map] +fn db_out(payments: Payments) -> Result { + let mut database_changes = DatabaseChanges::default(); + + for payment in payments.payments { + // Create unique key from chain + tx_hash + payment_reference + log_index + let key = format!("{}:{}:{}:{}", payment.chain, payment.tx_hash, payment.payment_reference, payment.log_index); + + database_changes + .push_change("payments", &key, 0, Operation::Create) + .change("id", ("", key.as_str())) + .change("chain", ("", payment.chain.as_str())) + .change("tx_hash", ("", payment.tx_hash.as_str())) + .change("block_number", ("", payment.block.to_string().as_str())) + .change("timestamp", ("", payment.timestamp.to_string().as_str())) + .change("contract_address", ("", payment.contract_address.as_str())) + .change("token_address", ("", payment.token_address.as_str())) + .change("from_address", ("", payment.from.as_str())) + .change("to_address", ("", payment.to.as_str())) + .change("amount", ("", payment.amount.as_str())) + .change("fee_amount", ("", payment.fee_amount.as_str())) + .change("fee_address", ("", payment.fee_address.as_str())) + .change("payment_reference", ("", payment.payment_reference.as_str())) + .change("energy_used", ("", payment.energy_used.as_str())) + .change("energy_fee", ("", payment.energy_fee.as_str())) + .change("net_fee", ("", payment.net_fee.as_str())) + .change("log_index", ("", payment.log_index.to_string().as_str())); + } + + Ok(database_changes) +} + + +/// Extracts TRON resource information from the transaction +/// Returns (energy_used, energy_fee, net_fee) as strings +fn extract_resource_info(transaction: &Transaction) -> (String, String, String) { + // Get energy usage from transaction directly (available in sf.tron.type.v1.Transaction) + let tx_energy_used = transaction.energy_used; + + // Try to get receipt info from transaction.info for more detailed data + let (energy_usage_total, energy_fee, net_fee) = transaction + .info + .as_ref() + .and_then(|info| info.receipt.as_ref()) + .map(|receipt| (receipt.energy_usage_total, receipt.energy_fee, receipt.net_fee)) + .unwrap_or((tx_energy_used, 0, 0)); + + ( + energy_usage_total.to_string(), + energy_fee.to_string(), + net_fee.to_string(), + ) +} + +/// Parses a TransferWithReferenceAndFee event from a log entry +fn parse_transfer_with_reference_and_fee( + log_entry: &Log, + contract_address: &str, + tx_hash: &str, + block_number: u64, + block_timestamp: u64, + transaction: &Transaction, + chain: &str, + log_index: u64, +) -> Option { + // Event: TransferWithReferenceAndFee(address tokenAddress, address to, uint256 amount, + // bytes indexed paymentReference, uint256 feeAmount, address feeAddress) + // + // Topics: + // [0] = Event signature hash + // [1] = paymentReference (indexed) + // + // Data (non-indexed parameters, ABI encoded): + // [0-31] = tokenAddress + // [32-63] = to + // [64-95] = amount + // [96-127] = feeAmount + // [128-159] = feeAddress + + if log_entry.topics.len() < 2 { + return None; + } + + let data = &log_entry.data; + if data.len() < 160 { + log::info!("Log data too short: {} bytes", data.len()); + return None; + } + + // Extract payment reference from indexed topic (with 0x prefix to match Ethereum subgraph format) + let payment_reference = format!("0x{}", hex::encode(&log_entry.topics[1])); + + // Parse non-indexed parameters from data + let token_address = parse_address_from_data(data, 0)?; + let to = parse_address_from_data(data, 32)?; + let amount = parse_uint256_from_data(data, 64); + let fee_amount = parse_uint256_from_data(data, 96); + let fee_address = parse_address_from_data(data, 128)?; + + // Get the sender (from) address from the transaction contracts + let from = transaction + .contracts + .first() + .and_then(|c| c.parameter.as_ref()) + .map(|p| extract_owner_address(p)) + .unwrap_or_default(); + + // Extract TRON resource information (energy and bandwidth) + let (energy_used, energy_fee, net_fee) = extract_resource_info(transaction); + + Some(Payment { + token_address, + to, + amount, + payment_reference, + fee_amount, + fee_address, + from, + block: block_number, + timestamp: block_timestamp, + tx_hash: tx_hash.to_string(), + contract_address: contract_address.to_string(), + chain: chain.to_string(), + energy_used, + energy_fee, + net_fee, + log_index, + }) +} + +/// Parses an address from ABI-encoded data at the given offset +fn parse_address_from_data(data: &[u8], offset: usize) -> Option { + if data.len() < offset + 32 { + return None; + } + // Address is the last 20 bytes of the 32-byte slot + let address_bytes = &data[offset + 12..offset + 32]; + Some(base58_encode(address_bytes)) +} + +/// Parses a uint256 from ABI-encoded data at the given offset +/// Returns the value as a decimal string for TheGraph BigInt compatibility +fn parse_uint256_from_data(data: &[u8], offset: usize) -> String { + if data.len() < offset + 32 { + return "0".to_string(); + } + let bytes = &data[offset..offset + 32]; + + // Convert bytes to decimal string using big-endian interpretation + // We process the bytes manually to handle arbitrarily large numbers + let mut result = Vec::new(); + + for &byte in bytes.iter() { + // Multiply result by 256 and add the new byte + let mut carry = byte as u32; + for digit in result.iter_mut().rev() { + let val = (*digit as u32) * 256 + carry; + *digit = (val % 10) as u8; + carry = val / 10; + } + while carry > 0 { + result.insert(0, (carry % 10) as u8); + carry /= 10; + } + } + + if result.is_empty() { + "0".to_string() + } else { + result.iter().map(|d| (b'0' + d) as char).collect() + } +} + +/// Extracts the owner address from a contract parameter by decoding the +/// protobuf Any.value as a TriggerSmartContract message. +fn extract_owner_address(parameter: &prost_types::Any) -> String { + match TriggerSmartContract::decode(parameter.value.as_slice()) { + Ok(contract) => { + if contract.owner_address.is_empty() { + log::info!("TriggerSmartContract owner_address is empty"); + String::new() + } else { + base58_encode(&contract.owner_address) + } + } + Err(e) => { + log::info!("Failed to decode TriggerSmartContract: {}", e); + String::new() + } + } +} + +/// Encodes bytes to TRON Base58Check address format +fn base58_encode(bytes: &[u8]) -> String { + // TRON addresses use Base58Check encoding with 0x41 prefix for mainnet + // This is a simplified version - in production, use a proper Base58Check implementation + if bytes.len() == 20 { + // Add TRON mainnet prefix (0x41) + let mut prefixed = vec![0x41]; + prefixed.extend_from_slice(bytes); + bs58::encode(&prefixed).with_check().into_string() + } else if bytes.len() == 21 && bytes[0] == 0x41 { + bs58::encode(bytes).with_check().into_string() + } else { + bs58::encode(bytes).with_check().into_string() + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_base58_encode() { + // Test with a known TRON address + let hex_addr = hex::decode("41a614f803b6fd780986a42c78ec9c7f77e6ded13c").unwrap(); + let encoded = base58_encode(&hex_addr); + assert!(encoded.starts_with('T')); + } + + #[test] + fn test_base58_encode_20_bytes() { + // Test with 20 bytes (without prefix) - should add 0x41 prefix + let addr_bytes = hex::decode("a614f803b6fd780986a42c78ec9c7f77e6ded13c").unwrap(); + let encoded = base58_encode(&addr_bytes); + assert!(encoded.starts_with('T')); + assert_eq!(encoded.len(), 34); // TRON addresses are 34 chars + } + + #[test] + fn test_parse_proxy_address() { + let params = "mainnet_proxy_address=TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd"; + let address = parse_proxy_address(params); + assert_eq!(address, "TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd"); + } + + #[test] + fn test_parse_chain() { + let params = "mainnet_proxy_address=TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd\nchain=tron"; + let chain = parse_chain(params); + assert_eq!(chain, "tron"); + } + + #[test] + fn test_parse_chain_default() { + // When chain is not specified, should default to "tron" + let params = "mainnet_proxy_address=TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd"; + let chain = parse_chain(params); + assert_eq!(chain, "tron"); + } + + #[test] + fn test_parse_chain_ethereum() { + let params = "mainnet_proxy_address=0x123\nchain=ethereum"; + let chain = parse_chain(params); + assert_eq!(chain, "ethereum"); + } + + #[test] + fn test_parse_address_from_data() { + // ABI-encoded address: 32 bytes with address in last 20 bytes + // Address: 0xa614f803b6fd780986a42c78ec9c7f77e6ded13c + let mut data = vec![0u8; 12]; // 12 bytes padding + data.extend_from_slice(&hex::decode("a614f803b6fd780986a42c78ec9c7f77e6ded13c").unwrap()); + + let address = parse_address_from_data(&data, 0); + assert!(address.is_some()); + assert!(address.unwrap().starts_with('T')); + } + + #[test] + fn test_parse_uint256_from_data() { + // Test parsing 1000000 (0x0F4240 = 1000000 in decimal) + let mut data = vec![0u8; 32]; + data[29] = 0x0F; + data[30] = 0x42; + data[31] = 0x40; + + let amount = parse_uint256_from_data(&data, 0); + assert_eq!(amount, "1000000"); + } + + #[test] + fn test_parse_uint256_zero() { + let data = vec![0u8; 32]; + let amount = parse_uint256_from_data(&data, 0); + assert_eq!(amount, "0"); + } + + #[test] + fn test_event_signature() { + // Verify the event signature hash is correct + // keccak256("TransferWithReferenceAndFee(address,address,uint256,bytes,uint256,address)") + assert_eq!( + TRANSFER_WITH_REF_AND_FEE_TOPIC, + "9f16cbcc523c67a60c450e5ffe4f3b7b6dbe772e7abcadb2686ce029a9a0a2b6" + ); + } + + #[test] + fn test_parse_full_event_data() { + // Simulate a full TransferWithReferenceAndFee event data + // Data layout (160 bytes total): + // [0-31] = tokenAddress (padded) + // [32-63] = to (padded) + // [64-95] = amount + // [96-127] = feeAmount + // [128-159] = feeAddress (padded) + + let mut data = Vec::new(); + + // Token address (padded to 32 bytes) + data.extend_from_slice(&[0u8; 12]); + data.extend_from_slice(&hex::decode("a614f803b6fd780986a42c78ec9c7f77e6ded13c").unwrap()); + + // To address (padded to 32 bytes) + data.extend_from_slice(&[0u8; 12]); + data.extend_from_slice(&hex::decode("b614f803b6fd780986a42c78ec9c7f77e6ded13d").unwrap()); + + // Amount: 1000000 (0x0F4240) + let mut amount_bytes = vec![0u8; 32]; + amount_bytes[29] = 0x0F; + amount_bytes[30] = 0x42; + amount_bytes[31] = 0x40; + data.extend_from_slice(&amount_bytes); + + // Fee amount: 1000 (0x3E8) + let mut fee_bytes = vec![0u8; 32]; + fee_bytes[30] = 0x03; + fee_bytes[31] = 0xE8; + data.extend_from_slice(&fee_bytes); + + // Fee address (padded to 32 bytes) + data.extend_from_slice(&[0u8; 12]); + data.extend_from_slice(&hex::decode("c614f803b6fd780986a42c78ec9c7f77e6ded13e").unwrap()); + + assert_eq!(data.len(), 160); + + // Parse each field + let token = parse_address_from_data(&data, 0); + let to = parse_address_from_data(&data, 32); + let amount = parse_uint256_from_data(&data, 64); + let fee_amount = parse_uint256_from_data(&data, 96); + let fee_address = parse_address_from_data(&data, 128); + + assert!(token.is_some()); + assert!(to.is_some()); + assert!(token.unwrap().starts_with('T')); + assert!(to.unwrap().starts_with('T')); + assert!(fee_address.is_some()); + assert!(fee_address.unwrap().starts_with('T')); + + // Amounts should be decimal strings + assert_eq!(amount, "1000000"); + assert_eq!(fee_amount, "1000"); + } + + #[test] + fn test_data_too_short() { + // Test with data shorter than expected + let data = vec![0u8; 100]; // Less than 160 bytes + + // Should still parse what's available + let token = parse_address_from_data(&data, 0); + assert!(token.is_some()); + + // But fee_address at offset 128 should fail + let fee_address = parse_address_from_data(&data, 128); + assert!(fee_address.is_none()); + } +} diff --git a/tron/src/pb/.last_generated_hash b/tron/src/pb/.last_generated_hash new file mode 100644 index 0000000..92e2931 --- /dev/null +++ b/tron/src/pb/.last_generated_hash @@ -0,0 +1 @@ +6d367968da883de6895eca0adeab176fb1af788bb0609bf980c80524730864c2 \ No newline at end of file diff --git a/tron/src/pb/google.api.rs b/tron/src/pb/google.api.rs new file mode 100644 index 0000000..e6f06a8 --- /dev/null +++ b/tron/src/pb/google.api.rs @@ -0,0 +1,52 @@ +// @generated +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Http { + #[prost(message, repeated, tag="1")] + pub rules: ::prost::alloc::vec::Vec, + #[prost(bool, tag="2")] + pub fully_decode_reserved_expansion: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HttpRule { + #[prost(string, tag="1")] + pub selector: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub body: ::prost::alloc::string::String, + #[prost(string, tag="12")] + pub response_body: ::prost::alloc::string::String, + #[prost(message, repeated, tag="11")] + pub additional_bindings: ::prost::alloc::vec::Vec, + #[prost(oneof="http_rule::Pattern", tags="2, 3, 4, 5, 6, 8")] + pub pattern: ::core::option::Option, +} +/// Nested message and enum types in `HttpRule`. +pub mod http_rule { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Pattern { + #[prost(string, tag="2")] + Get(::prost::alloc::string::String), + #[prost(string, tag="3")] + Put(::prost::alloc::string::String), + #[prost(string, tag="4")] + Post(::prost::alloc::string::String), + #[prost(string, tag="5")] + Delete(::prost::alloc::string::String), + #[prost(string, tag="6")] + Patch(::prost::alloc::string::String), + #[prost(message, tag="8")] + Custom(super::CustomHttpPattern), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CustomHttpPattern { + #[prost(string, tag="1")] + pub kind: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub path: ::prost::alloc::string::String, +} +// @@protoc_insertion_point(module) diff --git a/tron/src/pb/mod.rs b/tron/src/pb/mod.rs new file mode 100644 index 0000000..2ac8733 --- /dev/null +++ b/tron/src/pb/mod.rs @@ -0,0 +1,47 @@ +// @generated +pub mod google { + // @@protoc_insertion_point(attribute:google.api) + pub mod api { + include!("google.api.rs"); + // @@protoc_insertion_point(google.api) + } +} +// @@protoc_insertion_point(attribute:protocol) +pub mod protocol { + include!("protocol.rs"); + // @@protoc_insertion_point(protocol) +} +pub mod request { + pub mod tron { + // @@protoc_insertion_point(attribute:request.tron.v1) + pub mod v1 { + include!("request.tron.v1.rs"); + // @@protoc_insertion_point(request.tron.v1) + } + } +} +pub mod sf { + pub mod substreams { + pub mod tron { + // @@protoc_insertion_point(attribute:sf.substreams.tron.v1) + pub mod v1 { + include!("sf.substreams.tron.v1.rs"); + // @@protoc_insertion_point(sf.substreams.tron.v1) + } + } + // @@protoc_insertion_point(attribute:sf.substreams.v1) + pub mod v1 { + include!("sf.substreams.v1.rs"); + // @@protoc_insertion_point(sf.substreams.v1) + } + } + pub mod tron { + pub mod r#type { + // @@protoc_insertion_point(attribute:sf.tron.type.v1) + pub mod v1 { + include!("sf.tron.type.v1.rs"); + // @@protoc_insertion_point(sf.tron.type.v1) + } + } + } +} diff --git a/tron/src/pb/protocol.rs b/tron/src/pb/protocol.rs new file mode 100644 index 0000000..2525ef0 --- /dev/null +++ b/tron/src/pb/protocol.rs @@ -0,0 +1,3829 @@ +// @generated +// This file is @generated by prost-build. +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ResourceCode { + Bandwidth = 0, + Energy = 1, + TronPower = 2, +} +impl ResourceCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResourceCode::Bandwidth => "BANDWIDTH", + ResourceCode::Energy => "ENERGY", + ResourceCode::TronPower => "TRON_POWER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BANDWIDTH" => Some(Self::Bandwidth), + "ENERGY" => Some(Self::Energy), + "TRON_POWER" => Some(Self::TronPower), + _ => None, + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Endpoint { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub port: i32, + #[prost(bytes="vec", tag="3")] + pub node_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PingMessage { + #[prost(message, optional, tag="1")] + pub from: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub to: ::core::option::Option, + #[prost(int32, tag="3")] + pub version: i32, + #[prost(int64, tag="4")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PongMessage { + #[prost(message, optional, tag="1")] + pub from: ::core::option::Option, + #[prost(int32, tag="2")] + pub echo: i32, + #[prost(int64, tag="3")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FindNeighbours { + #[prost(message, optional, tag="1")] + pub from: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub target_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Neighbours { + #[prost(message, optional, tag="1")] + pub from: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub neighbours: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct BackupMessage { + #[prost(bool, tag="1")] + pub flag: bool, + #[prost(int32, tag="2")] + pub priority: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountId { + #[prost(bytes="vec", tag="1")] + pub name: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Vote { + #[prost(bytes="vec", tag="1")] + pub vote_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub vote_count: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Proposal { + #[prost(int64, tag="1")] + pub proposal_id: i64, + #[prost(bytes="vec", tag="2")] + pub proposer_address: ::prost::alloc::vec::Vec, + #[prost(map="int64, int64", tag="3")] + pub parameters: ::std::collections::HashMap, + #[prost(int64, tag="4")] + pub expiration_time: i64, + #[prost(int64, tag="5")] + pub create_time: i64, + #[prost(bytes="vec", repeated, tag="6")] + pub approvals: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(enumeration="proposal::State", tag="7")] + pub state: i32, +} +/// Nested message and enum types in `Proposal`. +pub mod proposal { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum State { + Pending = 0, + Disapproved = 1, + Approved = 2, + Canceled = 3, + } + impl State { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + State::Pending => "PENDING", + State::Disapproved => "DISAPPROVED", + State::Approved => "APPROVED", + State::Canceled => "CANCELED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "PENDING" => Some(Self::Pending), + "DISAPPROVED" => Some(Self::Disapproved), + "APPROVED" => Some(Self::Approved), + "CANCELED" => Some(Self::Canceled), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Exchange { + #[prost(int64, tag="1")] + pub exchange_id: i64, + #[prost(bytes="vec", tag="2")] + pub creator_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub create_time: i64, + #[prost(bytes="vec", tag="6")] + pub first_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="7")] + pub first_token_balance: i64, + #[prost(bytes="vec", tag="8")] + pub second_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="9")] + pub second_token_balance: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrder { + #[prost(bytes="vec", tag="1")] + pub order_id: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub create_time: i64, + #[prost(bytes="vec", tag="4")] + pub sell_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub sell_token_quantity: i64, + #[prost(bytes="vec", tag="6")] + pub buy_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="7")] + pub buy_token_quantity: i64, + #[prost(int64, tag="9")] + pub sell_token_quantity_remain: i64, + #[prost(int64, tag="10")] + pub sell_token_quantity_return: i64, + #[prost(enumeration="market_order::State", tag="11")] + pub state: i32, + #[prost(bytes="vec", tag="12")] + pub prev: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="13")] + pub next: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `MarketOrder`. +pub mod market_order { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum State { + Active = 0, + Inactive = 1, + Canceled = 2, + } + impl State { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + State::Active => "ACTIVE", + State::Inactive => "INACTIVE", + State::Canceled => "CANCELED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ACTIVE" => Some(Self::Active), + "INACTIVE" => Some(Self::Inactive), + "CANCELED" => Some(Self::Canceled), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrderList { + #[prost(message, repeated, tag="1")] + pub orders: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrderPairList { + #[prost(message, repeated, tag="1")] + pub order_pair: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrderPair { + #[prost(bytes="vec", tag="1")] + pub sell_token_id: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub buy_token_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketAccountOrder { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub orders: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(int64, tag="3")] + pub count: i64, + #[prost(int64, tag="4")] + pub total_count: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct MarketPrice { + #[prost(int64, tag="1")] + pub sell_token_quantity: i64, + #[prost(int64, tag="2")] + pub buy_token_quantity: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketPriceList { + #[prost(bytes="vec", tag="1")] + pub sell_token_id: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub buy_token_id: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub prices: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrderIdList { + #[prost(bytes="vec", tag="1")] + pub head: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub tail: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChainParameters { + #[prost(message, repeated, tag="1")] + pub chain_parameter: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `ChainParameters`. +pub mod chain_parameters { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct ChainParameter { + #[prost(string, tag="1")] + pub key: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub value: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Account { + #[prost(bytes="vec", tag="1")] + pub account_name: ::prost::alloc::vec::Vec, + #[prost(enumeration="AccountType", tag="2")] + pub r#type: i32, + #[prost(bytes="vec", tag="3")] + pub address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub balance: i64, + #[prost(message, repeated, tag="5")] + pub votes: ::prost::alloc::vec::Vec, + #[prost(map="string, int64", tag="6")] + pub asset: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(map="string, int64", tag="56")] + pub asset_v2: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(message, repeated, tag="7")] + pub frozen: ::prost::alloc::vec::Vec, + #[prost(int64, tag="8")] + pub net_usage: i64, + #[prost(int64, tag="41")] + pub acquired_delegated_frozen_balance_for_bandwidth: i64, + #[prost(int64, tag="42")] + pub delegated_frozen_balance_for_bandwidth: i64, + #[prost(int64, tag="46")] + pub old_tron_power: i64, + #[prost(message, optional, tag="47")] + pub tron_power: ::core::option::Option, + #[prost(bool, tag="60")] + pub asset_optimized: bool, + #[prost(int64, tag="9")] + pub create_time: i64, + #[prost(int64, tag="10")] + pub latest_opration_time: i64, + #[prost(int64, tag="11")] + pub allowance: i64, + #[prost(int64, tag="12")] + pub latest_withdraw_time: i64, + #[prost(bytes="vec", tag="13")] + pub code: ::prost::alloc::vec::Vec, + #[prost(bool, tag="14")] + pub is_witness: bool, + #[prost(bool, tag="15")] + pub is_committee: bool, + #[prost(message, repeated, tag="16")] + pub frozen_supply: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="17")] + pub asset_issued_name: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="57")] + pub asset_issued_id: ::prost::alloc::vec::Vec, + #[prost(map="string, int64", tag="18")] + pub latest_asset_operation_time: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(map="string, int64", tag="58")] + pub latest_asset_operation_time_v2: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(int64, tag="19")] + pub free_net_usage: i64, + #[prost(map="string, int64", tag="20")] + pub free_asset_net_usage: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(map="string, int64", tag="59")] + pub free_asset_net_usage_v2: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(int64, tag="21")] + pub latest_consume_time: i64, + #[prost(int64, tag="22")] + pub latest_consume_free_time: i64, + #[prost(bytes="vec", tag="23")] + pub account_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="24")] + pub net_window_size: i64, + #[prost(bool, tag="25")] + pub net_window_optimized: bool, + #[prost(message, optional, tag="26")] + pub account_resource: ::core::option::Option, + #[prost(bytes="vec", tag="30")] + pub code_hash: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="31")] + pub owner_permission: ::core::option::Option, + #[prost(message, optional, tag="32")] + pub witness_permission: ::core::option::Option, + #[prost(message, repeated, tag="33")] + pub active_permission: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="34")] + pub frozen_v2: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="35")] + pub unfrozen_v2: ::prost::alloc::vec::Vec, + #[prost(int64, tag="36")] + pub delegated_frozen_v2_balance_for_bandwidth: i64, + #[prost(int64, tag="37")] + pub acquired_delegated_frozen_v2_balance_for_bandwidth: i64, +} +/// Nested message and enum types in `Account`. +pub mod account { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct Frozen { + #[prost(int64, tag="1")] + pub frozen_balance: i64, + #[prost(int64, tag="2")] + pub expire_time: i64, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct AccountResource { + #[prost(int64, tag="1")] + pub energy_usage: i64, + #[prost(message, optional, tag="2")] + pub frozen_balance_for_energy: ::core::option::Option, + #[prost(int64, tag="3")] + pub latest_consume_time_for_energy: i64, + #[prost(int64, tag="4")] + pub acquired_delegated_frozen_balance_for_energy: i64, + #[prost(int64, tag="5")] + pub delegated_frozen_balance_for_energy: i64, + #[prost(int64, tag="6")] + pub storage_limit: i64, + #[prost(int64, tag="7")] + pub storage_usage: i64, + #[prost(int64, tag="8")] + pub latest_exchange_storage_time: i64, + #[prost(int64, tag="9")] + pub energy_window_size: i64, + #[prost(int64, tag="10")] + pub delegated_frozen_v2_balance_for_energy: i64, + #[prost(int64, tag="11")] + pub acquired_delegated_frozen_v2_balance_for_energy: i64, + #[prost(bool, tag="12")] + pub energy_window_optimized: bool, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct FreezeV2 { + #[prost(enumeration="super::ResourceCode", tag="1")] + pub r#type: i32, + #[prost(int64, tag="2")] + pub amount: i64, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct UnFreezeV2 { + #[prost(enumeration="super::ResourceCode", tag="1")] + pub r#type: i32, + #[prost(int64, tag="3")] + pub unfreeze_amount: i64, + #[prost(int64, tag="4")] + pub unfreeze_expire_time: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Key { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub weight: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatedResource { + #[prost(bytes="vec", tag="1")] + pub from: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub to: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub frozen_balance_for_bandwidth: i64, + #[prost(int64, tag="4")] + pub frozen_balance_for_energy: i64, + #[prost(int64, tag="5")] + pub expire_time_for_bandwidth: i64, + #[prost(int64, tag="6")] + pub expire_time_for_energy: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Authority { + #[prost(message, optional, tag="1")] + pub account: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub permission_name: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Permission { + #[prost(enumeration="permission::PermissionType", tag="1")] + pub r#type: i32, + #[prost(int32, tag="2")] + pub id: i32, + #[prost(string, tag="3")] + pub permission_name: ::prost::alloc::string::String, + #[prost(int64, tag="4")] + pub threshold: i64, + #[prost(int32, tag="5")] + pub parent_id: i32, + #[prost(bytes="vec", tag="6")] + pub operations: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub keys: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Permission`. +pub mod permission { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum PermissionType { + Owner = 0, + Witness = 1, + Active = 2, + } + impl PermissionType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + PermissionType::Owner => "Owner", + PermissionType::Witness => "Witness", + PermissionType::Active => "Active", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Owner" => Some(Self::Owner), + "Witness" => Some(Self::Witness), + "Active" => Some(Self::Active), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Witness { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub vote_count: i64, + #[prost(bytes="vec", tag="3")] + pub pub_key: ::prost::alloc::vec::Vec, + #[prost(string, tag="4")] + pub url: ::prost::alloc::string::String, + #[prost(int64, tag="5")] + pub total_produced: i64, + #[prost(int64, tag="6")] + pub total_missed: i64, + #[prost(int64, tag="7")] + pub latest_block_num: i64, + #[prost(int64, tag="8")] + pub latest_slot_num: i64, + #[prost(bool, tag="9")] + pub is_jobs: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Votes { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub old_votes: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub new_votes: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxOutput { + #[prost(int64, tag="1")] + pub value: i64, + #[prost(bytes="vec", tag="2")] + pub pub_key_hash: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxInput { + #[prost(message, optional, tag="1")] + pub raw_data: ::core::option::Option, + #[prost(bytes="vec", tag="4")] + pub signature: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `TXInput`. +pub mod tx_input { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Raw { + #[prost(bytes="vec", tag="1")] + pub tx_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub vout: i64, + #[prost(bytes="vec", tag="3")] + pub pub_key: ::prost::alloc::vec::Vec, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxOutputs { + #[prost(message, repeated, tag="1")] + pub outputs: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ResourceReceipt { + #[prost(int64, tag="1")] + pub energy_usage: i64, + #[prost(int64, tag="2")] + pub energy_fee: i64, + #[prost(int64, tag="3")] + pub origin_energy_usage: i64, + #[prost(int64, tag="4")] + pub energy_usage_total: i64, + #[prost(int64, tag="5")] + pub net_usage: i64, + #[prost(int64, tag="6")] + pub net_fee: i64, + #[prost(enumeration="transaction::result::ContractResult", tag="7")] + pub result: i32, + #[prost(int64, tag="8")] + pub energy_penalty_total: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketOrderDetail { + #[prost(bytes="vec", tag="1")] + pub maker_order_id: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub taker_order_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub fill_sell_quantity: i64, + #[prost(int64, tag="4")] + pub fill_buy_quantity: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transaction { + #[prost(message, optional, tag="1")] + pub raw_data: ::core::option::Option, + #[prost(bytes="vec", repeated, tag="2")] + pub signature: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(message, repeated, tag="5")] + pub ret: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Transaction`. +pub mod transaction { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Contract { + #[prost(enumeration="contract::ContractType", tag="1")] + pub r#type: i32, + #[prost(message, optional, tag="2")] + pub parameter: ::core::option::Option<::prost_types::Any>, + #[prost(bytes="vec", tag="3")] + pub provider: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub contract_name: ::prost::alloc::vec::Vec, + #[prost(int32, tag="5")] + pub permission_id: i32, + } + /// Nested message and enum types in `Contract`. + pub mod contract { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ContractType { + AccountCreateContract = 0, + TransferContract = 1, + TransferAssetContract = 2, + VoteAssetContract = 3, + VoteWitnessContract = 4, + WitnessCreateContract = 5, + AssetIssueContract = 6, + WitnessUpdateContract = 8, + ParticipateAssetIssueContract = 9, + AccountUpdateContract = 10, + FreezeBalanceContract = 11, + UnfreezeBalanceContract = 12, + WithdrawBalanceContract = 13, + UnfreezeAssetContract = 14, + UpdateAssetContract = 15, + ProposalCreateContract = 16, + ProposalApproveContract = 17, + ProposalDeleteContract = 18, + SetAccountIdContract = 19, + CustomContract = 20, + CreateSmartContract = 30, + TriggerSmartContract = 31, + GetContract = 32, + UpdateSettingContract = 33, + ExchangeCreateContract = 41, + ExchangeInjectContract = 42, + ExchangeWithdrawContract = 43, + ExchangeTransactionContract = 44, + UpdateEnergyLimitContract = 45, + AccountPermissionUpdateContract = 46, + ClearAbiContract = 48, + UpdateBrokerageContract = 49, + ShieldedTransferContract = 51, + MarketSellAssetContract = 52, + MarketCancelOrderContract = 53, + FreezeBalanceV2Contract = 54, + UnfreezeBalanceV2Contract = 55, + WithdrawExpireUnfreezeContract = 56, + DelegateResourceContract = 57, + UnDelegateResourceContract = 58, + CancelAllUnfreezeV2Contract = 59, + } + impl ContractType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ContractType::AccountCreateContract => "AccountCreateContract", + ContractType::TransferContract => "TransferContract", + ContractType::TransferAssetContract => "TransferAssetContract", + ContractType::VoteAssetContract => "VoteAssetContract", + ContractType::VoteWitnessContract => "VoteWitnessContract", + ContractType::WitnessCreateContract => "WitnessCreateContract", + ContractType::AssetIssueContract => "AssetIssueContract", + ContractType::WitnessUpdateContract => "WitnessUpdateContract", + ContractType::ParticipateAssetIssueContract => "ParticipateAssetIssueContract", + ContractType::AccountUpdateContract => "AccountUpdateContract", + ContractType::FreezeBalanceContract => "FreezeBalanceContract", + ContractType::UnfreezeBalanceContract => "UnfreezeBalanceContract", + ContractType::WithdrawBalanceContract => "WithdrawBalanceContract", + ContractType::UnfreezeAssetContract => "UnfreezeAssetContract", + ContractType::UpdateAssetContract => "UpdateAssetContract", + ContractType::ProposalCreateContract => "ProposalCreateContract", + ContractType::ProposalApproveContract => "ProposalApproveContract", + ContractType::ProposalDeleteContract => "ProposalDeleteContract", + ContractType::SetAccountIdContract => "SetAccountIdContract", + ContractType::CustomContract => "CustomContract", + ContractType::CreateSmartContract => "CreateSmartContract", + ContractType::TriggerSmartContract => "TriggerSmartContract", + ContractType::GetContract => "GetContract", + ContractType::UpdateSettingContract => "UpdateSettingContract", + ContractType::ExchangeCreateContract => "ExchangeCreateContract", + ContractType::ExchangeInjectContract => "ExchangeInjectContract", + ContractType::ExchangeWithdrawContract => "ExchangeWithdrawContract", + ContractType::ExchangeTransactionContract => "ExchangeTransactionContract", + ContractType::UpdateEnergyLimitContract => "UpdateEnergyLimitContract", + ContractType::AccountPermissionUpdateContract => "AccountPermissionUpdateContract", + ContractType::ClearAbiContract => "ClearABIContract", + ContractType::UpdateBrokerageContract => "UpdateBrokerageContract", + ContractType::ShieldedTransferContract => "ShieldedTransferContract", + ContractType::MarketSellAssetContract => "MarketSellAssetContract", + ContractType::MarketCancelOrderContract => "MarketCancelOrderContract", + ContractType::FreezeBalanceV2Contract => "FreezeBalanceV2Contract", + ContractType::UnfreezeBalanceV2Contract => "UnfreezeBalanceV2Contract", + ContractType::WithdrawExpireUnfreezeContract => "WithdrawExpireUnfreezeContract", + ContractType::DelegateResourceContract => "DelegateResourceContract", + ContractType::UnDelegateResourceContract => "UnDelegateResourceContract", + ContractType::CancelAllUnfreezeV2Contract => "CancelAllUnfreezeV2Contract", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "AccountCreateContract" => Some(Self::AccountCreateContract), + "TransferContract" => Some(Self::TransferContract), + "TransferAssetContract" => Some(Self::TransferAssetContract), + "VoteAssetContract" => Some(Self::VoteAssetContract), + "VoteWitnessContract" => Some(Self::VoteWitnessContract), + "WitnessCreateContract" => Some(Self::WitnessCreateContract), + "AssetIssueContract" => Some(Self::AssetIssueContract), + "WitnessUpdateContract" => Some(Self::WitnessUpdateContract), + "ParticipateAssetIssueContract" => Some(Self::ParticipateAssetIssueContract), + "AccountUpdateContract" => Some(Self::AccountUpdateContract), + "FreezeBalanceContract" => Some(Self::FreezeBalanceContract), + "UnfreezeBalanceContract" => Some(Self::UnfreezeBalanceContract), + "WithdrawBalanceContract" => Some(Self::WithdrawBalanceContract), + "UnfreezeAssetContract" => Some(Self::UnfreezeAssetContract), + "UpdateAssetContract" => Some(Self::UpdateAssetContract), + "ProposalCreateContract" => Some(Self::ProposalCreateContract), + "ProposalApproveContract" => Some(Self::ProposalApproveContract), + "ProposalDeleteContract" => Some(Self::ProposalDeleteContract), + "SetAccountIdContract" => Some(Self::SetAccountIdContract), + "CustomContract" => Some(Self::CustomContract), + "CreateSmartContract" => Some(Self::CreateSmartContract), + "TriggerSmartContract" => Some(Self::TriggerSmartContract), + "GetContract" => Some(Self::GetContract), + "UpdateSettingContract" => Some(Self::UpdateSettingContract), + "ExchangeCreateContract" => Some(Self::ExchangeCreateContract), + "ExchangeInjectContract" => Some(Self::ExchangeInjectContract), + "ExchangeWithdrawContract" => Some(Self::ExchangeWithdrawContract), + "ExchangeTransactionContract" => Some(Self::ExchangeTransactionContract), + "UpdateEnergyLimitContract" => Some(Self::UpdateEnergyLimitContract), + "AccountPermissionUpdateContract" => Some(Self::AccountPermissionUpdateContract), + "ClearABIContract" => Some(Self::ClearAbiContract), + "UpdateBrokerageContract" => Some(Self::UpdateBrokerageContract), + "ShieldedTransferContract" => Some(Self::ShieldedTransferContract), + "MarketSellAssetContract" => Some(Self::MarketSellAssetContract), + "MarketCancelOrderContract" => Some(Self::MarketCancelOrderContract), + "FreezeBalanceV2Contract" => Some(Self::FreezeBalanceV2Contract), + "UnfreezeBalanceV2Contract" => Some(Self::UnfreezeBalanceV2Contract), + "WithdrawExpireUnfreezeContract" => Some(Self::WithdrawExpireUnfreezeContract), + "DelegateResourceContract" => Some(Self::DelegateResourceContract), + "UnDelegateResourceContract" => Some(Self::UnDelegateResourceContract), + "CancelAllUnfreezeV2Contract" => Some(Self::CancelAllUnfreezeV2Contract), + _ => None, + } + } + } + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Result { + #[prost(int64, tag="1")] + pub fee: i64, + #[prost(enumeration="result::Code", tag="2")] + pub ret: i32, + #[prost(enumeration="result::ContractResult", tag="3")] + pub contract_ret: i32, + #[prost(string, tag="14")] + pub asset_issue_id: ::prost::alloc::string::String, + #[prost(int64, tag="15")] + pub withdraw_amount: i64, + #[prost(int64, tag="16")] + pub unfreeze_amount: i64, + #[prost(int64, tag="18")] + pub exchange_received_amount: i64, + #[prost(int64, tag="19")] + pub exchange_inject_another_amount: i64, + #[prost(int64, tag="20")] + pub exchange_withdraw_another_amount: i64, + #[prost(int64, tag="21")] + pub exchange_id: i64, + #[prost(int64, tag="22")] + pub shielded_transaction_fee: i64, + #[prost(bytes="vec", tag="25")] + pub order_id: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="26")] + pub order_details: ::prost::alloc::vec::Vec, + #[prost(int64, tag="27")] + pub withdraw_expire_amount: i64, + #[prost(map="string, int64", tag="28")] + pub cancel_unfreeze_v2_amount: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + } + /// Nested message and enum types in `Result`. + pub mod result { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Code { + Sucess = 0, + Failed = 1, + } + impl Code { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Code::Sucess => "SUCESS", + Code::Failed => "FAILED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCESS" => Some(Self::Sucess), + "FAILED" => Some(Self::Failed), + _ => None, + } + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ContractResult { + Default = 0, + Success = 1, + Revert = 2, + BadJumpDestination = 3, + OutOfMemory = 4, + PrecompiledContract = 5, + StackTooSmall = 6, + StackTooLarge = 7, + IllegalOperation = 8, + StackOverflow = 9, + OutOfEnergy = 10, + OutOfTime = 11, + JvmStackOverFlow = 12, + Unknown = 13, + TransferFailed = 14, + InvalidCode = 15, + } + impl ContractResult { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ContractResult::Default => "DEFAULT", + ContractResult::Success => "SUCCESS", + ContractResult::Revert => "REVERT", + ContractResult::BadJumpDestination => "BAD_JUMP_DESTINATION", + ContractResult::OutOfMemory => "OUT_OF_MEMORY", + ContractResult::PrecompiledContract => "PRECOMPILED_CONTRACT", + ContractResult::StackTooSmall => "STACK_TOO_SMALL", + ContractResult::StackTooLarge => "STACK_TOO_LARGE", + ContractResult::IllegalOperation => "ILLEGAL_OPERATION", + ContractResult::StackOverflow => "STACK_OVERFLOW", + ContractResult::OutOfEnergy => "OUT_OF_ENERGY", + ContractResult::OutOfTime => "OUT_OF_TIME", + ContractResult::JvmStackOverFlow => "JVM_STACK_OVER_FLOW", + ContractResult::Unknown => "UNKNOWN", + ContractResult::TransferFailed => "TRANSFER_FAILED", + ContractResult::InvalidCode => "INVALID_CODE", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "DEFAULT" => Some(Self::Default), + "SUCCESS" => Some(Self::Success), + "REVERT" => Some(Self::Revert), + "BAD_JUMP_DESTINATION" => Some(Self::BadJumpDestination), + "OUT_OF_MEMORY" => Some(Self::OutOfMemory), + "PRECOMPILED_CONTRACT" => Some(Self::PrecompiledContract), + "STACK_TOO_SMALL" => Some(Self::StackTooSmall), + "STACK_TOO_LARGE" => Some(Self::StackTooLarge), + "ILLEGAL_OPERATION" => Some(Self::IllegalOperation), + "STACK_OVERFLOW" => Some(Self::StackOverflow), + "OUT_OF_ENERGY" => Some(Self::OutOfEnergy), + "OUT_OF_TIME" => Some(Self::OutOfTime), + "JVM_STACK_OVER_FLOW" => Some(Self::JvmStackOverFlow), + "UNKNOWN" => Some(Self::Unknown), + "TRANSFER_FAILED" => Some(Self::TransferFailed), + "INVALID_CODE" => Some(Self::InvalidCode), + _ => None, + } + } + } + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Raw { + #[prost(bytes="vec", tag="1")] + pub ref_block_bytes: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub ref_block_num: i64, + #[prost(bytes="vec", tag="4")] + pub ref_block_hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="8")] + pub expiration: i64, + #[prost(message, repeated, tag="9")] + pub auths: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="10")] + pub data: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="11")] + pub contract: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="12")] + pub scripts: ::prost::alloc::vec::Vec, + #[prost(int64, tag="14")] + pub timestamp: i64, + #[prost(int64, tag="18")] + pub fee_limit: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionInfo { + #[prost(bytes="vec", tag="1")] + pub id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub fee: i64, + #[prost(int64, tag="3")] + pub block_number: i64, + #[prost(int64, tag="4")] + pub block_time_stamp: i64, + #[prost(bytes="vec", repeated, tag="5")] + pub contract_result: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bytes="vec", tag="6")] + pub contract_address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="7")] + pub receipt: ::core::option::Option, + #[prost(message, repeated, tag="8")] + pub log: ::prost::alloc::vec::Vec, + #[prost(enumeration="transaction_info::Code", tag="9")] + pub result: i32, + #[prost(bytes="vec", tag="10")] + pub res_message: ::prost::alloc::vec::Vec, + #[prost(string, tag="14")] + pub asset_issue_id: ::prost::alloc::string::String, + #[prost(int64, tag="15")] + pub withdraw_amount: i64, + #[prost(int64, tag="16")] + pub unfreeze_amount: i64, + #[prost(message, repeated, tag="17")] + pub internal_transactions: ::prost::alloc::vec::Vec, + #[prost(int64, tag="18")] + pub exchange_received_amount: i64, + #[prost(int64, tag="19")] + pub exchange_inject_another_amount: i64, + #[prost(int64, tag="20")] + pub exchange_withdraw_another_amount: i64, + #[prost(int64, tag="21")] + pub exchange_id: i64, + #[prost(int64, tag="22")] + pub shielded_transaction_fee: i64, + #[prost(bytes="vec", tag="25")] + pub order_id: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="26")] + pub order_details: ::prost::alloc::vec::Vec, + #[prost(int64, tag="27")] + pub packing_fee: i64, + #[prost(int64, tag="28")] + pub withdraw_expire_amount: i64, + #[prost(map="string, int64", tag="29")] + pub cancel_unfreeze_v2_amount: ::std::collections::HashMap<::prost::alloc::string::String, i64>, +} +/// Nested message and enum types in `TransactionInfo`. +pub mod transaction_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Log { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub topics: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bytes="vec", tag="3")] + pub data: ::prost::alloc::vec::Vec, + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Code { + Sucess = 0, + Failed = 1, + } + impl Code { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Code::Sucess => "SUCESS", + Code::Failed => "FAILED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCESS" => Some(Self::Sucess), + "FAILED" => Some(Self::Failed), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionRet { + #[prost(int64, tag="1")] + pub block_number: i64, + #[prost(int64, tag="2")] + pub block_time_stamp: i64, + #[prost(message, repeated, tag="3")] + pub transactioninfo: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transactions { + #[prost(message, repeated, tag="1")] + pub transactions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockHeader { + #[prost(message, optional, tag="1")] + pub raw_data: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub witness_signature: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `BlockHeader`. +pub mod block_header { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Raw { + #[prost(int64, tag="1")] + pub timestamp: i64, + #[prost(bytes="vec", tag="2")] + pub tx_trie_root: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub parent_hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="7")] + pub number: i64, + #[prost(int64, tag="8")] + pub witness_id: i64, + #[prost(bytes="vec", tag="9")] + pub witness_address: ::prost::alloc::vec::Vec, + #[prost(int32, tag="10")] + pub version: i32, + #[prost(bytes="vec", tag="11")] + pub account_state_root: ::prost::alloc::vec::Vec, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + #[prost(message, repeated, tag="1")] + pub transactions: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub block_header: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChainInventory { + #[prost(message, repeated, tag="1")] + pub ids: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub remain_num: i64, +} +/// Nested message and enum types in `ChainInventory`. +pub mod chain_inventory { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct BlockId { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub number: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockInventory { + #[prost(message, repeated, tag="1")] + pub ids: ::prost::alloc::vec::Vec, + #[prost(enumeration="block_inventory::Type", tag="2")] + pub r#type: i32, +} +/// Nested message and enum types in `BlockInventory`. +pub mod block_inventory { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct BlockId { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub number: i64, + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Type { + Sync = 0, + Advtise = 1, + Fetch = 2, + } + impl Type { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Type::Sync => "SYNC", + Type::Advtise => "ADVTISE", + Type::Fetch => "FETCH", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SYNC" => Some(Self::Sync), + "ADVTISE" => Some(Self::Advtise), + "FETCH" => Some(Self::Fetch), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Inventory { + #[prost(enumeration="inventory::InventoryType", tag="1")] + pub r#type: i32, + #[prost(bytes="vec", repeated, tag="2")] + pub ids: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +/// Nested message and enum types in `Inventory`. +pub mod inventory { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum InventoryType { + Trx = 0, + Block = 1, + } + impl InventoryType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + InventoryType::Trx => "TRX", + InventoryType::Block => "BLOCK", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TRX" => Some(Self::Trx), + "BLOCK" => Some(Self::Block), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Items { + #[prost(enumeration="items::ItemType", tag="1")] + pub r#type: i32, + #[prost(message, repeated, tag="2")] + pub blocks: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="3")] + pub block_headers: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub transactions: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Items`. +pub mod items { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ItemType { + Err = 0, + Trx = 1, + Block = 2, + Blockheader = 3, + } + impl ItemType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ItemType::Err => "ERR", + ItemType::Trx => "TRX", + ItemType::Block => "BLOCK", + ItemType::Blockheader => "BLOCKHEADER", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ERR" => Some(Self::Err), + "TRX" => Some(Self::Trx), + "BLOCK" => Some(Self::Block), + "BLOCKHEADER" => Some(Self::Blockheader), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct DynamicProperties { + #[prost(int64, tag="1")] + pub last_solidity_block_num: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct DisconnectMessage { + #[prost(enumeration="ReasonCode", tag="1")] + pub reason: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HelloMessage { + #[prost(message, optional, tag="1")] + pub from: ::core::option::Option, + #[prost(int32, tag="2")] + pub version: i32, + #[prost(int64, tag="3")] + pub timestamp: i64, + #[prost(message, optional, tag="4")] + pub genesis_block_id: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub solid_block_id: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub head_block_id: ::core::option::Option, + #[prost(bytes="vec", tag="7")] + pub address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="8")] + pub signature: ::prost::alloc::vec::Vec, + #[prost(int32, tag="9")] + pub node_type: i32, + #[prost(int64, tag="10")] + pub lowest_block_num: i64, + #[prost(bytes="vec", tag="11")] + pub code_version: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `HelloMessage`. +pub mod hello_message { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct BlockId { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub number: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InternalTransaction { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub caller_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub transfer_to_address: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub call_value_info: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub note: ::prost::alloc::vec::Vec, + #[prost(bool, tag="6")] + pub rejected: bool, + #[prost(string, tag="7")] + pub extra: ::prost::alloc::string::String, +} +/// Nested message and enum types in `InternalTransaction`. +pub mod internal_transaction { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct CallValueInfo { + #[prost(int64, tag="1")] + pub call_value: i64, + #[prost(string, tag="2")] + pub token_id: ::prost::alloc::string::String, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatedResourceAccountIndex { + #[prost(bytes="vec", tag="1")] + pub account: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub from_accounts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bytes="vec", repeated, tag="3")] + pub to_accounts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(int64, tag="4")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NodeInfo { + #[prost(int64, tag="1")] + pub begin_sync_num: i64, + #[prost(string, tag="2")] + pub block: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub solidity_block: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub current_connect_count: i32, + #[prost(int32, tag="5")] + pub active_connect_count: i32, + #[prost(int32, tag="6")] + pub passive_connect_count: i32, + #[prost(int64, tag="7")] + pub total_flow: i64, + #[prost(message, repeated, tag="8")] + pub peer_info_list: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="9")] + pub config_node_info: ::core::option::Option, + #[prost(message, optional, tag="10")] + pub machine_info: ::core::option::Option, + #[prost(map="string, string", tag="11")] + pub cheat_witness_info_map: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, +} +/// Nested message and enum types in `NodeInfo`. +pub mod node_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct PeerInfo { + #[prost(string, tag="1")] + pub last_sync_block: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub remain_num: i64, + #[prost(int64, tag="3")] + pub last_block_update_time: i64, + #[prost(bool, tag="4")] + pub sync_flag: bool, + #[prost(int64, tag="5")] + pub head_block_time_we_both_have: i64, + #[prost(bool, tag="6")] + pub need_sync_from_peer: bool, + #[prost(bool, tag="7")] + pub need_sync_from_us: bool, + #[prost(string, tag="8")] + pub host: ::prost::alloc::string::String, + #[prost(int32, tag="9")] + pub port: i32, + #[prost(string, tag="10")] + pub node_id: ::prost::alloc::string::String, + #[prost(int64, tag="11")] + pub connect_time: i64, + #[prost(double, tag="12")] + pub avg_latency: f64, + #[prost(int32, tag="13")] + pub sync_to_fetch_size: i32, + #[prost(int64, tag="14")] + pub sync_to_fetch_size_peek_num: i64, + #[prost(int32, tag="15")] + pub sync_block_requested_size: i32, + #[prost(int64, tag="16")] + pub un_fetch_syn_num: i64, + #[prost(int32, tag="17")] + pub block_in_porc_size: i32, + #[prost(string, tag="18")] + pub head_block_we_both_have: ::prost::alloc::string::String, + #[prost(bool, tag="19")] + pub is_active: bool, + #[prost(int32, tag="20")] + pub score: i32, + #[prost(int32, tag="21")] + pub node_count: i32, + #[prost(int64, tag="22")] + pub in_flow: i64, + #[prost(int32, tag="23")] + pub disconnect_times: i32, + #[prost(string, tag="24")] + pub local_disconnect_reason: ::prost::alloc::string::String, + #[prost(string, tag="25")] + pub remote_disconnect_reason: ::prost::alloc::string::String, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct ConfigNodeInfo { + #[prost(string, tag="1")] + pub code_version: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub p2p_version: ::prost::alloc::string::String, + #[prost(int32, tag="3")] + pub listen_port: i32, + #[prost(bool, tag="4")] + pub discover_enable: bool, + #[prost(int32, tag="5")] + pub active_node_size: i32, + #[prost(int32, tag="6")] + pub passive_node_size: i32, + #[prost(int32, tag="7")] + pub send_node_size: i32, + #[prost(int32, tag="8")] + pub max_connect_count: i32, + #[prost(int32, tag="9")] + pub same_ip_max_connect_count: i32, + #[prost(int32, tag="10")] + pub backup_listen_port: i32, + #[prost(int32, tag="11")] + pub backup_member_size: i32, + #[prost(int32, tag="12")] + pub backup_priority: i32, + #[prost(int32, tag="13")] + pub db_version: i32, + #[prost(int32, tag="14")] + pub min_participation_rate: i32, + #[prost(bool, tag="15")] + pub support_constant: bool, + #[prost(double, tag="16")] + pub min_time_ratio: f64, + #[prost(double, tag="17")] + pub max_time_ratio: f64, + #[prost(int64, tag="18")] + pub allow_creation_of_contracts: i64, + #[prost(int64, tag="19")] + pub allow_adaptive_energy: i64, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct MachineInfo { + #[prost(int32, tag="1")] + pub thread_count: i32, + #[prost(int32, tag="2")] + pub dead_lock_thread_count: i32, + #[prost(int32, tag="3")] + pub cpu_count: i32, + #[prost(int64, tag="4")] + pub total_memory: i64, + #[prost(int64, tag="5")] + pub free_memory: i64, + #[prost(double, tag="6")] + pub cpu_rate: f64, + #[prost(string, tag="7")] + pub java_version: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub os_name: ::prost::alloc::string::String, + #[prost(int64, tag="9")] + pub jvm_total_memory: i64, + #[prost(int64, tag="10")] + pub jvm_free_memory: i64, + #[prost(double, tag="11")] + pub process_cpu_rate: f64, + #[prost(message, repeated, tag="12")] + pub memory_desc_info_list: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="13")] + pub dead_lock_thread_info_list: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `MachineInfo`. + pub mod machine_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct MemoryDescInfo { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub init_size: i64, + #[prost(int64, tag="3")] + pub use_size: i64, + #[prost(int64, tag="4")] + pub max_size: i64, + #[prost(double, tag="5")] + pub use_rate: f64, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct DeadLockThreadInfo { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub lock_name: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub lock_owner: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub state: ::prost::alloc::string::String, + #[prost(int64, tag="5")] + pub block_time: i64, + #[prost(int64, tag="6")] + pub wait_time: i64, + #[prost(string, tag="7")] + pub stack_trace: ::prost::alloc::string::String, + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MetricsInfo { + #[prost(int64, tag="1")] + pub interval: i64, + #[prost(message, optional, tag="2")] + pub node: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub blockchain: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub net: ::core::option::Option, +} +/// Nested message and enum types in `MetricsInfo`. +pub mod metrics_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct NodeInfo { + #[prost(string, tag="1")] + pub ip: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub node_type: i32, + #[prost(string, tag="3")] + pub version: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub backup_status: i32, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct BlockChainInfo { + #[prost(int64, tag="1")] + pub head_block_num: i64, + #[prost(int64, tag="2")] + pub head_block_timestamp: i64, + #[prost(string, tag="3")] + pub head_block_hash: ::prost::alloc::string::String, + #[prost(int32, tag="4")] + pub fork_count: i32, + #[prost(int32, tag="5")] + pub fail_fork_count: i32, + #[prost(message, optional, tag="6")] + pub block_process_time: ::core::option::Option, + #[prost(message, optional, tag="7")] + pub tps: ::core::option::Option, + #[prost(int32, tag="8")] + pub transaction_cache_size: i32, + #[prost(message, optional, tag="9")] + pub missed_transaction: ::core::option::Option, + #[prost(message, repeated, tag="10")] + pub witnesses: ::prost::alloc::vec::Vec, + #[prost(int64, tag="11")] + pub fail_process_block_num: i64, + #[prost(string, tag="12")] + pub fail_process_block_reason: ::prost::alloc::string::String, + #[prost(message, repeated, tag="13")] + pub dup_witness: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `BlockChainInfo`. + pub mod block_chain_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Witness { + #[prost(string, tag="1")] + pub address: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub version: i32, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct DupWitness { + #[prost(string, tag="1")] + pub address: ::prost::alloc::string::String, + #[prost(int64, tag="2")] + pub block_num: i64, + #[prost(int32, tag="3")] + pub count: i32, + } + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct RateInfo { + #[prost(int64, tag="1")] + pub count: i64, + #[prost(double, tag="2")] + pub mean_rate: f64, + #[prost(double, tag="3")] + pub one_minute_rate: f64, + #[prost(double, tag="4")] + pub five_minute_rate: f64, + #[prost(double, tag="5")] + pub fifteen_minute_rate: f64, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct NetInfo { + #[prost(int32, tag="1")] + pub error_proto_count: i32, + #[prost(message, optional, tag="2")] + pub api: ::core::option::Option, + #[prost(int32, tag="3")] + pub connection_count: i32, + #[prost(int32, tag="4")] + pub valid_connection_count: i32, + #[prost(message, optional, tag="5")] + pub tcp_in_traffic: ::core::option::Option, + #[prost(message, optional, tag="6")] + pub tcp_out_traffic: ::core::option::Option, + #[prost(int32, tag="7")] + pub disconnection_count: i32, + #[prost(message, repeated, tag="8")] + pub disconnection_detail: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="9")] + pub udp_in_traffic: ::core::option::Option, + #[prost(message, optional, tag="10")] + pub udp_out_traffic: ::core::option::Option, + #[prost(message, optional, tag="11")] + pub latency: ::core::option::Option, + } + /// Nested message and enum types in `NetInfo`. + pub mod net_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct ApiInfo { + #[prost(message, optional, tag="1")] + pub qps: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub fail_qps: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub out_traffic: ::core::option::Option, + #[prost(message, repeated, tag="4")] + pub detail: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `ApiInfo`. + pub mod api_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct ApiDetailInfo { + #[prost(string, tag="1")] + pub name: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub qps: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub fail_qps: ::core::option::Option, + #[prost(message, optional, tag="4")] + pub out_traffic: ::core::option::Option, + } + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct DisconnectionDetailInfo { + #[prost(string, tag="1")] + pub reason: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub count: i32, + } + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct LatencyInfo { + #[prost(int32, tag="1")] + pub top99: i32, + #[prost(int32, tag="2")] + pub top95: i32, + #[prost(int32, tag="3")] + pub top75: i32, + #[prost(int32, tag="4")] + pub total_count: i32, + #[prost(int32, tag="5")] + pub delay1_s: i32, + #[prost(int32, tag="6")] + pub delay2_s: i32, + #[prost(int32, tag="7")] + pub delay3_s: i32, + #[prost(message, repeated, tag="8")] + pub detail: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `LatencyInfo`. + pub mod latency_info { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct LatencyDetailInfo { + #[prost(string, tag="1")] + pub witness: ::prost::alloc::string::String, + #[prost(int32, tag="2")] + pub top99: i32, + #[prost(int32, tag="3")] + pub top95: i32, + #[prost(int32, tag="4")] + pub top75: i32, + #[prost(int32, tag="5")] + pub count: i32, + #[prost(int32, tag="6")] + pub delay1_s: i32, + #[prost(int32, tag="7")] + pub delay2_s: i32, + #[prost(int32, tag="8")] + pub delay3_s: i32, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PbftMessage { + #[prost(message, optional, tag="1")] + pub raw_data: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub signature: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `PBFTMessage`. +pub mod pbft_message { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Raw { + #[prost(enumeration="MsgType", tag="1")] + pub msg_type: i32, + #[prost(enumeration="DataType", tag="2")] + pub data_type: i32, + #[prost(int64, tag="3")] + pub view_n: i64, + #[prost(int64, tag="4")] + pub epoch: i64, + #[prost(bytes="vec", tag="5")] + pub data: ::prost::alloc::vec::Vec, + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum MsgType { + ViewChange = 0, + Request = 1, + Preprepare = 2, + Prepare = 3, + Commit = 4, + } + impl MsgType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + MsgType::ViewChange => "VIEW_CHANGE", + MsgType::Request => "REQUEST", + MsgType::Preprepare => "PREPREPARE", + MsgType::Prepare => "PREPARE", + MsgType::Commit => "COMMIT", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "VIEW_CHANGE" => Some(Self::ViewChange), + "REQUEST" => Some(Self::Request), + "PREPREPARE" => Some(Self::Preprepare), + "PREPARE" => Some(Self::Prepare), + "COMMIT" => Some(Self::Commit), + _ => None, + } + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum DataType { + Block = 0, + Srl = 1, + } + impl DataType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + DataType::Block => "BLOCK", + DataType::Srl => "SRL", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "BLOCK" => Some(Self::Block), + "SRL" => Some(Self::Srl), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PbftCommitResult { + #[prost(bytes="vec", tag="1")] + pub data: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub signature: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Srl { + #[prost(bytes="vec", repeated, tag="1")] + pub sr_address: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AccountType { + Normal = 0, + AssetIssue = 1, + Contract = 2, +} +impl AccountType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AccountType::Normal => "Normal", + AccountType::AssetIssue => "AssetIssue", + AccountType::Contract => "Contract", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "Normal" => Some(Self::Normal), + "AssetIssue" => Some(Self::AssetIssue), + "Contract" => Some(Self::Contract), + _ => None, + } + } +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ReasonCode { + Requested = 0, + BadProtocol = 2, + TooManyPeers = 4, + DuplicatePeer = 5, + IncompatibleProtocol = 6, + RandomElimination = 7, + PeerQuiting = 8, + UnexpectedIdentity = 9, + LocalIdentity = 10, + PingTimeout = 11, + UserReason = 16, + Reset = 17, + SyncFail = 18, + FetchFail = 19, + BadTx = 20, + BadBlock = 21, + Forked = 22, + Unlinkable = 23, + IncompatibleVersion = 24, + IncompatibleChain = 25, + TimeOut = 32, + ConnectFail = 33, + TooManyPeersWithSameIp = 34, + LightNodeSyncFail = 35, + BelowThanMe = 36, + NotWitness = 37, + NoSuchMessage = 38, + Unknown = 255, +} +impl ReasonCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ReasonCode::Requested => "REQUESTED", + ReasonCode::BadProtocol => "BAD_PROTOCOL", + ReasonCode::TooManyPeers => "TOO_MANY_PEERS", + ReasonCode::DuplicatePeer => "DUPLICATE_PEER", + ReasonCode::IncompatibleProtocol => "INCOMPATIBLE_PROTOCOL", + ReasonCode::RandomElimination => "RANDOM_ELIMINATION", + ReasonCode::PeerQuiting => "PEER_QUITING", + ReasonCode::UnexpectedIdentity => "UNEXPECTED_IDENTITY", + ReasonCode::LocalIdentity => "LOCAL_IDENTITY", + ReasonCode::PingTimeout => "PING_TIMEOUT", + ReasonCode::UserReason => "USER_REASON", + ReasonCode::Reset => "RESET", + ReasonCode::SyncFail => "SYNC_FAIL", + ReasonCode::FetchFail => "FETCH_FAIL", + ReasonCode::BadTx => "BAD_TX", + ReasonCode::BadBlock => "BAD_BLOCK", + ReasonCode::Forked => "FORKED", + ReasonCode::Unlinkable => "UNLINKABLE", + ReasonCode::IncompatibleVersion => "INCOMPATIBLE_VERSION", + ReasonCode::IncompatibleChain => "INCOMPATIBLE_CHAIN", + ReasonCode::TimeOut => "TIME_OUT", + ReasonCode::ConnectFail => "CONNECT_FAIL", + ReasonCode::TooManyPeersWithSameIp => "TOO_MANY_PEERS_WITH_SAME_IP", + ReasonCode::LightNodeSyncFail => "LIGHT_NODE_SYNC_FAIL", + ReasonCode::BelowThanMe => "BELOW_THAN_ME", + ReasonCode::NotWitness => "NOT_WITNESS", + ReasonCode::NoSuchMessage => "NO_SUCH_MESSAGE", + ReasonCode::Unknown => "UNKNOWN", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "REQUESTED" => Some(Self::Requested), + "BAD_PROTOCOL" => Some(Self::BadProtocol), + "TOO_MANY_PEERS" => Some(Self::TooManyPeers), + "DUPLICATE_PEER" => Some(Self::DuplicatePeer), + "INCOMPATIBLE_PROTOCOL" => Some(Self::IncompatibleProtocol), + "RANDOM_ELIMINATION" => Some(Self::RandomElimination), + "PEER_QUITING" => Some(Self::PeerQuiting), + "UNEXPECTED_IDENTITY" => Some(Self::UnexpectedIdentity), + "LOCAL_IDENTITY" => Some(Self::LocalIdentity), + "PING_TIMEOUT" => Some(Self::PingTimeout), + "USER_REASON" => Some(Self::UserReason), + "RESET" => Some(Self::Reset), + "SYNC_FAIL" => Some(Self::SyncFail), + "FETCH_FAIL" => Some(Self::FetchFail), + "BAD_TX" => Some(Self::BadTx), + "BAD_BLOCK" => Some(Self::BadBlock), + "FORKED" => Some(Self::Forked), + "UNLINKABLE" => Some(Self::Unlinkable), + "INCOMPATIBLE_VERSION" => Some(Self::IncompatibleVersion), + "INCOMPATIBLE_CHAIN" => Some(Self::IncompatibleChain), + "TIME_OUT" => Some(Self::TimeOut), + "CONNECT_FAIL" => Some(Self::ConnectFail), + "TOO_MANY_PEERS_WITH_SAME_IP" => Some(Self::TooManyPeersWithSameIp), + "LIGHT_NODE_SYNC_FAIL" => Some(Self::LightNodeSyncFail), + "BELOW_THAN_ME" => Some(Self::BelowThanMe), + "NOT_WITNESS" => Some(Self::NotWitness), + "NO_SUCH_MESSAGE" => Some(Self::NoSuchMessage), + "UNKNOWN" => Some(Self::Unknown), + _ => None, + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AssetIssueContract { + #[prost(string, tag="41")] + pub id: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub name: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub abbr: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub total_supply: i64, + #[prost(message, repeated, tag="5")] + pub frozen_supply: ::prost::alloc::vec::Vec, + #[prost(int32, tag="6")] + pub trx_num: i32, + #[prost(int32, tag="7")] + pub precision: i32, + #[prost(int32, tag="8")] + pub num: i32, + #[prost(int64, tag="9")] + pub start_time: i64, + #[prost(int64, tag="10")] + pub end_time: i64, + #[prost(int64, tag="11")] + pub order: i64, + #[prost(int32, tag="16")] + pub vote_score: i32, + #[prost(bytes="vec", tag="20")] + pub description: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="21")] + pub url: ::prost::alloc::vec::Vec, + #[prost(int64, tag="22")] + pub free_asset_net_limit: i64, + #[prost(int64, tag="23")] + pub public_free_asset_net_limit: i64, + #[prost(int64, tag="24")] + pub public_free_asset_net_usage: i64, + #[prost(int64, tag="25")] + pub public_latest_free_net_time: i64, +} +/// Nested message and enum types in `AssetIssueContract`. +pub mod asset_issue_contract { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] + pub struct FrozenSupply { + #[prost(int64, tag="1")] + pub frozen_amount: i64, + #[prost(int64, tag="2")] + pub frozen_days: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferAssetContract { + #[prost(bytes="vec", tag="1")] + pub asset_name: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub to_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub amount: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnfreezeAssetContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateAssetContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub description: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub url: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub new_limit: i64, + #[prost(int64, tag="5")] + pub new_public_limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ParticipateAssetIssueContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub to_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub asset_name: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub amount: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WitnessCreateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub url: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WitnessUpdateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="12")] + pub update_url: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VoteWitnessContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub votes: ::prost::alloc::vec::Vec, + #[prost(bool, tag="3")] + pub support: bool, +} +/// Nested message and enum types in `VoteWitnessContract`. +pub mod vote_witness_contract { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Vote { + #[prost(bytes="vec", tag="1")] + pub vote_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub vote_count: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuthenticationPath { + #[prost(bool, repeated, tag="1")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MerklePath { + #[prost(message, repeated, tag="1")] + pub authentication_paths: ::prost::alloc::vec::Vec, + #[prost(bool, repeated, tag="2")] + pub index: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub rt: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OutputPoint { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub index: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OutputPointInfo { + #[prost(message, repeated, tag="1")] + pub out_points: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub block_num: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PedersenHash { + #[prost(bytes="vec", tag="1")] + pub content: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncrementalMerkleTree { + #[prost(message, optional, tag="1")] + pub left: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub right: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub parents: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncrementalMerkleVoucher { + #[prost(message, optional, tag="1")] + pub tree: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub filled: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub cursor: ::core::option::Option, + #[prost(int64, tag="4")] + pub cursor_depth: i64, + #[prost(bytes="vec", tag="5")] + pub rt: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="10")] + pub output_point: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncrementalMerkleVoucherInfo { + #[prost(message, repeated, tag="1")] + pub vouchers: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub paths: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpendDescription { + #[prost(bytes="vec", tag="1")] + pub value_commitment: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub anchor: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub nullifier: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub rk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub zkproof: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="6")] + pub spend_authority_signature: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReceiveDescription { + #[prost(bytes="vec", tag="1")] + pub value_commitment: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub note_commitment: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub epk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub c_enc: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub c_out: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="6")] + pub zkproof: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShieldedTransferContract { + #[prost(bytes="vec", tag="1")] + pub transparent_from_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub from_amount: i64, + #[prost(message, repeated, tag="3")] + pub spend_description: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="4")] + pub receive_description: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub binding_signature: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="6")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="7")] + pub to_amount: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ZksnarkRequest { + #[prost(message, optional, tag="1")] + pub transaction: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub sighash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub value_balance: i64, + #[prost(string, tag="4")] + pub tx_id: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ZksnarkResponse { + #[prost(enumeration="zksnark_response::Code", tag="1")] + pub code: i32, +} +/// Nested message and enum types in `ZksnarkResponse`. +pub mod zksnark_response { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum Code { + Success = 0, + Failed = 1, + } + impl Code { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Code::Success => "SUCCESS", + Code::Failed => "FAILED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCCESS" => Some(Self::Success), + "FAILED" => Some(Self::Failed), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketSellAssetContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub sell_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub sell_token_quantity: i64, + #[prost(bytes="vec", tag="4")] + pub buy_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub buy_token_quantity: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MarketCancelOrderContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub order_id: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct VoteAssetContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub vote_address: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bool, tag="3")] + pub support: bool, + #[prost(int32, tag="5")] + pub count: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuyStorageBytesContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub bytes: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BuyStorageContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub quant: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SellStorageContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub storage_bytes: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateBrokerageContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub brokerage: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangeCreateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub first_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub first_token_balance: i64, + #[prost(bytes="vec", tag="4")] + pub second_token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub second_token_balance: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangeInjectContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub exchange_id: i64, + #[prost(bytes="vec", tag="3")] + pub token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub quant: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangeWithdrawContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub exchange_id: i64, + #[prost(bytes="vec", tag="3")] + pub token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub quant: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangeTransactionContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub exchange_id: i64, + #[prost(bytes="vec", tag="3")] + pub token_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub quant: i64, + #[prost(int64, tag="5")] + pub expected: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountCreateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub account_address: ::prost::alloc::vec::Vec, + #[prost(enumeration="AccountType", tag="3")] + pub r#type: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountUpdateContract { + #[prost(bytes="vec", tag="1")] + pub account_name: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SetAccountIdContract { + #[prost(bytes="vec", tag="1")] + pub account_id: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountPermissionUpdateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub owner: ::core::option::Option, + #[prost(message, optional, tag="3")] + pub witness: ::core::option::Option, + #[prost(message, repeated, tag="4")] + pub actives: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FreezeBalanceContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub frozen_balance: i64, + #[prost(int64, tag="3")] + pub frozen_duration: i64, + #[prost(enumeration="ResourceCode", tag="10")] + pub resource: i32, + #[prost(bytes="vec", tag="15")] + pub receiver_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnfreezeBalanceContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(enumeration="ResourceCode", tag="10")] + pub resource: i32, + #[prost(bytes="vec", tag="15")] + pub receiver_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WithdrawBalanceContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransferContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub to_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub amount: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionBalanceTrace { + #[prost(bytes="vec", tag="1")] + pub transaction_identifier: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub operation: ::prost::alloc::vec::Vec, + #[prost(string, tag="3")] + pub r#type: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub status: ::prost::alloc::string::String, +} +/// Nested message and enum types in `TransactionBalanceTrace`. +pub mod transaction_balance_trace { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Operation { + #[prost(int64, tag="1")] + pub operation_identifier: i64, + #[prost(bytes="vec", tag="2")] + pub address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub amount: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockBalanceTrace { + #[prost(message, optional, tag="1")] + pub block_identifier: ::core::option::Option, + #[prost(int64, tag="2")] + pub timestamp: i64, + #[prost(message, repeated, tag="3")] + pub transaction_balance_trace: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `BlockBalanceTrace`. +pub mod block_balance_trace { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct BlockIdentifier { + #[prost(bytes="vec", tag="1")] + pub hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub number: i64, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct AccountTrace { + #[prost(int64, tag="1")] + pub balance: i64, + #[prost(int64, tag="99")] + pub placeholder: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountIdentifier { + #[prost(bytes="vec", tag="1")] + pub address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountBalanceRequest { + #[prost(message, optional, tag="1")] + pub account_identifier: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub block_identifier: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountBalanceResponse { + #[prost(int64, tag="1")] + pub balance: i64, + #[prost(message, optional, tag="2")] + pub block_identifier: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct FreezeBalanceV2Contract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub frozen_balance: i64, + #[prost(enumeration="ResourceCode", tag="3")] + pub resource: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnfreezeBalanceV2Contract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub unfreeze_balance: i64, + #[prost(enumeration="ResourceCode", tag="3")] + pub resource: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WithdrawExpireUnfreezeContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegateResourceContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(enumeration="ResourceCode", tag="2")] + pub resource: i32, + #[prost(int64, tag="3")] + pub balance: i64, + #[prost(bytes="vec", tag="4")] + pub receiver_address: ::prost::alloc::vec::Vec, + #[prost(bool, tag="5")] + pub lock: bool, + #[prost(int64, tag="6")] + pub lock_period: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UnDelegateResourceContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(enumeration="ResourceCode", tag="2")] + pub resource: i32, + #[prost(int64, tag="3")] + pub balance: i64, + #[prost(bytes="vec", tag="4")] + pub receiver_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CancelAllUnfreezeV2Contract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SmartContract { + #[prost(bytes="vec", tag="1")] + pub origin_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub contract_address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub abi: ::core::option::Option, + #[prost(bytes="vec", tag="4")] + pub bytecode: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub call_value: i64, + #[prost(int64, tag="6")] + pub consume_user_resource_percent: i64, + #[prost(string, tag="7")] + pub name: ::prost::alloc::string::String, + #[prost(int64, tag="8")] + pub origin_energy_limit: i64, + #[prost(bytes="vec", tag="9")] + pub code_hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="10")] + pub trx_hash: ::prost::alloc::vec::Vec, + #[prost(int32, tag="11")] + pub version: i32, +} +/// Nested message and enum types in `SmartContract`. +pub mod smart_contract { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Abi { + #[prost(message, repeated, tag="1")] + pub entrys: ::prost::alloc::vec::Vec, + } + /// Nested message and enum types in `ABI`. + pub mod abi { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Entry { + #[prost(bool, tag="1")] + pub anonymous: bool, + #[prost(bool, tag="2")] + pub constant: bool, + #[prost(string, tag="3")] + pub name: ::prost::alloc::string::String, + #[prost(message, repeated, tag="4")] + pub inputs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="5")] + pub outputs: ::prost::alloc::vec::Vec, + #[prost(enumeration="entry::EntryType", tag="6")] + pub r#type: i32, + #[prost(bool, tag="7")] + pub payable: bool, + #[prost(enumeration="entry::StateMutabilityType", tag="8")] + pub state_mutability: i32, + } + /// Nested message and enum types in `Entry`. + pub mod entry { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Param { + #[prost(bool, tag="1")] + pub indexed: bool, + #[prost(string, tag="2")] + pub name: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub r#type: ::prost::alloc::string::String, + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum EntryType { + UnknownEntryType = 0, + Constructor = 1, + Function = 2, + Event = 3, + Fallback = 4, + Receive = 5, + Error = 6, + } + impl EntryType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + EntryType::UnknownEntryType => "UnknownEntryType", + EntryType::Constructor => "Constructor", + EntryType::Function => "Function", + EntryType::Event => "Event", + EntryType::Fallback => "Fallback", + EntryType::Receive => "Receive", + EntryType::Error => "Error", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UnknownEntryType" => Some(Self::UnknownEntryType), + "Constructor" => Some(Self::Constructor), + "Function" => Some(Self::Function), + "Event" => Some(Self::Event), + "Fallback" => Some(Self::Fallback), + "Receive" => Some(Self::Receive), + "Error" => Some(Self::Error), + _ => None, + } + } + } + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum StateMutabilityType { + UnknownMutabilityType = 0, + Pure = 1, + View = 2, + Nonpayable = 3, + Payable = 4, + } + impl StateMutabilityType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + StateMutabilityType::UnknownMutabilityType => "UnknownMutabilityType", + StateMutabilityType::Pure => "Pure", + StateMutabilityType::View => "View", + StateMutabilityType::Nonpayable => "Nonpayable", + StateMutabilityType::Payable => "Payable", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UnknownMutabilityType" => Some(Self::UnknownMutabilityType), + "Pure" => Some(Self::Pure), + "View" => Some(Self::View), + "Nonpayable" => Some(Self::Nonpayable), + "Payable" => Some(Self::Payable), + _ => None, + } + } + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct ContractState { + #[prost(int64, tag="1")] + pub energy_usage: i64, + #[prost(int64, tag="2")] + pub energy_factor: i64, + #[prost(int64, tag="3")] + pub update_cycle: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateSmartContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub new_contract: ::core::option::Option, + #[prost(int64, tag="3")] + pub call_token_value: i64, + #[prost(int64, tag="4")] + pub token_id: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TriggerSmartContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub contract_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub call_value: i64, + #[prost(bytes="vec", tag="4")] + pub data: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub call_token_value: i64, + #[prost(int64, tag="6")] + pub token_id: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClearAbiContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub contract_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateSettingContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub contract_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub consume_user_resource_percent: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateEnergyLimitContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub contract_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="3")] + pub origin_energy_limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SmartContractDataWrapper { + #[prost(message, optional, tag="1")] + pub smart_contract: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub runtimecode: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub contract_state: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct InventoryItems { + #[prost(int32, tag="1")] + pub r#type: i32, + #[prost(bytes="vec", repeated, tag="2")] + pub items: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalApproveContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub proposal_id: i64, + #[prost(bool, tag="3")] + pub is_add_approval: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalCreateContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(map="int64, int64", tag="2")] + pub parameters: ::std::collections::HashMap, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalDeleteContract { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub proposal_id: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Return { + #[prost(bool, tag="1")] + pub result: bool, + #[prost(enumeration="r#return::ResponseCode", tag="2")] + pub code: i32, + #[prost(bytes="vec", tag="3")] + pub message: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `Return`. +pub mod r#return { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ResponseCode { + Success = 0, + Sigerror = 1, + ContractValidateError = 2, + ContractExeError = 3, + BandwithError = 4, + DupTransactionError = 5, + TaposError = 6, + TooBigTransactionError = 7, + TransactionExpirationError = 8, + ServerBusy = 9, + NoConnection = 10, + NotEnoughEffectiveConnection = 11, + BlockUnsolidified = 12, + OtherError = 20, + } + impl ResponseCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResponseCode::Success => "SUCCESS", + ResponseCode::Sigerror => "SIGERROR", + ResponseCode::ContractValidateError => "CONTRACT_VALIDATE_ERROR", + ResponseCode::ContractExeError => "CONTRACT_EXE_ERROR", + ResponseCode::BandwithError => "BANDWITH_ERROR", + ResponseCode::DupTransactionError => "DUP_TRANSACTION_ERROR", + ResponseCode::TaposError => "TAPOS_ERROR", + ResponseCode::TooBigTransactionError => "TOO_BIG_TRANSACTION_ERROR", + ResponseCode::TransactionExpirationError => "TRANSACTION_EXPIRATION_ERROR", + ResponseCode::ServerBusy => "SERVER_BUSY", + ResponseCode::NoConnection => "NO_CONNECTION", + ResponseCode::NotEnoughEffectiveConnection => "NOT_ENOUGH_EFFECTIVE_CONNECTION", + ResponseCode::BlockUnsolidified => "BLOCK_UNSOLIDIFIED", + ResponseCode::OtherError => "OTHER_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCCESS" => Some(Self::Success), + "SIGERROR" => Some(Self::Sigerror), + "CONTRACT_VALIDATE_ERROR" => Some(Self::ContractValidateError), + "CONTRACT_EXE_ERROR" => Some(Self::ContractExeError), + "BANDWITH_ERROR" => Some(Self::BandwithError), + "DUP_TRANSACTION_ERROR" => Some(Self::DupTransactionError), + "TAPOS_ERROR" => Some(Self::TaposError), + "TOO_BIG_TRANSACTION_ERROR" => Some(Self::TooBigTransactionError), + "TRANSACTION_EXPIRATION_ERROR" => Some(Self::TransactionExpirationError), + "SERVER_BUSY" => Some(Self::ServerBusy), + "NO_CONNECTION" => Some(Self::NoConnection), + "NOT_ENOUGH_EFFECTIVE_CONNECTION" => Some(Self::NotEnoughEffectiveConnection), + "BLOCK_UNSOLIDIFIED" => Some(Self::BlockUnsolidified), + "OTHER_ERROR" => Some(Self::OtherError), + _ => None, + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockReference { + #[prost(int64, tag="1")] + pub block_num: i64, + #[prost(bytes="vec", tag="2")] + pub block_hash: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct WitnessList { + #[prost(message, repeated, tag="1")] + pub witnesses: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProposalList { + #[prost(message, repeated, tag="1")] + pub proposals: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExchangeList { + #[prost(message, repeated, tag="1")] + pub exchanges: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AssetIssueList { + #[prost(message, repeated, tag="1")] + pub asset_issue: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockList { + #[prost(message, repeated, tag="1")] + pub block: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionList { + #[prost(message, repeated, tag="1")] + pub transaction: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionIdList { + #[prost(string, repeated, tag="1")] + pub tx_id: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatedResourceMessage { + #[prost(bytes="vec", tag="1")] + pub from_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub to_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DelegatedResourceList { + #[prost(message, repeated, tag="1")] + pub delegated_resource: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetAvailableUnfreezeCountRequestMessage { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct GetAvailableUnfreezeCountResponseMessage { + #[prost(int64, tag="1")] + pub count: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanDelegatedMaxSizeRequestMessage { + #[prost(int32, tag="1")] + pub r#type: i32, + #[prost(bytes="vec", tag="2")] + pub owner_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct CanDelegatedMaxSizeResponseMessage { + #[prost(int64, tag="1")] + pub max_size: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CanWithdrawUnfreezeAmountRequestMessage { + #[prost(bytes="vec", tag="1")] + pub owner_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub timestamp: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct CanWithdrawUnfreezeAmountResponseMessage { + #[prost(int64, tag="1")] + pub amount: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PricesResponseMessage { + #[prost(string, tag="1")] + pub prices: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NodeList { + #[prost(message, repeated, tag="1")] + pub nodes: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Node { + #[prost(message, optional, tag="1")] + pub address: ::core::option::Option
, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Address { + #[prost(bytes="vec", tag="1")] + pub host: ::prost::alloc::vec::Vec, + #[prost(int32, tag="2")] + pub port: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct EmptyMessage { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct NumberMessage { + #[prost(int64, tag="1")] + pub num: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BytesMessage { + #[prost(bytes="vec", tag="1")] + pub value: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct TimeMessage { + #[prost(int64, tag="1")] + pub begin_in_milliseconds: i64, + #[prost(int64, tag="2")] + pub end_in_milliseconds: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockReq { + #[prost(string, tag="1")] + pub id_or_num: ::prost::alloc::string::String, + #[prost(bool, tag="2")] + pub detail: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct BlockLimit { + #[prost(int64, tag="1")] + pub start_num: i64, + #[prost(int64, tag="2")] + pub end_num: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionLimit { + #[prost(bytes="vec", tag="1")] + pub transaction_id: ::prost::alloc::vec::Vec, + #[prost(int64, tag="2")] + pub limit_num: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountPaginated { + #[prost(message, optional, tag="1")] + pub account: ::core::option::Option, + #[prost(int64, tag="2")] + pub offset: i64, + #[prost(int64, tag="3")] + pub limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct TimePaginatedMessage { + #[prost(message, optional, tag="1")] + pub time_message: ::core::option::Option, + #[prost(int64, tag="2")] + pub offset: i64, + #[prost(int64, tag="3")] + pub limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountNetMessage { + #[prost(int64, tag="1")] + pub free_net_used: i64, + #[prost(int64, tag="2")] + pub free_net_limit: i64, + #[prost(int64, tag="3")] + pub net_used: i64, + #[prost(int64, tag="4")] + pub net_limit: i64, + #[prost(map="string, int64", tag="5")] + pub asset_net_used: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(map="string, int64", tag="6")] + pub asset_net_limit: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(int64, tag="7")] + pub total_net_limit: i64, + #[prost(int64, tag="8")] + pub total_net_weight: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AccountResourceMessage { + #[prost(int64, tag="1")] + pub free_net_used: i64, + #[prost(int64, tag="2")] + pub free_net_limit: i64, + #[prost(int64, tag="3")] + pub net_used: i64, + #[prost(int64, tag="4")] + pub net_limit: i64, + #[prost(map="string, int64", tag="5")] + pub asset_net_used: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(map="string, int64", tag="6")] + pub asset_net_limit: ::std::collections::HashMap<::prost::alloc::string::String, i64>, + #[prost(int64, tag="7")] + pub total_net_limit: i64, + #[prost(int64, tag="8")] + pub total_net_weight: i64, + #[prost(int64, tag="9")] + pub total_tron_power_weight: i64, + #[prost(int64, tag="10")] + pub tron_power_used: i64, + #[prost(int64, tag="11")] + pub tron_power_limit: i64, + #[prost(int64, tag="13")] + pub energy_used: i64, + #[prost(int64, tag="14")] + pub energy_limit: i64, + #[prost(int64, tag="15")] + pub total_energy_limit: i64, + #[prost(int64, tag="16")] + pub total_energy_weight: i64, + #[prost(int64, tag="21")] + pub storage_used: i64, + #[prost(int64, tag="22")] + pub storage_limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PaginatedMessage { + #[prost(int64, tag="1")] + pub offset: i64, + #[prost(int64, tag="2")] + pub limit: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionExtention { + #[prost(message, optional, tag="1")] + pub transaction: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="3")] + pub constant_result: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(message, optional, tag="4")] + pub result: ::core::option::Option, + #[prost(int64, tag="5")] + pub energy_used: i64, + #[prost(message, repeated, tag="6")] + pub logs: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub internal_transactions: ::prost::alloc::vec::Vec, + #[prost(int64, tag="8")] + pub energy_penalty: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EstimateEnergyMessage { + #[prost(message, optional, tag="1")] + pub result: ::core::option::Option, + #[prost(int64, tag="2")] + pub energy_required: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockExtention { + #[prost(message, repeated, tag="1")] + pub transactions: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub block_header: ::core::option::Option, + #[prost(bytes="vec", tag="3")] + pub blockid: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockListExtention { + #[prost(message, repeated, tag="1")] + pub block: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionListExtention { + #[prost(message, repeated, tag="1")] + pub transaction: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockIncrementalMerkleTree { + #[prost(int64, tag="1")] + pub number: i64, + #[prost(message, optional, tag="2")] + pub merkle_tree: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionSignWeight { + #[prost(message, optional, tag="1")] + pub permission: ::core::option::Option, + #[prost(bytes="vec", repeated, tag="2")] + pub approved_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(int64, tag="3")] + pub current_weight: i64, + #[prost(message, optional, tag="4")] + pub result: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub transaction: ::core::option::Option, +} +/// Nested message and enum types in `TransactionSignWeight`. +pub mod transaction_sign_weight { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Result { + #[prost(enumeration="result::ResponseCode", tag="1")] + pub code: i32, + #[prost(string, tag="2")] + pub message: ::prost::alloc::string::String, + } + /// Nested message and enum types in `Result`. + pub mod result { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ResponseCode { + EnoughPermission = 0, + NotEnoughPermission = 1, + SignatureFormatError = 2, + ComputeAddressError = 3, + PermissionError = 4, + OtherError = 20, + } + impl ResponseCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResponseCode::EnoughPermission => "ENOUGH_PERMISSION", + ResponseCode::NotEnoughPermission => "NOT_ENOUGH_PERMISSION", + ResponseCode::SignatureFormatError => "SIGNATURE_FORMAT_ERROR", + ResponseCode::ComputeAddressError => "COMPUTE_ADDRESS_ERROR", + ResponseCode::PermissionError => "PERMISSION_ERROR", + ResponseCode::OtherError => "OTHER_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "ENOUGH_PERMISSION" => Some(Self::EnoughPermission), + "NOT_ENOUGH_PERMISSION" => Some(Self::NotEnoughPermission), + "SIGNATURE_FORMAT_ERROR" => Some(Self::SignatureFormatError), + "COMPUTE_ADDRESS_ERROR" => Some(Self::ComputeAddressError), + "PERMISSION_ERROR" => Some(Self::PermissionError), + "OTHER_ERROR" => Some(Self::OtherError), + _ => None, + } + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionApprovedList { + #[prost(bytes="vec", repeated, tag="2")] + pub approved_list: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(message, optional, tag="4")] + pub result: ::core::option::Option, + #[prost(message, optional, tag="5")] + pub transaction: ::core::option::Option, +} +/// Nested message and enum types in `TransactionApprovedList`. +pub mod transaction_approved_list { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct Result { + #[prost(enumeration="result::ResponseCode", tag="1")] + pub code: i32, + #[prost(string, tag="2")] + pub message: ::prost::alloc::string::String, + } + /// Nested message and enum types in `Result`. + pub mod result { + #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] + #[repr(i32)] + pub enum ResponseCode { + Success = 0, + SignatureFormatError = 1, + ComputeAddressError = 2, + OtherError = 20, + } + impl ResponseCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResponseCode::Success => "SUCCESS", + ResponseCode::SignatureFormatError => "SIGNATURE_FORMAT_ERROR", + ResponseCode::ComputeAddressError => "COMPUTE_ADDRESS_ERROR", + ResponseCode::OtherError => "OTHER_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCCESS" => Some(Self::Success), + "SIGNATURE_FORMAT_ERROR" => Some(Self::SignatureFormatError), + "COMPUTE_ADDRESS_ERROR" => Some(Self::ComputeAddressError), + "OTHER_ERROR" => Some(Self::OtherError), + _ => None, + } + } + } + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IvkDecryptParameters { + #[prost(int64, tag="1")] + pub start_block_index: i64, + #[prost(int64, tag="2")] + pub end_block_index: i64, + #[prost(bytes="vec", tag="3")] + pub ivk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IvkDecryptAndMarkParameters { + #[prost(int64, tag="1")] + pub start_block_index: i64, + #[prost(int64, tag="2")] + pub end_block_index: i64, + #[prost(bytes="vec", tag="5")] + pub ivk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub nk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OvkDecryptParameters { + #[prost(int64, tag="1")] + pub start_block_index: i64, + #[prost(int64, tag="2")] + pub end_block_index: i64, + #[prost(bytes="vec", tag="3")] + pub ovk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecryptNotes { + #[prost(message, repeated, tag="1")] + pub note_txs: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `DecryptNotes`. +pub mod decrypt_notes { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct NoteTx { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(int32, tag="3")] + pub index: i32, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecryptNotesMarked { + #[prost(message, repeated, tag="1")] + pub note_txs: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `DecryptNotesMarked`. +pub mod decrypt_notes_marked { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct NoteTx { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(int32, tag="3")] + pub index: i32, + #[prost(bool, tag="4")] + pub is_spend: bool, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Note { + #[prost(int64, tag="1")] + pub value: i64, + #[prost(string, tag="2")] + pub payment_address: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="3")] + pub rcm: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub memo: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpendNote { + #[prost(message, optional, tag="3")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="4")] + pub alpha: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="5")] + pub voucher: ::core::option::Option, + #[prost(bytes="vec", tag="6")] + pub path: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ReceiveNote { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivateParameters { + #[prost(bytes="vec", tag="1")] + pub transparent_from_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub ask: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub from_amount: i64, + #[prost(message, repeated, tag="6")] + pub shielded_spends: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub shielded_receives: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="8")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="9")] + pub to_amount: i64, + #[prost(int64, tag="10")] + pub timeout: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivateParametersWithoutAsk { + #[prost(bytes="vec", tag="1")] + pub transparent_from_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub from_amount: i64, + #[prost(message, repeated, tag="6")] + pub shielded_spends: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="7")] + pub shielded_receives: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="8")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + #[prost(int64, tag="9")] + pub to_amount: i64, + #[prost(int64, tag="10")] + pub timeout: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpendAuthSigParameters { + #[prost(bytes="vec", tag="1")] + pub ask: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub tx_hash: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub alpha: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NfParameters { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub voucher: ::core::option::Option, + #[prost(bytes="vec", tag="3")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub nk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExpandedSpendingKeyMessage { + #[prost(bytes="vec", tag="1")] + pub ask: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub ovk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ViewingKeyMessage { + #[prost(bytes="vec", tag="1")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub nk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncomingViewingKeyMessage { + #[prost(bytes="vec", tag="1")] + pub ivk: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DiversifierMessage { + #[prost(bytes="vec", tag="1")] + pub d: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IncomingViewingKeyDiversifierMessage { + #[prost(message, optional, tag="1")] + pub ivk: ::core::option::Option, + #[prost(message, optional, tag="2")] + pub d: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PaymentAddressMessage { + #[prost(message, optional, tag="1")] + pub d: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub pk_d: ::prost::alloc::vec::Vec, + #[prost(string, tag="3")] + pub payment_address: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShieldedAddressInfo { + #[prost(bytes="vec", tag="1")] + pub sk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub ask: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="6")] + pub nk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="7")] + pub ivk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="8")] + pub d: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="9")] + pub pk_d: ::prost::alloc::vec::Vec, + #[prost(string, tag="10")] + pub payment_address: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NoteParameters { + #[prost(bytes="vec", tag="1")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub nk: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="3")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="4")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(int32, tag="5")] + pub index: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpendResult { + #[prost(bool, tag="1")] + pub result: bool, + #[prost(string, tag="2")] + pub message: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TransactionInfoList { + #[prost(message, repeated, tag="1")] + pub transaction_info: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SpendNoteTrc20 { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub alpha: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub root: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub path: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub pos: i64, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivateShieldedTrc20Parameters { + #[prost(bytes="vec", tag="1")] + pub ask: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(string, tag="4")] + pub from_amount: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub shielded_spends: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub shielded_receives: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="7")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + #[prost(string, tag="8")] + pub to_amount: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="9")] + pub shielded_trc20_contract_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PrivateShieldedTrc20ParametersWithoutAsk { + #[prost(bytes="vec", tag="1")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="2")] + pub nsk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(string, tag="4")] + pub from_amount: ::prost::alloc::string::String, + #[prost(message, repeated, tag="5")] + pub shielded_spends: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="6")] + pub shielded_receives: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="7")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + #[prost(string, tag="8")] + pub to_amount: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="9")] + pub shielded_trc20_contract_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShieldedTrc20Parameters { + #[prost(message, repeated, tag="1")] + pub spend_description: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag="2")] + pub receive_description: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub binding_signature: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub message_hash: ::prost::alloc::vec::Vec, + #[prost(string, tag="5")] + pub trigger_contract_input: ::prost::alloc::string::String, + #[prost(string, tag="6")] + pub parameter_type: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IvkDecryptTrc20Parameters { + #[prost(int64, tag="1")] + pub start_block_index: i64, + #[prost(int64, tag="2")] + pub end_block_index: i64, + #[prost(bytes="vec", tag="3")] + pub shielded_trc20_contract_address: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub ivk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="5")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="6")] + pub nk: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag="7")] + pub events: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OvkDecryptTrc20Parameters { + #[prost(int64, tag="1")] + pub start_block_index: i64, + #[prost(int64, tag="2")] + pub end_block_index: i64, + #[prost(bytes="vec", tag="3")] + pub ovk: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub shielded_trc20_contract_address: ::prost::alloc::vec::Vec, + #[prost(string, repeated, tag="5")] + pub events: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DecryptNotesTrc20 { + #[prost(message, repeated, tag="1")] + pub note_txs: ::prost::alloc::vec::Vec, +} +/// Nested message and enum types in `DecryptNotesTRC20`. +pub mod decrypt_notes_trc20 { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] + pub struct NoteTx { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(int64, tag="2")] + pub position: i64, + #[prost(bool, tag="3")] + pub is_spent: bool, + #[prost(bytes="vec", tag="4")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(int32, tag="5")] + pub index: i32, + #[prost(string, tag="6")] + pub to_amount: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="7")] + pub transparent_to_address: ::prost::alloc::vec::Vec, + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct NfTrc20Parameters { + #[prost(message, optional, tag="1")] + pub note: ::core::option::Option, + #[prost(bytes="vec", tag="2")] + pub ak: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub nk: ::prost::alloc::vec::Vec, + #[prost(int64, tag="4")] + pub position: i64, + #[prost(bytes="vec", tag="5")] + pub shielded_trc20_contract_address: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct NullifierResult { + #[prost(bool, tag="1")] + pub is_spent: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ShieldedTrc20TriggerContractParameters { + #[prost(message, optional, tag="1")] + pub shielded_trc20_parameters: ::core::option::Option, + #[prost(message, repeated, tag="2")] + pub spend_authority_signature: ::prost::alloc::vec::Vec, + #[prost(string, tag="3")] + pub amount: ::prost::alloc::string::String, + #[prost(bytes="vec", tag="4")] + pub transparent_to_address: ::prost::alloc::vec::Vec, +} +// @@protoc_insertion_point(module) diff --git a/tron/src/pb/request.tron.v1.rs b/tron/src/pb/request.tron.v1.rs new file mode 100644 index 0000000..2f72410 --- /dev/null +++ b/tron/src/pb/request.tron.v1.rs @@ -0,0 +1,63 @@ +// @generated +// This file is @generated by prost-build. +/// A single payment event from the ERC20FeeProxy contract +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Payment { + /// The token contract address (TRC20) + #[prost(string, tag="1")] + pub token_address: ::prost::alloc::string::String, + /// The recipient address + #[prost(string, tag="2")] + pub to: ::prost::alloc::string::String, + /// The payment amount (as string to preserve precision) + #[prost(string, tag="3")] + pub amount: ::prost::alloc::string::String, + /// The indexed payment reference (hex encoded) + #[prost(string, tag="4")] + pub payment_reference: ::prost::alloc::string::String, + /// The fee amount (as string to preserve precision) + #[prost(string, tag="5")] + pub fee_amount: ::prost::alloc::string::String, + /// The fee recipient address + #[prost(string, tag="6")] + pub fee_address: ::prost::alloc::string::String, + /// The sender address (msg.sender) + #[prost(string, tag="7")] + pub from: ::prost::alloc::string::String, + /// Block number where the event was emitted + #[prost(uint64, tag="8")] + pub block: u64, + /// Block timestamp (Unix timestamp in seconds) + #[prost(uint64, tag="9")] + pub timestamp: u64, + /// Transaction hash + #[prost(string, tag="10")] + pub tx_hash: ::prost::alloc::string::String, + /// The proxy contract address that emitted the event + #[prost(string, tag="11")] + pub contract_address: ::prost::alloc::string::String, + /// The blockchain network identifier (e.g., "tron", "ethereum", "polygon") + #[prost(string, tag="12")] + pub chain: ::prost::alloc::string::String, + /// Energy used (TRON's equivalent of gas) + #[prost(string, tag="13")] + pub energy_used: ::prost::alloc::string::String, + /// Energy fee paid in SUN (TRON's smallest unit) + #[prost(string, tag="14")] + pub energy_fee: ::prost::alloc::string::String, + /// Network/Bandwidth fee paid in SUN + #[prost(string, tag="15")] + pub net_fee: ::prost::alloc::string::String, + /// Log index within the transaction (for uniqueness when multiple events share the same payment_reference) + #[prost(uint64, tag="16")] + pub log_index: u64, +} +/// Collection of payment events +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Payments { + #[prost(message, repeated, tag="1")] + pub payments: ::prost::alloc::vec::Vec, +} +// @@protoc_insertion_point(module) diff --git a/tron/src/pb/sf.substreams.tron.v1.rs b/tron/src/pb/sf.substreams.tron.v1.rs new file mode 100644 index 0000000..7f4533b --- /dev/null +++ b/tron/src/pb/sf.substreams.tron.v1.rs @@ -0,0 +1,11 @@ +// @generated +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transactions { + #[prost(message, repeated, tag="1")] + pub transactions: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub clock: ::core::option::Option, +} +// @@protoc_insertion_point(module) diff --git a/tron/src/pb/sf.substreams.v1.rs b/tron/src/pb/sf.substreams.v1.rs new file mode 100644 index 0000000..63fcbbd --- /dev/null +++ b/tron/src/pb/sf.substreams.v1.rs @@ -0,0 +1,23 @@ +// @generated +// This file is @generated by prost-build. +/// Clock is a pointer to a block with added timestamp +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Clock { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(uint64, tag="2")] + pub number: u64, + #[prost(message, optional, tag="3")] + pub timestamp: ::core::option::Option<::prost_types::Timestamp>, +} +/// BlockRef is a pointer to a block to which we don't know the timestamp +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockRef { + #[prost(string, tag="1")] + pub id: ::prost::alloc::string::String, + #[prost(uint64, tag="2")] + pub number: u64, +} +// @@protoc_insertion_point(module) diff --git a/tron/src/pb/sf.tron.type.v1.rs b/tron/src/pb/sf.tron.type.v1.rs new file mode 100644 index 0000000..6cef6a2 --- /dev/null +++ b/tron/src/pb/sf.tron.type.v1.rs @@ -0,0 +1,127 @@ +// @generated +// This file is @generated by prost-build. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Block { + #[prost(bytes="vec", tag="1")] + pub id: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag="2")] + pub header: ::core::option::Option, + #[prost(message, repeated, tag="3")] + pub transactions: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct BlockHeader { + #[prost(uint64, tag="1")] + pub number: u64, + #[prost(bytes="vec", tag="2")] + pub tx_trie_root: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="3")] + pub witness_address: ::prost::alloc::vec::Vec, + #[prost(uint64, tag="4")] + pub parent_number: u64, + #[prost(bytes="vec", tag="5")] + pub parent_hash: ::prost::alloc::vec::Vec, + #[prost(uint32, tag="6")] + pub version: u32, + #[prost(int64, tag="7")] + pub timestamp: i64, + #[prost(bytes="vec", tag="8")] + pub witness_signature: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Transaction { + #[prost(bytes="vec", tag="1")] + pub txid: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", repeated, tag="2")] + pub signature: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bytes="vec", tag="3")] + pub ref_block_bytes: ::prost::alloc::vec::Vec, + #[prost(bytes="vec", tag="4")] + pub ref_block_hash: ::prost::alloc::vec::Vec, + #[prost(int64, tag="5")] + pub expiration: i64, + #[prost(int64, tag="6")] + pub timestamp: i64, + #[prost(bytes="vec", repeated, tag="7")] + pub contract_result: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>, + #[prost(bool, tag="8")] + pub result: bool, + #[prost(enumeration="ResponseCode", tag="9")] + pub code: i32, + #[prost(bytes="vec", tag="10")] + pub message: ::prost::alloc::vec::Vec, + #[prost(int64, tag="11")] + pub energy_used: i64, + #[prost(int64, tag="12")] + pub energy_penalty: i64, + #[prost(message, optional, tag="13")] + pub info: ::core::option::Option, + #[prost(message, repeated, tag="14")] + pub contracts: ::prost::alloc::vec::Vec, +} +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum ResponseCode { + Success = 0, + Sigerror = 1, + ContractValidateError = 2, + ContractExeError = 3, + BandwithError = 4, + DupTransactionError = 5, + TaposError = 6, + TooBigTransactionError = 7, + TransactionExpirationError = 8, + ServerBusy = 9, + NoConnection = 10, + NotEnoughEffectiveConnection = 11, + BlockUnsolidified = 12, + OtherError = 20, +} +impl ResponseCode { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + ResponseCode::Success => "SUCCESS", + ResponseCode::Sigerror => "SIGERROR", + ResponseCode::ContractValidateError => "CONTRACT_VALIDATE_ERROR", + ResponseCode::ContractExeError => "CONTRACT_EXE_ERROR", + ResponseCode::BandwithError => "BANDWITH_ERROR", + ResponseCode::DupTransactionError => "DUP_TRANSACTION_ERROR", + ResponseCode::TaposError => "TAPOS_ERROR", + ResponseCode::TooBigTransactionError => "TOO_BIG_TRANSACTION_ERROR", + ResponseCode::TransactionExpirationError => "TRANSACTION_EXPIRATION_ERROR", + ResponseCode::ServerBusy => "SERVER_BUSY", + ResponseCode::NoConnection => "NO_CONNECTION", + ResponseCode::NotEnoughEffectiveConnection => "NOT_ENOUGH_EFFECTIVE_CONNECTION", + ResponseCode::BlockUnsolidified => "BLOCK_UNSOLIDIFIED", + ResponseCode::OtherError => "OTHER_ERROR", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SUCCESS" => Some(Self::Success), + "SIGERROR" => Some(Self::Sigerror), + "CONTRACT_VALIDATE_ERROR" => Some(Self::ContractValidateError), + "CONTRACT_EXE_ERROR" => Some(Self::ContractExeError), + "BANDWITH_ERROR" => Some(Self::BandwithError), + "DUP_TRANSACTION_ERROR" => Some(Self::DupTransactionError), + "TAPOS_ERROR" => Some(Self::TaposError), + "TOO_BIG_TRANSACTION_ERROR" => Some(Self::TooBigTransactionError), + "TRANSACTION_EXPIRATION_ERROR" => Some(Self::TransactionExpirationError), + "SERVER_BUSY" => Some(Self::ServerBusy), + "NO_CONNECTION" => Some(Self::NoConnection), + "NOT_ENOUGH_EFFECTIVE_CONNECTION" => Some(Self::NotEnoughEffectiveConnection), + "BLOCK_UNSOLIDIFIED" => Some(Self::BlockUnsolidified), + "OTHER_ERROR" => Some(Self::OtherError), + _ => None, + } + } +} +// @@protoc_insertion_point(module) diff --git a/tron/substreams.yaml b/tron/substreams.yaml new file mode 100644 index 0000000..5cd9c56 --- /dev/null +++ b/tron/substreams.yaml @@ -0,0 +1,67 @@ +specVersion: v0.1.0 +package: + name: request_network_tron + version: v0.1.0 + url: https://github.com/RequestNetwork/payments-substream + doc: | + Request Network TRON Substreams module for indexing ERC20FeeProxy payment events. + Indexes TransferWithReferenceAndFee events from the deployed ERC20FeeProxy contract + on TRON mainnet. + +imports: + tron: https://spkg.io/streamingfast/tron-foundational-v0.1.2.spkg + sql: https://github.com/streamingfast/substreams-sink-sql/releases/download/protodefs-v1.0.3/substreams-sink-sql-protodefs-v1.0.3.spkg + database_change: https://github.com/streamingfast/substreams-sink-database-changes/releases/download/v1.2.1/substreams-database-change-v1.2.1.spkg + +protobuf: + files: + - request/tron/v1/payments.proto + importPaths: + - ./proto + +binaries: + default: + type: wasm/rust-v1 + file: ./target/wasm32-unknown-unknown/release/request_network_tron.wasm + +modules: + - name: map_erc20_fee_proxy_payments + kind: map + initialBlock: 79216121 # TRON mainnet deployment block + inputs: + - params: string + - source: sf.tron.type.v1.Block + output: + type: proto:request.tron.v1.Payments + doc: | + Extracts TransferWithReferenceAndFee events from ERC20FeeProxy contracts. + Filters transactions to the known proxy contract addresses and parses + the event logs to extract payment details. + + Params format: + mainnet_proxy_address=
+ chain= + + - name: db_out + kind: map + initialBlock: 79216121 + inputs: + - map: map_erc20_fee_proxy_payments + output: + type: proto:sf.substreams.sink.database.v1.DatabaseChanges + doc: | + Converts payment events to database changes for SQL sink. + +network: tron + +sink: + module: db_out + type: sf.substreams.sink.sql.v1.Service + config: + schema: "./schema.sql" + engine: postgres + +params: + map_erc20_fee_proxy_payments: | + mainnet_proxy_address=TCUDPYnS9dH3WvFEaE7wN7vnDa51J4R4fd + chain=tron