Repository: 0xcregis/anychain Branch: main Commit: f7ed658d501c Files: 177 Total size: 2.2 MB Directory structure: gitextract_yq5pvl5m/ ├── .github/ │ └── workflows/ │ ├── lint-pr.yml │ ├── release.yml │ └── rust.yml ├── .gitignore ├── Cargo.toml ├── LICENSE ├── Makefile ├── README.md ├── crates/ │ ├── anychain-bitcoin/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── amount.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── network/ │ │ │ ├── bitcoin.rs │ │ │ ├── bitcoin_testnet.rs │ │ │ ├── bitcoincash.rs │ │ │ ├── bitcoincash_testnet.rs │ │ │ ├── dogecoin.rs │ │ │ ├── dogecoin_testnet.rs │ │ │ ├── litecoin.rs │ │ │ ├── litecoin_testnet.rs │ │ │ └── mod.rs │ │ ├── public_key.rs │ │ ├── transaction.rs │ │ └── witness_program.rs │ ├── anychain-cardano/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── examples/ │ │ │ └── transfer-ada.rs │ │ ├── src/ │ │ │ ├── address.rs │ │ │ ├── amount.rs │ │ │ ├── format.rs │ │ │ ├── lib.rs │ │ │ ├── network.rs │ │ │ ├── public_key.rs │ │ │ ├── transaction.rs │ │ │ └── util.rs │ │ └── tests/ │ │ └── test_derive.rs │ ├── anychain-core/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── amount.rs │ │ ├── error.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── network.rs │ │ ├── no_std/ │ │ │ ├── io.rs │ │ │ └── mod.rs │ │ ├── public_key.rs │ │ ├── transaction.rs │ │ └── utilities/ │ │ ├── crypto.rs │ │ └── mod.rs │ ├── anychain-ethereum/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── network/ │ │ │ ├── mainnet.rs │ │ │ ├── mod.rs │ │ │ └── testnet.rs │ │ ├── public_key.rs │ │ ├── transaction/ │ │ │ ├── contract.rs │ │ │ ├── eip1559.rs │ │ │ ├── eip3009.rs │ │ │ ├── eip7702.rs │ │ │ ├── legacy.rs │ │ │ └── mod.rs │ │ └── util.rs │ ├── anychain-filecoin/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── amount.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── public_key.rs │ │ ├── transaction.rs │ │ └── utilities/ │ │ ├── crypto.rs │ │ └── mod.rs │ ├── anychain-kms/ │ │ ├── .gitignore │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── bip32/ │ │ │ ├── child_number.rs │ │ │ ├── derivation_path.rs │ │ │ ├── error.rs │ │ │ ├── extended_key/ │ │ │ │ ├── attrs.rs │ │ │ │ ├── extended_private_key.rs │ │ │ │ ├── extended_public_key.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── prefix.rs │ │ │ ├── private_key.rs │ │ │ └── public_key.rs │ │ ├── bip39/ │ │ │ ├── crypto.rs │ │ │ ├── error.rs │ │ │ ├── langs/ │ │ │ │ ├── chinese_simplified.txt │ │ │ │ ├── chinese_traditional.txt │ │ │ │ ├── english.txt │ │ │ │ ├── french.txt │ │ │ │ ├── italian.txt │ │ │ │ ├── japanese.txt │ │ │ │ ├── korean.txt │ │ │ │ └── spanish.txt │ │ │ ├── language.rs │ │ │ ├── mnemonic.rs │ │ │ ├── mnemonic_type.rs │ │ │ ├── mod.rs │ │ │ ├── seed.rs │ │ │ └── util.rs │ │ ├── crypto.rs │ │ ├── error.rs │ │ └── lib.rs │ ├── anychain-neo/ │ │ ├── Cargo.toml │ │ └── src/ │ │ ├── address.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── public_key.rs │ │ └── transaction.rs │ ├── anychain-polkadot/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── network/ │ │ │ ├── kusama.rs │ │ │ ├── mod.rs │ │ │ ├── polkadot.rs │ │ │ ├── rococo.rs │ │ │ └── westend.rs │ │ ├── public_key.rs │ │ ├── transaction.rs │ │ └── utilities/ │ │ ├── crypto.rs │ │ └── mod.rs │ ├── anychain-ripple/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ ├── address.rs │ │ ├── format.rs │ │ ├── lib.rs │ │ ├── public_key.rs │ │ └── transaction.rs │ └── anychain-tron/ │ ├── Cargo.toml │ ├── README.md │ └── src/ │ ├── abi.rs │ ├── address.rs │ ├── format.rs │ ├── lib.rs │ ├── protocol/ │ │ ├── Discover.rs │ │ ├── Tron.rs │ │ ├── account_contract.rs │ │ ├── asset_issue_contract.rs │ │ ├── balance_contract.rs │ │ ├── common.rs │ │ ├── exchange_contract.rs │ │ ├── market_contract.rs │ │ ├── mod.rs │ │ ├── proposal_contract.rs │ │ ├── shield_contract.rs │ │ ├── smart_contract.rs │ │ ├── storage_contract.rs │ │ ├── vote_asset_contract.rs │ │ └── witness_contract.rs │ ├── public_key.rs │ ├── transaction.rs │ └── trx.rs ├── docs/ │ ├── design-cn.md │ └── design-en.md ├── examples/ │ ├── anychain-bitcoin-cli/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ └── main.rs │ ├── anychain-bitcoin-client/ │ │ ├── Cargo.toml │ │ └── src/ │ │ └── main.rs │ ├── anychain-ethereum-cli/ │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src/ │ │ └── main.rs │ └── anychain-neo-cli/ │ ├── Cargo.toml │ ├── README.md │ └── src/ │ └── main.rs ├── lib.rs └── rust-toolchain.toml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/lint-pr.yml ================================================ name: PR on: pull_request_target: types: - opened - edited - synchronize permissions: contents: read jobs: main: name: Lint permissions: pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v5.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .github/workflows/release.yml ================================================ name: Build Binary on: push: tags: # Regex for a version number such as 0.2.1 - "[0-9]+.[0-9]+.[0-9]+" permissions: contents: write jobs: build-and-upload: name: Build and upload runs-on: ${{ matrix.os }} strategy: matrix: # You can add more, for any target you'd like! include: - build: linux os: ubuntu-latest target: x86_64-unknown-linux-musl - build: macos os: macos-latest target: x86_64-apple-darwin steps: - name: Checkout uses: actions/checkout@v4 - name: Get the release version from the tag shell: bash run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Install Rust # Or @nightly if you want uses: dtolnay/rust-toolchain@stable # Arguments to pass in with: # Make Rust compile to our target (defined in the matrix) targets: ${{ matrix.target }} - name: Build uses: actions-rs/cargo@v1 with: use-cross: true command: build args: --verbose --release --target ${{ matrix.target }} - name: Build archive shell: bash run: | # Replace with the name of your binary binary_name="anychain-bitcoin-cli" dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" mkdir "$dirname" if [ "${{ matrix.os }}" = "windows-latest" ]; then mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" else mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" fi if [ "${{ matrix.os }}" = "windows-latest" ]; then 7z a "$dirname.zip" "$dirname" echo "ASSET=$dirname.zip" >> $GITHUB_ENV else tar -czf "$dirname.tar.gz" "$dirname" echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV fi - name: Release uses: softprops/action-gh-release@v1 with: files: | ${{ env.ASSET }} ================================================ FILE: .github/workflows/rust.yml ================================================ name: Rust CI on: push: branches: [ "main" ] pull_request: branches: [ "main" ] env: CARGO_TERM_COLOR: always jobs: build: runs-on: ubuntu-latest strategy: matrix: rust-version: [ 1.95.0 ] steps: - name: Checkout code uses: actions/checkout@v6 - name: Cache Cargo dependencies uses: actions/cache@v5 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Install Protoc uses: arduino/setup-protoc@v3 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust-version }} - name: Check formatting run: cargo fmt -- --check - name: cargo clippy run: cargo clippy --workspace --all-targets --tests -- -D warnings - name: Build and test run: cargo test --all-features ================================================ FILE: .gitignore ================================================ # Generated by Cargo # will have compiled files and executables debug/ target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html # Cargo.lock # These are backup files generated by rustfmt **/*.rs.bk # MSVC Windows builds of rustc generate these, which store debugging information *.pdb # intellij files .idea/ .vscode/ # MaxOS files .DS_Store *.swp bak/* ================================================ FILE: Cargo.toml ================================================ [workspace] resolver = "2" members = [ "crates/anychain-core", "crates/anychain-bitcoin", "crates/anychain-ethereum", "crates/anychain-tron", "crates/anychain-filecoin", "crates/anychain-polkadot", "crates/anychain-ripple", #"crates/anychain-neo", "crates/anychain-cardano", "crates/anychain-kms", "examples/*", ] [workspace.package] authors = ["Shawndslee", "cregis.com"] edition = "2021" homepage = "https://www.cregis.com" license = "MIT/Apache-2.0" repository = "https://github.com/0xcregis/anychain" [workspace.dependencies] sha3 = "0.10.1" thiserror = "1.0" ripemd = "0.1.1" blake2b_simd = "1.0.0" bech32 = "0.9.0" hex = "0.4.2" libsecp256k1 = "0.7.1" ed25519-dalek = { version = "2", features = ["hazmat"] } #ed25519-dalek = "1.0.1" curve25519-dalek = { version = "4.1.3", features = ["group"] } base58 = { version = "0.2" } rand = { version = "0.8.6" } rand_core = { version = "0.6.3", default-features = false } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } sha2 = { version = "0.10.8", default-features = false } serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] } lazy_static = "1.4.0" num-bigint = "0.4.3" anyhow = "1.0.75" base64 = "0.21.5" # bytes = "1.0" protobuf = { version = "=3.7.2" } chrono = "0.4" clap = { version = "4.4.7", features = ["derive"] } rustc-hash = "1.1.0" hmac = "0.12.1" pbkdf2 = { version = "0.12.1", default-features = false } unicode-normalization = "0.1.22" zeroize = { version = "1.8.1", default-features = false } once_cell = { version = "1.18.0" } subtle = { version = "2", default-features = false } p256 = "0.13.2" bs58 = { version = "0.4", default-features = false, features = ["check", "alloc"] } # Ethereum ethereum-types = "0.13.1" rlp = { version = "0.5.2", features = ["derive"] } ethabi = "17.2.0" regex = { version = "1.3" } primitive-types = { version = "0.11.1", features = ["rlp"] } # Cardano cml-chain = "6.2.0" cml-crypto = "6.2.0" cml-core = "6.2.0" # Filecoin arbitrary = { version = "1.4.1", features = ["derive"] } bls-signatures = { version = "0.15.0" } cid = { version = "0.11.2" } data-encoding = "2.8.0" data-encoding-macro = "0.1.17" fvm_shared = { version = "~4.8.2" } fvm_ipld_encoding = "0.5.4" forest_encoding = "0.2.2" num-derive = "0.4.2" num-traits = { version = "0.2.19" } unsigned-varint = "0.8.0" [profile.release] strip = true # Automatically strip symbols from the binary opt-level = "s" # Optimize for size lto = true # Enable link time optimization codegen-units = 1 # Maximize size reduction optimizations [workspace.lints.clippy] uninlined_format_args = "allow" ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) [2013] [taiyi-research-institute] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Makefile ================================================ .PHONY: all check clean all: build check: fmt test clippy test: (command -v cargo-nextest && cargo nextest run --all-features --workspace) || cargo test --all-features --workspace fmt: cargo fmt --all -- --check clippy: cargo clippy --workspace --all-targets --tests -- -D warnings clean: cargo clean build: cargo build --release build-linux-server: rustup target add x86_64-unknown-linux-musl cargo build --release --target x86_64-unknown-linux-musl rustup target add aarch64-unknown-linux-musl cargo build --release --target aarch64-unknown-linux-musl build-ios: rustup target add aarch64-apple-ios cargo build --release --target aarch64-apple-ios ================================================ FILE: README.md ================================================ ## Anychain [![Rust CI](https://github.com/uduncloud/anychain/actions/workflows/rust.yml/badge.svg)](https://github.com/uduncloud/anychain/actions/workflows/rust.yml) ### What is Anychain? Anychain is a multi-chain supported blockchain development framework designed to simplify interactions with various blockchains such as Ethereum, Bitcoin, Tron, and more. It provides a suite of tools and libraries that enable developers to easily create, manage, and operate blockchain addresses, transactions, and smart contracts. ### What Can Anychain Do? - **Multi-Chain Support**: Interact with multiple blockchain platforms, allowing developers to use different blockchains within the same project. - **Address Management**: Easily create and verify blockchain addresses. - **Transaction Generation**: Generate and sign transactions, supporting various cryptocurrencies. - **Smart Contract Interaction**: Interact with smart contracts, call contract methods, and handle return values. - **Bandwidth Estimation**: Estimate the bandwidth required for transactions, helping developers optimize transaction costs. ### Who Needs Anychain? - **Blockchain Developers**: Developers looking to quickly build applications that interact with multiple blockchains. - **Fintech Companies**: Companies that need to integrate various cryptocurrency payment and transaction functionalities. - **Blockchain Researchers**: Academics and researchers who want to experiment and study different blockchains. - **Startups**: Startups aiming to leverage blockchain technology to build innovative products. ### Why Choose Anychain? - **Ease of Use**: Anychain offers a simple and intuitive API, allowing developers to get started quickly and reducing the learning curve. - **Flexibility**: Supports multiple blockchains, enabling developers to choose the most suitable chain based on their needs. - **Active Community**: Anychain has an active developer community that provides support and shares best practices. - **High Performance**: An optimized codebase ensures efficient transaction processing and low latency. ### Features #### Common Traits when it comes to building transactions for different blockchains, they are * PublicKey * Address * Amount * Transaction * Network * Format #### Common crates used in building transactions for different blockchains, they are * base58 * secp256k1 * hex * rand ### Functions * Build raw unsigned transactions for different blockchains according to parameters taken from the user of this library * Build signed transactions for different blockchains by merging the raw transaction and the corresponding signature taken from the user of this library ### Architecture & Design Doc ```mermaid flowchart LR A[iOS/Android App] --> |Link library| B[anychain-ffi-rust]; B --> |Wrap| C[anychain-bitcoin C library]; C --> |Implement| D[anychain-core]; ``` [Design Principles for AnyChain Wallet SDK](docs/design-en.md) ### Build the source cargo build --release ## Crates | Name | Description | Crates.io | Documentation | |-----------------------|------------------------|--------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------| | [`anychain-core`] | Core types and traits. | [![Crates.io](https://img.shields.io/crates/v/anychain-core)][anychain-core] | [![Documentation](https://shields.io/docsrs/anychain-core)][anychain-core-docs] | | [`anychain-kms`] | BIP32、BIP39. | [![Crates.io](https://img.shields.io/crates/v/anychain-kms)][anychain-kms] | [![Documentation](https://shields.io/docsrs/anychain-kms)][anychain-kms-docs] | | [`anychain-bitcoin`] | Bitcoin impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-bitcoin)][anychain-bitcoin] | [![Documentation](https://shields.io/docsrs/anychain-bitcoin)][anychain-bitcoin-docs] | | [`anychain-ethereum`] | Ethereum impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-ethereum)][anychain-ethereum] | [![Documentation](https://shields.io/docsrs/anychain-ethereum)][anychain-ethereum-docs] | | [`anychain-filecoin`] | Filecoin impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-filecoin)][anychain-filecoin] | [![Documentation](https://shields.io/docsrs/anychain-filecoin)][anychain-filecoin-docs] | | [`anychain-tron`] | Tron impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-tron)][anychain-tron] | [![Documentation](https://shields.io/docsrs/anychain-tron)][anychain-tron-docs] | | [`anychain-ripple`] | Ripple impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-ripple)][anychain-ripple] | [![Documentation](https://shields.io/docsrs/anychain-ripple)][anychain-ripple-docs] | | [`anychain-polkadot`] | Polkadot impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-polkadot)][anychain-polkadot] | [![Documentation](https://shields.io/docsrs/anychain-polkadot)][anychain-polkadot-docs] | | [`anychain-solana`] | Solana impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-solana)][anychain-solana] | [![Documentation](https://shields.io/docsrs/anychain-solana)][anychain-solana-docs] | | [`anychain-ton`] | Ton impl. | [![Crates.io](https://img.shields.io/crates/v/anychain-ton)][anychain-ton] | [![Documentation](https://shields.io/docsrs/anychain-solana)][anychain-solana-docs] | ## Supported Chains - Bitcoin - BitcoinCash - Dogecoin - Litecoin - Ethereum - Filecoin - Tron - Ripple - Arbitrum, Optimism, and Avalanche - Polkadot - Neo - Solana - Sui - Aptos - Sei - Ton ## License This project is licensed under the [MIT license][license]. ## Contact Feel free to join anychain sdk [Telegram](https://t.me/anychain_sdk) for discussions on code and research. [`anychain-core`]: https://github.com/0xcregis/anychain/tree/main/anychain-core [`anychain-kms`]: https://github.com/0xcregis/anychain/tree/main/anychain-kms [`anychain-bitcoin`]: https://github.com/0xcregis/anychain/tree/main/anychain-bitcoin [`anychain-ethereum`]: https://github.com/0xcregis/anychain/tree/main/anychain-ethereum [`anychain-filecoin`]: https://github.com/0xcregis/anychain/tree/main/anychain-filecoin [`anychain-tron`]: https://github.com/0xcregis/anychain/tree/main/anychain-tron [`anychain-ripple`]: https://github.com/0xcregis/anychain/tree/main/anychain-ripple [`anychain-polkadot`]: https://github.com/0xcregis/anychain/tree/main/anychain-polkadot [`anychain-solana`]: https://github.com/0xcregis/anychain-solana [`anychain-ton`]: https://github.com/0xcregis/anychain-ton [anychain-core]: https://crates.io/crates/anychain-core [anychain-kms]: https://crates.io/crates/anychain-kms [anychain-bitcoin]: https://crates.io/crates/anychain-bitcoin [anychain-ethereum]: https://crates.io/crates/anychain-ethereum [anychain-filecoin]: https://crates.io/crates/anychain-filecoin [anychain-tron]: https://crates.io/crates/anychain-tron [anychain-ripple]: https://crates.io/crates/anychain-ripple [anychain-polkadot]: https://crates.io/crates/anychain-polkadot [anychain-solana]: https://crates.io/crates/anychain-solana [anychain-ton]: https://crates.io/crates/anychain-ton [anychain-core-docs]: https://docs.rs/anychain-core [anychain-kms-docs]: https://docs.rs/anychain-kms [anychain-bitcoin-docs]: https://docs.rs/anychain-bitcoin [anychain-ethereum-docs]: https://docs.rs/anychain-ethereum [anychain-filecoin-docs]: https://docs.rs/anychain-filecoin [anychain-tron-docs]: https://docs.rs/anychain-tron [anychain-ripple-docs]: https://docs.rs/anychain-ripple [anychain-polkadot-docs]: https://docs.rs/anychain-polkadot [anychain-solana-docs]: https://docs.rs/anychain-solana [anychain-ton-docs]: https://docs.rs/anychain-ton [license]: https://github.com/0xcregis/anychain/blob/main/LICENSE ================================================ FILE: crates/anychain-bitcoin/Cargo.toml ================================================ [package] name = "anychain-bitcoin" description = "A Rust library for Bitcoin-focused cryptocurrency wallets, enabling seamless transactions on the Bitcoin blockchain" version = "0.1.15" keywords = ["bitcoin", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } base58 = { workspace = true } bech32 = { workspace = true } serde = { workspace = true } sha2 = { workspace = true } hex = { workspace = true } thiserror = { workspace = true } libsecp256k1 = { workspace = true } rand = { workspace = true } [features] default = ["std"] std = ["anychain-core/std"] [lints] workspace = true ================================================ FILE: crates/anychain-bitcoin/README.md ================================================ # anychain-bitcoin anychain-bitcoin is a Rust crate that provides a simple and efficient way to interact with the Bitcoin blockchain. This library aims to make it easy for developers to build applications that require Bitcoin data and functionality without having to deal with the complexities of the underlying protocol. ## Features - Easy-to-use API for querying and interacting with the Bitcoin blockchain - Support for mainnet, testnet, and regtest networks - Efficient and optimized for performance - Comprehensive documentation and examples ## Installation To use anychain-bitcoin in your Rust project, add the following to your Cargo.toml file: ```toml [dependencies] anychain-bitcoin = "0.1.8" ``` Then, import the crate in your code: ```rust extern crate anychain_bitcoin; ``` ## Usage Here's a simple example of how to use anychain-bitcoin to get the balance of a Bitcoin address: Addr ```rust use anychain_bitcoin::{Bitcoin, Address}; fn main() { let bitcoin = Bitcoin::new(); let address = Address::from_str("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa").unwrap(); let balance = bitcoin.get_balance(&address).unwrap(); println!("Balance: {} satoshis", balance); } ``` For more examples and detailed usage instructions, please refer to the [documentation](https://docs.rs/anychain-bitcoin). ## Contributing We welcome contributions from the community! If you'd like to contribute to anychain-bitcoin, please follow these steps: 1. Fork the repository 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Submit a pull request to the main repository Please make sure to write tests for your changes and follow the Rust coding style. ## License anychain-bitcoin is licensed under the MIT License. See [LICENSE](LICENSE) for more information ================================================ FILE: crates/anychain-bitcoin/src/address.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, BitcoinPublicKey, Opcode, Prefix, WitnessProgram}; use anychain_core::{ crypto::{checksum, hash160}, Address, AddressError, }; use anychain_core::{no_std::*, PublicKey}; use base58::{FromBase58, ToBase58}; use bech32::{self, u5, FromBase32, ToBase32, Variant}; use core::hash::Hash; use core::{fmt, marker::PhantomData, str::FromStr}; use sha2::{Digest, Sha256}; /// Represents a Bitcoin address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct BitcoinAddress { /// The Bitcoin address address: String, /// The format of the address format: BitcoinFormat, /// PhantomData _network: PhantomData, } pub static BASE32_ENCODE_TABLE: [u8; 32] = [ b'q', b'p', b'z', b'r', b'y', b'9', b'x', b'8', b'g', b'f', b'2', b't', b'v', b'd', b'w', b'0', b's', b'3', b'j', b'n', b'5', b'4', b'k', b'h', b'c', b'e', b'6', b'm', b'u', b'a', b'7', b'l', ]; pub static BASE32_DECODE_TABLE: [i8; 128] = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, -1, 10, 17, 21, 20, 26, 30, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, -1, 24, 13, 25, 9, 8, 23, -1, 18, 22, 31, 27, 19, -1, 1, 0, 3, 16, 11, 28, 12, 14, 6, 4, 2, -1, -1, -1, -1, -1, ]; fn checksum_bch(feed: Vec) -> [u8; 5] { let mut c = 1u64; for d in feed.iter() { let c0 = (c >> 35) as u8; c = ((c & 0x07ffffffff) << 5) ^ (*d as u64); if c0 & 0x01 != 0 { c ^= 0x98f2bc8e61; } if c0 & 0x02 != 0 { c ^= 0x79b76d99e2; } if c0 & 0x04 != 0 { c ^= 0xf33e5fb3c4; } if c0 & 0x08 != 0 { c ^= 0xae2eabe2a8; } if c0 & 0x10 != 0 { c ^= 0x1e4f43e470; } } c ^= 1; let mut ret = [0u8; 5]; for (i, byte) in ret.iter_mut().enumerate() { *byte = (c >> (8 * i)) as u8; } ret } fn compute_checksum_bch(payload: &str, prefix: &str) -> Result { let mut payload = payload.as_bytes().to_vec(); for byte in payload.clone() { match BASE32_DECODE_TABLE.get(byte as usize) { Some(val) if *val != -1 => {} _ => { return Err(AddressError::Message(format!( "Invalid base32 character '{}' for Bitcoin cash", byte as char ))) } } } payload .iter_mut() .for_each(|byte| *byte = BASE32_DECODE_TABLE[*byte as usize] as u8); let prefix = prefix.as_bytes().to_vec(); let prefix: Vec = prefix.iter().map(|byte| byte & 0x1f).collect(); let template = vec![0u8; 8]; let mut feed = prefix; feed.push(0); feed.extend(&payload); feed.extend(&template); let mut chechsum = checksum_bch(feed).to_vec(); chechsum.reverse(); let chechsum: Vec = chechsum .to_base32() .iter() .map(|byte| BASE32_ENCODE_TABLE[byte.to_u8() as usize]) .collect(); Ok(String::from_utf8(chechsum)?) } impl Address for BitcoinAddress { type SecretKey = libsecp256k1::SecretKey; type Format = BitcoinFormat; type PublicKey = BitcoinPublicKey; /// Returns the address corresponding to the given Bitcoin private key. fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::PublicKey::from_secret_key(secret_key).to_address(format) } /// Returns the address corresponding to the given Bitcoin public key. fn from_public_key( public_key: &Self::PublicKey, format: &Self::Format, ) -> Result { match format { BitcoinFormat::P2PKH => Self::p2pkh(public_key), BitcoinFormat::P2WSH => Err(AddressError::IncompatibleFormats( String::from("non-script"), String::from("p2wsh address"), )), BitcoinFormat::P2SH_P2WPKH => Self::p2sh_p2wpkh(public_key), BitcoinFormat::Bech32 => Self::bech32(public_key), BitcoinFormat::CashAddr => Self::cash_addr(public_key), } } } impl BitcoinAddress { /// Generate a P2PKH address from a hash160. pub fn p2pkh_from_hash(hash: &[u8]) -> Result { if hash.len() != 20 { return Err(AddressError::Message("Illegal hash160 length".to_string())); } let mut data = [0u8; 25]; data[0] = N::to_address_prefix(BitcoinFormat::P2PKH)?.version(); data[1..21].copy_from_slice(hash); let checksum = &checksum(&data[..21])[..4]; data[21..].copy_from_slice(checksum); Ok(Self { address: data.to_base58(), format: BitcoinFormat::P2PKH, _network: PhantomData, }) } /// Generate a P2SH_P2WPKH address from a hash160 pub fn p2sh_p2wpkh_from_hash(hash: &[u8]) -> Result { if hash.len() != 20 { return Err(AddressError::Message("Illegal hash160 length".to_string())); } let mut data = [0u8; 25]; data[0] = N::to_address_prefix(BitcoinFormat::P2SH_P2WPKH)?.version(); data[1..21].copy_from_slice(hash); let checksum = &checksum(&data[..21])[..4]; data[21..].copy_from_slice(checksum); Ok(Self { address: data.to_base58(), format: BitcoinFormat::P2SH_P2WPKH, _network: PhantomData, }) } // Generate a P2WSH address in Bech32 format from a sha256 script hash pub fn p2wsh_from_hash(hash: &[u8]) -> Result { if hash.len() != 32 { return Err(AddressError::Message("Illegal sha256 length".to_string())); } let v = N::to_address_prefix(BitcoinFormat::P2WSH)?.version(); let version = u5::try_from_u8(v)?; let mut data = vec![version]; data.extend_from_slice(&hash.to_vec().to_base32()); let prefix = N::to_address_prefix(BitcoinFormat::Bech32)?.prefix(); let bech32 = bech32::encode(&prefix, data, Variant::Bech32)?; Ok(Self { address: bech32, format: BitcoinFormat::P2WSH, _network: PhantomData, }) } /// Generate a Bech32 address from a hash160 pub fn bech32_from_hash(hash: &[u8]) -> Result { if hash.len() != 20 { return Err(AddressError::Message("Illegal hash160 length".to_string())); } let data = [ vec![u5::try_from_u8(0)?], // version byte: 0 hash.to_base32(), ] .concat(); let prefix = N::to_address_prefix(BitcoinFormat::Bech32)?.prefix(); let bech32 = bech32::encode(&prefix, data, Variant::Bech32)?; Ok(Self { address: bech32, format: BitcoinFormat::Bech32, _network: PhantomData, }) } /// Generate a CashAddr address from a hash160 pub fn cash_addr_from_hash(hash: &[u8]) -> Result { if hash.len() != 20 { return Err(AddressError::Message("Illegal hash160 length".to_string())); } let mut payload = vec![0u8]; // payload starts with version byte: 0 payload.extend(hash); let payload: Vec = payload .to_base32() .iter() .map(|byte| BASE32_ENCODE_TABLE[byte.to_u8() as usize]) .collect(); let payload = String::from_utf8(payload)?; let prefix = N::to_address_prefix(BitcoinFormat::CashAddr)?.prefix(); let checksum = compute_checksum_bch(&payload, &prefix)?; Ok(Self { address: format!("{}:{}{}", prefix, payload, checksum), format: BitcoinFormat::CashAddr, _network: PhantomData, }) } // Generate a P2TR address in Bech32 format from a sha256 script hash pub fn p2tr_from_hash(hash: &[u8]) -> Result { if hash.len() != 32 { return Err(AddressError::Message("Illegal sha256 length".to_string())); } let v = 1; let version = u5::try_from_u8(v)?; let mut data = vec![version]; data.extend_from_slice(&hash.to_vec().to_base32()); let prefix = N::to_address_prefix(BitcoinFormat::Bech32)?.prefix(); let bech32 = bech32::encode(&prefix, data, Variant::Bech32m)?; Ok(Self { address: bech32, format: BitcoinFormat::Bech32, _network: PhantomData, }) } /// Generate a P2PKH address from a given Bitcoin public key. pub fn p2pkh(public_key: &::PublicKey) -> Result { let hash = hash160(&public_key.serialize()); Self::p2pkh_from_hash(&hash) } // Generate a P2WSH address in Bech32 format from a given Bitcoin script pub fn p2wsh(original_script: &[u8]) -> Result { let hash = Sha256::digest(original_script).to_vec(); Self::p2wsh_from_hash(&hash) } /// Generate a P2SH_P2WPKH address from a given Bitcoin public key. pub fn p2sh_p2wpkh(public_key: &::PublicKey) -> Result { let hash = hash160(&Self::create_redeem_script(public_key)); Self::p2sh_p2wpkh_from_hash(&hash) } /// Generate a Bech32 address from a given Bitcoin public key. pub fn bech32(public_key: &::PublicKey) -> Result { let hash = hash160(&public_key.serialize()); Self::bech32_from_hash(&hash) } /// Generate a CashAddr address from a given Bitcoin public key. pub fn cash_addr(public_key: &::PublicKey) -> Result { let hash = hash160(&public_key.serialize()); Self::cash_addr_from_hash(&hash) } /// Return the format of the Bitcoin address. pub fn format(&self) -> BitcoinFormat { self.format.clone() } /// Generate a redeem script from a given Bitcoin public key. pub fn create_redeem_script(public_key: &::PublicKey) -> [u8; 22] { let mut redeem = [0u8; 22]; redeem[1] = Opcode::OP_PUSHBYTES_20 as u8; redeem[2..].copy_from_slice(&hash160(&public_key.serialize())); redeem } /// Decode the 'script_pub_key' to a bitcoin address pub fn from_script_pub_key(script_pub_key: &[u8]) -> Result { if script_pub_key.len() == 25 && script_pub_key[0] == Opcode::OP_DUP as u8 && script_pub_key[1] == Opcode::OP_HASH160 as u8 && script_pub_key[2] == 20 && script_pub_key[23] == Opcode::OP_EQUALVERIFY as u8 && script_pub_key[24] == Opcode::OP_CHECKSIG as u8 { // we are handling a p2pkh script if N::NAME.starts_with("bitcoin cash") { BitcoinAddress::::cash_addr_from_hash(&script_pub_key[3..23]) } else { BitcoinAddress::::p2pkh_from_hash(&script_pub_key[3..23]) } } else if script_pub_key.len() == 23 && script_pub_key[0] == Opcode::OP_HASH160 as u8 && script_pub_key[1] == 20 && script_pub_key[22] == Opcode::OP_EQUAL as u8 { // we are handling a p2sh_p2wpkh script BitcoinAddress::::p2sh_p2wpkh_from_hash(&script_pub_key[2..22]) } else if script_pub_key.len() == 34 && script_pub_key[0] == 0 && script_pub_key[1] == 32 { // we are handling a p2wsh script BitcoinAddress::::p2wsh_from_hash(&script_pub_key[2..]) } else if script_pub_key.len() == 34 && script_pub_key[0] == 81 && script_pub_key[1] == 32 { // we are handling a p2tr script BitcoinAddress::::p2tr_from_hash(&script_pub_key[2..]) } else if script_pub_key.len() == 22 && script_pub_key[0] == 0 && script_pub_key[1] == 20 { // we are handling a bech32 script BitcoinAddress::::bech32_from_hash(&script_pub_key[2..]) } else { Err(AddressError::Message( "Illegal utxo script public key".to_string(), )) } } } impl FromStr for BitcoinAddress { type Err = AddressError; fn from_str(address: &str) -> Result { if address.starts_with("bitcoincash") || address.starts_with("bchtest") { // we are processing a bitcoin cash address in CashAddr format let prefix = address.split(':').collect::>()[0]; // check if the address prefix corresponds to the correct network. let _ = N::from_address_prefix(Prefix::from_prefix(prefix))?; if address.len() != prefix.len() + 1 + 34 + 8 { return Err(AddressError::InvalidCharacterLength( address.len() - prefix.len() - 1, )); } let payload = &address[prefix.len() + 1..prefix.len() + 1 + 34]; let checksum_provided = &address[address.len() - 8..address.len()]; // check if the payload produces the provided checksum let checksum_gen = compute_checksum_bch(payload, prefix)?; if checksum_provided != checksum_gen { return Err(AddressError::InvalidChecksum( checksum_provided.to_string(), checksum_gen, )); } Ok(BitcoinAddress { address: address.to_string(), format: BitcoinFormat::CashAddr, _network: PhantomData, }) } else if address.starts_with("bc1") || address.starts_with("tb1") || address.starts_with("ltc1") || address.starts_with("tltc1") { // we are processing an address in Bech32 format let (hrp, data, _) = bech32::decode(address)?; if data.is_empty() { return Err(AddressError::InvalidAddress(address.to_owned())); } // check if the address prefix corresponds to the correct network. let _ = N::from_address_prefix(Prefix::from_prefix(&hrp))?; let version = data[0].to_u8(); let mut program = Vec::from_base32(&data[1..])?; let mut data = vec![version, program.len() as u8]; data.append(&mut program); // check if the witness program is valid. let _ = WitnessProgram::new(data.as_slice())?; Ok(Self { address: address.to_string(), format: BitcoinFormat::Bech32, _network: PhantomData, }) } else { let has_uppercase = |s: &str| { for c in s.chars() { if c.is_ascii_uppercase() { return true; } } false }; if has_uppercase(address) { // we are processing an address in p2pkh or p2sh_p2wpkh format let data = address.from_base58()?; if data.len() != 25 { return Err(AddressError::InvalidByteLength(data.len())); } let version = Prefix::from_version(data[0]); // check if the address prefix corresponds to the correct network let _ = N::from_address_prefix(version.clone())?; let format = BitcoinFormat::from_address_prefix(version)?; // check if the payload produces the provided checksum match format { BitcoinFormat::P2PKH | BitcoinFormat::P2SH_P2WPKH => { let checksum_gen = &checksum(&data[..21])[..4]; let checksum_provided = &data[21..]; if *checksum_gen != *checksum_provided { return Err(AddressError::InvalidChecksum( [data[..21].to_vec(), checksum_gen.to_vec()] .concat() .to_base58(), address.to_string(), )); } } _ => { return Err(AddressError::Message(format!( "Unrecognized version byte {}", data[0], ))) } } Ok(Self { address: address.to_string(), format, _network: PhantomData, }) } else { // we are processing a bitcoin cash address in CashAddr format without an explicit prefix let prefix = N::to_address_prefix(BitcoinFormat::CashAddr)?.prefix(); if address.len() != 42 { return Err(AddressError::InvalidCharacterLength(address.len())); } let payload = &address[..34]; let checksum_provided = &address[34..]; // check if the payload produces the provided checksum let checksum_gen = compute_checksum_bch(payload, &prefix)?; if checksum_provided != checksum_gen { return Err(AddressError::InvalidChecksum( checksum_provided.to_string(), checksum_gen, )); } Ok(Self { address: address.to_string(), format: BitcoinFormat::CashAddr, _network: PhantomData, }) } } } } impl fmt::Display for BitcoinAddress { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.address) } } #[cfg(test)] mod tests { use super::*; use crate::{create_script_pub_key, network::*}; use anychain_core::{hex, Network}; use rand::thread_rng; fn test_from_str(expected_address: &str, expected_format: &BitcoinFormat) { let address = BitcoinAddress::::from_str(expected_address).unwrap(); assert_eq!(expected_address, address.to_string()); assert_eq!(*expected_format, address.format); } fn test_to_str(expected_address: &str, address: &BitcoinAddress) { assert_eq!(expected_address, address.to_string()); } mod p2pkh_mainnet_compressed { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str); 5] = [ ( "L2o7RUmise9WoxNzmnVZeK83Mmt5Nn1NBpeftbthG5nsLWCzSKVg", "1GUwicFwsZbdE3XyJYjmPryiiuTiK7mZgS", ), ( "KzjKw25tuQoiDyQjUG38ZRNBdnfr5eMBnTsU4JahrVDwFCpRZP1J", "1J2shZV5b53GRVmTqmr3tJhkVbBML29C1z", ), ( "L2N8YRtxNMAVFAtxBt9PFSADtdvbmzFFHLSU61CtLdhYhrCGPfWh", "13TdfCiGPagApSJZu1o1Y3mpfqpp6oK2GB", ), ( "KwXH1Mu4FBtGN9nRn2VkBpienaVGZKvCAkZAdE96kK71dHR1oDRs", "1HaeDGHf3A2Uxeh3sKjVLYTn1hnEyuzLjF", ), ( "KwN7qiBnU4GNhboBhuPaPaFingTDKU4r27pGggwQYz865TvBT74V", "12WMrNLRosydPNNYM96dwk9jDv8rDRom3J", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2PKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2pkh_mainnet_uncompressed { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str); 5] = [ ( "5K9VY2kaJ264Pj4ygobGLk7JJMgZ2i6wQ9FFKEBxoFtKeAXPHYm", "18Bap2Lh5HJckiZcg8SYXoF5iPxkUoCN8u", ), ( "5KiudZRwr9wH5auJaW66WK3CGR1UzL7ZXiicvZEEaFScbbEt9Qs", "192JSK8wNP867JGxHNHay3obNSXqEyyhtx", ), ( "5KCxYELatMGyVZfZFcSAw1Hz4ngiURKS22x7ydNRxcXfUzhgWMH", "1NoZQSmjYHUZMbqLerwmT4xfe8A6mAo8TT", ), ( "5KT9CMP2Kgh2Afi8GbmFAHJXsH5DhcpH9KY3aH4Hkv5W6dASy7F", "1NyGFd49x4nqoau8RJvjf9tGZkoUNjwd5a", ), ( "5J4cXobHh2cF2MHpLvTFjEHZCtrNHzyDzKGE8LuST2VWP129pAE", "17nsg1F155BR6ie2miiLrSnMhF8GWcGq6V", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2PKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2pkh_testnet_compressed { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str); 5] = [ ( "cSCkpm1oSHTUtX5CHdQ4FzTv9qxLQWKx2SXMg22hbGSTNVcsUcCX", "mwCDgjeRgGpfTMY1waYAJF2dGz4Q5XAx6w", ), ( "cNp5uMWdh68Nk3pwShjxsSwhGPoCYgFvE1ANuPsk6qhcT4Jvp57n", "myH91eNrQKuuM7TeQYYddzL4URn6HiYbxW", ), ( "cN9aUHNMMLT9yqBJ3S5qnEPtP11nhT7ivkFK1FqNYQMozZPgMTjJ", "mho8tsQtF7fx2bPKudMcXvGpUVYRHHiH4m", ), ( "cSRpda6Bhog5SUyot96HSwSzn7FZNWzudKzoCzkgZrf9hUaL3Ass", "n3DgWHuAkg7eiPGH5gP8jeg3SbHBhuPJWS", ), ( "cTqLNf3iCaW61ofgmyf4ZxChUL8DZoCEPmNTCKRsexLSdNuGWQT1", "mjhMXrTdq4X1dcqTaNDjwGdVaJEGBKpCRj", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2PKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2pkh_testnet_uncompressed { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str); 5] = [ ( "934pVYUzZ7Sm4ZSP7MtXaQXAcMhZHpFHFBvzfW3epFgk5cWeYih", "my55YLK4BmM8AyUW5px2HSSKL4yzUE5Pho", ), ( "91dTfyLPPneZA6RsAXqNuT6qTQdAuuGVCUjmBtzgd1Tnd4RQT5K", "mw4afqNgGjn34okVmv9qH2WkvhfyTyNbde", ), ( "92GweXA6j4RCF3zHXGGy2ShJq6T7u9rrjmuYd9ktLHgNrWznzUC", "moYi3FQZKtcc66edT3uMwVQCcswenpNscU", ), ( "92QAQdzrEDkMExM9hHV5faWqKTdXcTgXguRBcyAyYqFCjVzhDLE", "mpRYQJ64ofurTCA3KKkaCjjUNqjYkUvB4w", ), ( "92H9Kf4ikaqNAJLc5tbwvbmiBWJzNDGtYmnvrigZeDVD3aqJ85Q", "mvqRXtgQKqumMosPY3dLvhdYsQJV2AswkA", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2PKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2sh_p2wpkh_mainnet { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str); 5] = [ ( "L3YPi4msjWdkqiH3ojfg3nwDmNYBrDScAtcugYBJSgsc3HTcqqjP", "38EMCierP738rgYVHjj1qJANHKgx1166TN", ), ( "KxxFoGgBdqqyGznT6he2wKYcFKm5urSANec7qjLeu3caEadSo5pv", "3Kc9Vqzi4eUn42g1KWewVPvtTpWpUwjNFv", ), ( "KziUnVFNBniwmvei7JvNJNcQZ27TDZe5VNn7ieRNK7QgMEVfKdo9", "3C2niRgmFP2kz47AAWASqq5nWobDke1AfJ", ), ( "Kx5veRe18jnV1rZiJA7Xerh5qLpwnbjV38r83sKcF1W9d1K2TGSp", "3Pai7Ly86pddxxwZ7rUhXjRJwog4oKqNYK", ), ( "L4RrcBy6hZMw3xD4eAFXDTWPhasd9N3rYrYgfiR9pnGuLdv7UsWZ", "3LW5tQGWBCiRLfCgk1FEUpwKoymFF8Lk7P", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2SH_P2WPKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2sh_p2wpkh_testnet { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str); 5] = [ ( "cSoLwgnCNXck57BGxdGRV4SQ42EUExV6ykdMK1RKwcEaB9MDZWki", "2N9e892o8DNZs25xHBwRPZLsrZK3dBsrH3d", ), ( "cQEUStvLToCNEQ6QGPyTmGFCTiMWWzQDkkj2tUPEiAzafybgUyu4", "2MwX52EZPfK1sq12H3ikgTybrUvKG62b9rV", ), ( "cRv6jkNhTNEL7563ezNuwWP9W7gEcjh19YbmHtTbrDUQsXF5PjoG", "2N2XaYpYxX6C6attRQ1NXJUgZdm861CPHJ7", ), ( "cNyZJwad53Y38RthGrmYyoHAtsT7cPisjW92HJ4RcAP1mC6xBpSm", "2N3HzUQ4DzfEbxYp3XtpEKBBSdBS1uc2DLk", ), ( "cUqEZZwzvdWv6pmnWV5eb68hNeWt3jDZgtCGf66rqk3bnbsXArVE", "2N5isk4qJHAKfLV987ePAqjLobJkrWVCuhj", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::P2SH_P2WPKH); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod bech32_mainnet { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str); 5] = [ ( "KyQ2StwnZ644hRLXdMrRUBGKT9WJcVVhnuzz2u528VHeAr5kFimR", "bc1qztqceddvavsxdgju4cz6z42tawu444m8uttmxg", ), ( "L3aeYHnEBqNt6tKTgUyweY9HvZ3mcLMsq7KQZkSu9Mj8Z1JN9oC2", "bc1q0s92yg9m0zqjjc07z5lhhlu3k6ue93fgzku2wy", ), ( "L3w7zoPzip7o6oXz3zVLNHbT2UyLBWuVG7uaEZDqneRjgjw9vmCE", "bc1q7rzq3xup0hdklkg6p8harn97zszuqwuaqc9l8t", ), ( "L2C75eEmRTU8yWeSwtQ6xeumoNVmCb2uEMfzuo5dkdMwpUWwYtRU", "bc1qgw90ly6jkpprh6g8atk5cxnwcavh4e0p2k3h65", ), ( "L2CJfT3w1VPDDLQfJKTmSb6gtSGyE1HxWYsitaq5Y1XLXTMC5Qmx", "bc1qgfzgf6pzuk7y88zk54nxluzg6dv9jett9suzuf", ), ]; const INVALID: [&str; 7] = [ "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5", // invalid checksum "BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", // invalid witness version "bc1rw5uspcuh", // invalid program length "bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", // invalid program length "BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", // invalid program length for witness version 0 (per BIP141) "bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", // invalid padding "bc1gmk9yu", // empty data section ]; #[test] fn from_invalid_address() { INVALID.iter().for_each(|invalid_bech32| { assert!(BitcoinAddress::::from_str(invalid_bech32).is_err()); }); } #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::Bech32); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod bech32_testnet { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str); 5] = [ ( "cVQmTtLoCjDJAXVj778xyww1ZbpJQt7Vq9sDt8Mdmw97Rg7TaNes", "tb1qmkvfprg8pkr3apv9gyykmhe26fexyla076ss0g", ), ( "cTxHRG8MgrnSQstuMs5VnQcFBjrs67NmiJGo1kevnJDS7QFGLUAi", "tb1qfe0dnfpxp4c9lfdjzvmf5q72jg83emgknmcxxd", ), ( "cSN1N2Vmhg9jPSUpXyQj8WbNUgeLHbC3Yj8SFX2N834YMepMwNZH", "tb1qx4jm2s3ks5vadh2ja3flsn4ckjzhdxmxmmrrzx", ), ( "cMvmoqYYzr4dgzNZ22PvaqSnNx98evXc1b7m8FfK9SdCqhiWdP2c", "tb1ql0g42pusevlgd0jh9gyr32s0h0pe96wpnrqg3m", ), ( "cVodD5ifcBjYVUs19GLwz6YzU2hUhdNagBx9QQcZp7TgjLuuFYn3", "tb1qwnh7hu5qfrjsk9pyn3vvmzr48v4l8kp4ug0txn", ), ]; const INVALID: [&str; 3] = [ "tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty", // invalid hrp "tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sL5k7", // Mixed case "tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", ]; #[test] fn from_invalid_address() { INVALID.iter().for_each(|invalid_bech32| { assert!(BitcoinAddress::::from_str(invalid_bech32).is_err()); }); } #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str::(address, &BitcoinFormat::Bech32); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } mod p2wsh_mainnet { use super::*; type N = Bitcoin; #[test] fn test_addr() { let script = "210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac"; let script_hex = hex::decode(script).unwrap(); let new_address = BitcoinAddress::::p2wsh(&script_hex).unwrap(); println!("address:{}", new_address); } } mod p2wsh_testnet { use super::*; type N = BitcoinTestnet; const SCRIPTPAIRS: [(&str, &str); 2] = [ ( "210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac", "tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7", ), ( "210253be79afe84fd9342c1f52024379b6da6299ea98844aee23838e8e678a765f7cac", "tb1qhmdep02f0jpjxs36ckyzjtfesknu8a8xmhnva7f3vw95t9g6q4ksaqhl9x", ), ]; #[test] fn from_str() { SCRIPTPAIRS.iter().for_each(|(script, address)| { let script_hex = hex::decode(script).unwrap(); let new_address = BitcoinAddress::::p2wsh(&script_hex).unwrap(); assert_eq!(new_address.to_string(), address.to_string()); assert_eq!(new_address.format, BitcoinFormat::P2WSH); }); } #[test] fn to_str() { SCRIPTPAIRS.iter().for_each(|(_, expected_address)| { let address = BitcoinAddress::::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } #[test] fn f() { let secret_key = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; let secret_key = libsecp256k1::SecretKey::parse(&secret_key).unwrap(); let formats = [ BitcoinFormat::P2PKH, BitcoinFormat::P2SH_P2WPKH, // BitcoinFormat::Bech32, // BitcoinFormat::CashAddr ]; for format in formats { let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!("{} {} address = \n{}\n", Bitcoin::NAME, format, address); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!( "{} {} address = \n{}\n", BitcoinTestnet::NAME, format, address ); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!("{} {} address = \n{}\n", BitcoinCash::NAME, format, address); let address = BitcoinAddress::::from_secret_key(&secret_key, &format) .unwrap(); println!( "{} {} address = \n{}\n", BitcoinCashTestnet::NAME, format, address ); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!("{} {} address = \n{}\n", Litecoin::NAME, format, address); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!( "{} {} address = \n{}\n", LitecoinTestnet::NAME, format, address ); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!("{} {} address = \n{}\n", Dogecoin::NAME, format, address); let address = BitcoinAddress::::from_secret_key(&secret_key, &format).unwrap(); println!( "{} {} address = \n{}\n", DogecoinTestnet::NAME, format, address ); } } #[test] fn ff() { let addr1 = "qzuu4gwvj0xjy4p7xj7n5gn4ewk4m3ujeqx3crgj59"; let addr2 = "qpkxa3xypl6rfp4nzewh9xrqnv90n2yxrcr0pmwas4"; let addr3 = "bchtest:qzuu4gwvj0xjy4p7xj7n5gn4ewk4m3ujeqx3crgj59"; let addr4 = "bitcoincash:qpkxa3xypl6rfp4nzewh9xrqnv90n2yxrcr0pmwas4"; let addr5 = "2MvtZ4txAvbaWRW2gXRmmrcUpQfsqNgpfUm"; let addr1 = BitcoinAddress::::from_str(addr1).unwrap(); let addr2 = BitcoinAddress::::from_str(addr2).unwrap(); let addr3 = BitcoinAddress::::from_str(addr3).unwrap(); let addr4 = BitcoinAddress::::from_str(addr4).unwrap(); let addr5 = BitcoinAddress::::from_str(addr5).unwrap(); println!( "address1 = {}\naddress2 = {}\naddress3 = {}\naddress4 = {}\naddress5 = {}", addr1, addr2, addr3, addr4, addr5, ); } #[test] fn test_decode_script() { let mut rng = thread_rng(); let sk = libsecp256k1::SecretKey::random(&mut rng); let addr = BitcoinAddress::::from_secret_key(&sk, &BitcoinFormat::P2PKH).unwrap(); println!("{}", addr); let script = create_script_pub_key(&addr).unwrap(); let addr = BitcoinAddress::::from_script_pub_key(&script).unwrap(); println!("{}", addr); let sk = libsecp256k1::SecretKey::random(&mut rng); let addr = BitcoinAddress::::from_secret_key(&sk, &BitcoinFormat::P2SH_P2WPKH).unwrap(); println!("{}", addr); let script = create_script_pub_key(&addr).unwrap(); let addr = BitcoinAddress::::from_script_pub_key(&script).unwrap(); println!("{}", addr); let sk = libsecp256k1::SecretKey::random(&mut rng); let addr = BitcoinAddress::::from_secret_key(&sk, &BitcoinFormat::Bech32).unwrap(); println!("{}", addr); let script = create_script_pub_key(&addr).unwrap(); let addr = BitcoinAddress::::from_script_pub_key(&script).unwrap(); println!("{}", addr); let sk = libsecp256k1::SecretKey::random(&mut rng); let addr = BitcoinAddress::::p2wsh_from_hash(&Sha256::digest(sk.serialize())).unwrap(); println!("{}", addr); let script = create_script_pub_key(&addr).unwrap(); let addr = BitcoinAddress::::from_script_pub_key(&script).unwrap(); println!("{}", addr); let sk = libsecp256k1::SecretKey::random(&mut rng); let addr = BitcoinAddress::::from_secret_key(&sk, &BitcoinFormat::CashAddr).unwrap(); println!("{}", addr); let script = create_script_pub_key(&addr).unwrap(); let addr = BitcoinAddress::::from_script_pub_key(&script).unwrap(); println!("{}", addr); } } ================================================ FILE: crates/anychain-bitcoin/src/amount.rs ================================================ use anychain_core::{Amount, AmountError}; use core::fmt; use serde::Serialize; use std::ops::{Add, Sub}; // Number of satoshis (base unit) per BTC const COIN: i64 = 1_0000_0000; /// Represents the amount of Bitcoin in satoshis #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct BitcoinAmount(pub i64); pub enum Denomination { // sat Satoshi, // uBTC (bit) MicroBit, // mBTC MilliBit, // cBTC CentiBit, // dBTC DeciBit, // BTC Bitcoin, } impl Denomination { /// The number of decimal places more than a satoshi. fn precision(self) -> u32 { match self { Denomination::Satoshi => 0, Denomination::MicroBit => 2, Denomination::MilliBit => 5, Denomination::CentiBit => 6, Denomination::DeciBit => 7, Denomination::Bitcoin => 8, } } } impl fmt::Display for Denomination { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "{}", match self { Denomination::Satoshi => "satoshi", Denomination::MicroBit => "uBTC", Denomination::MilliBit => "mBTC", Denomination::CentiBit => "cBTC", Denomination::DeciBit => "dBTC", Denomination::Bitcoin => "BTC", } ) } } impl Amount for BitcoinAmount {} impl BitcoinAmount { /// The zero amount. pub const ZERO: BitcoinAmount = BitcoinAmount(0); /// Exactly one satoshi. pub const ONE_SAT: BitcoinAmount = BitcoinAmount(1); /// Exactly one bitcoin. pub const ONE_BTC: BitcoinAmount = BitcoinAmount(COIN); pub fn from_satoshi(satoshis: i64) -> Result { Ok(Self(satoshis)) } pub fn from_ubtc(ubtc_value: i64) -> Result { let satoshis = ubtc_value * 10_i64.pow(Denomination::MicroBit.precision()); Self::from_satoshi(satoshis) } pub fn from_mbtc(mbtc_value: i64) -> Result { let satoshis = mbtc_value * 10_i64.pow(Denomination::MilliBit.precision()); Self::from_satoshi(satoshis) } pub fn from_cbtc(cbtc_value: i64) -> Result { let satoshis = cbtc_value * 10_i64.pow(Denomination::CentiBit.precision()); Self::from_satoshi(satoshis) } pub fn from_dbtc(dbtc_value: i64) -> Result { let satoshis = dbtc_value * 10_i64.pow(Denomination::DeciBit.precision()); Self::from_satoshi(satoshis) } pub fn from_btc(btc_value: i64) -> Result { let satoshis = btc_value * 10_i64.pow(Denomination::Bitcoin.precision()); Self::from_satoshi(satoshis) } } impl Add for BitcoinAmount { type Output = Result; fn add(self, rhs: Self) -> Self::Output { Self::from_satoshi(self.0 + rhs.0) } } impl Sub for BitcoinAmount { type Output = Result; fn sub(self, rhs: Self) -> Self::Output { Self::from_satoshi(self.0 - rhs.0) } } impl fmt::Display for BitcoinAmount { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } } #[cfg(test)] mod tests { use super::*; fn test_from_satoshi(sat_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_satoshi(sat_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_from_ubtc(ubtc_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_ubtc(ubtc_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_from_mbtc(mbtc_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_mbtc(mbtc_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_from_cbtc(cbtc_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_cbtc(cbtc_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_from_dbtc(dbtc_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_dbtc(dbtc_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_from_btc(btc_value: i64, expected_amount: BitcoinAmount) { let amount = BitcoinAmount::from_btc(btc_value).unwrap(); assert_eq!(expected_amount, amount) } fn test_addition(a: &i64, b: &i64, result: &i64) { let a = BitcoinAmount::from_satoshi(*a).unwrap(); let b = BitcoinAmount::from_satoshi(*b).unwrap(); let result = BitcoinAmount::from_satoshi(*result).unwrap(); assert_eq!(result, a.add(b).unwrap()); } fn test_subtraction(a: &i64, b: &i64, result: &i64) { let a = BitcoinAmount::from_satoshi(*a).unwrap(); let b = BitcoinAmount::from_satoshi(*b).unwrap(); let result = BitcoinAmount::from_satoshi(*result).unwrap(); assert_eq!(result, a.sub(b).unwrap()); } pub struct AmountDenominationTestCase { satoshi: i64, micro_bit: i64, milli_bit: i64, centi_bit: i64, deci_bit: i64, bitcoin: i64, } mod valid_conversions { use super::*; const TEST_AMOUNTS: [AmountDenominationTestCase; 5] = [ AmountDenominationTestCase { satoshi: 0, micro_bit: 0, milli_bit: 0, centi_bit: 0, deci_bit: 0, bitcoin: 0, }, AmountDenominationTestCase { satoshi: 100000000, micro_bit: 1000000, milli_bit: 1000, centi_bit: 100, deci_bit: 10, bitcoin: 1, }, AmountDenominationTestCase { satoshi: 100000000000, micro_bit: 1000000000, milli_bit: 1000000, centi_bit: 100000, deci_bit: 10000, bitcoin: 1000, }, AmountDenominationTestCase { satoshi: 123456700000000, micro_bit: 1234567000000, milli_bit: 1234567000, centi_bit: 123456700, deci_bit: 12345670, bitcoin: 1234567, }, AmountDenominationTestCase { satoshi: 2100000000000000, micro_bit: 21000000000000, milli_bit: 21000000000, centi_bit: 2100000000, deci_bit: 210000000, bitcoin: 21000000, }, ]; #[test] fn test_satoshi_conversion() { TEST_AMOUNTS.iter().for_each(|amounts| { test_from_satoshi(amounts.satoshi, BitcoinAmount(amounts.satoshi)) }); } #[test] fn test_ubtc_conversion() { TEST_AMOUNTS.iter().for_each(|amounts| { test_from_ubtc(amounts.micro_bit, BitcoinAmount(amounts.satoshi)) }); } #[test] fn test_mbtc_conversion() { TEST_AMOUNTS.iter().for_each(|amounts| { test_from_mbtc(amounts.milli_bit, BitcoinAmount(amounts.satoshi)) }); } #[test] fn test_cbtc_conversion() { TEST_AMOUNTS.iter().for_each(|amounts| { test_from_cbtc(amounts.centi_bit, BitcoinAmount(amounts.satoshi)) }); } #[test] fn test_dbtc_conversion() { TEST_AMOUNTS.iter().for_each(|amounts| { test_from_dbtc(amounts.deci_bit, BitcoinAmount(amounts.satoshi)) }); } #[test] fn test_btc_conversion() { TEST_AMOUNTS .iter() .for_each(|amounts| test_from_btc(amounts.bitcoin, BitcoinAmount(amounts.satoshi))); } } mod valid_arithmetic { use super::*; const TEST_VALUES: [(i64, i64, i64); 7] = [ (0, 0, 0), (1, 2, 3), (100000, 0, 100000), (123456789, 987654321, 1111111110), (100000000000000, 2000000000000000, 2100000000000000), (-100000000000000, -2000000000000000, -2100000000000000), (1000000, -1000000, 0), ]; #[test] fn test_valid_addition() { TEST_VALUES .iter() .for_each(|(a, b, c)| test_addition(a, b, c)); } #[test] fn test_valid_subtraction() { TEST_VALUES .iter() .for_each(|(a, b, c)| test_subtraction(c, b, a)); } } mod test_invalid { use super::*; mod test_invalid_conversion { use super::*; const INVALID_TEST_AMOUNTS: [AmountDenominationTestCase; 4] = [ AmountDenominationTestCase { satoshi: 1, micro_bit: 1, milli_bit: 1, centi_bit: 1, deci_bit: 1, bitcoin: 1, }, AmountDenominationTestCase { satoshi: 1, micro_bit: 10, milli_bit: 100, centi_bit: 1000, deci_bit: 1000000, bitcoin: 100000000, }, AmountDenominationTestCase { satoshi: 123456789, micro_bit: 1234567, milli_bit: 1234, centi_bit: 123, deci_bit: 12, bitcoin: 1, }, AmountDenominationTestCase { satoshi: 2100000000000000, micro_bit: 21000000000000, milli_bit: 21000000000, centi_bit: 2100000000, deci_bit: 210000000, bitcoin: 20999999, }, ]; #[should_panic] #[test] fn test_invalid_ubtc_conversion() { INVALID_TEST_AMOUNTS.iter().for_each(|amounts| { test_from_ubtc(amounts.micro_bit, BitcoinAmount(amounts.satoshi)) }); } #[should_panic] #[test] fn test_invalid_mbtc_conversion() { INVALID_TEST_AMOUNTS.iter().for_each(|amounts| { test_from_mbtc(amounts.milli_bit, BitcoinAmount(amounts.satoshi)) }); } #[should_panic] #[test] fn test_invalid_cbtc_conversion() { INVALID_TEST_AMOUNTS.iter().for_each(|amounts| { test_from_cbtc(amounts.centi_bit, BitcoinAmount(amounts.satoshi)) }); } #[should_panic] #[test] fn test_invalid_dbtc_conversion() { INVALID_TEST_AMOUNTS.iter().for_each(|amounts| { test_from_dbtc(amounts.deci_bit, BitcoinAmount(amounts.satoshi)) }); } #[should_panic] #[test] fn test_invalid_btc_conversion() { INVALID_TEST_AMOUNTS.iter().for_each(|amounts| { test_from_btc(amounts.bitcoin, BitcoinAmount(amounts.satoshi)) }); } } mod invalid_arithmetic { use super::*; const TEST_VALUES: [(i64, i64, i64); 8] = [ (0, 0, 1), (1, 2, 5), (100000, 1, 100000), (123456789, 123456789, 123456789), (-1000, -1000, 2000), (2100000000000000, 1, 2100000000000001), (2100000000000000, 2100000000000000, 4200000000000000), (-2100000000000000, -2100000000000000, -4200000000000000), ]; #[should_panic] #[test] fn test_invalid_addition() { TEST_VALUES .iter() .for_each(|(a, b, c)| test_addition(a, b, c)); } #[should_panic] #[test] fn test_invalid_subtraction() { TEST_VALUES .iter() .for_each(|(a, b, c)| test_subtraction(a, b, c)); } } } } ================================================ FILE: crates/anychain-bitcoin/src/format.rs ================================================ use crate::Prefix; use anychain_core::no_std::*; use anychain_core::{AddressError, Format}; use core::fmt; use core::str::FromStr; use serde::Serialize; /// Represents the format of a Bitcoin address #[derive(Serialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[allow(non_camel_case_types)] pub enum BitcoinFormat { /// Pay-to-Pubkey Hash, e.g. 1NoZQSmjYHUZMbqLerwmT4xfe8A6mAo8TT P2PKH, /// Pay-to-Script Hash, e.g. 34AgLJhwXrvmkZS1o5TrcdeevMt22Nar53 //P2SH, /// Pay-to-Witness-Script Hash, e.g. bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3 P2WSH, /// SegWit Pay-to-Witness-Public-Key Hash, e.g. 34AgLJhwXrvmkZS1o5TrcdeevMt22Nar53 P2SH_P2WPKH, /// Bech32, e.g. bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx Bech32, /// CashAddr, e.g. bitcoincash:qpkxa3xypl6rfp4nzewh9xrqnv90n2yxrcr0pmwas4 CashAddr, } impl Format for BitcoinFormat {} impl BitcoinFormat { /// Returns the format of the given address prefix. pub fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::AddressPrefix(prefix) => match prefix.as_str() { "bc" | "tb" | "ltc" | "tltc" => Ok(Self::Bech32), "bitcoincash" | "bchtest" => Ok(Self::CashAddr), _ => Err(AddressError::Message(format!( "Unrecognized address prefix {}", prefix, ))), }, Prefix::Version(version) => match version { 0x00 | 0x6f | 0x1e | 0x71 | 0x30 => Ok(Self::P2PKH), 0x05 | 0xc4 | 0x16 | 0x32 | 0x3a => Ok(Self::P2SH_P2WPKH), _ => Err(AddressError::Message(format!( "Unrecognized version byte {}", version, ))), }, } } } impl fmt::Display for BitcoinFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { BitcoinFormat::P2PKH => write!(f, "p2pkh"), BitcoinFormat::P2WSH => write!(f, "p2wsh"), BitcoinFormat::P2SH_P2WPKH => write!(f, "p2sh_p2wpkh"), BitcoinFormat::Bech32 => write!(f, "bech32"), BitcoinFormat::CashAddr => write!(f, "cash_addr"), } } } impl FromStr for BitcoinFormat { type Err = AddressError; fn from_str(format: &str) -> Result { match format { "p2pkh" => Ok(BitcoinFormat::P2PKH), "p2sh_p2wpkh" => Ok(BitcoinFormat::P2SH_P2WPKH), "p2wsh" => Ok(BitcoinFormat::P2WSH), "bech32" => Ok(BitcoinFormat::Bech32), "cash_addr" => Ok(BitcoinFormat::CashAddr), _ => Err(AddressError::Message(format!( "Unrecognized bitcoin address format {}", format, ))), } } } ================================================ FILE: crates/anychain-bitcoin/src/lib.rs ================================================ #![cfg_attr(not(feature = "std"), no_std)] #![warn(unused_extern_crates)] // #![forbid(unsafe_code)] #[macro_use] extern crate thiserror; pub mod address; pub use self::address::*; pub mod format; pub use self::format::*; pub mod network; pub use self::network::*; pub mod public_key; pub use self::public_key::*; pub mod witness_program; pub use self::witness_program::*; pub mod transaction; pub use self::transaction::*; pub mod amount; pub use self::amount::*; ================================================ FILE: crates/anychain-bitcoin/src/network/bitcoin.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct Bitcoin; impl Network for Bitcoin { const NAME: &'static str = "bitcoin"; } impl BitcoinNetwork for Bitcoin { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0x05)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("bc".to_string())), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x00 | 0x05 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "bc" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for Bitcoin { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for Bitcoin { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/bitcoin_testnet.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct BitcoinTestnet; impl Network for BitcoinTestnet { const NAME: &'static str = "bitcoin testnet"; } impl BitcoinNetwork for BitcoinTestnet { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x6f)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0xc4)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("tb".to_string())), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x6f | 0xc4 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "tb" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for BitcoinTestnet { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for BitcoinTestnet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/bitcoincash.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct BitcoinCash; impl Network for BitcoinCash { const NAME: &'static str = "bitcoin cash"; } impl BitcoinNetwork for BitcoinCash { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0x05)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("bc".to_string())), BitcoinFormat::CashAddr => Ok(Prefix::AddressPrefix("bitcoincash".to_string())), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x00 | 0x05 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "bc" | "bitcoincash" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 or CashAddr prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for BitcoinCash { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for BitcoinCash { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/bitcoincash_testnet.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct BitcoinCashTestnet; impl Network for BitcoinCashTestnet { const NAME: &'static str = "bitcoin cash testnet"; } impl BitcoinNetwork for BitcoinCashTestnet { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x6f)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0xc4)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("tb".to_string())), BitcoinFormat::CashAddr => Ok(Prefix::AddressPrefix("bchtest".to_string())), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x6f | 0xc4 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "tb" | "bchtest" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 or CashAddr prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for BitcoinCashTestnet { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for BitcoinCashTestnet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/dogecoin.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct Dogecoin; impl Network for Dogecoin { const NAME: &'static str = "dogecoin"; } impl BitcoinNetwork for Dogecoin { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x1e)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0x16)), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x1e | 0x16 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, _ => Err(AddressError::Message(format!( "{} does not support address format Bech32 or CashAddr", Self::NAME, ))), } } } impl FromStr for Dogecoin { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for Dogecoin { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/dogecoin_testnet.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct DogecoinTestnet; impl Network for DogecoinTestnet { const NAME: &'static str = "dogecoin testnet"; } pub static mut LOOP: u8 = 0; impl BitcoinNetwork for DogecoinTestnet { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x71)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0xc4)), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x71 | 0xc4 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, _ => Err(AddressError::Message(format!( "{} does not support address format Bech32 or CashAddr", Self::NAME, ))), } } } impl FromStr for DogecoinTestnet { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for DogecoinTestnet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/litecoin.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct Litecoin; impl Network for Litecoin { const NAME: &'static str = "litecoin"; } impl BitcoinNetwork for Litecoin { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x30)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0x32)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("ltc".to_string())), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x30 | 0x32 => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "ltc" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for Litecoin { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for Litecoin { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/litecoin_testnet.rs ================================================ use crate::{BitcoinFormat, BitcoinNetwork, Prefix}; use anychain_core::no_std::*; use anychain_core::{AddressError, Network, NetworkError}; use core::{fmt, str::FromStr}; use serde::Serialize; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] pub struct LitecoinTestnet; impl Network for LitecoinTestnet { const NAME: &'static str = "litecoin testnet"; } impl BitcoinNetwork for LitecoinTestnet { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result { match format { BitcoinFormat::P2PKH => Ok(Prefix::Version(0x6f)), BitcoinFormat::P2WSH => Ok(Prefix::Version(0x00)), BitcoinFormat::P2SH_P2WPKH => Ok(Prefix::Version(0x3a)), BitcoinFormat::Bech32 => Ok(Prefix::AddressPrefix("tltc".to_string())), f => Err(AddressError::Message(format!( "{} does not support address format {}", Self::NAME, f, ))), } } /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result { match prefix { Prefix::Version(version) => match version { 0x6f | 0x3a => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid version byte {:#0x} for {} network", version, Self::NAME, ))), }, Prefix::AddressPrefix(prefix) => match prefix.as_str() { "tltc" => Ok(Self), _ => Err(AddressError::Message(format!( "Invalid Bech32 prefix for {} network", Self::NAME, ))), }, } } } impl FromStr for LitecoinTestnet { type Err = NetworkError; fn from_str(s: &str) -> Result { match s { Self::NAME => Ok(Self), _ => Err(NetworkError::InvalidNetwork(s.into())), } } } impl fmt::Display for LitecoinTestnet { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", Self::NAME) } } ================================================ FILE: crates/anychain-bitcoin/src/network/mod.rs ================================================ use crate::format::BitcoinFormat; use anychain_core::no_std::*; use anychain_core::{AddressError, Network}; pub mod bitcoin; pub use self::bitcoin::*; pub mod bitcoin_testnet; pub use self::bitcoin_testnet::*; pub mod bitcoincash; pub use self::bitcoincash::*; pub mod bitcoincash_testnet; pub use self::bitcoincash_testnet::*; pub mod litecoin; pub use self::litecoin::*; pub mod litecoin_testnet; pub use self::litecoin_testnet::*; pub mod dogecoin; pub use self::dogecoin::*; pub mod dogecoin_testnet; pub use self::dogecoin_testnet::*; /// The interface for a Bitcoin network. pub trait BitcoinNetwork: Network { /// Returns the address prefix of the given network. fn to_address_prefix(format: BitcoinFormat) -> Result; /// Returns the network of the given address prefix. fn from_address_prefix(prefix: Prefix) -> Result; } #[derive(Clone)] pub enum Prefix { // address prefix of utxo compatible blockchains AddressPrefix(String), // version byte prepended to the hash160 Version(u8), } impl Prefix { pub fn version(self) -> u8 { if let Self::Version(version) = self { version } else { panic!("Attempt to get version byte from an AddressPrefix"); } } pub fn prefix(self) -> String { if let Self::AddressPrefix(prefix) = self { prefix } else { panic!("Attempt to get prefix from a version"); } } pub fn from_version(version: u8) -> Self { Self::Version(version) } pub fn from_prefix(prefix: &str) -> Self { Self::AddressPrefix(prefix.to_string()) } } ================================================ FILE: crates/anychain-bitcoin/src/public_key.rs ================================================ use crate::{BitcoinAddress, BitcoinFormat, BitcoinNetwork}; use anychain_core::{hex, Address, AddressError, PublicKey, PublicKeyError}; use core::{fmt, marker::PhantomData, str::FromStr}; /// Represents a Bitcoin public key #[derive(Debug, Clone, PartialEq, Eq)] pub struct BitcoinPublicKey { /// The ECDSA public key public_key: libsecp256k1::PublicKey, /// If true, the public key is serialized in compressed form compressed: bool, /// PhantomData _network: PhantomData, } impl PublicKey for BitcoinPublicKey { type SecretKey = libsecp256k1::SecretKey; type Address = BitcoinAddress; type Format = BitcoinFormat; /// Returns the address corresponding to the given public key. fn from_secret_key(secret_key: &Self::SecretKey) -> Self { Self { public_key: libsecp256k1::PublicKey::from_secret_key(secret_key), compressed: true, _network: PhantomData, } } /// Returns the address of the corresponding private key. fn to_address(&self, format: &Self::Format) -> Result { Self::Address::from_public_key(self, format) } } impl BitcoinPublicKey { /// Returns a public key given a secp256k1 public key. pub fn from_secp256k1_public_key( public_key: libsecp256k1::PublicKey, compressed: bool, ) -> Self { Self { public_key, compressed, _network: PhantomData, } } /// Returns the secp256k1 public key of the public key. pub fn to_secp256k1_public_key(&self) -> libsecp256k1::PublicKey { self.public_key } /// Serialize the Bitcoin public key as a vector of u8 pub fn serialize(&self) -> Vec { match self.compressed { true => self.public_key.serialize_compressed().to_vec(), false => self.public_key.serialize().to_vec(), } } /// Returns `true` if the public key is in compressed form. pub fn is_compressed(&self) -> bool { self.compressed } } impl FromStr for BitcoinPublicKey { type Err = PublicKeyError; fn from_str(public_key: &str) -> Result { let compressed = public_key.len() == 66; let p = hex::decode(public_key) .map_err(|error| PublicKeyError::Crate("hex", format!("{:?}", error)))?; let public_key = libsecp256k1::PublicKey::parse_slice(&p, None) .map_err(|error| PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)))?; Ok(Self { public_key, compressed, _network: PhantomData, }) } } impl fmt::Display for BitcoinPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.compressed { for s in &self.public_key.serialize_compressed()[..] { write!(f, "{:02x}", s)?; } } else { for s in &self.public_key.serialize()[..] { write!(f, "{:02x}", s)?; } } Ok(()) } } #[cfg(test)] mod tests { use super::*; use crate::network::*; fn test_to_address( expected_address: &BitcoinAddress, expected_format: &BitcoinFormat, public_key: &BitcoinPublicKey, ) { let address = public_key.to_address(expected_format).unwrap(); assert_eq!(*expected_address, address); } fn test_from_str( expected_public_key: &str, expected_address: &str, expected_compressed: bool, expected_format: &BitcoinFormat, ) { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); let address = public_key.to_address(expected_format).unwrap(); assert_eq!(expected_public_key, public_key.to_string()); assert_eq!(expected_compressed, public_key.compressed); assert_eq!(expected_address, address.to_string()); assert_eq!(*expected_format, address.format()); } fn test_to_str(expected_public_key: &str, public_key: &BitcoinPublicKey) { assert_eq!(expected_public_key, public_key.to_string()); } mod p2pkh_mainnet_compressed { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "L5hax5dZaByC3kJ4aLrZgnMXGSQReqRDYNqM1VAeXpqDRkRjX42H", "039ed714bf521e96e3f3609b74da898e44d0fb64ba68c62c57852470ffc28e3db5", "1uNM6oivjCJU2RcsNbfooVwcPjDRhjW7U", ), ( "L4uNhZS86VLiKKGZZGNxwP7s67EfYfQ7S9bNnVfVbU9GBVVo2xoD", "03a385ac59a31841764d55e7c8a243482a89073785524f0c45335afcf425d567b1", "16sz5SMFeRfwaqY6wKzkiufwPmF1J7RhAx", ), ( "KyH2BrThuUnzSXxDrDxQbpK277HxZfwPxVaCs5cwbzDEVNno2nts", "028fa046ccfbb4ff134a5e0e8969d8085c6e2a1a52d793d351d4ddf02cd43d64b2", "17QAwDwsLpehmCqSQXdHZb8vpsYVDnX7ic", ), ( "KxEqpgCMencSHwiCG6xix9teUrB7JQNy2c7LKU56fZKZtP46nEca", "02f7fb7e7d5dc97a5e1cd36b1ea3218234649f98f32cf08f45f8cd742860f676bf", "1ESGcxbb96gQmJuEQsSapdk1jH6JaEnbU9", ), ( "L2gCQPMpS5PqGvcBFMtYRT5S5jAo6WaNL1aPLvY2JkykkKSkqtm5", "02aad3c8ee3dc6753a5284c97124f0047b2af0b91ba256b6262e07fcc2630f6b7f", "1MRCogND3SKqa4xRZNpSC6iQxtwCpvmzfE", ), ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2PKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, true, &BitcoinFormat::P2PKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } mod p2pkh_mainnet_uncompressed { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "5KV26gjX4sYAkXvDnqZZuEyFUh1DKjgZ8wTKL7Fpm4ppJ8kpZQu", "0489efe59c51e542f4cc7e2464ba3835d0a1a3daf351e70db57053c4712aca58796a933d1331078c364b94dd53aba2357a01f446c22efedcea8ebce2167a9e1df8", "1KGHasyEpQZSHLea2GV3taTFZcw3uP7AAJ" ), ( "5JUfnMYvM4g94psa1p2MUfQptbiouXYbb5oskjY7mZ151rXDFTi", "04cf0ead0ea5df0700a4f063edf40397b377147d99f8f9404606e80dd931c819d2b571ab64754d27e69de5226f316e2dcab9f8b3b706d08104bcfe06f0e6dc7ff3", "1Ja8ReiHyPwNdWHZdJZVN9ZV6cNzC8DbTy" ), ( "5K2enrnWqJcQuHLeijT76YEqDagWo3cQLnPYk2CezrJ7A61QG5y", "04a215f5764beef937296f6797407e51b8823eb418c3d65f48c0950ee775504c3539ca06ef419c7c70cbdf30930c25b5abb8040a89e089b786363c2bd78a07f464", "1PvWPvCZV4mQACqXp3AsFvQHtyfq2eZG9c" ), ( "5JnV7DtVZvwbVeRLvXQSzyg5WxMYJMEQbJk8VoYhzDTz4tawudY", "04005e271fa3305bac32c5951fb84b35303b1231817e538aa5af6b145faae409a01f9e8c0330f4901577aacd43682fe2af39e69dcfaa7cff7390c006b3b66e90ad", "1FCHrsTrzxJy3sq1pQKLBQojuvYyMBzs4g" ), ( "5KVeWqioENjhaYZqXZX4nEfwEysJjXEvYfaeQx4pM2HK51ZW7Ur", "04b6c8c8a6e9ad27366d8e6a0fa6c11f15ad7a8f15ac0c1d38c714df1f6b00b102773c7ebb0d718fc93808fdaf6c6b4ff6213909d50a94d5d6c8b472a9d1f30d99", "1Hb6umXZs26hUZMt59nbkTAAfMpsmTkCBs" ) ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2PKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, false, &BitcoinFormat::P2PKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } mod p2pkh_testnet_compressed { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "cNB6GpygWSZNRG5hotKjdAaNfgrzx984QYb2uj9rHpaCDkyy2aAz", "02bc25a326a8fa59edd1a2adff51956ea3c61f404cff6e926225b3fe3b303561ac", "mkerhifaLqJgAgrAjLomUStznPgVewNkka", ), ( "cW4GQXEykwWJHVfRH8u25MzpzaU5XQDekdpdQbj9f9V7PLm25m4n", "02e21263a700b22c16088dc45fb10d38cc8c4ebb4cdcb612e6551d972b60aa2446", "n3NUsMjN3D6EWZ5nKZLvHnVwaAxfybQDq9", ), ( "cSA6Mo1PYYK2uaDH22KoreQZdkSLobcrxZwnLcotDiYocCSjCVXy", "0355210590fbe6dcb663c6166cd5cb169169e0d4bac76ce78d4ac29ddf683b2541", "mzt1DhTJMzXarvJukPUxnfA1syVhDuZapf", ), ( "cUVDoLpgXFYZGmjoyMusNEZJ174wk8ggjyH2Uo7L5nB1w5werAjX", "0259b863ba239379d6ebee4074b6f9c9f7f23a581ff529aa8d1431d94cb2f3cd99", "mxe1oRLS21dEqt6H77GPGUx59Zj4ucUBbc", ), ( "cRhBWs3Bg9oXERSEY8GLaZjN7eb1FmkCnRdmwjCG2pVXVPUqXNiT", "02826afccd44e32a9542f72a3a7753b99dbaf4a800bb70b6155510b1ce7a4bf607", "mpvYGW4UNjYRaQ1adpE8ThYNXCVkWjhAPb", ), ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2PKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, true, &BitcoinFormat::P2PKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } mod p2pkh_testnet_uncompressed { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "93W1kMkD1kAfevtDQ3LWortt8zjKqSSqonLxPvWFqg57arcwUru", "048bb370869871417660abdacebf25f786e69c6e861b1c11346071cc9ad69690c2dc19fd3965455afc9a662feef3432b88cc99e31fa30ba93993ca21322e43e894", "n4jx6NanXkXu7XSZrXBMKsFccxcp35UtJv" ), ( "92FshhFbVnbtpbvpdzGmKEnNkToJnvm6L45LhDQqn1Kxjp8d4oR", "04092301037dc083952053ccd320b5e12b30839fa0380d8a2c27547de4a527806962c5d1efc9e748cf6003fcc7ff0784caee9fa36d9b7ea330a613e4b71f8df0f9", "n47WkmoSwebNXyvbkRdubZmFbGm5SbKh1A" ), ( "92PbnSrnyLzS2HBNy4Vh2zg9hkVrztdxxDFihz92rBDyX25xF8N", "043e8f6512364e73a695f2b14b284a1c58ca9cbac2d8dd7dcf15f135260e87f1d0f89270f5a8d76b4e611861d68c955dc1524df4c20bb080bf0c0f536383379f91", "n3TWdpM742F8mxkcWQw8h2cifxyy82V2ov" ), ( "92SbtaaCwUuHmzYGdi9xp5GbfUivbLHTAkqxeWaX88E1Q9HZJfs", "0402acd5144558b5e779dead4c9e9b733e00b6e0554a243433bfccc730923a0beacd93f2b73c75f67d65fb830bde1cf101a8daea12ee3b659ef31fa274f52435d0", "muFcYctkUkfWW55n2GMUafkw71kbZuduNv" ), ( "91sSacE166SmPMoysEfZrQmM9aHgSfZbEfjmMf6nY8qBgvQMB1i", "04c8d1e7d88969b4345c874f50af41b8d310dd666c0a3df52c46c238a345fbda73165fccdedffb67390e87e81040bff8415b8d7c5a6bbc441c89841cb74012501d", "mwSgCKvDt3SoBxa3RZB1kXbxzX3oMvXxvT" ) ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2PKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, false, &BitcoinFormat::P2PKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } mod p2sh_p2wpkh_mainnet { use super::*; type N = Bitcoin; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "KyTx39W9vjeGRRjvZna5bbFGEpuih9pG5KBnxUJN7bChpGHHZuJN", "02468791fee1444df3a6e786e2f9da79198f8902387e1fa5a2c051950c4df51ab4", "3QKTruktKRSmY3QfhoijwT1BU1npSGMQPG", ), ( "L4EYurAwjsXiQrZ9XWdWdf5LDVAGAwGW58LtgZhGtR1cXUjS8oWD", "024a185e896e5cf4cb0b441a18b5eac1a682e1848731449a5bb4c4a55c6d0fac3f", "3JU5wvE4YrpZ5CgwpALBJB1C4YJjuZjXhj", ), ( "KyMSREGeHw2fnaRhTn1Cq9HYot9QR9AyUX6z8RbRF5Zr98qdmTjJ", "0337893947d9738d6d026bd5fa86d3c563ebc5840916d0ea50b143a83db7ef9de7", "3NzBJJPE3gaq5T9bmLJR4iHhmSHTgJdus4", ), ( "L5DtYc8LkDBQWWUAsWcgQZZqpVfUYCLyHZveGXKGT2hCS4pnnmqp", "03eb86647457f2dfda66e7574d26cc4a6ecca472bc2ff331f333eb21614a0c58ee", "3JUHwBJu1Figs4FesZPCgfBQKJC4GHjwPa", ), ( "L4GoufTyWZoy1WDzRDacywokD28C7amVH9Jyfsyr8XZpR8Pog7gK", "025195d4c21c7001103649f0bfb37f61a0da1e345e5847b005dbd10f0b7b7f9e6f", "3L6rBuHhf3MzY1qEXMxeyY18bo8H8uKb4D", ), ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2SH_P2WPKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, true, &BitcoinFormat::P2SH_P2WPKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } mod p2sh_p2wpkh_testnet { use super::*; type N = BitcoinTestnet; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "cPYtDeoeHg3wXp7hzcZ8Bu51HtN74yNdSDtdRuXamKCyzvU2oQM2", "025718c5ebfbbb3566bf4757ca57822377eca9be9ace4d038052156dfe73f4c439", "2Mt46mJZ8i7x2eiN77MekrD4UJg6GFt9mUh", ), ( "cMyPKTkYyhZS9cvrxkJZKFLEtqML6suBuDyZfFKXqGeHvnEPaD3x", "0236cd9b36cc3e08bf457ff6663b66d049ad942253d52bd5d939ea654d872bd5f3", "2MvRwrFLhxfwP96t6z6Th28No4Va19fogj3", ), ( "cTWWzheif86K9fouCo5gg1G4pEdGbLRrnHbY3uRr6AmhjKwNUrGh", "021779b92c6a29c0bb554af8a059d51e08c900ca652fac13c1dab62da34016b722", "2N1STUKnC6atTS2JttzdbP1891sCrD5i6xu", ), ( "cV2L63nMM3WZwrU9EKFFP218XAQBhsDmEQ9uTw3vhMAz25Gna9nF", "032a1af62e21831cc0951daf4f2e8f457bc59a4dc716e86f066b4de40020c9c8f1", "2N8mGnLgSL8GUyDELStD4YVGawdai52ax9q", ), ( "cTB6EeZgiGCziMQycbUCbn25AkipGACtY1Lyd1rAhGnTPEwHSHQT", "027ebe9c4c3d976c490d34aad11d66558b052e6359925f8b33e51428dfdf59ad79", "2N2JVpNUWsnV4MZMF11ewG2BVjhHoVNkv6K", ), ]; #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = BitcoinAddress::::from_str(address).unwrap(); let public_key = BitcoinPublicKey::::from_str(public_key).unwrap(); test_to_address(&address, &BitcoinFormat::P2SH_P2WPKH, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str::( expected_public_key, expected_address, true, &BitcoinFormat::P2SH_P2WPKH, ); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = BitcoinPublicKey::::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } } #[test] fn test_p2pkh_invalid() { type N = Bitcoin; // Invalid public key length let public_key = "0"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "039ed714bf521e96e3f3609b74da898e44"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "039ed714bf521e96e3f3609b74da898e44d0fb64ba68c62c57852470ffc28e3db"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "039ed714bf521e96e3f3609b74da898e44d0fb64ba68c62c57852470ffc28e3db5039ed714bf521e96e3f3609b74da898e44"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "039ed714bf521e96e3f3609b74da898e44d0fb64ba68c62c57852470ffc28e3db5039ed714bf521e96e3f3609b74da898e44d0fb64ba68c62c57852470ffc28e3db5"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); } #[test] fn test_p2sh_p2wpkh_invalid() { type N = Bitcoin; // Invalid public key length let public_key = "0"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "02468791fee1444df3a6e786e2f9da79198"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "02468791fee1444df3a6e786e2f9da79198f8902387e1fa5a2c051950c4df51ab"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "02468791fee1444df3a6e786e2f9da79198f8902387e1fa5a2c051950c4df51ab402468791fee1444df3a6e786e2f9da79198"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); let public_key = "02468791fee1444df3a6e786e2f9da79198f8902387e1fa5a2c051950c4df51ab402468791fee1444df3a6e786e2f9da79198f8902387e1fa5a2c051950c4df51ab4"; assert!(BitcoinPublicKey::::from_str(public_key).is_err()); } } ================================================ FILE: crates/anychain-bitcoin/src/transaction.rs ================================================ use crate::{ BitcoinAddress, BitcoinAmount, BitcoinFormat, BitcoinNetwork, BitcoinPublicKey, WitnessProgram, BASE32_DECODE_TABLE, }; use anychain_core::{ crypto::checksum as double_sha2, Transaction, TransactionError, TransactionId, }; use anychain_core::{ hex, no_std::{io::Read, *}, PublicKey, }; use libsecp256k1::Signature; use base58::FromBase58; use bech32::{u5, FromBase32}; use core::{fmt, str::FromStr}; use serde::Serialize; pub use sha2::{Digest, Sha256}; /// Returns the variable length integer of the given value. /// `` pub fn variable_length_integer(value: u64) -> Result, TransactionError> { match value { // bounded by u8::max_value() 0..=252 => Ok(vec![value as u8]), // bounded by u16::max_value() 253..=65535 => Ok([vec![0xfd], (value as u16).to_le_bytes().to_vec()].concat()), // bounded by u32::max_value() 65536..=4294967295 => Ok([vec![0xfe], (value as u32).to_le_bytes().to_vec()].concat()), // bounded by u64::max_value() _ => Ok([vec![0xff], value.to_le_bytes().to_vec()].concat()), } } /// Decode the value of a variable length integer. /// `` pub fn read_variable_length_integer(mut reader: R) -> Result { let mut flag = [0u8; 1]; let _ = reader.read(&mut flag)?; match flag[0] { 0..=252 => Ok(flag[0] as usize), 0xfd => { let mut size = [0u8; 2]; let _ = reader.read(&mut size)?; match u16::from_le_bytes(size) { s if s < 253 => Err(TransactionError::InvalidVariableSizeInteger(s as usize)), s => Ok(s as usize), } } 0xfe => { let mut size = [0u8; 4]; let _ = reader.read(&mut size)?; match u32::from_le_bytes(size) { s if s < 65536 => Err(TransactionError::InvalidVariableSizeInteger(s as usize)), s => Ok(s as usize), } } _ => { let mut size = [0u8; 8]; let _ = reader.read(&mut size)?; match u64::from_le_bytes(size) { s if s < 4294967296 => { Err(TransactionError::InvalidVariableSizeInteger(s as usize)) } s => Ok(s as usize), } } } } pub struct BitcoinVector; impl BitcoinVector { /// Read and output a vector with a variable length integer pub fn read(mut reader: R, func: F) -> Result, TransactionError> where F: Fn(&mut R) -> Result, { let count = read_variable_length_integer(&mut reader)?; (0..count).map(|_| func(&mut reader)).collect() } /// Read and output a vector with a variable length integer and the integer itself pub fn read_witness( mut reader: R, func: F, ) -> Result<(usize, Result, TransactionError>), TransactionError> where F: Fn(&mut R) -> Result, { let count = read_variable_length_integer(&mut reader)?; Ok((count, Self::read(reader, func))) } } /// Generate the script_pub_key of a corresponding address pub fn create_script_pub_key( address: &BitcoinAddress, ) -> Result, TransactionError> { match address.format() { BitcoinFormat::P2PKH => { let bytes = &address.to_string().from_base58()?; // Trim the prefix (1st byte) and the checksum (last 4 bytes) let pub_key_hash = bytes[1..(bytes.len() - 4)].to_vec(); let mut script = vec![]; script.push(Opcode::OP_DUP as u8); script.push(Opcode::OP_HASH160 as u8); script.extend(variable_length_integer(pub_key_hash.len() as u64)?); script.extend(pub_key_hash); script.push(Opcode::OP_EQUALVERIFY as u8); script.push(Opcode::OP_CHECKSIG as u8); Ok(script) } BitcoinFormat::P2SH_P2WPKH => { let script_bytes = &address.to_string().from_base58()?; let script_hash = script_bytes[1..(script_bytes.len() - 4)].to_vec(); let mut script = vec![]; script.push(Opcode::OP_HASH160 as u8); script.extend(variable_length_integer(script_hash.len() as u64)?); script.extend(script_hash); script.push(Opcode::OP_EQUAL as u8); Ok(script) } BitcoinFormat::P2WSH => { let (_, data, _) = bech32::decode(&address.to_string())?; let (v, script) = data.split_at(1); let script = Vec::from_base32(script)?; let mut script_bytes = vec![v[0].to_u8(), script.len() as u8]; script_bytes.extend(script); Ok(script_bytes) } BitcoinFormat::Bech32 => { let (_, data, _) = bech32::decode(&address.to_string())?; let (v, program) = data.split_at(1); let program = Vec::from_base32(program)?; let mut program_bytes = vec![v[0].to_u8(), program.len() as u8]; program_bytes.extend(program); Ok(WitnessProgram::new(&program_bytes)?.to_scriptpubkey()) } BitcoinFormat::CashAddr => { let address = address.to_string(); let prefix = N::to_address_prefix(BitcoinFormat::CashAddr)?.prefix(); let start = if address.starts_with(&prefix) { prefix.len() + 1 } else { 0 }; // trim the prefix and the checksum let bytes_u8 = address.as_bytes()[start..address.len() - 8].to_vec(); let bytes_u5: Vec = bytes_u8 .iter() .map(|byte| u5::try_from_u8(BASE32_DECODE_TABLE[*byte as usize] as u8).unwrap()) .collect(); let payload = Vec::::from_base32(&bytes_u5)?; // trim the version byte, left the public key hash let hash = payload[1..].to_vec(); let mut script = vec![]; script.push(Opcode::OP_DUP as u8); script.push(Opcode::OP_HASH160 as u8); script.extend(variable_length_integer(hash.len() as u64)?); script.extend(hash); script.push(Opcode::OP_EQUALVERIFY as u8); script.push(Opcode::OP_CHECKSIG as u8); Ok(script) } } } /// Construct and return the OP_RETURN script for the data /// output of a tx that spends 'amount' basic units of omni /// layer asset as indicated by 'property_id'. pub fn create_script_op_return(property_id: u32, amount: i64) -> Result, TransactionError> { let mut script = vec![]; let msg_type: u16 = 0; let msg_version: u16 = 0; script.push(Opcode::OP_RETURN as u8); script.push(Opcode::OP_PUSHBYTES_20 as u8); script.push(b'o'); script.push(b'm'); script.push(b'n'); script.push(b'i'); script.append(&mut msg_version.to_be_bytes().to_vec()); script.append(&mut msg_type.to_be_bytes().to_vec()); script.append(&mut property_id.to_be_bytes().to_vec()); script.append(&mut amount.to_be_bytes().to_vec()); Ok(script) } /// Represents a Bitcoin signature hash /// `` #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] #[allow(non_camel_case_types)] pub enum SignatureHash { /// Signs all inputs and outputs. SIGHASH_ALL = 0x01, /// Signs all inputs and none of the outputs. /// (e.g. "blank check" transaction, where any address can redeem the output) SIGHASH_NONE = 0x02, /// Signs all inputs and one corresponding output per input. /// (e.g. signing vin 0 will result in signing vout 0) SIGHASH_SINGLE = 0x03, SIGHASH_ALL_SIGHASH_FORKID = 0x41, SIGHASH_NONE_SIGHASH_FORKID = 0x42, SIGHASH_SINGLE_SIGHASH_FORKID = 0x43, /// Signs only one input and all outputs. /// Allows anyone to add or remove other inputs, forbids changing any outputs. /// (e.g. "crowdfunding" transaction, where the output is the "goal" address) SIGHASH_ALL_SIGHASH_ANYONECANPAY = 0x81, /// Signs only one input and none of the outputs. /// Allows anyone to add or remove other inputs or any outputs. /// (e.g. "dust collector" transaction, where "dust" can be aggregated and spent together) SIGHASH_NONE_SIGHASH_ANYONECANPAY = 0x82, /// Signs only one input and one corresponding output per input. /// Allows anyone to add or remove other inputs. SIGHASH_SINGLE_SIGHASH_ANYONECANPAY = 0x83, SIGHASH_ALL_SIGHASH_FORKID_SIGHASH_ANYONECANPAY = 0xc1, SIGHASH_NONE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY = 0xc2, SIGHASH_SINGLE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY = 0xc3, } impl fmt::Display for SignatureHash { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { SignatureHash::SIGHASH_ALL => write!(f, "SIGHASH_ALL"), SignatureHash::SIGHASH_NONE => write!(f, "SIGHASH_NONE"), SignatureHash::SIGHASH_SINGLE => write!(f, "SIGHASH_SINGLE"), SignatureHash::SIGHASH_ALL_SIGHASH_FORKID => { write!(f, "SIGHASH_ALL | SIGHASH_FORKID") } SignatureHash::SIGHASH_NONE_SIGHASH_FORKID => { write!(f, "SIGHASH_NONE | SIGHASH_FORKID") } SignatureHash::SIGHASH_SINGLE_SIGHASH_FORKID => { write!(f, "SIGHASH_SINGLE | SIGHASH_FORKID") } SignatureHash::SIGHASH_ALL_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_ALL | SIGHASH_ANYONECANPAY") } SignatureHash::SIGHASH_NONE_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_NONE | SIGHASH_ANYONECANPAY") } SignatureHash::SIGHASH_SINGLE_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_SINGLE | SIGHASH_ANYONECANPAY") } SignatureHash::SIGHASH_ALL_SIGHASH_FORKID_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_ALL | SIGHASH_FORKID | SIGHASH_ANYONECANPAY") } SignatureHash::SIGHASH_NONE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_NONE | SIGHASH_FORKID | SIGHASH_ANYONECANPAY") } SignatureHash::SIGHASH_SINGLE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY => { write!(f, "SIGHASH_SINGLE | SIGHASH_FORKID | SIGHASH_ANYONECANPAY") } } } } impl SignatureHash { pub fn from_byte(byte: &u8) -> Self { match byte { 0x02 => SignatureHash::SIGHASH_NONE, 0x03 => SignatureHash::SIGHASH_SINGLE, 0x41 => SignatureHash::SIGHASH_ALL_SIGHASH_FORKID, 0x42 => SignatureHash::SIGHASH_NONE_SIGHASH_FORKID, 0x43 => SignatureHash::SIGHASH_SINGLE_SIGHASH_FORKID, 0x81 => SignatureHash::SIGHASH_ALL_SIGHASH_ANYONECANPAY, 0x82 => SignatureHash::SIGHASH_NONE_SIGHASH_ANYONECANPAY, 0x83 => SignatureHash::SIGHASH_SINGLE_SIGHASH_ANYONECANPAY, 0xc1 => SignatureHash::SIGHASH_ALL_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, 0xc2 => SignatureHash::SIGHASH_NONE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, 0xc3 => SignatureHash::SIGHASH_SINGLE_SIGHASH_FORKID_SIGHASH_ANYONECANPAY, _ => SignatureHash::SIGHASH_ALL, } } } /// Represents the commonly used script opcodes #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)] #[allow(non_camel_case_types)] pub enum Opcode { OP_DUP = 0x76, OP_HASH160 = 0xa9, OP_CHECKSIG = 0xac, OP_EQUAL = 0x87, OP_EQUALVERIFY = 0x88, OP_RETURN = 0x6a, OP_PUSHBYTES_20 = 0x14, } impl fmt::Display for Opcode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Opcode::OP_DUP => write!(f, "OP_DUP"), Opcode::OP_HASH160 => write!(f, "OP_HASH160"), Opcode::OP_CHECKSIG => write!(f, "OP_CHECKSIG"), Opcode::OP_EQUAL => write!(f, "OP_EQUAL"), Opcode::OP_EQUALVERIFY => write!(f, "OP_EQUALVERIFY"), Opcode::OP_RETURN => write!(f, "OP_RETURN"), Opcode::OP_PUSHBYTES_20 => write!(f, "OP_PUSHBYTES_20"), } } } /// Represents a Bitcoin transaction outpoint #[derive(Debug, Clone, PartialEq, Eq)] pub struct Outpoint { /// Hash of the previous transaction (32 bytes) (uses reversed hash order from Bitcoin RPC) pub reverse_transaction_id: Vec, /// The index of certain utxo in the previous transaction (4 bytes) pub index: u32, } impl Outpoint { /// Returns a new Bitcoin transaction outpoint pub fn new(reverse_transaction_id: Vec, index: u32) -> Self { Self { reverse_transaction_id, index, } } } /// Represents a Bitcoin transaction input #[derive(Debug, Clone, PartialEq, Eq)] pub struct BitcoinTransactionInput { /// The outpoint (36 bytes) pub outpoint: Outpoint, /// The balance of the utxo pointed by this input (used for SegWit transaction signatures) pub balance: Option, /// The address of the utxo pointed by this input pub address: Option>, /// The address format of the utxo pointed by this input pub format: Option, /// The 'scriptPubkey' of the utxo pointed by this input pub script_pub_key: Option>, /// An optional redeem script in case of an SegWit utxo pub redeem_script: Option>, /// The transaction input script (variable size) pub script_sig: Vec, /// The sequence number (4 bytes) (0xFFFFFFFF unless lock > 0) /// Also used in replace-by-fee (BIP 125) pub sequence: Vec, /// The signature hash (4 bytes) (used in signing raw transaction only) pub sighash_code: SignatureHash, /// The witnesses in a SegWit transaction pub witnesses: Vec>, /// If true, the input has been signed pub is_signed: bool, /// Provide more flexibility for multiple signatures (for P2WSH) pub additional_witness: Option<(Vec, bool)>, /// Option for additional witness stack script args pub witness_script_data: Option>, } impl BitcoinTransactionInput { const DEFAULT_SEQUENCE: [u8; 4] = [0xf2, 0xff, 0xff, 0xff]; /// Returns a new Bitcoin transaction input. pub fn new( transaction_id: Vec, index: u32, public_key: Option>, format: Option, address: Option>, balance: Option, sighash: SignatureHash, ) -> Result { if transaction_id.len() != 32 { return Err(TransactionError::InvalidTransactionId(transaction_id.len())); } // Byte-wise reverse of computed SHA-256 hash values // https://bitcoin.org/en/developer-reference#hash-byte-order let mut reverse_transaction_id = transaction_id; reverse_transaction_id.reverse(); let format = match format { Some(f) => Some(f), None => Some(BitcoinFormat::P2PKH), }; let (address, script_pub_key, redeem_script) = match public_key { Some(pk) => { let addr = pk.to_address(&format.clone().unwrap())?; if let Some(v) = address { if v != addr { return Err(TransactionError::Message(format!( "Provided address {} does not match the provided public key {}", addr, pk, ))); } } let script_pub_key = create_script_pub_key(&addr)?; let redeem_script = match format { Some(BitcoinFormat::P2SH_P2WPKH) => { Some(BitcoinAddress::::create_redeem_script(&pk).to_vec()) } _ => None, }; (Some(addr), Some(script_pub_key), redeem_script) } None => match address { Some(addr) => { let script_pub_key = create_script_pub_key(&addr)?; (Some(addr), Some(script_pub_key), None) } None => (None, None, None), }, }; Ok(Self { outpoint: Outpoint::new(reverse_transaction_id, index), balance, address, format, script_pub_key, redeem_script, script_sig: vec![], sequence: BitcoinTransactionInput::::DEFAULT_SEQUENCE.to_vec(), sighash_code: sighash, witnesses: vec![], is_signed: false, additional_witness: None, witness_script_data: None, }) } pub fn set_public_key( &mut self, public_key: BitcoinPublicKey, format: BitcoinFormat, ) -> Result<(), TransactionError> { let address = public_key.to_address(&format)?; self.format = Some(format.clone()); self.script_pub_key = Some(create_script_pub_key(&address)?); self.address = Some(address); self.redeem_script = match format { BitcoinFormat::P2SH_P2WPKH => { Some(BitcoinAddress::::create_redeem_script(&public_key).to_vec()) } _ => None, }; Ok(()) } pub fn set_redeem_script(&mut self, redeem_script: Vec) -> Result<(), TransactionError> { self.redeem_script = Some(redeem_script); Ok(()) } pub fn set_format(&mut self, format: BitcoinFormat) -> Result<(), TransactionError> { self.format = Some(format); Ok(()) } pub fn set_balance(&mut self, balance: i64) -> Result<(), TransactionError> { self.balance = Some(BitcoinAmount(balance)); Ok(()) } pub fn set_sequence(&mut self, sequence: u32) -> Result<(), TransactionError> { self.sequence = u32::to_le_bytes(sequence).to_vec(); Ok(()) } pub fn set_sighash(&mut self, sighash: SignatureHash) -> Result<(), TransactionError> { self.sighash_code = sighash; Ok(()) } pub fn get_address(&self) -> Option> { self.address.clone() } pub fn get_format(&self) -> Option { self.format.clone() } pub fn get_balance(&self) -> Option { self.balance } pub fn get_sequence(&self) -> u32 { let sequence: [u8; 4] = self.sequence.clone().try_into().unwrap(); u32::from_le_bytes(sequence) } pub fn get_sighash(&self) -> SignatureHash { self.sighash_code } /// Read and output a Bitcoin transaction input pub fn read(mut reader: &mut R) -> Result { let mut transaction_hash = [0u8; 32]; let mut vin = [0u8; 4]; let mut sequence = [0u8; 4]; let _ = reader.read(&mut transaction_hash)?; let _ = reader.read(&mut vin)?; let outpoint = Outpoint::new(transaction_hash.to_vec(), u32::from_le_bytes(vin)); let script_sig: Vec = BitcoinVector::read(&mut reader, |s| { let mut byte = [0u8; 1]; let _ = s.read(&mut byte)?; Ok(byte[0]) })?; let _ = reader.read(&mut sequence)?; let script_sig_len = read_variable_length_integer(&script_sig[..])?; let sighash_code = SignatureHash::from_byte(&match script_sig_len { 0 => 0x01, length => script_sig[length], }); Ok(Self { outpoint, balance: None, address: None, format: None, script_pub_key: None, redeem_script: None, script_sig: script_sig.to_vec(), sequence: sequence.to_vec(), sighash_code, witnesses: vec![], is_signed: !script_sig.is_empty(), additional_witness: None, witness_script_data: None, }) } /// Returns the serialized transaction input. pub fn serialize(&self, raw: bool) -> Result, TransactionError> { let mut input = vec![]; input.extend(&self.outpoint.reverse_transaction_id); input.extend(&self.outpoint.index.to_le_bytes()); match raw { true => input.extend(vec![0x00]), false => match self.script_sig.len() { 0 => match &self.address { Some(address) => match address.format() { BitcoinFormat::P2PKH => { let script_pub_key = match &self.script_pub_key { Some(script) => script, None => { return Err(TransactionError::MissingOutpointScriptPublicKey) } }; input.extend(variable_length_integer(script_pub_key.len() as u64)?); input.extend(script_pub_key); } _ => input.extend(vec![0x00]), }, None => input.extend(vec![0x00]), }, _ => { input.extend(variable_length_integer(self.script_sig.len() as u64)?); input.extend(&self.script_sig); } }, }; input.extend(&self.sequence); Ok(input) } /// Insert 'signature' and 'public_key' into this input to make it signed pub fn sign( &mut self, signature: Vec, public_key: Vec, ) -> Result<(), TransactionError> { let mut signature = Signature::parse_standard_slice(&signature) .map_err(|error| TransactionError::Crate("libsecp256k1", format!("{:?}", error)))? .serialize_der() .as_ref() .to_vec(); signature.push(self.sighash_code as u8); let signature = [variable_length_integer(signature.len() as u64)?, signature].concat(); let public_key = [ variable_length_integer(public_key.len() as u64)?, public_key, ] .concat(); match self.get_format().unwrap() { BitcoinFormat::P2PKH | BitcoinFormat::CashAddr => { self.script_sig = [signature, public_key].concat() } BitcoinFormat::P2SH_P2WPKH => { let input_script = match &self.redeem_script { Some(script) => script.clone(), None => { return Err(TransactionError::Message( "Missing redeem script".to_string(), )) } }; self.script_sig = [ variable_length_integer(input_script.len() as u64)?, input_script, ] .concat(); self.witnesses.append(&mut vec![signature, public_key]); } BitcoinFormat::Bech32 => self.witnesses.append(&mut vec![signature, public_key]), BitcoinFormat::P2WSH => { return Err(TransactionError::Message( "P2WSH signing not supported".to_string(), )) } } self.is_signed = true; Ok(()) } } /// Represents a Bitcoin transaction output #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct BitcoinTransactionOutput { /// The amount (in Satoshi) pub amount: BitcoinAmount, /// The public key script pub script_pub_key: Vec, } impl BitcoinTransactionOutput { /// Returns a Bitcoin transaction output. pub fn new( address: BitcoinAddress, amount: BitcoinAmount, ) -> Result { Ok(Self { amount, script_pub_key: create_script_pub_key::(&address)?, }) } /// Returns the data output for a tx that spends 'amount' basic /// units of omni-layer asset as indicated by 'property_id'. pub fn omni_data_output( property_id: u32, amount: BitcoinAmount, ) -> Result { let data_output = BitcoinTransactionOutput { amount: BitcoinAmount(0), script_pub_key: create_script_op_return(property_id, amount.0)?, }; Ok(data_output) } /// Read and output a Bitcoin transaction output pub fn read(mut reader: &mut R) -> Result { let mut amount = [0u8; 8]; let _ = reader.read(&mut amount)?; let script_pub_key: Vec = BitcoinVector::read(&mut reader, |s| { let mut byte = [0u8; 1]; let _ = s.read(&mut byte)?; Ok(byte[0]) })?; Ok(Self { amount: BitcoinAmount::from_satoshi(u64::from_le_bytes(amount) as i64)?, script_pub_key, }) } /// Returns the serialized transaction output. pub fn serialize(&self) -> Result, TransactionError> { let mut output = vec![]; output.extend(&self.amount.0.to_le_bytes()); output.extend(variable_length_integer(self.script_pub_key.len() as u64)?); output.extend(&self.script_pub_key); Ok(output) } } /// Represents an Bitcoin transaction id and witness transaction id /// `` #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct BitcoinTransactionId { pub txid: Vec, pub wtxid: Vec, } impl TransactionId for BitcoinTransactionId {} impl fmt::Display for BitcoinTransactionId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", &hex::encode(&self.txid)) } } /// Represents the Bitcoin transaction parameters #[derive(Debug, Clone, PartialEq, Eq)] pub struct BitcoinTransactionParameters { /// The version number (4 bytes) pub version: u32, /// The transaction inputs pub inputs: Vec>, /// The transaction outputs pub outputs: Vec, /// The lock time (4 bytes) pub lock_time: u32, /// An optional 2 bytes to indicate SegWit transactions pub segwit_flag: bool, } impl BitcoinTransactionParameters { /// Returns a BitcoinTransactionParameters given the inputs and outputs pub fn new( inputs: Vec>, outputs: Vec, ) -> Result { Ok(Self { version: 2, inputs, outputs, lock_time: 0, segwit_flag: false, }) } /// Read and output the Bitcoin transaction parameters pub fn read(mut reader: R) -> Result { let mut version = [0u8; 4]; let _ = reader.read(&mut version)?; let mut inputs = BitcoinVector::read(&mut reader, BitcoinTransactionInput::::read)?; let segwit_flag = match inputs.is_empty() { true => { let mut flag = [0u8; 1]; let _ = reader.read(&mut flag)?; match flag[0] { 1 => { inputs = BitcoinVector::read(&mut reader, BitcoinTransactionInput::::read)?; true } _ => return Err(TransactionError::InvalidSegwitFlag(flag[0] as usize)), } } false => false, }; let outputs = BitcoinVector::read(&mut reader, BitcoinTransactionOutput::read)?; // if segwit_flag { // for input in &mut inputs { // let witnesses: Vec> = BitcoinVector::read(&mut reader, |s| { // let (size, witness) = BitcoinVector::read_witness(s, |sr| { // let mut byte = [0u8; 1]; // let _ = sr.read(&mut byte)?; // Ok(byte[0]) // })?; // Ok([variable_length_integer(size as u64)?, witness?].concat()) // })?; // if !witnesses.is_empty() { // input.sighash_code = // SignatureHash::from_byte(&witnesses[0][&witnesses[0].len() - 1]); // input.is_signed = true; // } // input.witnesses = witnesses; // } // } let params = BitcoinTransactionParameters:: { version: u32::from_le_bytes(version), inputs, outputs, lock_time: 0, segwit_flag, }; Ok(params) } } /// Represents a Bitcoin transaction #[derive(Debug, Clone, PartialEq, Eq)] pub struct BitcoinTransaction { /// The transaction parameters (version, inputs, outputs, lock_time, segwit_flag) pub parameters: BitcoinTransactionParameters, } impl fmt::Display for BitcoinTransaction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", hex::encode(self.to_bytes().unwrap())) } } impl Transaction for BitcoinTransaction { type Address = BitcoinAddress; type Format = BitcoinFormat; type PublicKey = BitcoinPublicKey; type TransactionId = BitcoinTransactionId; type TransactionParameters = BitcoinTransactionParameters; /// Returns an unsigned transaction given the transaction parameters. fn new(parameters: &Self::TransactionParameters) -> Result { Ok(Self { parameters: parameters.clone(), }) } /// Returns a transaction given the transaction bytes. /// Note:: Raw transaction hex does not include enough fn from_bytes(transaction: &[u8]) -> Result { Ok(Self { parameters: Self::TransactionParameters::read(transaction)?, }) } /// Returns the transaction in bytes. fn to_bytes(&self) -> Result, TransactionError> { let mut transaction = self.parameters.version.to_le_bytes().to_vec(); if self.parameters.segwit_flag { transaction.extend(vec![0x00, 0x01]); } transaction.extend(variable_length_integer(self.parameters.inputs.len() as u64)?); let mut has_witness = false; for input in &self.parameters.inputs { if !has_witness { has_witness = !input.witnesses.is_empty(); } transaction.extend(input.serialize(!input.is_signed)?); } transaction.extend(variable_length_integer( self.parameters.outputs.len() as u64 )?); for output in &self.parameters.outputs { transaction.extend(output.serialize()?); } if has_witness { for input in &self.parameters.inputs { match input.witnesses.len() { 0 => transaction.extend(vec![0x00]), _ => { transaction.extend(variable_length_integer(input.witnesses.len() as u64)?); for witness in &input.witnesses { transaction.extend(witness); } } }; } } transaction.extend(&self.parameters.lock_time.to_le_bytes()); Ok(transaction) } /// Returns the transaction id. fn to_transaction_id(&self) -> Result { let mut txid = double_sha2(&self.to_transaction_bytes_without_witness()?).to_vec(); let mut wtxid = double_sha2(&self.to_bytes()?).to_vec(); txid.reverse(); wtxid.reverse(); Ok(Self::TransactionId { txid, wtxid }) } fn sign(&mut self, _signature: Vec, _recid: u8) -> Result, TransactionError> { panic!( "trait method sign() deprecated for bitcoin, use custom methods for signature\ insertion in its own impl block instead." ); } } impl BitcoinTransaction { /// Return the P2PKH hash preimage of the raw transaction. pub fn p2pkh_hash_preimage( &self, vin: usize, sighash: SignatureHash, ) -> Result, TransactionError> { let mut preimage = self.parameters.version.to_le_bytes().to_vec(); preimage.extend(variable_length_integer(self.parameters.inputs.len() as u64)?); for (index, input) in self.parameters.inputs.iter().enumerate() { preimage.extend(input.serialize(index != vin)?); } preimage.extend(variable_length_integer( self.parameters.outputs.len() as u64 )?); for output in &self.parameters.outputs { preimage.extend(output.serialize()?); } preimage.extend(&self.parameters.lock_time.to_le_bytes()); preimage.extend(&(sighash as u32).to_le_bytes()); Ok(preimage) } /// Return the SegWit hash preimage of the raw transaction /// `` pub fn segwit_hash_preimage( &self, vin: usize, sighash: SignatureHash, ) -> Result, TransactionError> { let mut prev_outputs = vec![]; let mut prev_sequences = vec![]; let mut outputs = vec![]; for input in &self.parameters.inputs { prev_outputs.extend(&input.outpoint.reverse_transaction_id); prev_outputs.extend(&input.outpoint.index.to_le_bytes()); prev_sequences.extend(&input.sequence); } for output in &self.parameters.outputs { outputs.extend(&output.serialize()?); } let input = &self.parameters.inputs[vin]; let format = match &input.address { Some(address) => address.format(), None => return Err(TransactionError::MissingOutpointAddress), }; let script = match format { BitcoinFormat::Bech32 => match &input.script_pub_key { Some(script) => script[1..].to_vec(), None => return Err(TransactionError::MissingOutpointScriptPublicKey), }, BitcoinFormat::CashAddr => match &input.script_pub_key { Some(script) => script.to_vec(), None => return Err(TransactionError::MissingOutpointScriptPublicKey), }, BitcoinFormat::P2WSH => match &input.redeem_script { Some(redeem_script) => redeem_script.to_vec(), None => return Err(TransactionError::InvalidInputs("P2WSH".into())), }, BitcoinFormat::P2SH_P2WPKH => match &input.redeem_script { Some(redeem_script) => redeem_script[1..].to_vec(), None => return Err(TransactionError::InvalidInputs("P2SH_P2WPKH".into())), }, _ => return Err(TransactionError::UnsupportedPreimage("P2PKH".into())), }; let mut script_code = vec![]; if format == BitcoinFormat::P2WSH || format == BitcoinFormat::CashAddr { script_code.extend(script); } else { script_code.push(Opcode::OP_DUP as u8); script_code.push(Opcode::OP_HASH160 as u8); script_code.extend(script); script_code.push(Opcode::OP_EQUALVERIFY as u8); script_code.push(Opcode::OP_CHECKSIG as u8); } let script_code = [ variable_length_integer(script_code.len() as u64)?, script_code, ] .concat(); let hash_prev_outputs = double_sha2(&prev_outputs); let hash_sequence = double_sha2(&prev_sequences); let hash_outputs = double_sha2(&outputs); let balance = match &input.balance { Some(balance) => balance.0.to_le_bytes(), None => return Err(TransactionError::MissingOutpointAmount), }; let mut preimage = vec![]; preimage.extend(&self.parameters.version.to_le_bytes()); preimage.extend(hash_prev_outputs); preimage.extend(hash_sequence); preimage.extend(&input.outpoint.reverse_transaction_id); preimage.extend(&input.outpoint.index.to_le_bytes()); preimage.extend(&script_code); preimage.extend(&balance); preimage.extend(&input.sequence); preimage.extend(hash_outputs); preimage.extend(&self.parameters.lock_time.to_le_bytes()); preimage.extend(&(sighash as u32).to_le_bytes()); Ok(preimage) } /// Returns the transaction with the traditional serialization (no witness). pub fn to_transaction_bytes_without_witness(&self) -> Result, TransactionError> { let mut transaction = self.parameters.version.to_le_bytes().to_vec(); transaction.extend(variable_length_integer(self.parameters.inputs.len() as u64)?); for input in &self.parameters.inputs { transaction.extend(input.serialize(false)?); } transaction.extend(variable_length_integer( self.parameters.outputs.len() as u64 )?); for output in &self.parameters.outputs { transaction.extend(output.serialize()?); } transaction.extend(&self.parameters.lock_time.to_le_bytes()); Ok(transaction) } pub fn input( &mut self, index: u32, ) -> Result<&mut BitcoinTransactionInput, TransactionError> { if index as usize >= self.parameters.inputs.len() { return Err(TransactionError::Message(format!( "you are referring to input {}, which is out of bound", index ))); } Ok(&mut self.parameters.inputs[index as usize]) } pub fn digest(&mut self, index: u32) -> Result, TransactionError> { let input = self.input(index)?; let sighash = input.sighash_code; match input.get_address() { Some(addr) => { let preimage = match addr.format() { BitcoinFormat::P2PKH => self.p2pkh_hash_preimage(index as usize, sighash)?, _ => self.segwit_hash_preimage(index as usize, sighash)?, }; Ok(double_sha2(&preimage).to_vec()) } None => Err(TransactionError::MissingOutpointAddress), } } pub fn set_segwit(&mut self) -> Result<(), TransactionError> { for input in self.parameters.inputs.clone() { if self.parameters.segwit_flag { break; } if input.is_signed { match input.get_format() { Some(BitcoinFormat::P2SH_P2WPKH) | Some(BitcoinFormat::Bech32) => { self.parameters.segwit_flag = true } _ => {} } } } Ok(()) } } impl FromStr for BitcoinTransaction { type Err = TransactionError; fn from_str(transaction: &str) -> Result { Self::from_bytes(&hex::decode(transaction)?) } } ================================================ FILE: crates/anychain-bitcoin/src/witness_program.rs ================================================ //! //! WitnessProgram //! //! This module contains the representation of a Bitcoin witness program and utility functions //! related to the representation of such programs. //! //! If the version byte is 0, and the witness program is 20 bytes: //! - It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program. //! - The witness must consist of exactly 2 items (≤ 520 bytes each). The first one a signature, and the second one a public key. //! - The HASH160 of the public key must match the 20-byte witness program. //! - After normal script evaluation, the signature is verified against the public key with CHECKSIG operation. The verification must result in a single TRUE on the stack. //! //! If the version byte is 0, and the witness program is 32 bytes: //! - It is interpreted as a pay-to-witness-script-hash (P2WSH) program. //! - The witness must consist of an input stack to feed to the script, followed by a serialized script (witnessScript). //! - The witnessScript (≤ 10,000 bytes) is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program. //! - The witnessScript is deserialized, and executed after normal script evaluation with the remaining witness stack (≤ 520 bytes for each stack item). //! - The script must not fail, and result in exactly a single TRUE on the stack. //! //! If the version byte is 0, but the witness program is neither 20 nor 32 bytes, the script must fail. //! use anychain_core::no_std::*; use anychain_core::{hex, AddressError, TransactionError}; use core::str::FromStr; #[derive(Debug, Error, PartialEq, Eq)] pub enum WitnessProgramError { #[error("invalid program length {0}")] InvalidProgramLength(usize), #[error("invalid program length {0} for script version {1}")] InvalidProgramLengthForVersion(usize, u8), #[error("invalid version {0}")] InvalidVersion(u8), #[error("invalid program length: {{ expected: {0:?}, found: {1:?} }}")] MismatchedProgramLength(usize, usize), #[error("error decoding program from hex string")] ProgramDecodingError, } impl From for AddressError { fn from(error: WitnessProgramError) -> Self { AddressError::Crate("WitnessProgram", format!("{:?}", error)) } } impl From for TransactionError { fn from(error: WitnessProgramError) -> Self { TransactionError::Crate("WitnessProgram", format!("{:?}", error)) } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct WitnessProgram { /// The version byte pub version: u8, /// The witness program bytes pub program: Vec, } impl WitnessProgram { /// Returns a new witness program given a program with a version, data size, and data. pub fn new(program: &[u8]) -> Result { if program.len() < 2 { return Err(WitnessProgramError::InvalidProgramLength(program.len())); } // https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Decoding let data_size = program[1] as usize; let data = program[2..].to_vec(); if data_size != data.len() { return Err(WitnessProgramError::MismatchedProgramLength( data.len(), data_size, )); } let program = Self { version: program[0], program: data, }; match program.validate() { Ok(()) => Ok(program), Err(e) => Err(e), } } pub fn validate(&self) -> Result<(), WitnessProgramError> { if self.program.len() < 2 || self.program.len() > 40 { return Err(WitnessProgramError::InvalidProgramLength( self.program.len(), )); } if self.version > 16 { return Err(WitnessProgramError::InvalidVersion(self.version)); } // P2SH_P2WPKH start with 0x0014 // P2SH_P2WSH starts with 0x0020 // https://bitcoincore.org/en/segwit_wallet_dev/#creation-of-p2sh-p2wpkh-address if self.version == 0 && !(self.program.len() == 20 || self.program.len() == 32) { return Err(WitnessProgramError::InvalidProgramLengthForVersion( self.program.len(), self.version, )); } Ok(()) } /// Returns the witness program's scriptpubkey as a byte vector. pub fn to_scriptpubkey(&self) -> Vec { let mut output = Vec::with_capacity(self.program.len() + 2); let encoded_version = if self.version > 0 { self.version + 0x50 } else { self.version }; output.push(encoded_version); output.push(self.program.len() as u8); output.extend_from_slice(&self.program); output } } impl FromStr for WitnessProgram { type Err = WitnessProgramError; /// Returns a witness program given its hex representation. fn from_str(s: &str) -> Result { WitnessProgram::new(&match hex::decode(s) { Ok(bytes) => bytes, Err(_) => return Err(WitnessProgramError::ProgramDecodingError), }) } } #[cfg(test)] mod tests { use super::*; fn test_from_str(program_str: &str, expected_version: u8, expected_program: &[u8]) { let witness_program = WitnessProgram::from_str(program_str).unwrap(); assert_eq!(expected_version, witness_program.version); assert_eq!(expected_program.to_vec(), witness_program.program); } fn test_to_scriptpubkey(version: u8, program: &[u8], expected_scriptpubkey: &[u8]) { let witness_program = WitnessProgram { version, program: program.to_vec(), }; assert_eq!( expected_scriptpubkey.to_vec(), witness_program.to_scriptpubkey() ); } mod p2sh_p2wpkh { use super::*; const VALID_P2SH_P2WPKH_PROGRAMS: [(&str, u8, &[u8], &[u8]); 1] = [( "0014751e76e8199196d454941c45d1b3a323f1433bd6", 0x00, &[ 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, ], &[ 0x00, 0x14, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, ], )]; #[test] fn from_str() { VALID_P2SH_P2WPKH_PROGRAMS.iter().for_each( |&(program_str, expected_version, expected_program, _)| { test_from_str(program_str, expected_version, expected_program); }, ); } #[test] fn to_scriptpubkey() { VALID_P2SH_P2WPKH_PROGRAMS.iter().for_each( |&(_, version, program, expected_scriptpubkey)| { test_to_scriptpubkey(version, program, expected_scriptpubkey); }, ); } } mod p2sh_p2wsh { use super::*; const VALID_P2SH_P2WSH_PROGRAMS: [(&str, u8, &[u8], &[u8]); 1] = [( "00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262", 0x00, &[ 0x18, 0x63, 0x14, 0x3c, 0x14, 0xc5, 0x16, 0x68, 0x04, 0xbd, 0x19, 0x20, 0x33, 0x56, 0xda, 0x13, 0x6c, 0x98, 0x56, 0x78, 0xcd, 0x4d, 0x27, 0xa1, 0xb8, 0xc6, 0x32, 0x96, 0x04, 0x90, 0x32, 0x62, ], &[ 0x00, 0x20, 0x18, 0x63, 0x14, 0x3c, 0x14, 0xc5, 0x16, 0x68, 0x04, 0xbd, 0x19, 0x20, 0x33, 0x56, 0xda, 0x13, 0x6c, 0x98, 0x56, 0x78, 0xcd, 0x4d, 0x27, 0xa1, 0xb8, 0xc6, 0x32, 0x96, 0x04, 0x90, 0x32, 0x62, ], )]; #[test] fn from_str() { VALID_P2SH_P2WSH_PROGRAMS.iter().for_each( |&(program_str, expected_version, expected_program, _)| { test_from_str(program_str, expected_version, expected_program); }, ); } #[test] fn to_scriptpubkey() { VALID_P2SH_P2WSH_PROGRAMS.iter().for_each( |&(_, version, program, expected_scriptpubkey)| { test_to_scriptpubkey(version, program, expected_scriptpubkey); }, ); } } mod version_1 { use super::*; const VALID_OP_1_PROGRAMS: [(&str, u8, &[u8], &[u8]); 1] = [( "0128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6", 0x01, &[ 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, ], &[ 0x51, 0x28, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, ], )]; #[test] fn from_str() { VALID_OP_1_PROGRAMS.iter().for_each( |&(program_str, expected_version, expected_program, _)| { test_from_str(program_str, expected_version, expected_program); }, ); } #[test] fn to_scriptpubkey() { VALID_OP_1_PROGRAMS .iter() .for_each(|&(_, version, program, expected_scriptpubkey)| { test_to_scriptpubkey(version, program, expected_scriptpubkey); }); } } mod test_invalid { use super::*; mod new { use super::*; const INVALID_VERSION_PROGRAM: &[u8] = &[0x19, 0x03, 0x00, 0x00, 0x00]; const INVALID_LENGTH_FOR_VERSION: &[u8] = &[ 0x00, 0x0f, // Version 0, data length is incorrect 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, ]; const INVALID_LENGTH_PROGRAM: &[u8] = &[0x19]; const INVALID_LENGTH_PROGRAM_TOO_LONG: &[u8] = &[ 0x00, 0x29, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, 0x75, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6, 0x00, ]; #[test] fn new_invalid_version() { let witness_program_error = WitnessProgram::new(INVALID_VERSION_PROGRAM).unwrap_err(); assert_eq!( WitnessProgramError::InvalidVersion(0x19), witness_program_error ); } #[test] fn new_invalid_length() { let witness_program_error = WitnessProgram::new(INVALID_LENGTH_PROGRAM).unwrap_err(); assert_eq!( WitnessProgramError::InvalidProgramLength(1), witness_program_error ); } #[test] fn new_invalid_program_length_for_version() { let witness_program_error = WitnessProgram::new(INVALID_LENGTH_FOR_VERSION).unwrap_err(); assert_eq!( WitnessProgramError::InvalidProgramLengthForVersion(15, 0x00), witness_program_error ); } #[test] fn new_invalid_program_length_too_long() { let witness_program_error = WitnessProgram::new(INVALID_LENGTH_PROGRAM_TOO_LONG).unwrap_err(); assert_eq!( WitnessProgramError::InvalidProgramLength(41), witness_program_error ); } } mod from_str { use super::*; const INVALID_P2SH_P2WPKH_PROGRAM_LENGTH: &str = "0014751e76e8199196d454941c45d1b3a323f143"; const INVALID_P2SH_P2WSH_PROGRAM_LENGTH: &str = "00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c632960490"; const INVALID_OP_1_PROGRAM_LENGTH: &str = "0128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f143"; const INVALID_HEX_STR: &str = "001122zzxxyy"; #[test] fn from_str_invalid_p2sh_p2wpkh_program_len() { let witness_program_error = WitnessProgram::from_str(INVALID_P2SH_P2WPKH_PROGRAM_LENGTH).unwrap_err(); assert_eq!( WitnessProgramError::MismatchedProgramLength(18, 20), witness_program_error ); } #[test] fn from_str_invalid_p2sh_p2wsh_program_len() { let witness_program_error = WitnessProgram::from_str(INVALID_P2SH_P2WSH_PROGRAM_LENGTH).unwrap_err(); assert_eq!( WitnessProgramError::MismatchedProgramLength(30, 32), witness_program_error ); } #[test] fn from_str_invalid_op_1_program_len() { let witness_program_error = WitnessProgram::from_str(INVALID_OP_1_PROGRAM_LENGTH).unwrap_err(); assert_eq!( WitnessProgramError::MismatchedProgramLength(38, 40), witness_program_error ); } #[test] fn from_str_invalid_hex_str() { let witness_program_error = WitnessProgram::from_str(INVALID_HEX_STR).unwrap_err(); assert_eq!( WitnessProgramError::ProgramDecodingError, witness_program_error ); } } } } ================================================ FILE: crates/anychain-cardano/Cargo.toml ================================================ [package] name = "anychain-cardano" description = "A Rust library for Cardano-focused cryptocurrency wallets, enabling seamless transactions on the Solana blockchain" version = "0.1.5" keywords = ["cardano", "ada", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [[example]] name = "transfer-ada" path = "examples/transfer-ada.rs" [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } #anychain-kms = { path = "../anychain-kms", version = "0.1.17" } serde = { workspace = true } ed25519-dalek = { workspace = true } curve25519-dalek = { workspace = true } group = "0.13.0" # Cardano specific depends cml-chain = { workspace = true } cml-crypto = { workspace = true } cml-core = { workspace = true } #rand_core.workspace = true [dev-dependencies] hex = "0.4.3" bip39 = "2.1.0" blockfrost = "1.0.5" tokio = { version = "1.0", features = ["full"] } [features] default = ["std"] std = ["anychain-core/std"] [lints] workspace = true ================================================ FILE: crates/anychain-cardano/README.md ================================================ # anychain-cardano anychain-cardano is a Rust library that provides a simple and unified interface for interacting with the Cardano blockchain. ## License anychain-cardano released under the MIT License. See the [LICENSE](LICENSE) file for more information. ================================================ FILE: crates/anychain-cardano/examples/transfer-ada.rs ================================================ use blockfrost::{BlockFrostSettings, BlockfrostAPI, BlockfrostResult, Pagination}; // use cml_chain::builders::tx_builder::TransactionUnspentOutput; use cml_chain::transaction::TransactionInput; use cml_crypto::TransactionHash; // const MNEMONIC_ALICE: &str = "oak anchor meadow nerve limb true banner lock arena brisk width lottery frame walnut barrel innocent enhance feature one gate parade small alert hollow"; const MNEMONIC_ALICE: &str = "toe deal rival umbrella oak inch water hover option lawn essence panda wealth morning summer change soon casino spot decline rural unknown quarter disagree"; // const MNEMONIC_BOB: &str = "oak anchor meadow nerve limb true banner lock arena brisk width lottery frame walnut barrel innocent enhance feature one gate parade small alert hollow"; const MNEMONIC_BOB: &str = "rifle suffer defense test system measure dismiss ketchup enemy all iron clean assist tail rule razor cup source divert field that spatial food drop"; struct CardanoTransactionParameters { send_address: cml_chain::address::Address, // Sender's address recv_address: cml_chain::address::Address, // Receiver's address sender_private_key: String, // Sender's private key amount: u64, // Amount to transfer in lovelace ttl: u64, // Time-to-live (slot number) transaction_input: TransactionInput, // Transaction hash transaction_output_amount: u64, } mod generating_keys { use bip39::Mnemonic; use cml_chain::address::{Address, BaseAddress}; use cml_chain::certs::StakeCredential; use cml_chain::genesis::network_info::NetworkInfo; use cml_crypto::{Bip32PrivateKey, Bip32PublicKey}; fn derive_key( private_key: &Bip32PrivateKey, account: u32, chain: u32, index: u32, ) -> Bip32PublicKey { private_key .derive(harden(1852)) .derive(harden(1815)) .derive(harden(account)) .derive(chain) .derive(index) .to_public() } pub fn create_account(mnemonic_str: &str) -> Address { // Parse the mnemonic let mnemonic = Mnemonic::parse_normalized(mnemonic_str) .unwrap_or_else(|e| panic!("Failed to parse mnemonic: {:?}", e)); // Derive entropy and private key let entropy = mnemonic.to_entropy(); let bip32_private_key = Bip32PrivateKey::from_bip39_entropy(&entropy, &[]); // Derive spend and stake keys let spend = derive_key(&bip32_private_key, 0, 0, 0); let stake = derive_key(&bip32_private_key, 0, 2, 0); // Create base address let spend_cred = StakeCredential::new_pub_key(spend.to_raw_key().hash()); let stake_cred = StakeCredential::new_pub_key(stake.to_raw_key().hash()); BaseAddress::new( NetworkInfo::testnet().network_id(), spend_cred.clone(), stake_cred.clone(), ) .to_address() } pub fn create_signing_key(mnemonic_str: &str) -> String { let mnemonic = Mnemonic::parse_normalized(mnemonic_str) .unwrap_or_else(|e| panic!("Failed to parse mnemonic: {:?}", e)); let entropy = mnemonic.to_entropy(); let bip32_private_key = Bip32PrivateKey::from_bip39_entropy(&entropy, &[]); bip32_private_key .derive(harden(1852)) .derive(harden(1815)) .derive(harden(0)) .derive(0) .derive(0) .to_raw_key() .to_bech32() } fn harden(index: u32) -> u32 { index | 0x80_00_00_00 } } mod tx_builder { use super::CardanoTransactionParameters; use cml_chain::builders::input_builder::SingleInputBuilder; use cml_chain::builders::output_builder::TransactionOutputBuilder; use cml_chain::builders::tx_builder::{ choose_change_selection_algo, ChangeSelectionAlgo, TransactionBuilder, TransactionBuilderConfigBuilder, }; use cml_chain::crypto::hash::hash_transaction; use cml_chain::crypto::utils::make_vkey_witness; use cml_chain::fees::LinearFee; use cml_chain::genesis::network_info::plutus_alonzo_cost_models; use cml_chain::plutus::ExUnitPrices; use cml_chain::transaction::{TransactionOutput, TransactionWitnessSet}; use cml_chain::utils::NetworkId; use cml_chain::{SubCoin, Value}; use cml_core::serialization::Serialize; const MAX_VALUE_SIZE: u32 = 4000; const MAX_TX_SIZE: u32 = 8000; fn create_linear_fee(coefficient: u64, constant: u64) -> LinearFee { LinearFee::new(coefficient, constant, 0) } fn create_default_linear_fee() -> LinearFee { // create_linear_fee(500, 2) create_linear_fee(1000, 2) } fn create_tx_builder_full( linear_fee: LinearFee, pool_deposit: u64, key_deposit: u64, max_val_size: u32, coins_per_utxo_byte: u64, ) -> TransactionBuilder { let cfg = TransactionBuilderConfigBuilder::default() .fee_algo(linear_fee) .pool_deposit(pool_deposit) .key_deposit(key_deposit) .max_value_size(max_val_size) .max_tx_size(MAX_TX_SIZE) .coins_per_utxo_byte(coins_per_utxo_byte) .ex_unit_prices(ExUnitPrices::new( SubCoin::new(577, 10000), SubCoin::new(721, 10000000), )) .collateral_percentage(150) .max_collateral_inputs(3) .cost_models(plutus_alonzo_cost_models()) .build() .unwrap(); TransactionBuilder::new(cfg) } fn create_tx_builder( linear_fee: LinearFee, coins_per_utxo_byte: u64, pool_deposit: u64, key_deposit: u64, ) -> TransactionBuilder { create_tx_builder_full( linear_fee, pool_deposit, key_deposit, MAX_VALUE_SIZE, coins_per_utxo_byte, ) } fn create_tx_builder_with_fee(linear_fee: LinearFee) -> TransactionBuilder { create_tx_builder(linear_fee, 1, 1, 1) } fn create_default_tx_builder() -> TransactionBuilder { create_tx_builder_with_fee(create_default_linear_fee()) } pub fn build_tx_with_change(params: &CardanoTransactionParameters) -> Vec { let mut tx_builder = create_default_tx_builder(); let input = { SingleInputBuilder::new( params.transaction_input.clone(), TransactionOutput::new( params.send_address.clone(), Value::from(params.transaction_output_amount), None, None, ), ) .payment_key() .unwrap() }; tx_builder.add_input(input).unwrap(); tx_builder .add_output( TransactionOutputBuilder::new() .with_address(params.recv_address.clone()) .next() .unwrap() .with_value(params.amount) .build() .unwrap(), ) .unwrap(); // TODO: set fee tx_builder.set_ttl(params.ttl + 200); let change_addr = params.send_address.clone(); let added_change = choose_change_selection_algo(ChangeSelectionAlgo::Default)( &mut tx_builder, &change_addr, false, ); assert!(added_change.is_ok()); assert!(added_change.unwrap()); assert_eq!( tx_builder .get_explicit_input() .unwrap() .checked_add(&tx_builder.get_implicit_input().unwrap()) .unwrap(), tx_builder .get_explicit_output() .unwrap() .checked_add(&Value::from(tx_builder.get_fee_if_set().unwrap())) .unwrap() ); // assert_eq!(tx_builder.full_size().unwrap(), 294); // assert_eq!(tx_builder.output_sizes(), vec![65, 65]); // TODO: set network id tx_builder.set_network_id(NetworkId::testnet()); let final_tx = tx_builder.build(ChangeSelectionAlgo::Default, &change_addr); assert!(final_tx.is_ok()); let final_tx_builder = final_tx.unwrap(); let body = final_tx_builder.body(); let mut witness_set = TransactionWitnessSet::new(); let alice_private_key = cml_crypto::PrivateKey::from_bech32(¶ms.sender_private_key).unwrap(); witness_set.vkeywitnesses = Some( vec![make_vkey_witness( &hash_transaction(&body), &alice_private_key, )] .into(), ); let final_tx = cml_chain::transaction::Transaction::new(body, witness_set, true, None); let hex_encoded = hex::encode(final_tx.to_cbor_bytes()); dbg!("Hex Encoded Transaction: {}", hex_encoded); final_tx.to_cbor_bytes() } } #[tokio::main] async fn main() -> BlockfrostResult<()> { let address_alice = generating_keys::create_account(MNEMONIC_ALICE); let address_bob = generating_keys::create_account(MNEMONIC_BOB); let api = BlockfrostAPI::new( "preprodwYU86nDDxOQKRAkTvp660AQu2pxLfh9l", BlockFrostSettings::new(), ); assert_eq!( address_alice.to_bech32(None).unwrap(), "addr_test1qztenh2rujsa47xgz0u53rjm4ape6urd4yua4f8u6h3rz2lg3cfqlr49zru49t7ejlwjxsdhy9rdafs3fs2yc2egzjeqfqgg4z" ); assert_eq!( address_bob.to_bech32(None).unwrap(), "addr_test1qravems9gq7fqnnsx4u2eqpmx6v7d0h65slk0lsfpwhwew83s0t8du45gf8w86q27kadzqjwszck4hvf4avhjqu3l2esuqsd00" ); /* let address = "addr_test1qp5tjpeph2su74qrg60se276u6zvd90umxmctufxr0jf8gr7dsy677qxztemp72yqgu3xv35w2fts5c5k2c9szlrn5fqttkd5z"; let addresses = api.addresses(address).await; let addresses_total = api.addresses_total(address).await; let addresses_utxos = api.addresses_utxos(address, Pagination::default()).await; dbg!(&addresses); dbg!(&addresses_total); dbg!(&addresses_utxos); */ let alice_address_content = api .addresses(&address_alice.to_bech32(None).unwrap()) .await?; //print alice and bob address content in mutiple lines println!("Alice Address Content:"); for amount in alice_address_content.amount { println!("{:?}", amount); } if let Ok(bob_address_content) = api.addresses(&address_bob.to_bech32(None).unwrap()).await { println!("Bob Address Content:"); for amount in bob_address_content.amount { println!("{:?}", amount); } } else { println!("Bob address not found"); } let slot = api.blocks_latest().await; let slot = slot?.slot.unwrap() as u64; let alice_utxos = api .addresses_utxos(&address_alice.to_bech32(None).unwrap(), Pagination::all()) .await?; let alice_utxo = alice_utxos[0].clone(); println!( "Alice UTXOs: {}:{}, {:?}", alice_utxo.tx_hash, alice_utxo.output_index, alice_utxo ); let params = CardanoTransactionParameters { send_address: address_alice, recv_address: address_bob, sender_private_key: generating_keys::create_signing_key(MNEMONIC_ALICE), amount: 10_000_000, ttl: slot, transaction_input: TransactionInput::new( TransactionHash::from_hex(&alice_utxo.tx_hash).unwrap(), alice_utxo.output_index as u64, ), transaction_output_amount: alice_utxo .amount .iter() .find(|u| u.unit == "lovelace") .unwrap() .quantity .parse() .unwrap(), }; // Should contain the correct cbor contents let transaction_data = tx_builder::build_tx_with_change(¶ms); let transaction_hash = api.transactions_submit(transaction_data).await?; dbg!(&transaction_hash); // println!("{}", transaction_hash); Ok(()) } ================================================ FILE: crates/anychain-cardano/src/address.rs ================================================ use { crate::{format::CardanoFormat, public_key::CardanoPublicKey}, anychain_core::{Address, AddressError, PublicKey}, core::{ fmt::{Display, Formatter, Result as FmtResult}, str::FromStr, }, curve25519_dalek::Scalar, std::hash::Hash, }; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct CardanoAddress(pub cml_chain::address::Address); impl Address for CardanoAddress { type SecretKey = Scalar; type Format = CardanoFormat; type PublicKey = CardanoPublicKey; fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::PublicKey::from_secret_key(secret_key).to_address(format) } fn from_public_key( public_key: &Self::PublicKey, format: &Self::Format, ) -> Result { public_key.to_address(format) } } impl FromStr for CardanoAddress { type Err = AddressError; fn from_str(addr: &str) -> Result { let address = cml_chain::address::Address::from_bech32(addr) .map_err(|error| AddressError::InvalidAddress(format!("{:?}", error)))?; Ok(Self(address)) } } impl Display for CardanoAddress { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { write!(f, "{}", self.0.to_bech32(None).unwrap()) } } #[cfg(test)] mod tests { use super::CardanoAddress; use crate::{format::CardanoFormat, network::CardanoNetwork}; use anychain_core::Address; use curve25519_dalek::Scalar; #[test] fn test() { let sk = [ 104u8, 78, 102, 228, 174, 250, 35, 99, 180, 223, 45, 40, 124, 22, 12, 130, 70, 82, 183, 48, 195, 95, 207, 80, 47, 5, 201, 222, 157, 148, 168, 13, ]; let sk = Scalar::from_bytes_mod_order(sk); let sk_to = [ 189, 149, 70, 173, 231, 111, 65, 210, 164, 15, 24, 21, 180, 45, 148, 78, 252, 149, 36, 168, 70, 107, 84, 229, 47, 5, 213, 243, 253, 249, 19, 11u8, ]; let sk_to = Scalar::from_bytes_mod_order(sk_to); let format = CardanoNetwork::Preprod; let format = CardanoFormat::Enterprise(format); let from = CardanoAddress::from_secret_key(&sk, &format).unwrap(); let to = CardanoAddress::from_secret_key(&sk_to, &format).unwrap(); println!("from: {}\nto: {}\n", from, to); } } ================================================ FILE: crates/anychain-cardano/src/amount.rs ================================================ //! Definitions for the native Cardano token and its fractional LOVELACE. use { anychain_core::{to_basic_unit_u64, Amount, AmountError}, core::fmt, serde::{Deserialize, Serialize}, std::ops::{Add, Sub}, }; /// Represents the amount of SOL in lamports #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct CardanoAmount(pub u64); pub enum Denomination { LOVELACE, ADA, } impl Denomination { /// The number of decimal places more than one LOVELACE. /// There are 10^6 LOVELACE in one ADA fn precision(self) -> u64 { match self { Denomination::LOVELACE => 0, Denomination::ADA => 6, } } } impl fmt::Display for Denomination { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "{}", match self { Denomination::LOVELACE => "lovelace", Denomination::ADA => "ADA", } ) } } impl Amount for CardanoAmount {} impl CardanoAmount { pub fn from_u64(lovelace: u64) -> Self { Self(lovelace) } pub fn from_u64_str(value: &str) -> Result { match value.parse::() { Ok(lovelace) => Ok(lovelace), Err(error) => Err(AmountError::Crate("uint", format!("{:?}", error))), } } pub fn from_lovelace(lovelace_value: &str) -> Result { let lovelace = Self::from_u64_str(lovelace_value)?; Ok(Self::from_u64(lovelace)) } pub fn from_ada(sol_value: &str) -> Result { let lovelace_value = to_basic_unit_u64(sol_value, Denomination::ADA.precision()); let lovelace = Self::from_u64_str(&lovelace_value)?; Ok(Self::from_u64(lovelace)) } } impl Add for CardanoAmount { type Output = Self; fn add(self, rhs: Self) -> Self { Self(self.0 + rhs.0) } } impl Sub for CardanoAmount { type Output = Self; fn sub(self, rhs: Self) -> Self::Output { Self(self.0 - rhs.0) } } impl fmt::Display for CardanoAmount { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } } #[cfg(test)] #[allow(dead_code)] mod tests { use super::*; fn test_from_lovelace(lovelace_value: &str, expected_amount: &str) { let amount = CardanoAmount::from_lovelace(lovelace_value).unwrap(); assert_eq!(expected_amount, amount.to_string()) } fn test_from_ada(ada_value: &str, expected_amount: &str) { let amount = CardanoAmount::from_ada(ada_value).unwrap(); assert_eq!(expected_amount, amount.to_string()) } pub struct AmountDenominationTestCase { lovelace: &'static str, ada: &'static str, } const TEST_AMOUNTS: [AmountDenominationTestCase; 2] = [ AmountDenominationTestCase { lovelace: "0", ada: "0", }, AmountDenominationTestCase { lovelace: "1000000", ada: "1", }, ]; #[test] fn test_lovelace_conversion() { TEST_AMOUNTS .iter() .for_each(|amounts| test_from_lovelace(amounts.lovelace, amounts.lovelace)); } #[test] fn test_sol_conversion() { TEST_AMOUNTS .iter() .for_each(|amounts| test_from_ada(amounts.ada, amounts.lovelace)); } fn test_addition(a: &str, b: &str, result: &str) { let a = CardanoAmount::from_lovelace(a).unwrap(); let b = CardanoAmount::from_lovelace(b).unwrap(); let result = CardanoAmount::from_lovelace(result).unwrap(); assert_eq!(result, a.add(b)); } fn test_subtraction(a: &str, b: &str, result: &str) { let a = CardanoAmount::from_lovelace(a).unwrap(); let b = CardanoAmount::from_lovelace(b).unwrap(); let result = CardanoAmount::from_lovelace(result).unwrap(); assert_eq!(result, a.sub(b)); } mod valid_arithmetic { use super::*; const TEST_VALUES: [(&str, &str, &str); 5] = [ ("0", "0", "0"), ("1", "2", "3"), ("100000", "0", "100000"), ("123456789", "987654321", "1111111110"), ("1000000000000000", "2000000000000000", "3000000000000000"), ]; #[test] fn test_valid_addition() { TEST_VALUES .iter() .for_each(|(a, b, c)| test_addition(a, b, c)); } } } ================================================ FILE: crates/anychain-cardano/src/format.rs ================================================ use crate::network::CardanoNetwork; use { anychain_core::Format, core::{default::Default, fmt}, }; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum CardanoFormat { Base(CardanoNetwork), Enterprise(CardanoNetwork), Reward(CardanoNetwork), Byron(CardanoNetwork), } impl CardanoFormat {} impl Default for CardanoFormat { fn default() -> Self { Self::Base(CardanoNetwork::default()) } } impl Format for CardanoFormat {} impl fmt::Display for CardanoFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { CardanoFormat::Base(_) => write!(f, "base"), CardanoFormat::Enterprise(_) => write!(f, "enterprise"), CardanoFormat::Reward(_) => write!(f, "reward"), CardanoFormat::Byron(_) => write!(f, "byron"), } } } #[cfg(test)] mod tests { use super::*; #[test] fn test_display() { assert_eq!( CardanoFormat::Base(CardanoNetwork::Mainnet).to_string(), "base" ); assert_eq!( CardanoFormat::Enterprise(CardanoNetwork::Mainnet).to_string(), "enterprise" ); assert_eq!( CardanoFormat::Reward(CardanoNetwork::Mainnet).to_string(), "reward" ); assert_eq!( CardanoFormat::Byron(CardanoNetwork::Mainnet).to_string(), "byron" ); } } ================================================ FILE: crates/anychain-cardano/src/lib.rs ================================================ pub mod address; pub mod amount; pub mod format; pub mod network; pub mod public_key; pub mod transaction; mod util; pub use self::address::*; pub use self::amount::*; pub use self::format::*; pub use self::network::*; pub use self::public_key::*; pub use self::transaction::*; ================================================ FILE: crates/anychain-cardano/src/network.rs ================================================ /// Mainnet: This is the primary network where actual transactions occur and real ADA is used. /// It is the live network used by end-users and applications. /// /// Preview: This is a testing environment that mimics the mainnet but uses test ADA. /// It is used for testing new features and updates before they are deployed to the mainnet. /// /// Preprod: This is another testing environment similar to TestnetPreview, but it may be used for pre-production testing. /// It allows developers to test their applications in an environment that closely resembles the mainnet before final deployment. #[derive(Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum CardanoNetwork { #[default] Mainnet, Preprod, Preview, } impl CardanoNetwork { pub fn info(&self) -> CardanoNetworkInfo { match self { CardanoNetwork::Mainnet => CardanoNetworkInfo::mainnet(), CardanoNetwork::Preprod => CardanoNetworkInfo::preprod(), CardanoNetwork::Preview => CardanoNetworkInfo::preview(), } } } #[derive(Debug, Clone, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct CardanoNetworkInfo { network_id: u8, protocol_magic: u32, } impl CardanoNetworkInfo { pub fn new(network_id: u8, protocol_magic: u32) -> Self { Self { network_id, protocol_magic, } } pub fn network_id(&self) -> u8 { self.network_id } pub fn protocol_magic(&self) -> u32 { self.protocol_magic } pub fn mainnet() -> CardanoNetworkInfo { CardanoNetworkInfo { network_id: 0b0001, protocol_magic: 764824073, } } pub fn preprod() -> CardanoNetworkInfo { CardanoNetworkInfo { network_id: 0b0000, protocol_magic: 1, } } pub fn preview() -> CardanoNetworkInfo { CardanoNetworkInfo { network_id: 0b0000, protocol_magic: 2, } } } ================================================ FILE: crates/anychain-cardano/src/public_key.rs ================================================ use { crate::{address::CardanoAddress, format::CardanoFormat}, anychain_core::{AddressError, PublicKey, PublicKeyError}, cml_chain::{ address::{EnterpriseAddress, RewardAddress}, certs::StakeCredential, }, cml_crypto::{blake2b224, Ed25519KeyHash}, core::{fmt, str::FromStr}, curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE as G, Scalar}, group::GroupEncoding, }; #[derive(Debug, Clone, PartialEq, Eq)] pub struct CardanoPublicKey(pub ed25519_dalek::VerifyingKey); impl PublicKey for CardanoPublicKey { type SecretKey = Scalar; type Address = CardanoAddress; type Format = CardanoFormat; fn from_secret_key(secret_key: &Self::SecretKey) -> Self { let pk = secret_key * G; let pk = pk.to_bytes(); let pk = ed25519_dalek::VerifyingKey::from_bytes(&pk).unwrap(); Self(pk) } fn to_address(&self, format: &Self::Format) -> Result { let bytes = self.0.as_bytes(); let hash = blake2b224(bytes); let hash = Ed25519KeyHash::from(hash); let cred = StakeCredential::new_pub_key(hash); match format { CardanoFormat::Enterprise(network) => { let address = EnterpriseAddress::new(network.info().network_id(), cred).to_address(); Ok(CardanoAddress(address)) } CardanoFormat::Reward(network) => { let address = RewardAddress::new(network.info().network_id(), cred).to_address(); Ok(CardanoAddress(address)) } _ => Err(AddressError::Message("unsupported format".to_string())), } } } impl FromStr for CardanoPublicKey { type Err = PublicKeyError; fn from_str(_: &str) -> Result { todo!() } } impl fmt::Display for CardanoPublicKey { fn fmt(&self, _: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-cardano/src/transaction.rs ================================================ use crate::util::create_default_tx_builder; use crate::{CardanoAddress, CardanoFormat, CardanoPublicKey}; use anychain_core::{Transaction, TransactionError, TransactionId}; use cml_chain::Deserialize; use cml_chain::{ assets::Value, builders::{ input_builder::SingleInputBuilder, output_builder::TransactionOutputBuilder, tx_builder::ChangeSelectionAlgo, }, crypto::{Vkey, Vkeywitness}, transaction::{ Transaction as SignedTransaction, TransactionInput, TransactionOutput, TransactionWitnessSet, }, utils::NetworkId, }; use cml_core::serialization::{RawBytesEncoding, Serialize}; use cml_crypto::{blake2b256, Ed25519Signature, TransactionHash}; use std::{fmt, str::FromStr}; #[derive(Debug, Clone)] pub struct Input { pub txid: String, pub index: u64, pub address: Option, pub amount: Option, } #[derive(Debug, Clone)] pub struct Output { pub address: CardanoAddress, pub amount: u64, } #[derive(Debug, Clone)] pub struct CardanoTransactionParameters { pub inputs: Vec, pub outputs: Vec, pub slot: u64, pub network: u8, } #[derive(Debug, Clone)] pub struct CardanoSignature { pub public_key: Vec, pub rs: Vec, } #[derive(Debug, Clone)] pub struct CardanoTransaction { pub params: CardanoTransactionParameters, pub signatures: Option>, } impl FromStr for CardanoTransaction { type Err = TransactionError; fn from_str(_: &str) -> Result { todo!() } } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct CardanoTransactionId(pub [u8; 32]); impl fmt::Display for CardanoTransactionId { fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { todo!() } } impl TransactionId for CardanoTransactionId {} impl CardanoTransaction { pub fn sign(&mut self, sigs: Vec) -> Result, TransactionError> { self.signatures = Some(sigs); self.to_bytes() } } impl Transaction for CardanoTransaction { type Address = CardanoAddress; type Format = CardanoFormat; type PublicKey = CardanoPublicKey; type TransactionId = CardanoTransactionId; type TransactionParameters = CardanoTransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(CardanoTransaction { params: params.clone(), signatures: None, }) } fn sign(&mut self, _: Vec, _: u8) -> Result, TransactionError> { todo!() } fn to_bytes(&self) -> Result, TransactionError> { let mut builder = create_default_tx_builder(); let change_address = self.params.inputs[0].address.clone(); let change_address = &change_address.unwrap().0; for input in &self.params.inputs { let txid = TransactionHash::from_hex(&input.txid) .map_err(|e| TransactionError::Message(e.to_string()))?; let address = input.address.clone().unwrap().0.clone(); let amount = Value::from(input.amount.unwrap()); let input = TransactionInput::new(txid, input.index); let output = TransactionOutput::new(address, amount, None, None); let input = SingleInputBuilder::new(input, output) .payment_key() .map_err(|e| TransactionError::Message(e.to_string()))?; builder .add_input(input) .map_err(|e| TransactionError::Message(e.to_string()))?; } for output in &self.params.outputs { let output = TransactionOutputBuilder::new() .with_address(output.address.0.clone()) .next() .map_err(|e| TransactionError::Message(e.to_string()))? .with_value(output.amount) .build() .map_err(|e| TransactionError::Message(e.to_string()))?; builder .add_output(output) .map_err(|e| TransactionError::Message(e.to_string()))?; } let input_amount = builder .get_explicit_input() .map_err(|e| TransactionError::Message(e.to_string()))?; let output_amount = builder .get_explicit_output() .map_err(|e| TransactionError::Message(e.to_string()))?; let fee = input_amount.coin - output_amount.coin; builder.set_fee(fee); let network = NetworkId::from(self.params.network as u64); builder.set_network_id(network); builder.set_ttl(self.params.slot + 200); let tx = builder .build(ChangeSelectionAlgo::Default, change_address) .map_err(|e| TransactionError::Message(e.to_string()))? .body(); match &self.signatures { Some(sigs) => { let mut witnesses = vec![]; for sig in sigs { let pk = sig.public_key.as_slice(); let rs = sig.rs.as_slice(); let pk = Vkey::from_raw_bytes(pk) .map_err(|e| TransactionError::Message(e.to_string()))?; let rs = Ed25519Signature::from_raw_bytes(rs) .map_err(|e| TransactionError::Message(e.to_string()))?; let witness = Vkeywitness::new(pk, rs); witnesses.push(witness); } let mut witness_set = TransactionWitnessSet::new(); witness_set.vkeywitnesses = Some(witnesses.into()); let signed_tx = SignedTransaction::new(tx, witness_set, true, None); Ok(signed_tx.to_cbor_bytes()) } None => Ok(tx.to_cbor_bytes()), } } fn from_bytes(stream: &[u8]) -> Result { let signed_tx = SignedTransaction::from_cbor_bytes(stream) .map_err(|e| TransactionError::Message(e.to_string()))?; let tx = signed_tx.body; let mut inputs = vec![]; let mut outputs = vec![]; for input in tx.inputs { let txid = input.transaction_id.to_hex(); let index = input.index; inputs.push(Input { txid, index, address: None, amount: None, }); } for output in tx.outputs { let address = CardanoAddress(output.address().clone()); let amount = output.amount().coin; outputs.push(Output { address, amount }); } let network_id = tx.network_id.unwrap().network as u8; Self::new(&CardanoTransactionParameters { inputs, outputs, slot: 0, network: network_id, }) } fn to_transaction_id(&self) -> Result { let hash = blake2b256(&self.to_bytes()?); Ok(CardanoTransactionId(hash)) } } // #[cfg(test)] // mod tests { // use super::{CardanoTransaction, CardanoTransactionParameters, Input, Output}; // use crate::{CardanoAddress, CardanoPublicKey, CardanoSignature}; // use anychain_core::{PublicKey, Transaction}; // use anychain_kms::ed25519_sign; // use blockfrost::{BlockFrostSettings, BlockfrostAPI, Pagination}; // use curve25519_dalek::Scalar; // use std::str::FromStr; // use tokio::runtime::Runtime; // #[test] // fn test() { // let api = BlockfrostAPI::new( // "preprodwYU86nDDxOQKRAkTvp660AQu2pxLfh9l", // BlockFrostSettings::new(), // ); // let sk1 = [ // 104u8, 78, 102, 228, 174, 250, 35, 99, 180, 223, 45, 40, 124, 22, 12, 130, 70, 82, 183, // 48, 195, 95, 207, 80, 47, 5, 201, 222, 157, 148, 168, 13, // ]; // let sk2 = [ // 105u8, 78, 102, 228, 174, 250, 35, 98, 181, 23, 45, 40, 124, 22, 127, 130, 70, 82, 183, // 48, 5, 95, 207, 180, 47, 15, 201, 12, 157, 148, 168, 13, // ]; // let sk1 = Scalar::from_bytes_mod_order(sk1); // let pk1 = CardanoPublicKey::from_secret_key(&sk1).0; // let pk1 = pk1.to_bytes().to_vec(); // let sk2 = Scalar::from_bytes_mod_order(sk2); // let pk2 = CardanoPublicKey::from_secret_key(&sk2).0; // let pk2 = pk2.to_bytes().to_vec(); // let from1 = "addr_test1vrxhpfe4dxarnwpdhckjqu2ncc9q90ne8ewszgaree9secczx006l"; // let from2 = "addr_test1vrlum7eyq5t0s8z96fyr83v6q0vust6ygexax29z4xtahcc4egk9j"; // let mut inputs = vec![]; // let utxos = Runtime::new() // .unwrap() // .block_on(async { api.addresses_utxos(from1, Pagination::all()).await.unwrap() }); // for utxo in utxos { // let txid = utxo.tx_hash; // let index = utxo.output_index as u64; // let address = CardanoAddress::from_str(&utxo.address).unwrap(); // let amount: u64 = utxo // .amount // .iter() // .find(|u| u.unit == "lovelace") // .unwrap() // .quantity // .parse() // .unwrap(); // inputs.push(Input { // txid, // index, // address: Some(address), // amount: Some(amount), // }); // } // let utxos = Runtime::new() // .unwrap() // .block_on(async { api.addresses_utxos(from2, Pagination::all()).await.unwrap() }); // for utxo in utxos { // let txid = utxo.tx_hash; // let index = utxo.output_index as u64; // let address = CardanoAddress::from_str(&utxo.address).unwrap(); // let amount: u64 = utxo // .amount // .iter() // .find(|u| u.unit == "lovelace") // .unwrap() // .quantity // .parse() // .unwrap(); // inputs.push(Input { // txid, // index, // address: Some(address), // amount: Some(amount), // }); // } // let to = "addr_test1vz9v4d75kzw7t8nnfnn7ua9c85khelnq2y7fp3p6646szucc5xk6n"; // let to = CardanoAddress::from_str(to).unwrap(); // let amount = 100000000u64; // let to1 = Output { // address: to, // amount, // }; // let to = "addr_test1vrxhpfe4dxarnwpdhckjqu2ncc9q90ne8ewszgaree9secczx006l"; // let to = CardanoAddress::from_str(to).unwrap(); // let amount = 9800000000u64; // let to2 = Output { // address: to, // amount, // }; // let outputs = vec![to1, to2]; // let slot = Runtime::new() // .unwrap() // .block_on(async { api.blocks_latest().await.unwrap().slot.unwrap() as u64 }); // let network = 0u8; // 0 indicates testnet, 1 indicates mainnet // let params = CardanoTransactionParameters { // inputs, // outputs, // slot, // network, // }; // let mut tx = CardanoTransaction::new(¶ms).unwrap(); // let msg = tx.to_transaction_id().unwrap().0.to_vec(); // let rs1 = ed25519_sign(&sk1, &msg).unwrap(); // let rs2 = ed25519_sign(&sk2, &msg).unwrap(); // let sig1 = CardanoSignature { // public_key: pk1, // rs: rs1, // }; // let sig2 = CardanoSignature { // public_key: pk2, // rs: rs2, // }; // let tx = tx.sign(vec![sig1, sig2]).unwrap(); // let tx = CardanoTransaction::from_bytes(&tx).unwrap(); // println!("{:?}", tx); // // let res = Runtime::new() // // .unwrap() // // .block_on(async { api.transactions_submit(tx).await.unwrap() }); // // println!("res: {}", res); // } // } ================================================ FILE: crates/anychain-cardano/src/util.rs ================================================ use cml_chain::builders::tx_builder::{TransactionBuilder, TransactionBuilderConfigBuilder}; use cml_chain::fees::LinearFee; use cml_chain::genesis::network_info::plutus_alonzo_cost_models; use cml_chain::plutus::ExUnitPrices; use cml_chain::SubCoin; const MAX_VALUE_SIZE: u32 = 4000; const MAX_TX_SIZE: u32 = 8000; fn create_linear_fee(coefficient: u64, constant: u64) -> LinearFee { LinearFee::new(coefficient, constant, 0) } fn create_default_linear_fee() -> LinearFee { // create_linear_fee(500, 2) create_linear_fee(1000, 2) } fn create_tx_builder_full( linear_fee: LinearFee, pool_deposit: u64, key_deposit: u64, max_val_size: u32, coins_per_utxo_byte: u64, ) -> TransactionBuilder { let cfg = TransactionBuilderConfigBuilder::default() .fee_algo(linear_fee) .pool_deposit(pool_deposit) .key_deposit(key_deposit) .max_value_size(max_val_size) .max_tx_size(MAX_TX_SIZE) .coins_per_utxo_byte(coins_per_utxo_byte) .ex_unit_prices(ExUnitPrices::new( SubCoin::new(577, 10000), SubCoin::new(721, 10000000), )) .collateral_percentage(150) .max_collateral_inputs(3) .cost_models(plutus_alonzo_cost_models()) .build() .unwrap(); TransactionBuilder::new(cfg) } fn create_tx_builder( linear_fee: LinearFee, coins_per_utxo_byte: u64, pool_deposit: u64, key_deposit: u64, ) -> TransactionBuilder { create_tx_builder_full( linear_fee, pool_deposit, key_deposit, MAX_VALUE_SIZE, coins_per_utxo_byte, ) } fn create_tx_builder_with_fee(linear_fee: LinearFee) -> TransactionBuilder { create_tx_builder(linear_fee, 1, 1, 1) } pub fn create_default_tx_builder() -> TransactionBuilder { create_tx_builder_with_fee(create_default_linear_fee()) } ================================================ FILE: crates/anychain-cardano/tests/test_derive.rs ================================================ use bip39::Mnemonic; use cml_chain::{ address::{Address, AddressKind, BaseAddress}, certs::StakeCredential, genesis::network_info::NetworkInfo, }; use cml_crypto::{Bip32PrivateKey, Bip32PublicKey}; fn harden(index: u32) -> u32 { index | 0x80_00_00_00 } static BASE_ADDR_ALICE: &str = "addr_test1qp5tjpeph2su74qrg60se276u6zvd90umxmctufxr0jf8gr7dsy677qxztemp72yqgu3xv35w2fts5c5k2c9szlrn5fqttkd5z"; static BASE_ADDR_BOB: &str = "addr_test1qz68r5889sfly48tvr3kmlcf2uc8dxvyk598mkt8qd200z8r8yuyp7vaas4ezh9pdn5vu3wzlntj0h6qdnt4mrmqu0pqt62yar"; /// Helper function to derive keys fn derive_key( private_key: &Bip32PrivateKey, account: u32, chain: u32, index: u32, ) -> Bip32PublicKey { private_key .derive(harden(1852)) .derive(harden(1815)) .derive(harden(account)) .derive(chain) .derive(index) .to_public() } #[test] fn test_derive_alice() { // Parse the mnemonic let mnemonic_str = "lazy habit orient public finger other absorb shine cause mind general spend exit innocent drama"; let mnemonic = Mnemonic::parse_normalized(mnemonic_str) .unwrap_or_else(|e| panic!("Failed to parse mnemonic: {:?}", e)); // Derive entropy and private key let entropy = mnemonic.to_entropy(); let bip32_private_key = Bip32PrivateKey::from_bip39_entropy(&entropy, &[]); // dbg!(&bip32_private_key.to_bech32()); let bip32_public_key = bip32_private_key.to_public(); // Verify the public key assert_eq!( bip32_public_key.to_bech32(), "xpub1gyuwtxy45wmzjsetlrx82mhg86c98zvnwvl7yvaxwt5g5f7aau9usq4e9gwraq2qh5j2ywml0smhflslxfsj0hjqnmzspclprkp5tkcmfgu4v" ); // Derive spend and stake keys let spend = derive_key(&bip32_private_key, 0, 0, 0); let stake = derive_key(&bip32_private_key, 0, 2, 0); // Create base address let spend_cred = StakeCredential::new_pub_key(spend.to_raw_key().hash()); let stake_cred = StakeCredential::new_pub_key(stake.to_raw_key().hash()); let address = BaseAddress::new(NetworkInfo::testnet().network_id(), spend_cred, stake_cred).to_address(); // Verify the base address let address_bech32 = address.to_bech32(None).unwrap(); assert_eq!(address_bech32, BASE_ADDR_ALICE); } #[test] fn test_derive_bob() { // Parse the mnemonic let mnemonic_str = "oak anchor meadow nerve limb true banner lock arena brisk width lottery frame walnut barrel innocent enhance feature one gate parade small alert hollow"; let mnemonic = Mnemonic::parse_normalized(mnemonic_str) .unwrap_or_else(|e| panic!("Failed to parse mnemonic: {:?}", e)); // Derive entropy and private key let entropy = mnemonic.to_entropy(); let bip32_private_key = Bip32PrivateKey::from_bip39_entropy(&entropy, &[]); // Derive spend and stake keys let spend = derive_key(&bip32_private_key, 0, 0, 0); let stake = derive_key(&bip32_private_key, 0, 2, 0); // Create base address let spend_cred = StakeCredential::new_pub_key(spend.to_raw_key().hash()); let stake_cred = StakeCredential::new_pub_key(stake.to_raw_key().hash()); let address = BaseAddress::new(NetworkInfo::testnet().network_id(), spend_cred, stake_cred).to_address(); // Verify the base address let address_bech32 = address.to_bech32(None).unwrap(); assert_eq!(address_bech32, BASE_ADDR_BOB); } #[test] fn test_from_address() { // Parse the base address let base_address = Address::from_bech32(BASE_ADDR_ALICE) .unwrap_or_else(|e| panic!("Failed to parse address: {:?}", e)); // Verify address properties assert_eq!(AddressKind::Base, base_address.kind()); assert_eq!( base_address.network_id().unwrap(), NetworkInfo::testnet().network_id() ); } ================================================ FILE: crates/anychain-core/Cargo.toml ================================================ [package] name = "anychain-core" version = "0.1.8" description = "A core support for cryptocurrency wallets" categories = ["command-line-utilities", "cryptography::cryptocurrencies"] keywords = ["bitcoin", "blockchain", "ethereum", "no_std"] readme = "README.md" # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] sha3 = { workspace = true } thiserror = { workspace = true } ripemd = { workspace = true } bech32 = { workspace = true } hex = { workspace = true } base58 = { workspace = true , optional = true } rand_core = { workspace = true } serde_json = { workspace = true } sha2 = { workspace = true } [features] default = ["std"] std = ["base58"] ================================================ FILE: crates/anychain-core/README.md ================================================ # anychain-core anychain-core is a Rust crate that provides core functionality for working with various blockchain implementations. This crate aims to simplify the process of integrating different blockchain technologies into your projects by providing a unified interface and a set of common utilities. ## Features - Unified interface for interacting with multiple blockchain implementations - Support for popular blockchain platforms (e.g., Ethereum, Bitcoin, etc.) - Extensible design for adding custom blockchain implementations - Utility functions for common tasks (e.g., address validation, transaction signing, etc.) ## Getting Started To start using anychain-core, add it as a dependency in your Cargo.toml file: ```toml [dependencies] anychain-core = "0.1.7" ``` Then, import the crate in your Rust code: ```rust extern crate anychain_core; ``` ## Usage Here's a basic example of how to use anychain-core to interact with an Ethereum blockchain: ```rust use anychain_core::{Blockchain, Ethereum}; fn main() { let eth = Ethereum::new("https://mainnet.infura.io/v3/YOUR-API-KEY"); let balance = eth.get_balance("0x742d35Cc6634C0532925a3b844Bc454e4438f44e").unwrap(); println!("Balance: {}", balance); } ``` For more examples and usage details, please refer to the [documentation](https://docs.rs/anychain-core). ## Contributing We welcome contributions to anychain-core! If you'd like to contribute, please follow these steps: 1. Fork the repository on GitHub 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Submit a pull request to merge your changes into the main repository Please make sure to write tests for your changes and follow the existing coding style. ## License anychain-core is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information ================================================ FILE: crates/anychain-core/src/address.rs ================================================ use crate::{ format::Format, no_std::{ fmt::{Debug, Display}, hash::Hash, FromStr, String, }, public_key::{PublicKey, PublicKeyError}, }; /// The interface for a generic address. pub trait Address: 'static + Clone + Debug + Display + FromStr + Hash + PartialEq + Eq + Send + Sized + Sync { type SecretKey; type Format: Format; type PublicKey: PublicKey; /// Returns the address corresponding to the given private key. fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result; /// Returns the address corresponding to the given public key. fn from_public_key( public_key: &Self::PublicKey, format: &Self::Format, ) -> Result; fn is_valid(address: &str) -> bool { Self::from_str(address).is_ok() } } #[derive(Debug, Error)] pub enum AddressError { #[error("{0:}: {1:}")] Crate(&'static str, String), #[error("invalid format conversion from {0:} to {1:}")] IncompatibleFormats(String, String), #[error("invalid address: {0:}")] InvalidAddress(String), #[error("invalid byte length: {0:}")] InvalidByteLength(usize), #[error("invalid character length: {0:}")] InvalidCharacterLength(usize), #[error("invalid address checksum: {{ expected: {0:}, found: {1:} }}")] InvalidChecksum(String, String), #[error("invalid network: {{ expected: {0}, found: {1} }}")] InvalidNetwork(String, String), #[error("invalid address prefix: {0:}")] InvalidPrefix(String), #[error("invalid address prefix length: {0:?}")] InvalidPrefixLength(usize), #[error("{0}")] Message(String), #[error("missing public spend key and/or public view key")] MissingPublicKey, #[error("{0}")] PublicKeyError(PublicKeyError), } impl From for AddressError { fn from(error: crate::no_std::io::Error) -> Self { AddressError::Crate("crate::no_std::io", format!("{error:?}")) } } impl From for AddressError { fn from(error: crate::no_std::FromUtf8Error) -> Self { AddressError::Crate("crate::no_std", format!("{error:?}")) } } impl From<&'static str> for AddressError { fn from(msg: &'static str) -> Self { AddressError::Message(msg.into()) } } impl From for AddressError { fn from(error: PublicKeyError) -> Self { AddressError::PublicKeyError(error) } } impl From for AddressError { fn from(error: base58::FromBase58Error) -> Self { AddressError::Crate("base58", format!("{error:?}")) } } impl From for AddressError { fn from(error: bech32::Error) -> Self { AddressError::Crate("bech32", format!("{error:?}")) } } impl From for AddressError { fn from(error: core::str::Utf8Error) -> Self { AddressError::Crate("core::str", format!("{error:?}")) } } impl From for AddressError { fn from(error: hex::FromHexError) -> Self { AddressError::Crate("hex", format!("{error:?}")) } } impl From for AddressError { fn from(error: rand_core::Error) -> Self { AddressError::Crate("rand", format!("{error:?}")) } } ================================================ FILE: crates/anychain-core/src/amount.rs ================================================ use { crate::no_std::{ fmt::{Debug, Display}, hash::Hash, String, }, thiserror::Error, }; /// The interface for a generic amount. pub trait Amount: Copy + Clone + Debug + Display + Send + Sync + 'static + Eq + Ord + Sized + Hash { } #[derive(Debug, Error)] pub enum AmountError { #[error("{0}: {1}")] Crate(&'static str, String), #[error("the amount: {0:} exceeds the supply bounds of {1:}")] AmountOutOfBounds(String, String), #[error("invalid amount: {0:}")] InvalidAmount(String), } /// Converts any available denomination to the minimum denomination pub fn to_basic_unit(value: &str, mut denomination: u32) -> String { if denomination > 18 { println!("illegal denomination"); return "".to_string(); } let mut has_point: bool = false; let mut point: usize = 0; let mut cnt: usize = 0; for c in value.chars() { if c.is_ascii_digit() || c == '.' { if c == '.' { if has_point { println!("duplicate decimal point"); return "".to_string(); } if cnt == 0 { // the decimal point is at the front, indicating the value is 0 return "0".to_string(); } has_point = true; point = cnt; } cnt += 1; } else { println!("illegal decimal string"); return "".to_string(); } } let mut value = value.to_string(); // the decimal string does not contain a decimal point, // so we add one to the end. if !has_point { value.insert(value.len(), '.'); point = value.len() - 1; } let mut v = value.as_bytes().to_vec(); // now we right-shift the decimal point for 'denomination' times while denomination > 0 { // the decimal point is at the end of the vec, so push '0' // to the end and swap it with the decimal point if point == v.len() - 1 { v.push(b'0'); } // swap the decimal point with its next digit v.swap(point, point + 1); point += 1; denomination -= 1; } // round up or down to the nearest integer if point < v.len() - 1 && v[point + 1] > b'5' { v[point - 1] += 1; } v.truncate(point); String::from_utf8(v).unwrap() } /// Converts any available denomination to the minimum denomination pub fn to_basic_unit_u64(value: &str, mut denomination: u64) -> String { if denomination > 18 { println!("illegal denomination"); return "".to_string(); } let mut has_point: bool = false; let mut point: usize = 0; let mut cnt: usize = 0; for c in value.chars() { if c.is_ascii_digit() || c == '.' { if c == '.' { if has_point { println!("duplicate decimal point"); return "".to_string(); } if cnt == 0 { // the decimal point is at the front, indicating the value is 0 return "0".to_string(); } has_point = true; point = cnt; } cnt += 1; } else { println!("illegal decimal string"); return "".to_string(); } } let mut value = value.to_string(); // the decimal string does not contain a decimal point, // so we add one to the end. if !has_point { value.insert(value.len(), '.'); point = value.len() - 1; } let mut v = value.as_bytes().to_vec(); // now we right-shift the decimal point for 'denomination' times while denomination > 0 { // the decimal point is at the end of the vec, so push '0' // to the end and swap it with the decimal point if point == v.len() - 1 { v.push(b'0'); } // swap the decimal point with its next digit v.swap(point, point + 1); point += 1; denomination -= 1; } // round up or down to the nearest integer if point < v.len() - 1 && v[point + 1] > b'5' { v[point - 1] += 1; } v.truncate(point); String::from_utf8(v).unwrap() } #[test] fn test() { let s = to_basic_unit("0.0001037910", 7); println!("s = {s}"); } ================================================ FILE: crates/anychain-core/src/error.rs ================================================ use crate::{ no_std::{ fmt::Error as FmtError, io::Error as IoError, num::ParseIntError as NumParseIntError, String, }, AddressError, AmountError, FormatError, PublicKeyError, TransactionError, }; #[derive(Debug, Error)] pub enum Error { #[error("Runtime Error:{0}")] RuntimeError(String), #[error("Invalid Address: {0}")] InvalidAddress(#[from] AddressError), #[error("Invalid Transaction: {0:}")] InvalidTransaction(#[from] TransactionError), #[error("Invalid Amount: {0:}")] InvalidAmount(#[from] AmountError), #[error("Invalid PublickKey: {0:}")] InvalidPublickKey(#[from] PublicKeyError), #[error("Invalid Format: {0:}")] InvalidFormat(#[from] FormatError), #[error("io error: {0:}")] Io(#[from] IoError), #[error("fmt error: {0:}")] Fmt(#[from] FmtError), #[error("fromHex error: {0:}")] FromHex(#[from] ::hex::FromHexError), #[error("parsing error: {0:}")] ParseInt(#[from] NumParseIntError), } ================================================ FILE: crates/anychain-core/src/format.rs ================================================ use { crate::no_std::{ fmt::{Debug, Display}, hash::Hash, String, Vec, }, thiserror::Error, }; /// The interface for a generic format. pub trait Format: Clone + Debug + Display + Send + Sync + 'static + Eq + Ord + Sized + Hash { } #[derive(Debug, Error)] pub enum FormatError { #[error("{0}: {1}")] Crate(&'static str, String), #[error("invalid address prefix: {0:?}")] InvalidPrefix(Vec), #[error("invalid version bytes: {0:?}")] InvalidVersionBytes(Vec), #[error("unsupported derivation path for the format: {0}")] UnsupportedDerivationPath(String), } ================================================ FILE: crates/anychain-core/src/lib.rs ================================================ //! # Model //! //! A model for cryptocurrency wallets. #![cfg_attr(not(feature = "std"), no_std)] #![warn(unused_extern_crates, dead_code)] #![forbid(unsafe_code)] #[cfg(not(feature = "std"))] #[allow(unused_imports)] #[doc(hidden)] #[macro_use] extern crate alloc; #[macro_use] extern crate thiserror; pub mod no_std; pub mod address; pub use self::address::*; pub mod amount; pub use self::amount::*; pub mod format; pub use self::format::*; pub mod network; pub use self::network::*; pub mod public_key; pub use self::public_key::*; pub mod transaction; pub use self::transaction::*; pub mod utilities; pub use self::utilities::*; pub mod error; pub use error::*; // export common crate pub use hex; // pub use bls_signatures; // pub use ethereum_types; ================================================ FILE: crates/anychain-core/src/network.rs ================================================ use { crate::no_std::{ fmt::{Debug, Display}, hash::Hash, FromStr, String, }, thiserror::Error, }; /// The interface for a generic network. pub trait Network: Copy + Clone + Debug + Display + FromStr + Send + Sync + 'static + Eq + Ord + Sized + Hash { const NAME: &'static str; } #[derive(Debug, Error)] pub enum NetworkError { #[error("invalid extended private key prefix: {0}")] InvalidExtendedPrivateKeyPrefix(String), #[error("invalid extended public key prefix: {0}")] InvalidExtendedPublicKeyPrefix(String), #[error("invalid network: {0}")] InvalidNetwork(String), } ================================================ FILE: crates/anychain-core/src/no_std/io.rs ================================================ //! no-std io replacement use crate::no_std::Vec; use core::{cmp, fmt, mem}; pub trait Read { fn read(&mut self, buf: &mut [u8]) -> Result; fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>; } impl Read for &mut R { #[inline] fn read(&mut self, buf: &mut [u8]) -> Result { (**self).read(buf) } #[inline] fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> { (**self).read_exact(buf) } } impl Read for &[u8] { #[inline] fn read(&mut self, buf: &mut [u8]) -> Result { let amt = cmp::min(buf.len(), self.len()); let (a, b) = self.split_at(amt); // First check if the amount of bytes we want to read is small: // `copy_from_slice` will generally expand to a call to `memcpy`, and // for a single byte the overhead is significant. if amt == 1 { buf[0] = a[0]; } else { buf[..amt].copy_from_slice(a); } *self = b; Ok(amt) } #[inline] fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error> { if buf.len() > self.len() { return Err(Error); } let (a, b) = self.split_at(buf.len()); // First check if the amount of bytes we want to read is small: // `copy_from_slice` will generally expand to a call to `memcpy`, and // for a single byte the overhead is significant. if buf.len() == 1 { buf[0] = a[0]; } else { buf.copy_from_slice(a); } *self = b; Ok(()) } } pub trait Write { fn write(&mut self, buf: &[u8]) -> Result; fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>; } impl Write for &mut W { #[inline] fn write(&mut self, buf: &[u8]) -> Result { (**self).write(buf) } #[inline] fn write_all(&mut self, buf: &[u8]) -> Result<(), Error> { (**self).write_all(buf) } } impl Write for &mut [u8] { #[inline] fn write(&mut self, buf: &[u8]) -> Result { let amt = cmp::min(buf.len(), self.len()); let (a, b) = mem::replace(self, &mut []).split_at_mut(amt); a.copy_from_slice(&buf[..amt]); *self = b; Ok(amt) } #[inline] fn write_all(&mut self, buf: &[u8]) -> Result<(), Error> { let amt = cmp::min(buf.len(), self.len()); let (a, b) = mem::replace(self, &mut []).split_at_mut(amt); a.copy_from_slice(&buf[..amt]); *self = b; if amt == buf.len() { Ok(()) } else { Err(Error) } } } impl Write for Vec { #[inline] fn write(&mut self, buf: &[u8]) -> Result { self.extend_from_slice(buf); Ok(buf.len()) } #[inline] fn write_all(&mut self, buf: &[u8]) -> Result<(), Error> { self.extend_from_slice(buf); Ok(()) } } #[derive(Debug)] pub struct Error; impl fmt::Display for Error { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { writeln!(f, "Error in no_std::io operation") } } ================================================ FILE: crates/anychain-core/src/no_std/mod.rs ================================================ #[cfg(not(feature = "std"))] #[doc(hidden)] pub use alloc::{ borrow::ToOwned, format, string::FromUtf8Error, string::String, string::ToString, vec, vec::Vec, }; #[cfg(not(feature = "std"))] #[doc(hidden)] pub use core::{ hash, num, {fmt, str::FromStr}, }; #[cfg(feature = "std")] #[doc(hidden)] pub use std::{ borrow::ToOwned, fmt, format, hash, num, str::FromStr, string::FromUtf8Error, string::String, string::ToString, vec, vec::Vec, }; #[cfg(not(feature = "std"))] #[doc(hidden)] pub mod io; #[cfg(feature = "std")] pub use std::io; ================================================ FILE: crates/anychain-core/src/public_key.rs ================================================ use { crate::{ address::{Address, AddressError}, format::Format, no_std::{ fmt::{Debug, Display}, FromStr, String, }, }, thiserror::Error, }; /// Generic public key. pub trait PublicKey: Clone + Debug + Display + FromStr + Send + Sync + 'static + Sized { type SecretKey; type Address: Address; type Format: Format; /// Returns a public key given an secp256k1 secret key. fn from_secret_key(secret_key: &Self::SecretKey) -> Self; /// Returns an address corresponding to this public key. fn to_address(&self, format: &Self::Format) -> Result; } #[derive(Debug, Error)] pub enum PublicKeyError { #[error("{0}: {1}")] Crate(&'static str, String), #[error("invalid byte length: {0}")] InvalidByteLength(usize), #[error("invalid character length: {0}")] InvalidCharacterLength(usize), #[error("invalid public key prefix: {0}")] InvalidPrefix(String), #[error("no public spending key found")] NoSpendingKey, #[error("no public viewing key found")] NoViewingKey, } impl From for PublicKeyError { fn from(error: crate::no_std::io::Error) -> Self { PublicKeyError::Crate("crate::no_std::io", format!("{error:?}")) } } impl From for PublicKeyError { fn from(error: base58::FromBase58Error) -> Self { PublicKeyError::Crate("base58", format!("{error:?}")) } } impl From for PublicKeyError { fn from(error: bech32::Error) -> Self { PublicKeyError::Crate("bech32", format!("{error:?}")) } } impl From for PublicKeyError { fn from(error: hex::FromHexError) -> Self { PublicKeyError::Crate("hex", format!("{error:?}")) } } // impl From for PublicKeyError { // fn from(error: libsecp256k1::Error) -> Self { // PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)) // } // } ================================================ FILE: crates/anychain-core/src/transaction.rs ================================================ use { crate::{ address::{Address, AddressError}, amount::AmountError, format::Format, no_std::{ fmt::{Debug, Display}, hash::Hash, String, Vec, }, public_key::PublicKey, utilities::crypto::keccak256, }, thiserror::Error, }; /** * 返回合约函数签名,取keccak256 hash值的前4个Bytes */ pub fn func_selector(func_signature: &str) -> [u8; 4] { let mut func_id = [0u8; 4]; func_id.clone_from_slice(&keccak256(func_signature.as_bytes())[..4]); func_id } /// The interface for a generic transaction id. pub trait TransactionId: Clone + Debug + Display + Send + Sync + 'static + Eq + Sized + Hash { } /// The interface for a generic transactions. pub trait Transaction: Clone + Send + Sync + 'static { type Address: Address; type Format: Format; type PublicKey: PublicKey; type TransactionId: TransactionId; type TransactionParameters; /// Returns an unsigned transaction given the transaction parameters. fn new(parameters: &Self::TransactionParameters) -> Result; /// Returns a signed transaction bytes given the (signature,recovery_id) fn sign(&mut self, signature: Vec, recid: u8) -> Result, TransactionError>; /// Returns a transaction given the transaction bytes. fn from_bytes(transaction: &[u8]) -> Result; /// Returns the transaction in bytes. fn to_bytes(&self) -> Result, TransactionError>; /// Returns the transaction id. fn to_transaction_id(&self) -> Result; } #[derive(Debug, Error)] pub enum TransactionError { #[error("{0}")] AddressError(#[from] AddressError), #[error("{0}")] AmountError(#[from] AmountError), #[error("witnesses have a conflicting anchor")] ConflictingWitnessAnchors(), #[error("{0}: {1}")] Crate(&'static str, String), #[error("Failed note decryption for enc_cyphertext: {0}")] FailedNoteDecryption(String), #[error("invalid binding signature for the transaction")] InvalidBindingSig(), #[error("invalid chain id {0}")] InvalidChainId(u8), #[error("invalid ephemeral key {0}")] InvalidEphemeralKey(String), #[error("insufficient information to craft transaction. missing: {0}")] InvalidInputs(String), #[error("invalid output address: {0}")] InvalidOutputAddress(String), #[error("invalid ouptut description for address: {0}")] InvalidOutputDescription(String), #[error("invalid transaction RLP length: expected - 9, found - {0}")] InvalidRlpLength(usize), #[error("invalid script pub key for format: {0}")] InvalidScriptPubKey(String), #[error("invalid segwit flag: {0}")] InvalidSegwitFlag(usize), #[error("invalid spend description for address")] InvalidSpendDescription, #[error("invalid transaction id {0}")] InvalidTransactionId(usize), #[error( "invalid transaction - either both sender and signature should be present, or neither" )] InvalidTransactionState, #[error("invalid variable size integer: {0}")] InvalidVariableSizeInteger(usize), #[error("{0}")] Message(String), #[error("missing diversifier, check that the address is a Sapling address")] MissingDiversifier, #[error("missing outpoint address")] MissingOutpointAddress, #[error("missing outpoint amount")] MissingOutpointAmount, #[error("missing outpoint script public key")] MissingOutpointScriptPublicKey, #[error("missing output parameters")] MissingOutputParameters, #[error("missing spend description")] MissingSpendDescription, #[error("missing spend parameters")] MissingSpendParameters, #[error("missing signature")] MissingSignature, #[error("Null Error")] NullError(()), #[error("Joinsplits are not supported")] UnsupportedJoinsplits, #[error("unsupported preimage operation on address format of {0}")] UnsupportedPreimage(String), #[error("Reaching end of Ripple SerializedType 'Object'")] EndOfObject, #[error("Reaching end of Ripple SerializedType 'Array'")] EndOfArray, } impl From for TransactionError { fn from(error: crate::no_std::io::Error) -> Self { TransactionError::Crate("crate::no_std::io", format!("{error:?}")) } } impl From<&'static str> for TransactionError { fn from(msg: &'static str) -> Self { TransactionError::Message(msg.into()) } } impl From<()> for TransactionError { fn from(error: ()) -> Self { TransactionError::NullError(error) } } impl From for TransactionError { fn from(error: base58::FromBase58Error) -> Self { TransactionError::Crate("base58", format!("{error:?}")) } } impl From for TransactionError { fn from(error: bech32::Error) -> Self { TransactionError::Crate("bech32", format!("{error:?}")) } } impl From for TransactionError { fn from(error: core::num::ParseIntError) -> Self { TransactionError::Crate("core::num", format!("{error:?}")) } } impl From for TransactionError { fn from(error: core::str::ParseBoolError) -> Self { TransactionError::Crate("core::str", format!("{error:?}")) } } impl From for TransactionError { fn from(error: hex::FromHexError) -> Self { TransactionError::Crate("hex", format!("{error:?}")) } } // impl From for TransactionError { // fn from(error: rlp::DecoderError) -> Self { // TransactionError::Crate("rlp", format!("{:?}", error)) // } // } // impl From for TransactionError { // fn from(error: libsecp256k1::Error) -> Self { // TransactionError::Crate("libsecp256k1", format!("{:?}", error)) // } // } impl From for TransactionError { fn from(error: serde_json::error::Error) -> Self { TransactionError::Crate("serde_json", format!("{error:?}")) } } #[cfg(test)] mod tests { use crate::func_selector; #[test] fn test_func_selector() { let selector = func_selector("transfer(address,uint256)"); assert_eq!("a9059cbb", hex::encode(selector)); } } ================================================ FILE: crates/anychain-core/src/utilities/crypto.rs ================================================ use ripemd::Ripemd160; use sha2::{Digest, Sha256, Sha512}; use sha3::Keccak256; #[inline] pub fn sha256(input: &[u8]) -> [u8; 32] { let mut hasher = Sha256::new(); hasher.update(input); hasher.finalize().into() } #[inline] pub fn sha512(input: &[u8]) -> [u8; 64] { let mut hasher = Sha512::new(); hasher.update(input); hasher.finalize().into() } #[inline] pub fn keccak256(input: &[u8]) -> [u8; 32] { let mut hasher = Keccak256::new(); hasher.update(input); hasher.finalize().into() } pub fn checksum(data: &[u8]) -> Vec { Sha256::digest(Sha256::digest(data)).to_vec() } pub fn hash160(bytes: &[u8]) -> Vec { Ripemd160::digest(Sha256::digest(bytes)).to_vec() } ================================================ FILE: crates/anychain-core/src/utilities/mod.rs ================================================ use crate::no_std::*; //#[cfg_attr(test, macro_use)] pub mod crypto; pub fn to_hex_string(bytes: &[u8]) -> String { bytes .iter() .map(|b| format!("{b:02X}")) .collect::>() .join("") } ================================================ FILE: crates/anychain-ethereum/Cargo.toml ================================================ [package] name = "anychain-ethereum" description = "A Rust library for Ethereum-focused cryptocurrency wallets, enabling seamless transactions on the Ethereum blockchain" version = "0.1.38" keywords = ["blockchain", "crypto", "ethereum", "wallet"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } anychain-kms = { path = "../anychain-kms", version = "0.1.18" } regex = { workspace = true } rlp = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } ethabi = { workspace = true } libsecp256k1 = { workspace = true } ethereum-types = { workspace = true } rand.workspace = true [features] default = ["std"] std = ["anychain-core/std"] [lints] workspace = true ================================================ FILE: crates/anychain-ethereum/README.md ================================================ # AnyChain Ethereum Crate `anychain-ethereum` is a Rust crate that provides a simple and efficient way to interact with the Ethereum blockchain. This library aims to make it easy for developers to build applications that require Ethereum data and functionality without having to deal with the complexities of the underlying protocol. This is the README for the anychain-ethereum crate, a Rust library that provides a simple and efficient way to interact with the Ethereum blockchain. ## Features - Easy interaction with Ethereum nodes - Support for multiple Ethereum networks (Mainnet, Ropsten, Rinkeby, etc.) - Sending and receiving transactions - Querying contract data - Deploying and interacting with smart contracts - Support for popular Ethereum wallets (e.g., MetaMask, Ledger, Trezor) ## Installation To use the anychain-ethereum crate in your Rust project, add the following to your Cargo.toml file: ```toml [dependencies] anychain-ethereum = "0.1.19" ``` ## Usage Here's a simple example of how to use the anychain-ethereum crate to interact with the Ethereum blockchain: ```rust use anychain_ethereum::{Ethereum, Network}; fn main() { // Create an Ethereum instance for the desired network let eth = Ethereum::new(Network::Mainnet); // Get the balance of an Ethereum address let address = "0x742d35Cc6634C0532925a3b844Bc454e4438f44e".parse().unwrap(); let balance = eth.get_balance(&address).unwrap(); println!("Balance: {} ETH", balance); } ``` For more examples and detailed usage instructions, please refer to the [documentation](https://docs.rs/anychain-ethereum). ## Contributing We welcome contributions to the anychain-ethereum crate! If you'd like to contribute, please follow these steps: 1. Fork the repository 2. Create a new branch with your changes 3. Submit a pull request to the main repository Before submitting your pull request, please ensure that your code adheres to the project's coding standards and that all tests pass. ## License The anychain-ethereum crate is licensed under the [MIT License](LICENSE) ================================================ FILE: crates/anychain-ethereum/src/address.rs ================================================ use crate::format::EthereumFormat; use crate::public_key::EthereumPublicKey; use anychain_core::{to_hex_string, Address, AddressError, Error, PublicKey}; use anychain_core::hex; use anychain_core::utilities::crypto::keccak256; use core::{convert::TryFrom, fmt, str::FromStr}; use libsecp256k1::SecretKey; use regex::Regex; use serde::{Deserialize, Serialize}; /// Represents an Ethereum address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Hash, Default)] pub struct EthereumAddress(String); impl Address for EthereumAddress { type SecretKey = SecretKey; type Format = EthereumFormat; type PublicKey = EthereumPublicKey; /// Returns the address corresponding to the given private key. fn from_secret_key( secret_key: &Self::SecretKey, _format: &Self::Format, ) -> Result { Self::from_public_key(&EthereumPublicKey::from_secret_key(secret_key), _format) } /// Returns the address corresponding to the given public key. fn from_public_key( public_key: &Self::PublicKey, _: &Self::Format, ) -> Result { // public_key.from_private_key(); Ok(Self::checksum_address(public_key)) } } impl EthereumAddress { /// Returns the checksum address given a public key. /// Adheres to EIP-55 . pub fn checksum_address(public_key: &EthereumPublicKey) -> Self { let hash = keccak256(&public_key.to_secp256k1_public_key().serialize()[1..]); let address = to_hex_string(&hash[12..]).to_lowercase(); let hash = to_hex_string(&keccak256(address.as_bytes())); let mut checksum_address = "0x".to_string(); for c in 0..40 { let ch = match &hash[c..=c] { "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" => address[c..=c].to_lowercase(), _ => address[c..=c].to_uppercase(), }; checksum_address.push_str(&ch); } EthereumAddress(checksum_address) } pub fn to_bytes(&self) -> Result, Error> { let regex = Regex::new(r"^0x").unwrap(); let address = self.0.clone(); let address = address.to_lowercase(); let address = regex.replace_all(&address, "").to_string(); Ok(hex::decode(address)?) } pub fn len(&self) -> usize { self.0.len() } pub fn is_empty(&self) -> bool { self.len() == 0 } } impl<'a> TryFrom<&'a str> for EthereumAddress { type Error = AddressError; fn try_from(address: &'a str) -> Result { Self::from_str(address) } } impl FromStr for EthereumAddress { type Err = AddressError; fn from_str(address: &str) -> Result { let addr = match address.starts_with("0x") { true => &address[2..], false => address, }; if addr.len() != 40 { return Err(AddressError::InvalidCharacterLength(addr.len())); } let addr = addr.to_lowercase(); let _ = hex::decode(addr)?; match address.starts_with("0x") { true => Ok(EthereumAddress(address.to_string())), false => Ok(EthereumAddress(format!("0x{}", address))), } } } impl fmt::Display for EthereumAddress { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.0) } } #[cfg(test)] mod tests { use super::*; use anychain_core::public_key::PublicKey; fn test_from_str(expected_address: &str) { let address = EthereumAddress::from_str(expected_address).unwrap(); assert_eq!(expected_address, address.to_string()); } fn test_to_str(expected_address: &str, address: &EthereumAddress) { assert_eq!(expected_address, address.to_string()); } #[test] fn test_public_key_bytes_to_address() { let public_key = &[ 48, 197, 53, 33, 226, 92, 169, 86, 37, 63, 188, 254, 37, 235, 20, 135, 106, 56, 177, 59, 236, 29, 192, 201, 164, 68, 243, 209, 167, 158, 75, 249, 32, 161, 71, 27, 58, 76, 240, 10, 117, 87, 201, 40, 236, 137, 172, 167, 140, 5, 65, 94, 239, 146, 230, 155, 0, 250, 200, 93, 219, 69, 123, 168, ]; let public_key = libsecp256k1::PublicKey::parse_slice(public_key, None).unwrap(); let public_key = EthereumPublicKey::from_secp256k1_public_key(public_key); let address = public_key.to_address(&EthereumFormat::Standard).unwrap(); assert_eq!( "0x0Df2f15895AB69A7eF06519F6c4732e648719f04", address.to_string() ); } mod checksum_address { use super::*; const KEYPAIRS: [(&str, &str); 5] = [ ( "f89f23eaeac18252fedf81bb8318d3c111d48c19b0680dcf6e0a8d5136caf287", "0x9141B7539E7902872095C408BfA294435e2b8c8a", ), ( "a93701ea343247db13466f6448ffbca658726e2b4a77530db3eca3c9250b4f0d", "0xa0967B1F698DC497A694FE955666D1dDd398145C", ), ( "de61e35e2e5eb9504d52f5042126591d80144d49f74b8ced68f4959a3e8edffd", "0xD5d13d1dD277BB9041e560A63ee29c086D370b0A", ), ( "56f01d5e01b6fd1cc123d8d1eae0d148e00c025b5be2ef624775f7a1b802e9c1", "0xc4488ebbE882fa2aF1D466CB2C8ecafE316c067a", ), ( "363af8b4d3ff22bb0e4ffc2ff198b4b5be0316f8a507ad5fe32f021c3d1ae8ad", "0xF9001e6AEE6EA439D713fBbF960EbA76f4770E2B", ), ]; #[test] fn from_str() { KEYPAIRS.iter().for_each(|(_, address)| { test_from_str(address); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_address)| { let address = EthereumAddress::from_str(expected_address).unwrap(); test_to_str(expected_address, &address); }); } } #[test] fn test_address() { let pubkey = EthereumPublicKey::from_str( "040b4fed878e6b0ff6847e2ac9c13b556d161e1344cd270ed6cafac21f0144399d9ef31f2\ 67722fdeccba59ffd57ff84a020a2d3b416344c68e840bc7d97e77570", ) .unwrap(); let address = EthereumAddress::from_public_key(&pubkey, &EthereumFormat::Standard).unwrap(); assert_eq!( "0x5a2a8410875E882aEe87bF8e5F2e1eDE8810617b", address.to_string() ) } } ================================================ FILE: crates/anychain-ethereum/src/format.rs ================================================ use anychain_core::Format; use core::fmt; /// Represents the format of a Ethereum address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum EthereumFormat { Standard, } impl Format for EthereumFormat {} impl fmt::Display for EthereumFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Standard") } } ================================================ FILE: crates/anychain-ethereum/src/lib.rs ================================================ #![cfg_attr(not(feature = "std"), no_std)] pub mod address; pub mod format; pub mod network; pub mod public_key; pub mod transaction; mod util; pub use self::address::*; pub use self::format::*; pub use self::network::*; pub use self::public_key::*; pub use self::transaction::*; ================================================ FILE: crates/anychain-ethereum/src/network/mainnet.rs ================================================ use super::EthereumNetwork; #[derive(Copy, Clone, Debug)] pub struct Ethereum; impl EthereumNetwork for Ethereum { const CHAIN_ID: u32 = 1; } #[derive(Copy, Clone, Debug)] pub struct EthereumClassic; impl EthereumNetwork for EthereumClassic { const CHAIN_ID: u32 = 61; } #[derive(Copy, Clone, Debug)] pub struct Polygon; impl EthereumNetwork for Polygon { const CHAIN_ID: u32 = 137; } #[derive(Copy, Clone, Debug)] pub struct Arbitrum; impl EthereumNetwork for Arbitrum { const CHAIN_ID: u32 = 42161; } #[derive(Copy, Clone, Debug)] pub struct Avalanche; impl EthereumNetwork for Avalanche { const CHAIN_ID: u32 = 43114; } #[derive(Copy, Clone, Debug)] pub struct Base; impl EthereumNetwork for Base { const CHAIN_ID: u32 = 8453; } #[derive(Copy, Clone, Debug)] pub struct BinanceSmartChain; impl EthereumNetwork for BinanceSmartChain { const CHAIN_ID: u32 = 56; } #[derive(Copy, Clone, Debug)] pub struct HuobiEco; impl EthereumNetwork for HuobiEco { const CHAIN_ID: u32 = 128; } #[derive(Copy, Clone, Debug)] pub struct Okex; impl EthereumNetwork for Okex { const CHAIN_ID: u32 = 66; } #[derive(Copy, Clone, Debug)] pub struct OpBnb; impl EthereumNetwork for OpBnb { const CHAIN_ID: u32 = 204; } #[derive(Copy, Clone, Debug)] pub struct Optimism; impl EthereumNetwork for Optimism { const CHAIN_ID: u32 = 10; } #[derive(Copy, Clone, Debug)] pub struct Linea; impl EthereumNetwork for Linea { const CHAIN_ID: u32 = 59144; } #[derive(Copy, Clone, Debug)] pub struct Xlayer; impl EthereumNetwork for Xlayer { const CHAIN_ID: u32 = 196; } #[derive(Copy, Clone, Debug)] pub struct Sei; impl EthereumNetwork for Sei { const CHAIN_ID: u32 = 1329; } #[derive(Copy, Clone, Debug)] pub struct Cro; impl EthereumNetwork for Cro { const CHAIN_ID: u32 = 25; } #[derive(Copy, Clone, Debug)] pub struct Mova; impl EthereumNetwork for Mova { const CHAIN_ID: u32 = 61900; } #[derive(Copy, Clone, Debug)] pub struct Ink; impl EthereumNetwork for Ink { const CHAIN_ID: u32 = 57073; } #[derive(Copy, Clone, Debug)] pub struct Morph; impl EthereumNetwork for Morph { const CHAIN_ID: u32 = 2818; } #[derive(Copy, Clone, Debug)] pub struct Maca; impl EthereumNetwork for Maca { const CHAIN_ID: u32 = 777178; } #[derive(Copy, Clone, Debug)] pub struct Uni; impl EthereumNetwork for Uni { const CHAIN_ID: u32 = 130; } ================================================ FILE: crates/anychain-ethereum/src/network/mod.rs ================================================ pub trait EthereumNetwork: Copy + Clone + Send + Sync + 'static { const CHAIN_ID: u32; } pub mod mainnet; pub mod testnet; pub use mainnet::*; pub use testnet::*; ================================================ FILE: crates/anychain-ethereum/src/network/testnet.rs ================================================ use super::EthereumNetwork; #[derive(Copy, Clone, Debug)] pub struct Sepolia; // ETH testnet // ETH testnet impl EthereumNetwork for Sepolia { const CHAIN_ID: u32 = 11155111; } #[derive(Copy, Clone, Debug)] pub struct Goerli; // ETH testnet // ETH testnet impl EthereumNetwork for Goerli { const CHAIN_ID: u32 = 5; } #[derive(Copy, Clone, Debug)] pub struct Kotti; // ETC testnet // ETC testnet impl EthereumNetwork for Kotti { const CHAIN_ID: u32 = 6; } #[derive(Copy, Clone, Debug)] pub struct Mumbai; // Polygon testnet // Polygon testnet impl EthereumNetwork for Mumbai { const CHAIN_ID: u32 = 80001; } #[derive(Copy, Clone, Debug)] pub struct Amoy; // Polygon testnet // Polygon testnet impl EthereumNetwork for Amoy { const CHAIN_ID: u32 = 80002; } #[derive(Copy, Clone, Debug)] pub struct ArbitrumGoerli; // Arbitrum testnet // Arbitrum testnet impl EthereumNetwork for ArbitrumGoerli { const CHAIN_ID: u32 = 421613; } #[derive(Copy, Clone, Debug)] pub struct AvalancheTestnet; // Avalanche testnet // Avalanche testnet impl EthereumNetwork for AvalancheTestnet { const CHAIN_ID: u32 = 43113; } #[derive(Copy, Clone, Debug)] pub struct BaseGoerli; // Base testnet // Base testnet impl EthereumNetwork for BaseGoerli { const CHAIN_ID: u32 = 84531; } #[derive(Copy, Clone, Debug)] pub struct BinanceSmartChainTestnet; // BinanceSmartChain testnet // BinanceSmartChain testnet impl EthereumNetwork for BinanceSmartChainTestnet { const CHAIN_ID: u32 = 97; } #[derive(Copy, Clone, Debug)] pub struct HuobiEcoTestnet; // HuobiEco testnet // HuobiEco testnet impl EthereumNetwork for HuobiEcoTestnet { const CHAIN_ID: u32 = 256; } #[derive(Copy, Clone, Debug)] pub struct OkexTestnet; // Okex testnet // Okex testnet impl EthereumNetwork for OkexTestnet { const CHAIN_ID: u32 = 65; } #[derive(Copy, Clone, Debug)] pub struct OpBnbTestnet; // OpBnb testnet // OpBnb testnet impl EthereumNetwork for OpBnbTestnet { const CHAIN_ID: u32 = 5611; } #[derive(Copy, Clone, Debug)] pub struct OptimismGoerli; // Optimism testnet // Optimism testnet impl EthereumNetwork for OptimismGoerli { const CHAIN_ID: u32 = 420; } #[derive(Copy, Clone, Debug)] pub struct LineaSepolia; // Linea testnet // Linea testnet impl EthereumNetwork for LineaSepolia { const CHAIN_ID: u32 = 59141; } #[derive(Copy, Clone, Debug)] pub struct XlayerTestnet; // Xlayer testnet // Xlayer testnet impl EthereumNetwork for XlayerTestnet { const CHAIN_ID: u32 = 195; } #[derive(Copy, Clone, Debug)] pub struct SeiTestnet; // Sei testnet // Sei testnet impl EthereumNetwork for SeiTestnet { const CHAIN_ID: u32 = 1328; } #[derive(Copy, Clone, Debug)] pub struct CroTestnet; // Cro testnet // Cro testnet impl EthereumNetwork for CroTestnet { const CHAIN_ID: u32 = 338; } #[derive(Copy, Clone, Debug)] pub struct MovaTestnet; // Mova testnet // Mova testnet impl EthereumNetwork for MovaTestnet { const CHAIN_ID: u32 = 10323; } #[derive(Copy, Clone, Debug)] pub struct InkTestnet; // Ink testnet // Ink testnet impl EthereumNetwork for InkTestnet { const CHAIN_ID: u32 = 763373; } #[derive(Copy, Clone, Debug)] pub struct MorphTestnet; // Morph testnet // Morph testnet impl EthereumNetwork for MorphTestnet { const CHAIN_ID: u32 = 2710; } #[derive(Copy, Clone, Debug)] pub struct MacaTestnet; impl EthereumNetwork for MacaTestnet { const CHAIN_ID: u32 = 777177; } #[derive(Copy, Clone, Debug)] pub struct UniSepolia; impl EthereumNetwork for UniSepolia { const CHAIN_ID: u32 = 1301; } ================================================ FILE: crates/anychain-ethereum/src/public_key.rs ================================================ use crate::address::EthereumAddress; use crate::format::EthereumFormat; use anychain_core::{hex, Address, AddressError, PublicKey, PublicKeyError}; use core::{fmt, fmt::Display, str::FromStr}; /// Represents an Ethereum public key #[derive(Debug, Clone, PartialEq, Eq)] pub struct EthereumPublicKey(libsecp256k1::PublicKey); impl PublicKey for EthereumPublicKey { type SecretKey = libsecp256k1::SecretKey; type Address = EthereumAddress; type Format = EthereumFormat; /// Returns the public key corresponding to the given private key. fn from_secret_key(secret_key: &Self::SecretKey) -> Self { Self(libsecp256k1::PublicKey::from_secret_key(secret_key)) } /// Returns the address of this public key. fn to_address(&self, _format: &Self::Format) -> Result { Self::Address::from_public_key(self, _format) } } impl EthereumPublicKey { /// Returns a public key given a secp256k1 public key. pub fn from_secp256k1_public_key(public_key: libsecp256k1::PublicKey) -> Self { Self(public_key) } pub fn from_slice(sl: &[u8]) -> Result { libsecp256k1::PublicKey::parse_slice(sl, None) .map(Self) .map_err(|e| PublicKeyError::Crate("from splice", format!("{:?}", e))) } /// Returns the secp256k1 public key of the public key pub fn to_secp256k1_public_key(&self) -> libsecp256k1::PublicKey { self.0 } } impl FromStr for EthereumPublicKey { type Err = PublicKeyError; fn from_str(public_key: &str) -> Result { let p = hex::decode(public_key) .map_err(|error| PublicKeyError::Crate("hex", format!("{:?}", error)))?; let public_key = libsecp256k1::PublicKey::parse_slice(p.as_slice(), None) .map_err(|error| PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)))?; Ok(Self(public_key)) } } impl Display for EthereumPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for s in &self.0.serialize()[1..] { write!(f, "{:02x}", s)?; } Ok(()) } } #[cfg(test)] mod tests { use super::*; use libsecp256k1::SecretKey; fn test_from_secret_key(expected_public_key: &EthereumPublicKey, secret_key: &SecretKey) { let public_key = EthereumPublicKey::from_secret_key(secret_key); assert_eq!(*expected_public_key, public_key); } fn test_to_address(expected_address: &EthereumAddress, public_key: &EthereumPublicKey) { let address = public_key.to_address(&EthereumFormat::Standard).unwrap(); assert_eq!(*expected_address, address); } fn test_from_str(expected_public_key: &str, expected_address: &str) { let public_key = EthereumPublicKey::from_str(expected_public_key).unwrap(); let address = public_key.to_address(&EthereumFormat::Standard).unwrap(); assert_eq!(expected_public_key, public_key.to_string()); assert_eq!(expected_address, address.to_string()); } fn test_to_str(expected_public_key: &str, public_key: &EthereumPublicKey) { assert_eq!(expected_public_key, public_key.to_string()); } mod checksum_address { use super::*; const KEYPAIRS: [(&str, &str, &str); 5] = [ ( "2f46188bd601ece2a4446fa31de9419ee9baabf5305d65a5a7aea8badee27a5a", "06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f35931f33e57adfc4f11bdf1946be2d75d6ecc925e8d22f319c71a721c", "0x9Ed0C5817aE96Cb886BF74EB02B238De682e9B07" ), ( "d96c4c30bbabde58653e4fb4f4d97d064c70e300a37ab8780a8ecc15220423fb", "bfe0746c85802c3ca1c2d5e4f4d23fb8321b8b1009af67855cc9a4aed8285567d7045bb700e27d5e33572ae5d84a8d1e11bb134f6f14f37ffcb2fa73f7c6b0ac", "0xBc90633A78dA594ace8e25AAA3517F924C76099d" ), ( "c677a1215eebd35d20337d8896ee6579c78f41f93946b17c8d4ccb772c25cde4", "ff3e50efb509efd0d18ff9074bc8b253419d2437e0c1e81661c1ba419f877162eed685d80bdd3b33adde4ff2a0946dd97460f126992064059a129e2a7172d566", "0xA99E404A60ab8561F7c844529F735A88D7A61C5A" ), ( "b681e5bd4ddffefe1a691fe7c6375775c11992b9a25e4f9e3f235eb054d49343", "d9ed72afa68a9732df005df2dbbfb2abcad050579bd8dfeb32389d0f1e492d130ca33f9e71345d558da5859026fee86c03be685f95a4c8ddc55e048c5ff8b398", "0x28826C9f713c96ee63e59Ed9220c77b021FAfC3e" ), ( "da5d359af6827e76e0a1b71c75c375f0d33f63bae4fd551d81ee10faa34e33e9", "0b752d5e89126b62a99edfe40a4cbd9122cfb04257a28d225858d38bc92a0e1517e797e9029e810b329afa32a1d46268e84eb10c700314b0059f506130d1e9e6", "0x9eC59170674DbEfeF40efE2ED03175b39fCA921a" ) ]; #[test] fn from_private_key() { KEYPAIRS.iter().for_each(|(secret_key, public_key, _)| { let public_key = EthereumPublicKey::from_str(public_key).unwrap(); let secret_key = hex::decode(*secret_key).unwrap(); let secret_key = SecretKey::parse_slice(&secret_key).unwrap(); test_from_secret_key(&public_key, &secret_key); }); } #[test] fn to_address() { KEYPAIRS.iter().for_each(|(_, public_key, address)| { let address = EthereumAddress::from_str(address).unwrap(); let public_key = EthereumPublicKey::from_str(public_key).unwrap(); test_to_address(&address, &public_key); }); } #[test] fn from_str() { KEYPAIRS .iter() .for_each(|(_, expected_public_key, expected_address)| { test_from_str(expected_public_key, expected_address); }); } #[test] fn to_str() { KEYPAIRS.iter().for_each(|(_, expected_public_key, _)| { let public_key = EthereumPublicKey::from_str(expected_public_key).unwrap(); test_to_str(expected_public_key, &public_key); }); } #[test] fn test_pubkey() { let str = "b9b77d6ac1380a581d3efc136a21a939f5a6ce59afeb3eddf6a52b342b33f5be455b3610100ee1129d1638e99272879be60519835e2b3b7703eb4791af3daa7f"; let public_key = EthereumPublicKey::from_str(str).unwrap(); let address = EthereumAddress::checksum_address(&public_key); assert_eq!( "0xDF3e1897f4b01f6b17870b98B4548BaBE14A007C", address.to_string() ); } } #[test] fn test_checksum_address_invalid() { // Invalid public key length let public_key = "0"; assert!(EthereumPublicKey::from_str(public_key).is_err()); let public_key = "06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b014"; assert!(EthereumPublicKey::from_str(public_key).is_err()); let public_key = "06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f35931f33e57adfc4f11bdf1946be2d75d6ecc925e8d22f319c71a721"; assert!(EthereumPublicKey::from_str(public_key).is_err()); let public_key = "06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f35931f33e57adfc4f11bdf1946be2d75d6ecc925e8d22f319c71a721c06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f3593"; assert!(EthereumPublicKey::from_str(public_key).is_err()); let public_key = "06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f35931f33e57adfc4f11bdf1946be2d75d6ecc925e8d22f319c71a721c06d68e391c6961fceb5d8c5ad8ee5c6346db24df9dae61c9c0b0142409760451d982c0f35931f33e57adfc4f11bdf1946be2d75d6ecc925e8d22f319c71a721c"; assert!(EthereumPublicKey::from_str(public_key).is_err()); } #[test] fn address_gen() { let raw_pk = [ 68, 157, 12, 4, 213, 228, 35, 105, 155, 249, 86, 130, 216, 186, 113, 85, 31, 137, 113, 153, 70, 239, 218, 142, 132, 65, 222, 134, 52, 145, 148, 88, 63, 245, 105, 222, 219, 39, 56, 192, 195, 4, 38, 29, 9, 78, 172, 238, 179, 168, 66, 80, 132, 123, 45, 104, 145, 132, 159, 243, 144, 62, 194, 164, ]; let raw_pk1 = [ 117, 243, 73, 0, 152, 143, 226, 83, 116, 252, 10, 247, 191, 14, 206, 13, 110, 192, 140, 32, 250, 238, 177, 101, 109, 113, 26, 254, 67, 191, 47, 11, 155, 57, 117, 158, 227, 111, 235, 20, 65, 167, 102, 64, 98, 103, 106, 226, 241, 213, 193, 36, 72, 57, 163, 202, 72, 21, 35, 233, 194, 163, 225, 28, ]; let pk = EthereumPublicKey::from_slice(&raw_pk); assert!(pk.is_ok()); let pk1 = EthereumPublicKey::from_slice(&raw_pk1); assert!(pk1.is_ok()); let addr = pk.unwrap().to_address(&EthereumFormat::Standard).unwrap(); let addr1 = pk1.unwrap().to_address(&EthereumFormat::Standard).unwrap(); assert_eq!( "0xE28D6881aC932066611A259a8C343E545b0b55B7", addr.to_string() ); assert_eq!( "0xCd28AF3e09527D2a756F1e7c7aD7A8A9BdEB080d", addr1.to_string() ); } #[test] fn test_public_key_from_invalid_slice() { let invalid_slice = [1u8; 31]; // A 31-byte slice, invalid as a public key let public_key = EthereumPublicKey::from_slice(&invalid_slice); assert!(public_key.is_err()); let invalid_slice = [0u8; 65]; // A 31-byte slice, invalid as a public key let public_key = EthereumPublicKey::from_slice(&invalid_slice); assert!(public_key.is_err()); } } ================================================ FILE: crates/anychain-ethereum/src/transaction/contract.rs ================================================ use core::str::FromStr; use crate::{EthereumAddress, Transfer}; use anychain_core::{hex, TransactionError}; use ethabi::{ethereum_types::H160, Function, Param, ParamType, StateMutability, Token}; use ethereum_types::U256; use serde_json::{json, Value}; pub fn erc20_transfer_func() -> Function { let param_to = Param { name: "to".to_string(), kind: ParamType::Address, internal_type: None, }; let param_amount = Param { name: "amount".to_string(), kind: ParamType::Uint(256), internal_type: None, }; #[allow(deprecated)] Function { name: "transfer".to_string(), inputs: vec![param_to, param_amount], outputs: vec![], constant: None, state_mutability: StateMutability::Payable, } } pub fn eip3009_transfer_func() -> Function { let param_from = Param { name: "from".to_string(), kind: ParamType::Address, internal_type: None, }; let param_to = Param { name: "to".to_string(), kind: ParamType::Address, internal_type: None, }; let param_value = Param { name: "value".to_string(), kind: ParamType::Uint(256), internal_type: None, }; let param_valid_after = Param { name: "validAfter".to_string(), kind: ParamType::Uint(256), internal_type: None, }; let param_valid_before = Param { name: "validBefore".to_string(), kind: ParamType::Uint(256), internal_type: None, }; let param_nonce = Param { name: "nonce".to_string(), kind: ParamType::FixedBytes(32), internal_type: None, }; let param_v = Param { name: "v".to_string(), kind: ParamType::Uint(8), internal_type: None, }; let param_r = Param { name: "r".to_string(), kind: ParamType::FixedBytes(32), internal_type: None, }; let param_s = Param { name: "s".to_string(), kind: ParamType::FixedBytes(32), internal_type: None, }; #[allow(deprecated)] Function { name: "transferWithAuthorization".to_string(), inputs: vec![ param_from, param_to, param_value, param_valid_after, param_valid_before, param_nonce, param_v, param_r, param_s, ], outputs: vec![], constant: None, state_mutability: StateMutability::NonPayable, } } pub fn schedule_func() -> Function { let param_calls = Param { name: "calls".to_string(), kind: ParamType::Array(Box::new(ParamType::Tuple(vec![ ParamType::Address, ParamType::Uint(256), ParamType::Bytes, ]))), internal_type: None, }; #[allow(deprecated)] Function { name: "schedule".to_string(), inputs: vec![param_calls], outputs: vec![], constant: None, state_mutability: StateMutability::Payable, } } pub fn execute_batch_transfer_func() -> Function { let param_calls = Param { name: "calls".to_string(), kind: ParamType::Array(Box::new(ParamType::Tuple(vec![ ParamType::Address, ParamType::Uint(256), ParamType::Bytes, ]))), internal_type: None, }; let param_v = Param { name: "v".to_string(), kind: ParamType::Uint(8), internal_type: None, }; let param_r = Param { name: "r".to_string(), kind: ParamType::FixedBytes(32), internal_type: None, }; let param_s = Param { name: "s".to_string(), kind: ParamType::FixedBytes(32), internal_type: None, }; #[allow(deprecated)] Function { name: "execute_batch_transfer".to_string(), inputs: vec![param_calls, param_v, param_r, param_s], outputs: vec![], constant: None, state_mutability: StateMutability::NonPayable, } } pub fn erc20_transfer(address: &EthereumAddress, amount: U256) -> Vec { let func = erc20_transfer_func(); let tokens = vec![ Token::Address(H160::from_slice(&address.to_bytes().unwrap())), Token::Uint(amount), ]; func.encode_input(&tokens).unwrap() } pub fn decode(data: Vec) -> Result { if data.len() < 4 { return Err(TransactionError::Message("Illegal data".to_string())); } let selector = hex::encode(&data[..4]); match selector.as_str() { // we're dealing with an erc20 transfer "a9059cbb" => { let func = erc20_transfer_func(); match func.decode_input(&data[4..]) { Ok(tokens) => { let to = tokens[0].clone(); let amount = tokens[1].clone(); let to = hex::encode(to.into_address().unwrap().as_bytes()); let amount = amount.into_uint().unwrap().to_string(); Ok(json!({ "type": "erc20_transfer", "params": { "to": to, "amount": amount, } })) } Err(e) => Err(TransactionError::Message(e.to_string())), } } // we're dealing with an eip3009 transfer "e3ee160e" => { let func = eip3009_transfer_func(); match func.decode_input(&data[4..]) { Ok(tokens) => { let from = tokens[0].clone(); let to = tokens[1].clone(); let value = tokens[2].clone(); let valid_after = tokens[3].clone(); let valid_before = tokens[4].clone(); let nonce = tokens[5].clone(); Ok(json!({ "type": "eip3009_transfer", "params": { "from": hex::encode(from.into_address().unwrap().as_bytes()), "to": hex::encode(to.into_address().unwrap().as_bytes()), "value": value.into_uint().unwrap().to_string(), "validAfter": valid_after.into_uint().unwrap().to_string(), "validBefore": valid_before.into_uint().unwrap().to_string(), "nonce": hex::encode(nonce.into_fixed_bytes().unwrap()), } })) } Err(e) => Err(TransactionError::Message(e.to_string())), } } // we're dealing with a batch transfer "5a67d813" => { let func = schedule_func(); match func.decode_input(&data[4..]) { Ok(tokens) => { let mut batch_transfers = json!([]); let calls = tokens[0].clone(); let calls = calls.into_array().unwrap(); for call in calls { let mut batch_transfer = json!({}); let call = call.into_tuple().unwrap(); let from = call[0].clone(); let from = hex::encode(from.into_address().unwrap().as_bytes()); let from = EthereumAddress::from_str(&from).unwrap(); batch_transfer .as_object_mut() .unwrap() .insert("from".to_string(), json!(from.to_string())); let data = call[2].clone(); let data = data.into_bytes().unwrap(); if data.len() < 4 { return Err(TransactionError::Message("Illegal data".to_string())); } let func = execute_batch_transfer_func(); let mut transfers = json!([]); match func.decode_input(&data[4..]) { Ok(tokens) => { let calls = tokens[0].clone(); let calls = calls.into_array().unwrap(); for call in calls { let transfer = Transfer::from_token(call)?; transfers.as_array_mut().unwrap().push(transfer.to_json()); } } Err(e) => return Err(TransactionError::Message(e.to_string())), } batch_transfer .as_object_mut() .unwrap() .insert("transfers".to_string(), transfers); batch_transfers.as_array_mut().unwrap().push(batch_transfer); } Ok(json!({ "type": "batch_transfer", "batchTransfers": batch_transfers, })) } Err(e) => Err(TransactionError::Message(e.to_string())), } } _ => Err(TransactionError::Message( "Unsupported contract function".to_string(), )), } } ================================================ FILE: crates/anychain-ethereum/src/transaction/eip1559.rs ================================================ use crate::util::{adapt2, pad_zeros, restore_sender, trim_leading_zeros}; use crate::{EthereumAddress, EthereumFormat, EthereumNetwork, EthereumPublicKey}; use anychain_core::{hex, utilities::crypto::keccak256, Transaction, TransactionError}; use core::{fmt, marker::PhantomData, str::FromStr}; use ethereum_types::U256; use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream}; use super::EthereumTransactionId; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Eip1559TransactionParameters { pub chain_id: u32, pub nonce: U256, pub max_priority_fee_per_gas: U256, pub max_fee_per_gas: U256, pub gas_limit: U256, pub to: EthereumAddress, pub amount: U256, pub data: Vec, pub access_list: Vec, } impl Eip1559TransactionParameters { pub fn to_rlp(&self, array_len: usize) -> Result { let to = self .to .to_bytes() .map_err(|e| TransactionError::Message(format!("{}", e)))?; let mut rlp = RlpStream::new(); rlp.begin_list(array_len); rlp.append(&self.chain_id); rlp.append(&self.nonce); rlp.append(&self.max_priority_fee_per_gas); rlp.append(&self.max_fee_per_gas); rlp.append(&self.gas_limit); rlp.append(&to); rlp.append(&self.amount); rlp.append(&self.data); rlp.append_list(&self.access_list); Ok(rlp) } pub fn get_data(&self) -> Vec { self.data.clone() } } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Eip1559TransactionSignature { pub y_parity: bool, pub r: Vec, pub s: Vec, } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct AccessItem { pub address: EthereumAddress, pub storage_keys: Vec>, } impl Encodable for AccessItem { fn rlp_append(&self, s: &mut RlpStream) { s.begin_list(2); s.append(&self.address.to_bytes().unwrap()); s.append_list::, Vec>(&self.storage_keys); } } impl Decodable for AccessItem { fn decode(rlp: &rlp::Rlp) -> Result { let address = hex::encode(rlp.val_at::>(0)?); let address = EthereumAddress::from_str(&address).unwrap(); let storage_keys = rlp.list_at::>(1)?; Ok(Self { address, storage_keys, }) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Eip1559Transaction { pub sender: Option, pub params: Eip1559TransactionParameters, pub signature: Option, _network: PhantomData, } impl Eip1559Transaction { pub fn restore_sender(&mut self) -> Result<(), TransactionError> { if self.signature.is_none() { return Err(TransactionError::Message( "Signature is missing".to_string(), )); } let sig = self.signature.clone().unwrap(); self.signature = None; let recid = match sig.y_parity { true => 1, false => 0, } as u8; let _sig = [sig.r.clone(), sig.s.clone()].concat(); let msg = self.to_transaction_id()?.txid; let sender = restore_sender(msg, _sig, recid)?; self.sender = Some(sender); self.signature = Some(sig); Ok(()) } } impl Transaction for Eip1559Transaction { type Address = EthereumAddress; type Format = EthereumFormat; type PublicKey = EthereumPublicKey; type TransactionId = EthereumTransactionId; type TransactionParameters = Eip1559TransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(Self { sender: None, params: params.clone(), signature: None, _network: PhantomData, }) } fn sign(&mut self, rs: Vec, recid: u8) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length: {}", rs.len() ))); } let y_parity = recid == 1; let r = rs[..32].to_vec(); let s = rs[32..].to_vec(); self.signature = Some(Eip1559TransactionSignature { y_parity, r, s }); self.to_bytes() } fn to_bytes(&self) -> Result, TransactionError> { let rlp = match &self.signature { Some(sig) => { let mut rlp = self.params.to_rlp(12)?; let r = trim_leading_zeros(&sig.r); let s = trim_leading_zeros(&sig.s); rlp.append(&sig.y_parity); rlp.append(&r); rlp.append(&s); rlp.out().to_vec() } None => self.params.to_rlp(9)?.out().to_vec(), }; Ok([vec![2u8], rlp].concat()) } fn from_bytes(tx: &[u8]) -> Result { let rlp = Rlp::new(&tx[1..]); let to = adapt2(rlp.val_at::>(5))?; let to = hex::encode(to); let chain_id = adapt2(rlp.val_at::(0))?; let nonce = adapt2(rlp.val_at::(1))?; let max_priority_fee_per_gas = adapt2(rlp.val_at::(2))?; let max_fee_per_gas = adapt2(rlp.val_at::(3))?; let gas_limit = adapt2(rlp.val_at::(4))?; let to = EthereumAddress::from_str(&to)?; let amount = adapt2(rlp.val_at::(6))?; let data = adapt2(rlp.val_at::>(7))?; let access_list = adapt2(rlp.list_at::(8))?; let y_parity = adapt2(rlp.val_at::(9))?; let mut r = adapt2(rlp.val_at::>(10))?; let mut s = adapt2(rlp.val_at::>(11))?; let params = Eip1559TransactionParameters { chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, amount, data, access_list, }; let mut tx = Eip1559Transaction::::new(¶ms)?; if !r.is_empty() && !s.is_empty() { pad_zeros(&mut r, 32); pad_zeros(&mut s, 32); let sig = Eip1559TransactionSignature { y_parity, r, s }; tx.signature = Some(sig); tx.restore_sender()?; } Ok(tx) } fn to_transaction_id(&self) -> Result { Ok(Self::TransactionId { txid: keccak256(&self.to_bytes()?).to_vec(), }) } } impl FromStr for Eip1559Transaction { type Err = TransactionError; fn from_str(tx: &str) -> Result { let tx = match &tx[..2] { "0x" => &tx[2..], _ => tx, }; Self::from_bytes(&hex::decode(tx)?) } } impl fmt::Display for Eip1559Transaction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "0x{}", &hex::encode(match self.to_bytes() { Ok(transaction) => transaction, _ => return Err(fmt::Error), }) ) } } #[cfg(test)] mod tests { use crate::{ Eip1559Transaction, Eip1559TransactionParameters, EthereumAddress, EthereumNetwork, Sepolia, TransferWithAuthorizationParameters, }; use anychain_core::{hex, Transaction}; use anychain_kms::secp256k1_sign; use core::str::FromStr; use ethereum_types::U256; use std::time::SystemTime; #[test] fn test_eip1559_tx() { let params = Eip1559TransactionParameters { chain_id: Sepolia::CHAIN_ID, nonce: U256::from_dec_str("4").unwrap(), max_priority_fee_per_gas: U256::from_dec_str("100000000000").unwrap(), max_fee_per_gas: U256::from_dec_str("200000000000").unwrap(), gas_limit: U256::from_dec_str("21000").unwrap(), to: EthereumAddress::from_str("0xf7a63003b8ef116939804b4c2dd49290a39c4d97").unwrap(), amount: U256::from_dec_str("10000000000000000").unwrap(), data: vec![], access_list: vec![], }; let mut tx = Eip1559Transaction::::new(¶ms).unwrap(); let msg = tx.to_transaction_id().unwrap().txid; let msg = libsecp256k1::Message::parse_slice(&msg).unwrap(); let sk = "08d586ed207046d6476f92fd4852be3830a9d651fc148d6fa5a6f15b77ba5df0"; let sk = hex::decode(sk).unwrap(); let sk = libsecp256k1::SecretKey::parse_slice(&sk).unwrap(); let (sig, recid) = libsecp256k1::sign(&msg, &sk); let sig = sig.serialize().to_vec(); let recid = recid.serialize(); let _ = tx.sign(sig, recid); println!("{}", tx); } #[test] fn test_eip3009_tx() { let sk = "3d98c2d5a7f737693b470114816000645419af49bd21258cc99142f6ef5fd60a".to_string(); let sk = hex::decode(sk).unwrap(); let from = "0x7eE4c635d204eBE65fc8987CE6570CFA1651E8Af".to_string(); let to = "0xf7a63003b8ef116939804b4c2dd49290a39c4d97".to_string(); let usdc = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238".to_string(); let amount = "100000".to_string(); let now = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap() .as_secs(); let mut transfer = TransferWithAuthorizationParameters::::new( "USDC".to_string(), "2".to_string(), usdc.clone(), from, to, amount, now.to_string(), (now + 100).to_string(), "0xc16e8459b9c3ecfbbc20c34444c72ce016cdb109fa5a982b0dd223e15e8f96de".to_string(), ) .unwrap(); let digest = transfer.digest().unwrap(); let (rs, recid) = secp256k1_sign(&sk, &digest).unwrap(); let data = transfer .sign(recid, rs[..32].to_vec(), rs[32..].to_vec()) .unwrap(); let nonce = U256::from(22); let max_priority_fee_per_gas = U256::from_dec_str("50000000000").unwrap(); let max_fee_per_gas = U256::from_dec_str("50000000000").unwrap(); let gas_limit = U256::from(210000); let to = EthereumAddress::from_str(&usdc).unwrap(); let amount = U256::from(0); let params = Eip1559TransactionParameters { chain_id: Sepolia::CHAIN_ID, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, amount, data, access_list: vec![], }; let mut tx = Eip1559Transaction::::new(¶ms).unwrap(); let txid = tx.to_transaction_id().unwrap().txid; let (rs, recid) = secp256k1_sign(&sk, &txid).unwrap(); let tx = tx.sign(rs, recid).unwrap(); let tx = hex::encode(tx); println!("Tx: {}", tx); } } ================================================ FILE: crates/anychain-ethereum/src/transaction/eip3009.rs ================================================ use core::marker::PhantomData; use core::str::FromStr; use crate::contract::eip3009_transfer_func; use crate::{EthereumAddress, EthereumNetwork}; use anychain_core::{crypto::keccak256, hex, TransactionError}; use ethabi::{encode, Token}; use ethereum_types::{H160, U256}; trait EIP712TypedData { fn type_hash(&self) -> Result, TransactionError>; fn encode(&self) -> Result, TransactionError>; fn hash_struct(&self) -> Result, TransactionError> { Ok(keccak256(&self.encode()?).to_vec()) } } struct EIP712Domain { name: String, version: String, verifying_contract: EthereumAddress, _network: PhantomData, } impl EIP712TypedData for EIP712Domain { fn type_hash(&self) -> Result, TransactionError> { let stream = "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" .as_bytes(); Ok(keccak256(stream).to_vec()) } fn encode(&self) -> Result, TransactionError> { let type_hash = self.type_hash()?; let name = keccak256(self.name.as_bytes()).to_vec(); let version = keccak256(self.version.as_bytes()).to_vec(); let chain_id = U256::from(N::CHAIN_ID); let contract = self .verifying_contract .to_bytes() .map_err(|e| TransactionError::Message(e.to_string()))?; let contract = H160::from_slice(&contract); let type_hash = Token::FixedBytes(type_hash); let name = Token::FixedBytes(name); let version = Token::FixedBytes(version); let chain_id = Token::Uint(chain_id); let contract = Token::Address(contract); Ok(encode(&[type_hash, name, version, chain_id, contract])) } } impl EIP712Domain { fn new(name: String, version: String, contract: String) -> Result { let verifying_contract = EthereumAddress::from_str(&contract)?; Ok(Self { name, version, verifying_contract, _network: PhantomData, }) } } pub struct TransferWithAuthorizationParameters { domain: Option>, from: EthereumAddress, to: EthereumAddress, amount: U256, valid_after: U256, valid_before: U256, nonce: Vec, // 32-byte hash v: u8, r: Vec, s: Vec, } impl EIP712TypedData for TransferWithAuthorizationParameters { fn type_hash(&self) -> Result, TransactionError> { let stream = "TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)".as_bytes(); Ok(keccak256(stream).to_vec()) } fn encode(&self) -> Result, TransactionError> { let type_hash = self.type_hash()?; let from = self .from .to_bytes() .map_err(|e| TransactionError::Message(e.to_string()))?; let to = self .to .to_bytes() .map_err(|e| TransactionError::Message(e.to_string()))?; let from = H160::from_slice(&from); let to = H160::from_slice(&to); let type_hash = Token::FixedBytes(type_hash); let from = Token::Address(from); let to = Token::Address(to); let amount = Token::Uint(self.amount); let valid_after = Token::Uint(self.valid_after); let valid_before = Token::Uint(self.valid_before); let nonce = Token::FixedBytes(self.nonce.clone()); Ok(encode(&[ type_hash, from, to, amount, valid_after, valid_before, nonce, ])) } } impl TransferWithAuthorizationParameters { #[allow(clippy::too_many_arguments)] pub fn new( name: String, version: String, contract: String, from: String, to: String, amount: String, valid_after: String, valid_before: String, nonce: String, ) -> Result { let domain = Some(EIP712Domain::::new(name, version, contract)?); let from = EthereumAddress::from_str(&from) .map_err(|e| TransactionError::Message(e.to_string()))?; let to = EthereumAddress::from_str(&to).map_err(|e| TransactionError::Message(e.to_string()))?; let amount = U256::from_dec_str(&amount).map_err(|e| TransactionError::Message(e.to_string()))?; let valid_after = U256::from_dec_str(&valid_after) .map_err(|e| TransactionError::Message(e.to_string()))?; let valid_before = U256::from_dec_str(&valid_before) .map_err(|e| TransactionError::Message(e.to_string()))?; let nonce = match nonce.strip_prefix("0x") { Some(nonce) => nonce, None => &nonce, }; let nonce = hex::decode(nonce)?; Ok(Self { domain, from, to, amount, valid_after, valid_before, nonce, v: 0, r: vec![], s: vec![], }) } pub fn sign(&mut self, recid: u8, r: Vec, s: Vec) -> Result, TransactionError> { self.v = recid + 27; self.r = r; self.s = s; self.to_data() } pub fn digest(&self) -> Result, TransactionError> { if let Some(domain) = &self.domain { let domain_separator = domain.hash_struct()?; let hash_params = self.hash_struct()?; let stream = [ vec![25], /* 0x19 */ vec![1], /* 0x01 */ domain_separator, hash_params, ] .concat(); Ok(keccak256(stream.as_ref()).to_vec()) } else { Err(TransactionError::Message("domain not provided".to_string())) } } fn to_data(&self) -> Result, TransactionError> { let func = eip3009_transfer_func(); let from = self .from .to_bytes() .map_err(|e| TransactionError::Message(e.to_string()))?; let to = self .to .to_bytes() .map_err(|e| TransactionError::Message(e.to_string()))?; let amount = self.amount; let valid_after = self.valid_after; let valid_before = self.valid_before; let nonce = self.nonce.clone(); let v = U256::from(self.v); let r = self.r.clone(); let s = self.s.clone(); let tokens = vec![ Token::Address(H160::from_slice(&from)), Token::Address(H160::from_slice(&to)), Token::Uint(amount), Token::Uint(valid_after), Token::Uint(valid_before), Token::FixedBytes(nonce), Token::Uint(v), Token::FixedBytes(r), Token::FixedBytes(s), ]; func.encode_input(&tokens) .map_err(|e| TransactionError::Message(e.to_string())) } } #[cfg(test)] mod tests { use super::*; use crate::{ eip3009::TransferWithAuthorizationParameters, Eip1559Transaction, Eip1559TransactionParameters, Sepolia, }; use anychain_core::Transaction; use anychain_kms::secp256k1_sign; use std::time::SystemTime; #[test] fn test_eip3009_tx() { let sk = "3d98c2d5a7f737693b470114816000645419af49bd21258cc99142f6ef5fd60a".to_string(); let sk = hex::decode(sk).unwrap(); let from = "0x7eE4c635d204eBE65fc8987CE6570CFA1651E8Af".to_string(); let to = "0xf7a63003b8ef116939804b4c2dd49290a39c4d97".to_string(); let usdc = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238".to_string(); let amount = "100000".to_string(); let now = SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .unwrap() .as_secs(); use rand::RngCore; let mut nonce = [0u8; 32]; rand::rngs::OsRng.fill_bytes(&mut nonce); let nonce = hex::encode(nonce); let mut transfer = TransferWithAuthorizationParameters::::new( "USDC".to_string(), "2".to_string(), usdc.clone(), from, to, amount, now.to_string(), (now + 100).to_string(), nonce, ) .unwrap(); let digest = transfer.digest().unwrap(); let (rs, recid) = secp256k1_sign(&sk, &digest).unwrap(); let data = transfer .sign(recid, rs[..32].to_vec(), rs[32..].to_vec()) .unwrap(); println!("Data: 0x{}", hex::encode(&data)); let nonce = U256::from(67); let max_priority_fee_per_gas = U256::from_dec_str("1000000000").unwrap(); let max_fee_per_gas = U256::from_dec_str("1000000000").unwrap(); let gas_limit = U256::from(210000); let to = EthereumAddress::from_str(&usdc).unwrap(); let amount = U256::from(0); let params = Eip1559TransactionParameters { chain_id: Sepolia::CHAIN_ID, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, amount, data, access_list: vec![], }; let mut tx = Eip1559Transaction::::new(¶ms).unwrap(); let txid = tx.to_transaction_id().unwrap().txid; let (rs, recid) = secp256k1_sign(&sk, &txid).unwrap(); let tx = tx.sign(rs, recid).unwrap(); let tx = hex::encode(tx); println!("Tx: {}", tx); } } ================================================ FILE: crates/anychain-ethereum/src/transaction/eip7702.rs ================================================ use crate::contract::{erc20_transfer_func, execute_batch_transfer_func, schedule_func}; use crate::util::{adapt2, pad_zeros, restore_sender, trim_leading_zeros}; use crate::{erc20_transfer, AccessItem, EthereumTransactionId}; use crate::{EthereumAddress, EthereumFormat, EthereumNetwork, EthereumPublicKey}; use anychain_core::{hex, utilities::crypto::keccak256, Transaction, TransactionError}; use core::{fmt, marker::PhantomData, str::FromStr}; use ethabi::{encode, ethereum_types::H160, Token}; use ethereum_types::U256; use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream}; use serde_json::{json, Value}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Authorization { pub chain_id: u32, pub contract: EthereumAddress, pub nonce: U256, pub y_parity: bool, pub r: Vec, pub s: Vec, } impl Authorization { pub fn digest(&self) -> Vec { let mut rlp = RlpStream::new(); rlp.begin_list(3); rlp.append(&self.chain_id); rlp.append(&self.contract.to_bytes().unwrap()); rlp.append(&self.nonce); let stream = [vec![5u8], rlp.out().as_ref().to_vec()].concat(); keccak256(&stream).to_vec() } pub fn sign(&mut self, rs: Vec, recid: u8) { self.y_parity = recid == 1; self.r = rs[..32].to_vec(); self.s = rs[32..].to_vec(); } pub fn restore_sender(&self) -> Result { let recid = match self.y_parity { true => 1, false => 0, } as u8; let sig = [self.r.clone(), self.s.clone()].concat(); let msg = self.digest(); restore_sender(msg, sig, recid) } } impl Encodable for Authorization { fn rlp_append(&self, s: &mut RlpStream) { s.begin_list(6); s.append(&self.chain_id); s.append(&self.contract.to_bytes().unwrap()); s.append(&self.nonce); s.append(&self.y_parity); s.append(&trim_leading_zeros(&self.r)); s.append(&trim_leading_zeros(&self.s)); } } impl Decodable for Authorization { fn decode(rlp: &rlp::Rlp) -> Result { let chain_id = rlp.val_at::(0)?; let contract = rlp.val_at::>(1)?; let contract = hex::encode(contract); let contract = EthereumAddress::from_str(&contract).unwrap(); let nonce = rlp.val_at::(2)?; let y_parity = rlp.val_at(3)?; let mut r = rlp.val_at(4)?; let mut s = rlp.val_at(5)?; pad_zeros(&mut r, 32); pad_zeros(&mut s, 32); Ok(Self { chain_id, contract, nonce, y_parity, r, s, }) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Eip7702TransactionParameters { pub chain_id: u32, pub nonce: U256, pub max_priority_fee_per_gas: U256, pub max_fee_per_gas: U256, pub gas_limit: U256, pub to: EthereumAddress, pub amount: U256, pub data: Vec, pub access_list: Vec, pub authorizations: Vec, } impl Eip7702TransactionParameters { pub fn to_rlp(&self, array_len: usize) -> Result { let to = self .to .to_bytes() .map_err(|e| TransactionError::Message(format!("{}", e)))?; let mut rlp = RlpStream::new(); rlp.begin_list(array_len); rlp.append(&self.chain_id); rlp.append(&self.nonce); rlp.append(&self.max_priority_fee_per_gas); rlp.append(&self.max_fee_per_gas); rlp.append(&self.gas_limit); rlp.append(&to); rlp.append(&self.amount); rlp.append(&self.data); rlp.append_list(&self.access_list); rlp.append_list(&self.authorizations); Ok(rlp) } pub fn get_data(&self) -> Vec { self.data.clone() } } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Eip7702TransactionSignature { pub y_parity: bool, pub r: Vec, pub s: Vec, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Eip7702Transaction { pub sender: Option, pub params: Eip7702TransactionParameters, pub signature: Option, _network: PhantomData, } impl Eip7702Transaction { pub fn restore_sender(&mut self) -> Result<(), TransactionError> { if self.signature.is_none() { return Err(TransactionError::Message( "Signature is missing".to_string(), )); } let sig = self.signature.clone().unwrap(); self.signature = None; let recid = match sig.y_parity { true => 1, false => 0, } as u8; let _sig = [sig.r.clone(), sig.s.clone()].concat(); let msg = self.to_transaction_id()?.txid; let sender = restore_sender(msg, _sig, recid)?; self.sender = Some(sender); self.signature = Some(sig); Ok(()) } } impl Transaction for Eip7702Transaction { type Address = EthereumAddress; type Format = EthereumFormat; type PublicKey = EthereumPublicKey; type TransactionId = EthereumTransactionId; type TransactionParameters = Eip7702TransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(Self { sender: None, params: params.clone(), signature: None, _network: PhantomData, }) } fn sign(&mut self, rs: Vec, recid: u8) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length: {}", rs.len() ))); } let y_parity = recid == 1; let r = rs[..32].to_vec(); let s = rs[32..].to_vec(); self.signature = Some(Eip7702TransactionSignature { y_parity, r, s }); self.to_bytes() } fn to_bytes(&self) -> Result, TransactionError> { let rlp = match &self.signature { Some(sig) => { let mut rlp = self.params.to_rlp(13)?; let r = trim_leading_zeros(&sig.r); let s = trim_leading_zeros(&sig.s); rlp.append(&sig.y_parity); rlp.append(&r); rlp.append(&s); rlp.out().to_vec() } None => self.params.to_rlp(10)?.out().to_vec(), }; Ok([vec![4u8], rlp].concat()) } fn from_bytes(tx: &[u8]) -> Result { if tx.is_empty() || tx[0] != 4u8 { return Err(TransactionError::Message( "Invalid transaction type for EIP-7702".to_string(), )); } let rlp = Rlp::new(&tx[1..]); let item_count = adapt2(rlp.item_count())?; if item_count != 10 && item_count != 13 { return Err(TransactionError::Message(format!( "Invalid RLP item count for EIP-7702: {}", item_count ))); } let to = adapt2(rlp.val_at::>(5))?; let to = hex::encode(to); let chain_id = adapt2(rlp.val_at::(0))?; let nonce = adapt2(rlp.val_at::(1))?; let max_priority_fee_per_gas = adapt2(rlp.val_at::(2))?; let max_fee_per_gas = adapt2(rlp.val_at::(3))?; let gas_limit = adapt2(rlp.val_at::(4))?; let to = EthereumAddress::from_str(&to)?; let amount = adapt2(rlp.val_at::(6))?; let data = adapt2(rlp.val_at::>(7))?; let access_list = adapt2(rlp.list_at::(8))?; let authorizations = adapt2(rlp.list_at::(9))?; let params = Eip7702TransactionParameters { chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, amount, data, access_list, authorizations, }; let mut tx = Eip7702Transaction::::new(¶ms)?; if item_count == 13 { let y_parity = adapt2(rlp.val_at::(10))?; let mut r = adapt2(rlp.val_at::>(11))?; let mut s = adapt2(rlp.val_at::>(12))?; pad_zeros(&mut r, 32); pad_zeros(&mut s, 32); let sig = Eip7702TransactionSignature { y_parity, r, s }; tx.signature = Some(sig); tx.restore_sender()?; } Ok(tx) } fn to_transaction_id(&self) -> Result { Ok(Self::TransactionId { txid: keccak256(&self.to_bytes()?).to_vec(), }) } } impl FromStr for Eip7702Transaction { type Err = TransactionError; fn from_str(tx: &str) -> Result { let tx = match &tx[..2] { "0x" => &tx[2..], _ => tx, }; Self::from_bytes(&hex::decode(tx)?) } } impl fmt::Display for Eip7702Transaction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "0x{}", &hex::encode(match self.to_bytes() { Ok(transaction) => transaction, _ => return Err(fmt::Error), }) ) } } pub struct Many2ManyTransfer { pub transfers: Vec>, } impl Many2ManyTransfer { pub fn new(transfers: Vec>) -> Self { Self { transfers } } pub fn authorizations(&self) -> Result, TransactionError> { self.transfers .iter() .map(|transfer| transfer.authorization()) .collect::, TransactionError>>() .map_err(|e| TransactionError::Message(format!("{}", e))) } pub fn data(&self) -> Result, TransactionError> { let func = schedule_func(); let calls = Token::Array( self.transfers .iter() .map(|t| t.to_token()) .collect::>(), ); let tokens = vec![calls]; func.encode_input(&tokens) .map_err(|e| TransactionError::Message(format!("Failed to encode transfers: {}", e))) } } pub struct One2ManyTransfer { // address which initiates transfers pub from: String, // nonce of from address pub nonce: u64, // nonce of the transfer contract (for replay protection) pub nonce_contract: u64, // contract authorized to from by 7702 pub contract: String, // transfer batch pub transfers: Vec, // from's signature for contract authorization pub sig_auth: Option>, // froms's signature for transfers pub sig_transfer: Option>, _network: PhantomData, } impl One2ManyTransfer { pub fn new( from: String, nonce: u64, nonce_contract: u64, contract: String, transfers: Vec, ) -> Self { Self { from, nonce, nonce_contract, contract, transfers, sig_auth: None, sig_transfer: None, _network: PhantomData, } } pub fn digest(&self, typ: u8) -> Result, TransactionError> { match typ { // returns the auth digest 0 => { let auth = self.authorization()?; Ok(auth.digest()) } // returns the transfer digest 1 => { let chain_id = U256::from(N::CHAIN_ID); let chain_id = Token::Uint(chain_id); let nonce = Token::Uint(U256::from(self.nonce_contract)); let calls = Token::Array( self.transfers .iter() .map(|t| t.to_token()) .collect::>(), ); let stream = encode(&[chain_id, nonce, calls]); Ok(keccak256(&stream).to_vec()) } _ => Err(TransactionError::Message("invalid digest type".to_string())), } } pub fn sign(&mut self, rs: Vec, recid: u8, typ: u8) -> Result<(), TransactionError> { let sig = [rs, vec![recid]].concat(); match typ { // insert the auth signature 0 => { self.sig_auth = Some(sig); Ok(()) } // insert the transfer signature 1 => { self.sig_transfer = Some(sig); Ok(()) } _ => Err(TransactionError::Message( "invalid signature type".to_string(), )), } } pub fn authorization(&self) -> Result { let chain_id = N::CHAIN_ID; let contract = EthereumAddress::from_str(&self.contract)?; let nonce = U256::from(self.nonce); let mut auth = Authorization { chain_id, contract, nonce, y_parity: false, r: vec![], s: vec![], }; match &self.sig_auth { Some(sig_auth) => { auth.sign(sig_auth[..64].to_vec(), sig_auth[64]); Ok(auth) } None => Ok(auth), } } pub fn data(&self) -> Result, TransactionError> { if self.sig_transfer.is_none() { return Err(TransactionError::Message( "transfers not signed yet".to_string(), )); } let func = execute_batch_transfer_func(); let calls = Token::Array( self.transfers .iter() .map(|t| t.to_token()) .collect::>(), ); let sig = self.sig_transfer.clone().unwrap(); let v = sig[64] + 27; let r = sig[..32].to_vec(); let s = sig[32..64].to_vec(); let v = Token::Uint(U256::from(v)); let r = Token::FixedBytes(r); let s = Token::FixedBytes(s); let tokens = vec![calls, v, r, s]; func.encode_input(&tokens) .map_err(|e| TransactionError::Message(format!("Failed to encode transfers: {}", e))) } pub fn to_token(&self) -> Token { let from = EthereumAddress::from_str(&self.from).unwrap(); let to = Token::Address(H160::from_slice(&from.to_bytes().unwrap())); let amount = Token::Uint(U256::zero()); let data = Token::Bytes(self.data().unwrap()); Token::Tuple(vec![to, amount, data]) } } pub struct Transfer { pub token: Option, pub to: EthereumAddress, pub amount: U256, } impl Transfer { pub fn new(token: Option, to: String, amount: String) -> Self { Self { token: token.map(|t| EthereumAddress::from_str(&t).unwrap()), to: EthereumAddress::from_str(&to).unwrap(), amount: U256::from_dec_str(&amount).unwrap(), } } pub fn to_token(&self) -> Token { match &self.token { Some(token) => { let to = Token::Address(H160::from_slice(&token.to_bytes().unwrap())); let amount = Token::Uint(U256::from(0)); let data = Token::Bytes(erc20_transfer(&self.to, self.amount)); Token::Tuple(vec![to, amount, data]) } None => { let to = Token::Address(H160::from_slice(&self.to.to_bytes().unwrap())); let amount = Token::Uint(self.amount); let data = Token::Bytes(vec![]); Token::Tuple(vec![to, amount, data]) } } } pub fn from_token(token: Token) -> Result { let call = token.into_tuple().unwrap(); let to = call[0].clone().into_address().unwrap(); let to = EthereumAddress::from_str(&hex::encode(to)).unwrap(); let amount = call[1].clone().clone().into_uint().unwrap(); let data = call[2].clone().into_bytes().unwrap(); if data.is_empty() { Ok(Self { token: None, to, amount, }) } else { let func = erc20_transfer_func(); let transfer = func .decode_input(&data[4..]) .map_err(|e| TransactionError::Message(format!("Failed to decode data: {}", e)))?; if transfer.len() != 2 { return Err(TransactionError::Message( "Invalid ERC20 transfer data length".to_string(), )); } let token = Some(to); let to = transfer[0].clone().into_address().unwrap(); let to = EthereumAddress::from_str(&hex::encode(to)).unwrap(); let amount = transfer[1].clone().into_uint().unwrap(); Ok(Self { token, to, amount }) } } pub fn to_json(&self) -> Value { let to = self.to.to_string(); let amount = self.amount.to_string(); match &self.token { Some(token) => { let token = token.to_string(); json!({ "token": token, "to": to, "amount": amount, }) } None => json!({ "to": to, "amount": amount, }), } } } #[cfg(test)] mod tests { use anychain_core::{hex, PublicKey, Transaction}; use anychain_kms::{ bip32::{DerivationPath, Prefix, XprvSecp256k1}, bip39::{Language, Mnemonic, Seed}, secp256k1_sign, }; use core::str::FromStr; use ethereum_types::U256; use serde_json::{json, Value}; use crate::{ Authorization, Eip1559Transaction, Eip1559TransactionParameters, Eip7702Transaction, Eip7702TransactionParameters, EthereumAddress, EthereumFormat, EthereumNetwork, EthereumPublicKey, Sepolia, }; pub fn _parse_mnemonic(phrase: String) -> Value { if let Some(lang) = Language::from_phrase(&phrase) { Mnemonic::validate(&phrase, lang).unwrap(); let phrase = Mnemonic::from_phrase(&phrase, lang).unwrap(); let seed = Seed::new(&phrase, ""); let seed = seed.as_bytes(); let xprv = XprvSecp256k1::new(seed).unwrap(); let xpub = xprv.public_key().to_string(Prefix::XPUB); let xprv = xprv.to_string(Prefix::XPRV).to_string(); let data = json!({ "xprv": xprv, "xpub": xpub, }); data } else { Value::Null } } pub fn create_sk(xprv: String, path: String) -> libsecp256k1::SecretKey { let xprv = XprvSecp256k1::from_str(&xprv).unwrap(); let derive_path = DerivationPath::from_str(&path).unwrap(); let xprv = xprv.derive_from_path(&derive_path).unwrap(); let sk = xprv.private_key(); *sk } pub fn _create_address(xprv: String, path: String) -> EthereumAddress { let xprv = XprvSecp256k1::from_str(&xprv).unwrap(); let derive_path = DerivationPath::from_str(&path).unwrap(); let xprv = xprv.derive_from_path(&derive_path).unwrap(); let xpub = xprv.public_key(); let pk = *xpub.public_key(); EthereumPublicKey::from_secp256k1_public_key(pk) .to_address(&EthereumFormat::Standard) .unwrap() } #[test] fn test_tx() { let xprv = "xprv9s21ZrQH143K4AQzoQF6p3riRHUPG7VMQpYdCkcc548CYYT76Ay2nTFDXAfrMq7MT6NMePhuYP2uTGhTXjZZ1AZrGPZ4MyysX8ffTx9VwXU".to_string(); let delegate = "m/44/60/0/3".to_string(); let sk_delegate = create_sk(xprv.clone(), delegate.clone()); let sk_delegate = sk_delegate.serialize().to_vec(); let chain_id = Sepolia::CHAIN_ID; let nonce = U256::from(61); let max_priority_fee_per_gas = U256::from("200000000"); let max_fee_per_gas = U256::from("200000000"); let gas_limit = U256::from("21000"); let to = EthereumAddress::from_str("0x424Ef693c6F2648983aEc92f35a1143ba9Dd076C").unwrap(); let amount = U256::from_dec_str("100000000000000000").unwrap(); let params = Eip1559TransactionParameters { chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, amount, data: vec![], access_list: vec![], }; let mut tx = Eip1559Transaction::::new(¶ms).unwrap(); let msg = tx.to_transaction_id().unwrap().txid; let (rs, recid) = secp256k1_sign(&sk_delegate, &msg).unwrap(); let tx = tx.sign(rs, recid).unwrap(); let tx = hex::encode(tx); println!("Tx: {}", tx); } #[test] fn test_decouple() { let sk = "3d98c2d5a7f737693b470114816000645419af49bd21258cc99142f6ef5fd60a".to_string(); let sk = hex::decode(sk).unwrap(); let batch = "0x0000000000000000000000000000000000000000"; let batch = EthereumAddress::from_str(batch).unwrap(); let mut auth = Authorization { chain_id: Sepolia::CHAIN_ID, contract: batch, nonce: U256::from(66), y_parity: false, r: vec![], s: vec![], }; let digest = auth.digest(); let (rs, recid) = secp256k1_sign(&sk, &digest).unwrap(); auth.sign(rs, recid); let params = Eip7702TransactionParameters { chain_id: Sepolia::CHAIN_ID, nonce: U256::from(65), max_priority_fee_per_gas: U256::from_dec_str("1000000000").unwrap(), max_fee_per_gas: U256::from_dec_str("1000000000").unwrap(), gas_limit: U256::from(2100000), to: EthereumAddress::from_str("0x7eE4c635d204eBE65fc8987CE6570CFA1651E8Af").unwrap(), amount: U256::zero(), data: vec![], access_list: vec![], authorizations: vec![auth], }; let mut tx = Eip7702Transaction::::new(¶ms).unwrap(); let txid = tx.to_transaction_id().unwrap().txid; let (rs, recid) = secp256k1_sign(&sk, &txid).unwrap(); let tx = tx.sign(rs, recid).unwrap(); let tx = hex::encode(tx); println!("Tx: {}", tx); } } // Delegate: 0x7eE4c635d204eBE65fc8987CE6570CFA1651E8Af // From1: 0x424Ef693c6F2648983aEc92f35a1143ba9Dd076C // From2: 0x6f5ce2e6F2C8D2a6f91FbDeAc835074363c24a6E // To1: 0xBed74Ed65aE59eEa3339Daa215ea1d3B162F4E8B // To2: 0xf04e36C86e94093C2cb79FaD024962382568EFec // To3: 0x4a4763eFA2e89b88B3Aeef1282d150aC84188F06 // To4: 0xE87C78EA9Faa78A6924E228eAe24b59AB53e1c9e ================================================ FILE: crates/anychain-ethereum/src/transaction/legacy.rs ================================================ use super::EthereumTransactionId; use crate::util::{adapt2, pad_zeros, restore_sender, trim_leading_zeros}; use crate::{EthereumAddress, EthereumFormat, EthereumNetwork, EthereumPublicKey}; use anychain_core::{hex, utilities::crypto::keccak256, Transaction, TransactionError}; use core::{fmt, marker::PhantomData, str::FromStr}; use ethereum_types::U256; use rlp::{Rlp, RlpStream}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct EthereumTransactionParameters { pub nonce: U256, pub gas_price: U256, pub gas_limit: U256, pub to: EthereumAddress, pub amount: U256, pub data: Vec, } impl EthereumTransactionParameters { pub fn to_rlp(&self) -> Result { let to = self .to .to_bytes() .map_err(|e| TransactionError::Message(format!("{}", e)))?; let mut rlp = RlpStream::new(); rlp.begin_list(9); rlp.append(&self.nonce); rlp.append(&self.gas_price); rlp.append(&self.gas_limit); rlp.append(&to); rlp.append(&self.amount); rlp.append(&self.data); Ok(rlp) } pub fn get_data(&self) -> Vec { self.data.clone() } } #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct EthereumTransactionSignature { pub v: u32, pub r: Vec, pub s: Vec, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct EthereumTransaction { /// The address of the sender pub sender: Option, /// The transaction parameters (gas, gas_price, nonce, data) pub params: EthereumTransactionParameters, /// The transaction signature pub signature: Option, _network: PhantomData, } impl EthereumTransaction { pub fn restore_sender(&mut self) -> Result<(), TransactionError> { if self.signature.is_none() { return Err(TransactionError::Message( "Signature is missing".to_string(), )); } let sig = self.signature.clone().unwrap(); self.signature = None; let r = sig.r.clone(); let s = sig.s.clone(); let recid = (sig.v - 2 * N::CHAIN_ID - 35) as u8; let _sig = [r, s].concat(); let msg = self.to_transaction_id()?.txid; let sender = restore_sender(msg, _sig, recid)?; self.sender = Some(sender); self.signature = Some(sig); Ok(()) } } impl Transaction for EthereumTransaction { type Address = EthereumAddress; type Format = EthereumFormat; type PublicKey = EthereumPublicKey; type TransactionId = EthereumTransactionId; type TransactionParameters = EthereumTransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(Self { sender: None, params: params.clone(), signature: None, _network: PhantomData, }) } fn sign(&mut self, rs: Vec, recid: u8) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length: {}", rs.len() ))); } let v = 2 * N::CHAIN_ID + 35 + (recid as u32); let r = rs[..32].to_vec(); let s = rs[32..].to_vec(); self.signature = Some(EthereumTransactionSignature { v, r, s }); self.to_bytes() } fn to_bytes(&self) -> Result, TransactionError> { match &self.signature { Some(sig) => { let mut rlp = self.params.to_rlp()?; let r = trim_leading_zeros(&sig.r); let s = trim_leading_zeros(&sig.s); rlp.append(&sig.v); rlp.append(&r); rlp.append(&s); Ok(rlp.out().to_vec()) } None => { let mut rlp = self.params.to_rlp()?; rlp.append(&N::CHAIN_ID); rlp.append(&0u8); rlp.append(&0u8); Ok(rlp.out().to_vec()) } } } fn from_bytes(tx: &[u8]) -> Result { let rlp = Rlp::new(tx); let to = adapt2(rlp.val_at::>(3))?; let to = hex::encode(to); let nonce = adapt2(rlp.val_at::(0))?; let gas_price = adapt2(rlp.val_at::(1))?; let gas_limit = adapt2(rlp.val_at::(2))?; let to = EthereumAddress::from_str(&to)?; let amount = adapt2(rlp.val_at::(4))?; let data = adapt2(rlp.val_at::>(5))?; let v = adapt2(rlp.val_at::(6))?; let mut r = adapt2(rlp.val_at::>(7))?; let mut s = adapt2(rlp.val_at::>(8))?; let params = EthereumTransactionParameters { nonce, gas_price, gas_limit, to, amount, data, }; let mut tx = EthereumTransaction::::new(¶ms)?; if !r.is_empty() && !s.is_empty() { pad_zeros(&mut r, 32); pad_zeros(&mut s, 32); let sig = EthereumTransactionSignature { v, r, s }; tx.signature = Some(sig); tx.restore_sender()?; } Ok(tx) } fn to_transaction_id(&self) -> Result { Ok(Self::TransactionId { txid: keccak256(&self.to_bytes()?).to_vec(), }) } } impl FromStr for EthereumTransaction { type Err = TransactionError; fn from_str(tx: &str) -> Result { let tx = match &tx[..2] { "0x" => &tx[2..], _ => tx, }; Self::from_bytes(&hex::decode(tx)?) } } impl fmt::Display for EthereumTransaction { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "0x{}", &hex::encode(match self.to_bytes() { Ok(transaction) => transaction, _ => return Err(fmt::Error), }) ) } } #[cfg(test)] mod tests { use crate::{EthereumAddress, EthereumTransaction, EthereumTransactionParameters, Sepolia}; use anychain_core::{hex, Transaction}; use core::str::FromStr; use ethereum_types::U256; #[test] fn test_legacy_tx() { let params = EthereumTransactionParameters { nonce: U256::from_dec_str("6").unwrap(), gas_price: U256::from_dec_str("20000000000").unwrap(), gas_limit: U256::from_dec_str("21000").unwrap(), to: EthereumAddress::from_str("0xf7a63003b8ef116939804b4c2dd49290a39c4d97").unwrap(), amount: U256::from_dec_str("10000000000000000").unwrap(), data: vec![], }; let mut tx = EthereumTransaction::::new(¶ms).unwrap(); let msg = tx.to_transaction_id().unwrap().txid; let msg = libsecp256k1::Message::parse_slice(&msg).unwrap(); let sk = "08d586ed207046d6476f92fd4852be3830a9d651fc148d6fa5a6f15b77ba5df0"; let sk = hex::decode(sk).unwrap(); let sk = libsecp256k1::SecretKey::parse_slice(&sk).unwrap(); let (sig, recid) = libsecp256k1::sign(&msg, &sk); let sig = sig.serialize().to_vec(); let recid = recid.serialize(); let _ = tx.sign(sig, recid); println!("{}", tx); } } ================================================ FILE: crates/anychain-ethereum/src/transaction/mod.rs ================================================ pub mod contract; pub mod eip1559; pub mod eip3009; pub mod eip7702; pub mod legacy; pub use contract::*; pub use eip1559::*; pub use eip3009::*; pub use eip7702::*; pub use legacy::*; use anychain_core::{hex, TransactionId}; use core::fmt; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct EthereumTransactionId { pub txid: Vec, } impl TransactionId for EthereumTransactionId {} impl fmt::Display for EthereumTransactionId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "0x{}", hex::encode(&self.txid)) } } ================================================ FILE: crates/anychain-ethereum/src/util.rs ================================================ use crate::{EthereumAddress, EthereumFormat, EthereumPublicKey}; use anychain_core::{PublicKey, TransactionError}; use libsecp256k1::{recover, Error, Message, RecoveryId, Signature}; /// Trim the leading zeros of a byte stream and return it pub(crate) fn trim_leading_zeros(v: &Vec) -> &[u8] { let mut cnt: usize = 0; for byte in v { if *byte != 0 { break; } else { cnt += 1; } } &v[cnt..] } /// Prepend a number of zeros to 'v' to make it 'to_len' bytes long pub(crate) fn pad_zeros(v: &mut Vec, to_len: usize) { if v.len() < to_len { let mut temp = v.clone(); let len = v.len(); v.clear(); v.resize(to_len - len, 0); v.append(&mut temp); } } pub(crate) fn adapt1(v: Result) -> Result { match v { Ok(t) => Ok(t), Err(e) => Err(TransactionError::Message(format!( "libsecp256k1 error: {}", e ))), } } pub(crate) fn adapt2(v: Result) -> Result { match v { Ok(t) => Ok(t), Err(e) => Err(TransactionError::Message(format!("rlp error:{}", e))), } } pub(crate) fn restore_sender( msg: Vec, sig: Vec, recid: u8, ) -> Result { let recid = adapt1(RecoveryId::parse(recid))?; let sig = adapt1(Signature::parse_standard_slice(&sig))?; let msg = adapt1(Message::parse_slice(&msg))?; let pk = adapt1(recover(&msg, &sig, &recid))?; let pk = EthereumPublicKey::from_secp256k1_public_key(pk); Ok(pk.to_address(&EthereumFormat::Standard)?) } ================================================ FILE: crates/anychain-filecoin/Cargo.toml ================================================ [package] name = "anychain-filecoin" description = "A Rust library for Filecoin-focused cryptocurrency wallets, enabling seamless transactions on the Filecoin blockchain" version = "0.1.11" keywords = ["filecoin", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } serde = { workspace = true } serde_json = { workspace = true } fvm_shared = { workspace = true } data-encoding = { workspace = true } data-encoding-macro = { workspace = true } fvm_ipld_encoding = { workspace = true } num-derive = { workspace = true } num-traits = { workspace = true } thiserror = { workspace = true } lazy_static = { workspace = true } unsigned-varint = { workspace = true } blake2b_simd = { workspace = true } num-bigint = { workspace = true } anyhow = { workspace = true } forest_encoding = { workspace = true } cid = { workspace = true } base64 = { workspace = true } libsecp256k1 = { workspace = true } bls-signatures = { workspace = true } arbitrary = { workspace = true, optional = true } [features] default = ["std"] std = ["anychain-core/std"] arb = ["dep:arbitrary"] [lints] workspace = true ================================================ FILE: crates/anychain-filecoin/README.md ================================================ # anychain-filecoin anychain-filecoin is a Rust library that provides a simple and unified interface for interacting with the Filecoin blockchain. It is designed to be easy to use, efficient, and extensible. This library is inspired by the anychain-filecoin project and follows a similar structure and design principles. ## Features - Unified API for Filecoin blockchain interaction - Support for mainnet and testnet networks - Wallet management (create, import, and export) - Address genera[README.md](README.md)tion and validation - Transaction building, signing, and broadcasting - Querying blockchain data (blocks, transactions, balances, etc.) - Extensible design for future improvements and additional features ## Installation Add the following to your Cargo.toml file: ```toml [dependencies] anychain-filecoin = "0.1.9" ``` Then run cargo build to download and compile the library. ## Usage Here's a simple example of how to use the library: ```rust ``` For more examples and detailed usage instructions, please refer to the [documentation](https://docs.rs/anychain-filecoin). ## Contributing We welcome contributions from the community! If you'd like to contribute, please follow these steps: 1. Fork the repository 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Create a pull request and describe your changes Please make sure to follow the Rust coding guidelines and add tests for any new features or bug fixes. ## License anychain-filecoin is released under the MIT License. See the [LICENSE](LICENSE) file for more information. ================================================ FILE: crates/anychain-filecoin/src/address.rs ================================================ #![allow(non_local_definitions)] use crate::format::FilecoinFormat; use crate::public_key::FilecoinPublicKey; use std::borrow::Cow; use std::default::Default; use std::fmt; use std::hash::Hash; use std::str::FromStr; use crate::utilities::crypto::{blake2b_160, blake2b_checksum}; use anychain_core::PublicKey; use anychain_core::{Address, AddressError}; use bls_signatures::Serialize as BlsSerialize; use data_encoding::DecodeError; use data_encoding::Encoding; use data_encoding_macro::new_encoding; use fvm_ipld_encoding::serde_bytes; use num_derive::FromPrimitive; use num_traits::FromPrimitive; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use thiserror::Error; /// Represents a filecoin address #[derive(PartialEq, Eq, Clone, Debug, Hash, Copy, Default)] #[cfg_attr(feature = "arb", derive(arbitrary::Arbitrary))] pub struct FilecoinAddress { network: Network, payload: Payload, } impl Address for FilecoinAddress { type SecretKey = super::public_key::FilecoinSecretKey; type Format = FilecoinFormat; type PublicKey = FilecoinPublicKey; /// Returns the address corresponding to the given private key. fn from_secret_key( secret_key: &Self::SecretKey, _format: &Self::Format, ) -> Result { Self::from_public_key(&FilecoinPublicKey::from_secret_key(secret_key), _format) } /// Returns the address corresponding to the given public key. fn from_public_key( public_key: &Self::PublicKey, _: &Self::Format, ) -> Result { match public_key { FilecoinPublicKey::Secp256k1(key) => { Ok(FilecoinAddress::new_secp256k1(&key.serialize()).unwrap()) } FilecoinPublicKey::Bls(key) => Ok(FilecoinAddress::new_bls(&key.as_bytes()).unwrap()), } } } // impl Cbor for FilecoinAddress {} impl FilecoinAddress { /// Address constructor fn new(network: Network, protocol: Protocol, bz: &[u8]) -> Result { Ok(Self { network, payload: Payload::new(protocol, bz)?, }) } /// Creates address from encoded bytes pub fn from_bytes(bz: &[u8]) -> Result { if bz.len() < 2 { Err(Error::InvalidLength) } else { let protocol = Protocol::from_byte(bz[0]).ok_or(Error::UnknownProtocol)?; Self::new(NETWORK_DEFAULT, protocol, &bz[1..]) } } /// Generates new address using ID protocol pub const fn new_id(id: u64) -> Self { Self { network: NETWORK_DEFAULT, payload: Payload::ID(id), } } /// Generates new address using Secp256k1 pubkey pub fn new_secp256k1(pubkey: &[u8]) -> Result { if pubkey.len() != 65 { return Err(Error::InvalidSECPLength(pubkey.len())); } Ok(Self { network: NETWORK_DEFAULT, payload: Payload::Secp256k1(blake2b_160(pubkey)), }) } pub fn new_secp256k1_v2( network: Network, pubkey: libsecp256k1::PublicKey, ) -> Result { Ok(Self { network, payload: Payload::Secp256k1(blake2b_160(&pubkey.serialize())), }) } /// Generates new address using the Actor protocol pub fn new_actor(data: &[u8]) -> Self { Self { network: NETWORK_DEFAULT, payload: Payload::Actor(blake2b_160(data)), } } /// Generates new address using BLS pubkey pub fn new_bls(pubkey: &[u8]) -> Result { if pubkey.len() != BLS_PUB_LEN { return Err(Error::InvalidBLSLength(pubkey.len())); } let mut key = [0u8; BLS_PUB_LEN]; key.copy_from_slice(pubkey); Ok(Self { network: NETWORK_DEFAULT, payload: Payload::BLS(key), }) } pub fn is_bls_zero_address(&self) -> bool { match self.payload { Payload::BLS(payload_bytes) => payload_bytes == *BLS_ZERO_ADDR_BYTES, _ => false, } } /// Returns protocol for Address pub fn protocol(&self) -> Protocol { Protocol::from(self.payload) } /// Returns the `Payload` object from the address, where the respective protocol data is kept /// in an enum separated by protocol pub fn payload(&self) -> &Payload { &self.payload } /// Converts Address into `Payload` object, where the respective protocol data is kept /// in an enum separated by protocol pub fn into_payload(self) -> Payload { self.payload } /// Returns the raw bytes data payload of the Address pub fn payload_bytes(&self) -> Vec { self.payload.to_raw_bytes() } /// Returns network configuration of Address pub fn network(&self) -> Network { self.network } /// Sets the network for the address and returns a mutable reference to it pub fn set_network(&mut self, network: Network) -> &mut Self { self.network = network; self } /// Returns encoded bytes of Address pub fn to_bytes(self) -> Vec { self.payload.to_bytes() } /// Get ID of the address. ID protocol only. pub fn id(&self) -> Result { match self.payload { Payload::ID(id) => Ok(id), _ => Err(Error::NonIDAddress), } } } impl fmt::Display for FilecoinAddress { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", encode(self)) } } impl FromStr for FilecoinAddress { type Err = Error; fn from_str(addr: &str) -> Result { if addr.len() > MAX_ADDRESS_LEN || addr.len() < 3 { return Err(Error::InvalidLength); } // ensure the network character is valid before converting let network: Network = match addr.get(0..1).ok_or(Error::UnknownNetwork)? { TESTNET_PREFIX => Network::Testnet, MAINNET_PREFIX => Network::Mainnet, _ => { return Err(Error::UnknownNetwork); } }; // get protocol from second character let protocol: Protocol = match addr.get(1..2).ok_or(Error::UnknownProtocol)? { "0" => Protocol::ID, "1" => Protocol::Secp256k1, "2" => Protocol::Actor, "3" => Protocol::BLS, _ => { return Err(Error::UnknownProtocol); } }; // bytes after the protocol character is the data payload of the address let raw = addr.get(2..).ok_or(Error::InvalidPayload)?; if protocol == Protocol::ID { if raw.len() > 20 { // 20 is max u64 as string return Err(Error::InvalidLength); } let id = raw.parse::().unwrap(); return Ok(FilecoinAddress { network, payload: Payload::ID(id), }); } // decode using byte32 encoding let mut payload = ADDRESS_ENCODER.decode(raw.as_bytes())?; // payload includes checksum at end, so split after decoding let cksm = payload.split_off(payload.len() - CHECKSUM_HASH_LEN); // sanity check to make sure address hash values are correct length if (protocol == Protocol::Secp256k1 || protocol == Protocol::Actor) && payload.len() != PAYLOAD_HASH_LEN { return Err(Error::InvalidPayload); } // sanity check to make sure bls pub key is correct length if protocol == Protocol::BLS && payload.len() != BLS_PUB_LEN { return Err(Error::InvalidPayload); } // validate checksum let mut ingest = payload.clone(); ingest.insert(0, protocol as u8); if !validate_checksum(&ingest, cksm) { return Err(Error::InvalidChecksum); } FilecoinAddress::new(network, protocol, &payload) } } impl Serialize for FilecoinAddress { fn serialize(&self, s: S) -> Result where S: Serializer, { let address_bytes = self.to_bytes(); serde_bytes::Serialize::serialize(&address_bytes, s) } } impl<'de> Deserialize<'de> for FilecoinAddress { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { let bz: Cow<'de, [u8]> = serde_bytes::Deserialize::deserialize(deserializer)?; // Create and return created address of unmarshalled bytes FilecoinAddress::from_bytes(&bz).map_err(de::Error::custom) } } /// encode converts the address into a string fn encode(addr: &FilecoinAddress) -> String { match addr.protocol() { Protocol::Secp256k1 | Protocol::Actor | Protocol::BLS => { let ingest = addr.to_bytes(); let mut bz = addr.payload_bytes(); // payload bytes followed by calculated checksum bz.extend(blake2b_checksum(&ingest)); format!( "{}{}{}", addr.network.to_prefix(), addr.protocol(), ADDRESS_ENCODER.encode(bz.as_mut()), ) } Protocol::ID => format!( "{}{}{}", addr.network.to_prefix(), addr.protocol(), from_leb_bytes(&addr.payload_bytes()).expect("should read encoded bytes"), ), } } pub(crate) fn to_leb_bytes(id: u64) -> Result, Error> { // write id to buffer in leb128 format Ok(unsigned_varint::encode::u64(id, &mut unsigned_varint::encode::u64_buffer()).into()) } pub(crate) fn from_leb_bytes(bz: &[u8]) -> Result { // write id to buffer in leb128 format let (id, remaining) = unsigned_varint::decode::u64(bz).unwrap(); if !remaining.is_empty() { return Err(Error::InvalidPayload); } Ok(id) } /// Validates the checksum against the ingest data pub fn validate_checksum(ingest: &[u8], expect: Vec) -> bool { let digest = blake2b_checksum(ingest); digest == expect } /// Protocol defines the addressing protocol used to derive data to an address #[derive(PartialEq, Eq, Copy, Clone, FromPrimitive, Debug, Hash)] #[repr(u8)] pub enum Protocol { /// ID protocol addressing ID = 0, /// SECP256K1 key addressing Secp256k1 = 1, /// Actor protocol addressing Actor = 2, /// BLS key addressing BLS = 3, } impl Protocol { /// from_byte allows referencing back to Protocol from encoded byte pub(super) fn from_byte(b: u8) -> Option { FromPrimitive::from_u8(b) } } /// allows conversion of Protocol value to string impl fmt::Display for Protocol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let i = *self as u8; write!(f, "{}", i) } } /// Payload is the data of the Address. Variants are the supported Address protocols. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] #[cfg_attr(feature = "arb", derive(arbitrary::Arbitrary))] pub enum Payload { /// ID protocol address. ID(u64), /// SECP256K1 key address, 20 byte hash of PublicKey Secp256k1([u8; PAYLOAD_HASH_LEN]), /// Actor protocol address, 20 byte hash of actor data Actor([u8; PAYLOAD_HASH_LEN]), /// BLS key address, full 48 byte public key BLS([u8; BLS_PUB_LEN]), } impl Default for Payload { fn default() -> Self { Payload::Secp256k1([0; PAYLOAD_HASH_LEN]) } } impl Payload { /// Returns encoded bytes of Address without the protocol byte. pub fn to_raw_bytes(self) -> Vec { use Payload::*; match self { ID(i) => to_leb_bytes(i).unwrap(), Secp256k1(arr) => arr.to_vec(), Actor(arr) => arr.to_vec(), BLS(arr) => arr.to_vec(), } } /// Returns encoded bytes of Address including the protocol byte. pub fn to_bytes(self) -> Vec { use Payload::*; let mut bz = match self { ID(i) => to_leb_bytes(i).unwrap(), Secp256k1(arr) => arr.to_vec(), Actor(arr) => arr.to_vec(), BLS(arr) => arr.to_vec(), }; bz.insert(0, Protocol::from(self) as u8); bz } /// Generates payload from raw bytes and protocol. pub fn new(protocol: Protocol, payload: &[u8]) -> Result { let payload = match protocol { Protocol::ID => Self::ID(from_leb_bytes(payload)?), Protocol::Secp256k1 => Self::Secp256k1( payload .try_into() .map_err(|_| Error::InvalidPayloadLength(payload.len()))?, ), Protocol::Actor => Self::Actor( payload .try_into() .map_err(|_| Error::InvalidPayloadLength(payload.len()))?, ), Protocol::BLS => Self::BLS( payload .try_into() .map_err(|_| Error::InvalidPayloadLength(payload.len()))?, ), }; Ok(payload) } } impl From for Protocol { fn from(pl: Payload) -> Self { match pl { Payload::ID(_) => Self::ID, Payload::Secp256k1(_) => Self::Secp256k1, Payload::Actor(_) => Self::Actor, Payload::BLS(_) => Self::BLS, } } } impl From<&Payload> for Protocol { fn from(pl: &Payload) -> Self { match pl { Payload::ID(_) => Self::ID, Payload::Secp256k1(_) => Self::Secp256k1, Payload::Actor(_) => Self::Actor, Payload::BLS(_) => Self::BLS, } } } /// Address error #[derive(Debug, PartialEq, Error)] pub enum Error { #[error("Unknown address network")] UnknownNetwork, #[error("Unknown address protocol")] UnknownProtocol, #[error("Invalid address payload")] InvalidPayload, #[error("Invalid address length")] InvalidLength, #[error("Invalid payload length, wanted: {} got: {0}", PAYLOAD_HASH_LEN)] InvalidPayloadLength(usize), #[error("Invalid BLS pub key length, wanted: {} got: {0}", BLS_PUB_LEN)] InvalidBLSLength(usize), #[error("Invalid SECP pub key length, wanted: {} got: {0}", SECP_PUB_LEN)] InvalidSECPLength(usize), #[error("Invalid address checksum")] InvalidChecksum, #[error("Decoding for address failed: {0}")] Base32Decoding(#[from] DecodeError), #[error("Cannot get id from non id address")] NonIDAddress, } /// Network defines the preconfigured networks to use with address encoding #[derive(PartialEq, Eq, Copy, Clone, Debug, Default, Hash)] #[cfg_attr(feature = "arb", derive(arbitrary::Arbitrary))] pub enum Network { #[default] Mainnet = 0, Testnet = 1, } impl Network { /// to_prefix is used to convert the network into a string /// used when converting address to string pub(super) fn to_prefix(self) -> &'static str { match self { Network::Mainnet => MAINNET_PREFIX, Network::Testnet => TESTNET_PREFIX, } } } /// defines the encoder for base32 encoding with the provided string with no padding pub const ADDRESS_ENCODER: Encoding = new_encoding! { symbols: "abcdefghijklmnopqrstuvwxyz234567", padding: None, }; /// Hash length of payload for Secp and Actor addresses. pub const PAYLOAD_HASH_LEN: usize = 20; /// Uncompressed secp public key used for validation of Secp addresses. pub const SECP_PUB_LEN: usize = 65; /// BLS public key length used for validation of BLS addresses. pub const BLS_PUB_LEN: usize = 48; lazy_static::lazy_static! { static ref BLS_ZERO_ADDR_BYTES: [u8; BLS_PUB_LEN] = { let bz_addr = FilecoinAddress::from_str("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a"); if let Ok(FilecoinAddress {payload: Payload::BLS(pubkey), ..}) = bz_addr { pubkey } else { panic!("failed to parse BLS address from provided BLS_ZERO_ADDR string") } }; } /// Length of the checksum hash for string encodings. pub const CHECKSUM_HASH_LEN: usize = 4; const MAX_ADDRESS_LEN: usize = 84 + 2; const MAINNET_PREFIX: &str = "f"; const TESTNET_PREFIX: &str = "t"; // TODO pull network from config (probably) // TODO: can we do this using build flags? pub const NETWORK_DEFAULT: Network = Network::Testnet; #[cfg(test)] mod tests { use super::*; #[test] fn base32_to_internal_address() { let addr = FilecoinAddress::from_str("f2qexjxohk7c7j6r2tud6kgab6yd62fhdszjukcra").unwrap(); assert_eq!( "f2qexjxohk7c7j6r2tud6kgab6yd62fhdszjukcra", addr.to_string() ); } #[test] fn test_mainnet_address() { let secret_bytes = [1u8; 32]; let secret_key = libsecp256k1::SecretKey::parse_slice(&secret_bytes).unwrap(); let public_key = libsecp256k1::PublicKey::from_secret_key(&secret_key); let addr = FilecoinAddress::new_secp256k1_v2(Network::Mainnet, public_key).unwrap(); let addr_str = addr.to_string(); assert!(addr_str.starts_with(MAINNET_PREFIX)); assert!(addr_str.starts_with("f1")); assert_eq!(addr.network(), Network::Mainnet); assert_eq!("f1ksu3ktw4xhyaoltwr546b3epfs5wxxqfyyxipwi", addr_str); } } ================================================ FILE: crates/anychain-filecoin/src/amount.rs ================================================ use anychain_core::to_basic_unit as to_atto_fil; use core::fmt; use num_bigint::BigInt; /// Represents the amount of filecoin in attoFIL pub type FilecoinAmount = BigInt; pub enum Denomination { AttoFIL, FemtoFIL, PicoFIL, NanoFIL, MicroFIL, MilliFIL, FIL, } impl Denomination { fn precision(self) -> u32 { match self { Denomination::AttoFIL => 0, Denomination::FemtoFIL => 3, Denomination::PicoFIL => 6, Denomination::NanoFIL => 9, Denomination::MicroFIL => 12, Denomination::MilliFIL => 15, Denomination::FIL => 18, } } } impl fmt::Display for Denomination { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "{}", match self { Denomination::AttoFIL => "attoFIL", Denomination::FemtoFIL => "femtoFIL", Denomination::PicoFIL => "picoFIL", Denomination::NanoFIL => "nanoFIL", Denomination::MicroFIL => "microFIL", Denomination::MilliFIL => "milliFIL", Denomination::FIL => "FIL", } ) } } pub trait FilecoinAmountConverter { fn from_decimal_str(val: &str) -> Self; fn from_atto_fil(atto_fil_value: &str) -> Self; fn from_femto_fil(femto_fil_value: &str) -> Self; fn from_pico_fil(pico_fil_value: &str) -> Self; fn from_nano_fil(nano_fil_value: &str) -> Self; fn from_micro_fil(micro_fil_value: &str) -> Self; fn from_milli_fil(milli_fil_value: &str) -> Self; fn from_fil(fil_value: &str) -> Self; fn add(self, b: Self) -> Self; fn sub(self, b: Self) -> Self; } impl FilecoinAmountConverter for FilecoinAmount { fn from_decimal_str(val: &str) -> Self { FilecoinAmount::parse_bytes(val.as_bytes(), 10).unwrap() } fn from_atto_fil(atto_fil_value: &str) -> Self { FilecoinAmount::from_decimal_str(atto_fil_value) } fn from_femto_fil(femto_fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(femto_fil_value, Denomination::FemtoFIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn from_pico_fil(pico_fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(pico_fil_value, Denomination::PicoFIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn from_nano_fil(nano_fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(nano_fil_value, Denomination::NanoFIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn from_micro_fil(micro_fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(micro_fil_value, Denomination::MilliFIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn from_milli_fil(milli_fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(milli_fil_value, Denomination::MilliFIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn from_fil(fil_value: &str) -> Self { let atto_fil_value = to_atto_fil(fil_value, Denomination::FIL.precision()); FilecoinAmount::from_decimal_str(&atto_fil_value) } fn add(self, b: Self) -> Self { &self + &b } fn sub(self, b: Self) -> Self { &self + &b } } #[cfg(test)] mod tests { use super::*; #[test] fn f() { let atto_fil = FilecoinAmount::from_fil("0.0001"); assert_eq!("100000000000000", atto_fil.to_string()); } } ================================================ FILE: crates/anychain-filecoin/src/format.rs ================================================ use anychain_core::Format; use core::fmt; use serde::Serialize; /// Represents the format of a Filecoin address #[derive(Serialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum FilecoinFormat { Base32, } impl Format for FilecoinFormat {} impl fmt::Display for FilecoinFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Base32") } } ================================================ FILE: crates/anychain-filecoin/src/lib.rs ================================================ pub mod address; pub use self::address::*; pub mod amount; pub use self::amount::*; pub mod format; pub use self::format::*; pub mod public_key; pub use self::public_key::*; pub mod transaction; mod utilities; pub use self::transaction::*; ================================================ FILE: crates/anychain-filecoin/src/public_key.rs ================================================ use crate::address::FilecoinAddress; use crate::format::FilecoinFormat; use anychain_core::{hex, Address, AddressError, PublicKey, PublicKeyError}; use bls_signatures::{self, Serialize}; use core::panic; use core::{fmt, fmt::Display, str::FromStr}; /// Represents a filecoin secret key #[derive(Debug, Clone, PartialEq)] pub enum FilecoinSecretKey { Secp256k1(libsecp256k1::SecretKey), Bls(bls_signatures::PrivateKey), } /// Represents a filecoin public key #[derive(Debug, Clone, PartialEq)] pub enum FilecoinPublicKey { Secp256k1(libsecp256k1::PublicKey), Bls(bls_signatures::PublicKey), } impl PublicKey for FilecoinPublicKey { type SecretKey = FilecoinSecretKey; type Address = FilecoinAddress; type Format = FilecoinFormat; /// Returns the filecoin public key corresponding to the given secp256k1 secret key. fn from_secret_key(secret_key: &Self::SecretKey) -> Self { match secret_key { FilecoinSecretKey::Secp256k1(key) => { Self::Secp256k1(libsecp256k1::PublicKey::from_secret_key(key)) } FilecoinSecretKey::Bls(key) => Self::Bls(key.public_key()), } } /// Returns the address of the corresponding filecoin public key. fn to_address(&self, _format: &Self::Format) -> Result { Self::Address::from_public_key(self, _format) } } impl FilecoinPublicKey { /// Returns a filecoin public key given an secp256k1 public key. pub fn from_secp256k1_public_key(public_key: libsecp256k1::PublicKey) -> Self { Self::Secp256k1(public_key) } /// Returns the secp256k1 public key of this filecoin public key pub fn to_secp256k1_public_key(&self) -> libsecp256k1::PublicKey { match self { Self::Secp256k1(key) => *key, _ => panic!("not an secp256k1 public key"), } } /// Returns a filecoin public key given a bls public key pub fn from_bls_public_key(public_key: bls_signatures::PublicKey) -> Self { Self::Bls(public_key) } /// Returns the bls public key of this filecoin public key pub fn to_bls_public_key(&self) -> bls_signatures::PublicKey { match self { Self::Bls(key) => *key, _ => panic!("not a bls public key"), } } } impl FromStr for FilecoinPublicKey { type Err = PublicKeyError; fn from_str(public_key: &str) -> Result { let mut s = public_key.to_string(); let mut is_bls = false; if s.starts_with("secp256k1_pub_") { s = s[14..].to_string(); } else if s.starts_with("bls_pub_") { s = s[8..].to_string(); is_bls = true; } else { return Err(PublicKeyError::InvalidPrefix("".to_string())); } let stream = hex::decode(&s)?; match is_bls { true => { let key = bls_signatures::PublicKey::from_bytes(&stream) .map_err(|e| PublicKeyError::Crate("bls_signatures", format!("{:?}", e)))?; Ok(Self::Bls(key)) } false => { let key = libsecp256k1::PublicKey::parse_slice(&stream, None).map_err(|error| { PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)) })?; Ok(Self::Secp256k1(key)) } } } } impl Display for FilecoinPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Secp256k1(key) => { let mut s = "secp256k1_pub_".to_string(); s.push_str(&hex::encode(key.serialize())); write!(f, "{}", s) } Self::Bls(key) => { let mut s = "bls_pub_".to_string(); s.push_str(&hex::encode(key.as_bytes())); write!(f, "{}", s) } } } } #[cfg(test)] mod tests { use super::*; #[test] fn test_public_key_from_str() { let invalid_bls = "bls_pub_deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; let _key = FilecoinPublicKey::from_str(invalid_bls); // Crate("bls_signatures","GroupDecode") assert!(matches!(_key, Err(PublicKeyError::Crate(_, _)))); } #[test] fn test_public_key_secp256k1() { let secret_bytes = [1u8; 32]; let secp_secret = libsecp256k1::SecretKey::parse_slice(&secret_bytes).unwrap(); let secret = FilecoinSecretKey::Secp256k1(secp_secret); let public_key = FilecoinPublicKey::from_secret_key(&secret); assert!(matches!(public_key, FilecoinPublicKey::Secp256k1(_))); let encoded = public_key.to_string(); assert!(encoded.starts_with("secp256k1_pub_")); assert_eq!("secp256k1_pub_041b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f70beaf8f588b541507fed6a642c5ab42dfdf8120a7f639de5122d47a69a8e8d1", encoded); let parsed = FilecoinPublicKey::from_str(&encoded).unwrap(); assert_eq!(parsed, public_key); let address = public_key.to_address(&FilecoinFormat::Base32).unwrap(); assert!(address.to_string().starts_with("t1")); assert_eq!( "t1ksu3ktw4xhyaoltwr546b3epfs5wxxqfyyxipwi", address.to_string() ); } #[test] fn test_public_key_bls() { let secret_bytes = [7u8; 32]; let bls_secret = bls_signatures::PrivateKey::from_bytes(&secret_bytes).unwrap(); let secret = FilecoinSecretKey::Bls(bls_secret); let public_key = FilecoinPublicKey::from_secret_key(&secret); assert!(matches!(public_key, FilecoinPublicKey::Bls(_))); let encoded = public_key.to_string(); assert!(encoded.starts_with("bls_pub_")); assert_eq!("bls_pub_a4cafe0e4602bb74340d45b931591034894f6be4aae24c4e80931d622636bb4da64804903072c655995b423113f41705", encoded); let parsed = FilecoinPublicKey::from_str(&encoded).unwrap(); assert_eq!(parsed, public_key); let address = public_key.to_address(&FilecoinFormat::Base32).unwrap(); assert!(address.to_string().starts_with("t3")); assert_eq!("t3utfp4dsgak5xinaniw4tcwiqgseu627evlreytuasmowejrwxng2msaesayhfrsvtfnuemit6qlqku4rk5ba", address.to_string()); } } ================================================ FILE: crates/anychain-filecoin/src/transaction.rs ================================================ #![allow(non_local_definitions)] use crate::address::ADDRESS_ENCODER as BASE32_ENCODER; use crate::address::{FilecoinAddress, Protocol}; use crate::amount::FilecoinAmount; use crate::format::FilecoinFormat; use crate::public_key::FilecoinPublicKey; use crate::utilities::crypto::blake2b_256; use anychain_core::{Transaction, TransactionError, TransactionId}; use cid::Cid; use anyhow::anyhow; use fvm_ipld_encoding::de::{Deserialize, Deserializer}; use fvm_ipld_encoding::ser::{Serialize, Serializer}; pub use fvm_ipld_encoding::RawBytes; use fvm_ipld_encoding::{de, ser, serde_bytes}; use forest_encoding::tuple::*; use fvm_ipld_encoding::repr::*; use fvm_shared::bigint::bigint_ser::{BigIntDe, BigIntSer}; use fvm_shared::MethodNum; use num_derive::FromPrimitive; use core::panic; use std::borrow::Cow; use std::fmt::{self, Display}; use std::str::FromStr; use self::json::FilecoinTransactionJson; const DAG_CBOR_CODEC: u64 = 0x71; const BLAKE2B_256_MULTIHASH_CODE: u64 = 0xb220; fn cid_from_cbor(value: &T) -> anyhow::Result { let data = fvm_ipld_encoding::to_vec(value)?; let digest = blake2b_256(&data); let hash = cid::multihash::Multihash::<64>::wrap(BLAKE2B_256_MULTIHASH_CODE, &digest) .map_err(|e| anyhow!("failed to build multihash: {e}"))?; Ok(Cid::new_v1(DAG_CBOR_CODEC, hash)) } /// Represents the parameters for a filecoin transaction #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] pub struct FilecoinTransactionParameters { pub version: i64, pub from: FilecoinAddress, pub to: FilecoinAddress, pub sequence: u64, pub value: FilecoinAmount, pub method_num: MethodNum, pub params: RawBytes, pub gas_limit: i64, pub gas_fee_cap: FilecoinAmount, pub gas_premium: FilecoinAmount, } // impl Cbor for FilecoinTransactionParameters {} impl FilecoinTransactionParameters { pub fn cid(&self) -> anyhow::Result { cid_from_cbor(self) } /// Helper function to convert the message into signing bytes. /// This function returns the message `Cid` bytes. pub fn to_bytes(&self) -> Vec { // Safe to unwrap here, unsigned message cannot fail to serialize. self.cid().unwrap().to_bytes() } /// Does some basic checks on the Message to see if the fields are valid. pub fn check(self: &FilecoinTransactionParameters) -> anyhow::Result<()> { if self.gas_limit == 0 { return Err(anyhow!("Message has no gas limit set")); } if self.gas_limit < 0 { return Err(anyhow!("Message has negative gas limit")); } Ok(()) } } impl Serialize for FilecoinTransactionParameters { fn serialize(&self, s: S) -> std::result::Result where S: Serializer, { ( &self.version, &self.to, &self.from, &self.sequence, BigIntSer(&self.value), &self.gas_limit, BigIntSer(&self.gas_fee_cap), BigIntSer(&self.gas_premium), &self.method_num, &self.params, ) .serialize(s) } } impl<'de> Deserialize<'de> for FilecoinTransactionParameters { fn deserialize(deserializer: D) -> std::result::Result where D: Deserializer<'de>, { let ( version, to, from, sequence, BigIntDe(value), gas_limit, BigIntDe(gas_fee_cap), BigIntDe(gas_premium), method_num, params, ) = Deserialize::deserialize(deserializer)?; Ok(Self { version, from, to, sequence, value, method_num, params, gas_limit, gas_fee_cap, gas_premium, }) } } /// Signature variants for Filecoin signatures. #[allow(non_local_definitions)] #[derive( Clone, Debug, PartialEq, FromPrimitive, Copy, Eq, Serialize_repr, Deserialize_repr, Hash, Default, )] #[repr(u8)] pub enum FilecoinSignatureType { #[default] Secp256k1 = 1, BLS = 2, } /// A cryptographic signature, represented in bytes, of any key protocol. #[derive(Clone, Debug, PartialEq, Eq, Hash, Default)] pub struct FilecoinSignature { pub sig_type: FilecoinSignatureType, pub bytes: Vec, } // impl Cbor for FilecoinSignature {} impl ser::Serialize for FilecoinSignature { fn serialize(&self, serializer: S) -> Result where S: ser::Serializer, { let mut bytes = Vec::with_capacity(self.bytes.len() + 1); // Insert signature type byte bytes.push(self.sig_type as u8); bytes.extend_from_slice(&self.bytes); serde_bytes::Serialize::serialize(&bytes, serializer) } } impl<'de> de::Deserialize<'de> for FilecoinSignature { fn deserialize(deserializer: D) -> Result where D: de::Deserializer<'de>, { let bytes: Cow<'de, [u8]> = serde_bytes::Deserialize::deserialize(deserializer)?; if bytes.is_empty() { return Err(de::Error::custom("Cannot deserialize empty bytes")); } // Remove signature type byte let mut sig_type = FilecoinSignatureType::Secp256k1; let b = bytes[0]; if b == 1 { } else if b == 2 { sig_type = FilecoinSignatureType::BLS; } else { panic!("Invalid signature type byte (must be 1 or 2)") } Ok(FilecoinSignature { bytes: bytes[1..].to_vec(), sig_type, }) } } /// Represents a filecoin transaction id #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct FilecoinTransactionId { pub txid: Vec, } impl TransactionId for FilecoinTransactionId {} impl fmt::Display for FilecoinTransactionId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", &BASE32_ENCODER.encode(&self.txid[..])) } } /// Represents a wrapped filecoin transaction with signature bytes. #[derive(PartialEq, Clone, Debug, Serialize_tuple, Deserialize_tuple, Hash, Eq, Default)] pub struct FilecoinTransaction { pub params: FilecoinTransactionParameters, pub signature: FilecoinSignature, } // impl Cbor for FilecoinTransaction {} impl Transaction for FilecoinTransaction { type Address = FilecoinAddress; type Format = FilecoinFormat; type PublicKey = FilecoinPublicKey; type TransactionId = FilecoinTransactionId; type TransactionParameters = FilecoinTransactionParameters; /// Returns a new filecoin transaction given the transaction parameters fn new(parameters: &Self::TransactionParameters) -> Result { Ok(Self { params: parameters.clone(), signature: FilecoinSignature::default(), }) } /// Reconstruct a filecoin transaction from the given binary stream and return it fn from_bytes(transaction: &[u8]) -> Result { Ok(serde_json::from_slice::(transaction)?.0) } /// Insert the given signature into this filecoin transaction to make it signed, /// and return the binary stream of it fn sign(&mut self, mut signature: Vec, recid: u8) -> Result, TransactionError> { signature.push(recid); let sig = FilecoinSignature { sig_type: match self.params.from.protocol() { Protocol::Secp256k1 => FilecoinSignatureType::Secp256k1, Protocol::BLS => FilecoinSignatureType::BLS, _ => panic!("Unrecognized signature type"), }, bytes: signature, }; self.signature = sig; self.to_bytes() } /// Returns the binary stream of this filecoin transaction fn to_bytes(&self) -> Result, TransactionError> { Ok( serde_json::to_string(&json::FilecoinTransactionJsonRef(self))? .as_bytes() .to_vec(), ) } /// Returns the transaction id of this filecoin transaction fn to_transaction_id(&self) -> Result { let stream = self.to_bytes().unwrap(); Ok(FilecoinTransactionId { txid: blake2b_256(&stream).to_vec(), }) } } impl FilecoinTransaction { pub fn cid(&self) -> anyhow::Result { cid_from_cbor(self) } pub fn digest(&self) -> Result, TransactionError> { Ok(blake2b_256(&self.params.to_bytes()).to_vec()) } } impl FromStr for FilecoinTransaction { type Err = TransactionError; fn from_str(s: &str) -> Result { Ok(serde_json::from_str::(s)?.0) } } impl Display for FilecoinTransaction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{}", String::from_utf8(self.to_bytes().unwrap()).unwrap() ) } } pub mod json { use super::*; use cid::Cid; use serde::{ser, Deserialize, Deserializer, Serialize, Serializer}; /// Wrapper for serializing and de-serializing a `FilecoinTransaction` from JSON. #[derive(Deserialize, Serialize)] #[serde(transparent)] pub struct FilecoinTransactionJson(#[serde(with = "self")] pub FilecoinTransaction); /// Wrapper for serializing a `FilecoinTransaction` reference to JSON. #[derive(Serialize)] #[serde(transparent)] pub struct FilecoinTransactionJsonRef<'a>(#[serde(with = "self")] pub &'a FilecoinTransaction); impl From for FilecoinTransaction { fn from(wrapper: FilecoinTransactionJson) -> Self { wrapper.0 } } impl From for FilecoinTransactionJson { fn from(tx: FilecoinTransaction) -> Self { FilecoinTransactionJson(tx) } } pub fn serialize(tx: &FilecoinTransaction, serializer: S) -> Result where S: Serializer, { #[derive(Serialize)] #[serde(rename_all = "PascalCase")] struct FilecoinTransactionSer<'a> { #[serde(with = "parameter_json")] message: &'a FilecoinTransactionParameters, #[serde(with = "signature_json")] signature: &'a FilecoinSignature, #[serde(default, rename = "CID", with = "cid_json::opt")] cid: Option, } FilecoinTransactionSer { message: &tx.params, signature: &tx.signature, cid: Some(tx.cid().map_err(ser::Error::custom)?), } .serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { #[derive(Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] struct FilecoinTransactionDe { #[serde(with = "parameter_json")] message: FilecoinTransactionParameters, #[serde(with = "signature_json")] signature: FilecoinSignature, } let FilecoinTransactionDe { message, signature } = Deserialize::deserialize(deserializer)?; Ok(FilecoinTransaction { params: message, signature, }) } } pub mod parameter_json { use super::address_json::AddressJson; use super::amount_json; use super::cid_json; use super::FilecoinAmount; use super::FilecoinTransactionParameters; use super::RawBytes; use base64::{engine::general_purpose, Engine as _}; use cid::Cid; use serde::{de, ser, Deserialize, Deserializer, Serialize, Serializer}; /// Wrapper for serializing and de-serializing a Message from JSON. #[derive(Deserialize, Serialize, Debug)] #[serde(transparent)] pub struct ParameterJson(#[serde(with = "self")] pub FilecoinTransactionParameters); /// Wrapper for serializing a Message reference to JSON. #[derive(Serialize)] #[serde(transparent)] pub struct ParameterJsonRef<'a>(#[serde(with = "self")] pub &'a FilecoinTransactionParameters); impl From for FilecoinTransactionParameters { fn from(wrapper: ParameterJson) -> Self { wrapper.0 } } impl From for ParameterJson { fn from(wrapper: FilecoinTransactionParameters) -> Self { ParameterJson(wrapper) } } #[derive(Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] struct JsonHelper { version: i64, to: AddressJson, from: AddressJson, #[serde(rename = "Nonce")] sequence: u64, #[serde(with = "amount_json")] value: FilecoinAmount, gas_limit: i64, #[serde(with = "amount_json")] gas_fee_cap: FilecoinAmount, #[serde(with = "amount_json")] gas_premium: FilecoinAmount, #[serde(rename = "Method")] method_num: u64, params: Option, #[serde(default, rename = "CID", with = "cid_json::opt")] cid: Option, } pub fn serialize( params: &FilecoinTransactionParameters, serializer: S, ) -> Result where S: Serializer, { JsonHelper { version: params.version, to: params.to.into(), from: params.from.into(), sequence: params.sequence, value: params.value.clone(), gas_limit: params.gas_limit, gas_fee_cap: params.gas_fee_cap.clone(), gas_premium: params.gas_premium.clone(), method_num: params.method_num, params: Some(general_purpose::STANDARD.encode(params.params.bytes())), cid: Some(params.cid().map_err(ser::Error::custom)?), } .serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { let m: JsonHelper = Deserialize::deserialize(deserializer)?; Ok(FilecoinTransactionParameters { version: m.version, to: m.to.into(), from: m.from.into(), sequence: m.sequence, value: m.value, gas_limit: m.gas_limit, gas_fee_cap: m.gas_fee_cap, gas_premium: m.gas_premium, method_num: m.method_num, params: RawBytes::new( general_purpose::STANDARD .decode(m.params.unwrap_or_default()) .map_err(de::Error::custom)?, ), }) } } pub mod signature_json { use super::{FilecoinSignature, FilecoinSignatureType}; use base64::{engine::general_purpose, Engine as _}; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; // Wrapper for serializing and deserializing a Signature from JSON. #[derive(Deserialize, Serialize)] #[serde(transparent)] pub struct SignatureJson(#[serde(with = "self")] pub FilecoinSignature); /// Wrapper for serializing a Signature reference to JSON. #[derive(Serialize)] #[serde(transparent)] pub struct SignatureJsonRef<'a>(#[serde(with = "self")] pub &'a FilecoinSignature); #[derive(Serialize, Deserialize)] struct JsonHelper { #[serde(rename = "Type")] sig_type: FilecoinSignatureType, #[serde(rename = "Data")] bytes: String, } pub fn serialize(sig: &FilecoinSignature, serializer: S) -> Result where S: Serializer, { JsonHelper { sig_type: sig.sig_type, bytes: general_purpose::STANDARD.encode(&sig.bytes), } .serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { let JsonHelper { sig_type, bytes } = Deserialize::deserialize(deserializer)?; Ok(FilecoinSignature { sig_type, bytes: general_purpose::STANDARD .decode(bytes) .map_err(de::Error::custom)?, }) } pub mod signature_type { use super::*; use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] enum JsonHelperEnum { Bls, Secp256k1, } #[derive(Debug, Serialize, Deserialize)] #[serde(transparent)] pub struct SignatureTypeJson(#[serde(with = "self")] pub FilecoinSignatureType); pub fn serialize( sig_type: &FilecoinSignatureType, serializer: S, ) -> Result where S: Serializer, { let json = match sig_type { FilecoinSignatureType::BLS => JsonHelperEnum::Bls, FilecoinSignatureType::Secp256k1 => JsonHelperEnum::Secp256k1, }; json.serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { let json_enum: JsonHelperEnum = Deserialize::deserialize(deserializer)?; let signature_type = match json_enum { JsonHelperEnum::Bls => FilecoinSignatureType::BLS, JsonHelperEnum::Secp256k1 => FilecoinSignatureType::Secp256k1, }; Ok(signature_type) } } } pub mod cid_json { use cid::Cid; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; /// Wrapper for serializing and de-serializing a Cid from JSON. #[derive(Deserialize, Serialize, Clone, Debug)] #[serde(transparent)] pub struct CidJson(#[serde(with = "self")] pub Cid); /// Wrapper for serializing a CID reference to JSON. #[derive(Serialize)] #[serde(transparent)] pub struct CidJsonRef<'a>(#[serde(with = "self")] pub &'a Cid); impl From for Cid { fn from(wrapper: CidJson) -> Self { wrapper.0 } } pub fn serialize(c: &Cid, serializer: S) -> Result where S: Serializer, { CidMap { cid: c.to_string() }.serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { let CidMap { cid } = Deserialize::deserialize(deserializer)?; cid.parse().map_err(de::Error::custom) } /// Structure just used as a helper to serialize a CID into a map with key "/" #[derive(Serialize, Deserialize)] struct CidMap { #[serde(rename = "/")] cid: String, } pub mod opt { use super::{Cid, CidJson, CidJsonRef}; use serde::{self, Deserialize, Deserializer, Serialize, Serializer}; pub fn serialize(v: &Option, serializer: S) -> Result where S: Serializer, { v.as_ref().map(CidJsonRef).serialize(serializer) } pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> where D: Deserializer<'de>, { let s: Option = Deserialize::deserialize(deserializer)?; Ok(s.map(|v| v.0)) } } } pub mod address_json { use super::FilecoinAddress; use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; use std::borrow::Cow; use std::str::FromStr; /// Wrapper for serializing and de-serializing a `FilecoinAddress` from JSON. #[derive(Deserialize, Serialize)] #[serde(transparent)] pub struct AddressJson(#[serde(with = "self")] pub FilecoinAddress); /// Wrapper for serializing a `FilecoinAddress` reference to JSON. #[derive(Serialize)] #[serde(transparent)] pub struct AddressJsonRef<'a>(#[serde(with = "self")] pub &'a FilecoinAddress); impl From for AddressJson { fn from(addr: FilecoinAddress) -> Self { Self(addr) } } impl From for FilecoinAddress { fn from(addr: AddressJson) -> Self { addr.0 } } pub fn serialize(addr: &FilecoinAddress, serializer: S) -> Result where S: Serializer, { serializer.serialize_str(&addr.to_string()) } pub fn deserialize<'de, D>(deserializer: D) -> Result where D: Deserializer<'de>, { let address_as_string: Cow<'de, str> = Deserialize::deserialize(deserializer)?; FilecoinAddress::from_str(&address_as_string).map_err(de::Error::custom) } } pub mod amount_json { use super::FilecoinAmount; use serde::{Deserialize, Serialize}; use std::str::FromStr; /// Serializes `FilecoinAmount` as String pub fn serialize(amount: &FilecoinAmount, serializer: S) -> Result where S: serde::Serializer, { String::serialize(&amount.to_string(), serializer) } /// De-serializes String into `BigInt`. pub fn deserialize<'de, D>(deserializer: D) -> Result where D: serde::Deserializer<'de>, { let s = String::deserialize(deserializer)?; FilecoinAmount::from_str(&s).map_err(serde::de::Error::custom) } } #[cfg(test)] mod tests { use std::str::FromStr; use anychain_core::Transaction; use fvm_ipld_encoding::RawBytes; use crate::{ FilecoinAddress, FilecoinAmount, FilecoinAmountConverter, FilecoinTransaction, FilecoinTransactionParameters, }; #[test] fn filecoin_transaction_serialization_test() { let params = FilecoinTransactionParameters { version: 0, from: FilecoinAddress::from_str("f1lhjzzj6on64czzsgfw5jxsf7y5uv5qvh7dmpevy").unwrap(), to: FilecoinAddress::from_str("t1meiag3eum5xtxi5tivnw4fjhkrdtaqu4v5t4nly").unwrap(), sequence: 999, value: FilecoinAmount::from_fil("1"), method_num: 0, params: RawBytes::new(vec![]), gas_limit: 500000, gas_fee_cap: FilecoinAmount::from_milli_fil("1"), gas_premium: FilecoinAmount::from_milli_fil("100"), }; let tx = FilecoinTransaction::new(¶ms).unwrap(); let expected = r#"{"Message":{"Version":0,"To":"t1meiag3eum5xtxi5tivnw4fjhkrdtaqu4v5t4nly","From":"f1lhjzzj6on64czzsgfw5jxsf7y5uv5qvh7dmpevy","Nonce":999,"Value":"1000000000000000000","GasLimit":500000,"GasFeeCap":"1000000000000000","GasPremium":"100000000000000000","Method":0,"Params":"","CID":{"/":"bafy2bzacea2dufcc2vhvrt3pzn24t2zmuhnbdmf5kgch6blkxsppukc4rp6bu"}},"Signature":{"Type":1,"Data":""},"CID":{"/":"bafy2bzacebx42rzvvl3v6mio44ileyxwohj2d2i34otmk7wwqsd4rdl4b3bhq"}}"#; // Robust: compare parsed JSON, not raw string formatting. let actual_json: serde_json::Value = serde_json::from_str(&tx.to_string()).unwrap(); let expected_json: serde_json::Value = serde_json::from_str(expected).unwrap(); assert_eq!(actual_json, expected_json); let param_bytes = params.to_bytes(); assert_eq!( &[ 1, 113, 160, 228, 2, 32, 52, 58, 20, 66, 213, 79, 88, 207, 111, 203, 117, 201, 235, 44, 161, 218, 17, 176, 189, 81, 132, 127, 5, 106, 188, 158, 250, 40, 92, 139, 252, 26 ], param_bytes.as_slice() ); } #[test] fn filecoin_transaction_deserialization_test() { let s = r#"{"Message":{"Version":0,"To":"t1meiag3eum5xtxi5tivnw4fjhkrdtaqu4v5t4nly","From":"f1lhjzzj6on64czzsgfw5jxsf7y5uv5qvh7dmpevy","Nonce":999,"Value":"1000000000000000000","GasLimit":500000,"GasFeeCap":"1000000000000000","GasPremium":"100000000000000000","Method":0,"Params":"","CID":{"/":"bafy2bzacea2dufcc2vhvrt3pzn24t2zmuhnbdmf5kgch6blkxsppukc4rp6bu"}},"Signature":{"Type":1,"Data":""},"CID":{"/":"bafy2bzacebx42rzvvl3v6mio44ileyxwohj2d2i34otmk7wwqsd4rdl4b3bhq"}}"#; let tx = FilecoinTransaction::from_bytes(s.as_bytes()).unwrap(); let expected_json: serde_json::Value = serde_json::from_str(s).unwrap(); let actual_json: serde_json::Value = serde_json::from_str(&tx.to_string()).unwrap(); assert_eq!(actual_json, expected_json); // Assert each Message property explicitly assert_eq!(tx.params.version, 0); assert_eq!( tx.params.to.to_string(), "t1meiag3eum5xtxi5tivnw4fjhkrdtaqu4v5t4nly" ); assert_eq!( tx.params.from.to_string(), "f1lhjzzj6on64czzsgfw5jxsf7y5uv5qvh7dmpevy" ); assert_eq!(tx.params.sequence, 999); assert_eq!(tx.params.value.to_string(), "1000000000000000000"); assert_eq!(tx.params.gas_limit, 500000); assert_eq!(tx.params.gas_fee_cap.to_string(), "1000000000000000"); assert_eq!(tx.params.gas_premium.to_string(), "100000000000000000"); assert_eq!(tx.params.method_num, 0); assert!(tx.params.params.bytes().is_empty()); assert_eq!(actual_json["Message"]["Params"].as_str(), Some("")); assert_eq!( actual_json["Message"]["CID"]["/"].as_str(), Some("bafy2bzacea2dufcc2vhvrt3pzn24t2zmuhnbdmf5kgch6blkxsppukc4rp6bu") ); // Optional extra field-level checks (nice for readable test failures) assert_eq!(tx.signature.sig_type as u8, 1); } } ================================================ FILE: crates/anychain-filecoin/src/utilities/crypto.rs ================================================ /// Hash length of payload for addresses of filecoin. pub const PAYLOAD_HASH_LEN: usize = 20; /// Returns a 20-byte address hash for given public key // #[inline] pub fn blake2b_160(input: &[u8]) -> [u8; 20] { let digest = blake2b_simd::Params::new() .hash_length(PAYLOAD_HASH_LEN) .to_state() .update(input) .finalize(); let mut hash = [0u8; 20]; hash.copy_from_slice(digest.as_bytes()); hash } /// Returns a 32-byte hash for given data #[inline] pub fn blake2b_256(ingest: &[u8]) -> [u8; 32] { let digest = blake2b_simd::Params::new() .hash_length(32) .to_state() .update(ingest) .finalize(); let mut hash = [0u8; 32]; hash.clone_from_slice(digest.as_bytes()); hash } /// Length of the checksum hash for string encodings. pub const CHECKSUM_HASH_LEN: usize = 4; /// Checksum calculates the 4 byte checksum hash pub fn blake2b_checksum(ingest: &[u8]) -> Vec { blake2b_simd::Params::new() .hash_length(CHECKSUM_HASH_LEN) .to_state() .update(ingest) .finalize() .as_bytes() .to_vec() } ================================================ FILE: crates/anychain-filecoin/src/utilities/mod.rs ================================================ pub mod crypto; ================================================ FILE: crates/anychain-kms/.gitignore ================================================ target/ .DS_Store/ ================================================ FILE: crates/anychain-kms/Cargo.toml ================================================ [package] name = "anychain-kms" description = "A Rust library providing Key Management Schema for AnyChain. Handles general security and signature algorithms." version = "0.1.23" keywords = ["cryptography", "security", "signature", "algorithm"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] rustc-hash = { workspace = true } rand = { workspace = true } sha2 = { workspace = true } hmac = { workspace = true } bs58 = { workspace = true } pbkdf2 = { workspace = true } unicode-normalization = { workspace = true } anyhow = { workspace = true } thiserror = { workspace = true } zeroize = { workspace = true } once_cell = { workspace = true } subtle = { workspace = true } ripemd = { workspace = true } hex = { workspace = true } libsecp256k1 = { workspace = true } ed25519-dalek = { workspace = true } curve25519-dalek = { workspace = true } group = "0.13.0" encoding = "0.2.33" anychain-core = { version = "0.1.8", path = "../anychain-core" } [dev-dependencies] hex-literal = "0.4" [features] alloc = ["zeroize/alloc"] std = ["alloc"] chinese-simplified = [] chinese-traditional = [] # Note: English is the standard for bip39 so always included french = [] italian = [] japanese = [] korean = [] spanish = [] default = ["std", "chinese-simplified", "chinese-traditional", "french", "italian", "japanese", "korean", "spanish"] [lints] workspace = true ================================================ FILE: crates/anychain-kms/README.md ================================================ # KMS Key Management Schema ## Introduction Rust implementation of BIP32、BIP39 ## Reference * [BIP32 Official Doc](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) * [BIP39 Official Doc](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) * [Elliptic-Curve-Cryptography](https://en.wikipedia.org/wiki/Elliptic-curve_cryptography) ================================================ FILE: crates/anychain-kms/src/bip32/child_number.rs ================================================ //! Child numbers use crate::bip32::{Error, Result}; use core::{ fmt::{self, Display}, str::FromStr, }; /// Index of a particular child key for a given (extended) private key. #[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)] pub struct ChildNumber(pub u32); impl ChildNumber { /// Size of a child number when encoded as bytes. pub const BYTE_SIZE: usize = 4; /// Hardened child keys use indices 2^31 through 2^32-1. pub const HARDENED_FLAG: u32 = 1 << 31; /// Create new [`ChildNumber`] with the given index and hardened flag. /// /// Returns an error if it is equal to or greater than [`Self::HARDENED_FLAG`]. pub fn new(index: u32, hardened: bool) -> Result { if index >= Self::HARDENED_FLAG { Err(Error::ChildNumber) } else if hardened { Ok(Self(index | Self::HARDENED_FLAG)) } else { Ok(Self(index)) } } /// Parse a child number from the byte encoding. pub fn from_bytes(bytes: [u8; Self::BYTE_SIZE]) -> Self { u32::from_be_bytes(bytes).into() } /// Serialize this child number as bytes. pub fn to_bytes(self) -> [u8; Self::BYTE_SIZE] { self.0.to_be_bytes() } /// Get the index number for this [`ChildNumber`], i.e. with /// [`Self::HARDENED_FLAG`] cleared. pub fn index(self) -> u32 { self.0 & !Self::HARDENED_FLAG } /// Is this child number within the hardened range? pub fn is_hardened(&self) -> bool { self.0 & Self::HARDENED_FLAG != 0 } } impl Display for ChildNumber { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.index())?; if self.is_hardened() { f.write_str("\'")?; } Ok(()) } } impl From for ChildNumber { fn from(n: u32) -> ChildNumber { ChildNumber(n) } } impl From for u32 { fn from(n: ChildNumber) -> u32 { n.0 } } impl FromStr for ChildNumber { type Err = Error; fn from_str(child: &str) -> Result { let (child, hardened) = match child.strip_suffix('\'') { Some(c) => (c, true), None => (child, false), }; let index = child.parse().map_err(|_| Error::ChildNumber)?; ChildNumber::new(index, hardened) } } #[cfg(test)] mod tests { use super::ChildNumber; use crate::bip32::Error; #[test] fn parse_non_hardened() { let n = "42".parse::().unwrap(); assert_eq!(n, ChildNumber::new(42, false).unwrap()); assert_eq!(n.index(), 42); assert!(!n.is_hardened()); } #[test] fn parse_hardened() { let n = "42'".parse::().unwrap(); assert_eq!(n, ChildNumber::new(42, true).unwrap()); assert_eq!(n.index(), 42); assert!(n.is_hardened()); } #[test] fn parse_rejects_invalid() { assert_eq!("42!".parse::(), Err(Error::ChildNumber)); } #[test] fn index_overflow() { // Invalid index let index = ChildNumber::HARDENED_FLAG; assert_eq!(ChildNumber::new(index, false), Err(Error::ChildNumber)); assert_eq!(ChildNumber::new(index, true), Err(Error::ChildNumber)); } } ================================================ FILE: crates/anychain-kms/src/bip32/derivation_path.rs ================================================ //! Derivation paths use crate::bip32::{ChildNumber, Error, Result}; use alloc::vec::{self, Vec}; use core::{ fmt::{self, Display}, str::FromStr, }; /// Prefix for all derivation paths. const PREFIX: &str = "m"; /// Derivation paths within a hierarchical keyspace. #[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct DerivationPath { path: Vec, } impl DerivationPath { /// Iterate over the [`ChildNumber`] values in this derivation path. pub fn iter(&self) -> impl Iterator + '_ { self.path.iter().cloned() } /// Is this derivation path empty? (i.e. the root) pub fn is_empty(&self) -> bool { self.path.is_empty() } /// Get the count of [`ChildNumber`] values in this derivation path. pub fn len(&self) -> usize { self.path.len() } /// Get the parent [`DerivationPath`] for the current one. /// /// Returns `None` if this is already the root path. pub fn parent(&self) -> Option { self.path.len().checked_sub(1).map(|n| { let mut parent = self.clone(); parent.path.truncate(n); parent }) } /// Push a [`ChildNumber`] onto an existing derivation path. pub fn push(&mut self, child_number: ChildNumber) { self.path.push(child_number) } } impl AsRef<[ChildNumber]> for DerivationPath { fn as_ref(&self) -> &[ChildNumber] { &self.path } } impl Display for DerivationPath { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(PREFIX)?; for child_number in self.iter() { write!(f, "/{}", child_number)?; } Ok(()) } } impl Extend for DerivationPath { fn extend(&mut self, iter: T) where T: IntoIterator, { self.path.extend(iter); } } impl FromStr for DerivationPath { type Err = Error; fn from_str(path: &str) -> Result { let mut path = path.split('/'); if path.next() != Some(PREFIX) { return Err(Error::Decode); } Ok(DerivationPath { path: path.map(str::parse).collect::>()?, }) } } impl IntoIterator for DerivationPath { type Item = ChildNumber; type IntoIter = vec::IntoIter; fn into_iter(self) -> vec::IntoIter { self.path.into_iter() } } #[cfg(test)] mod tests { use super::DerivationPath; use alloc::string::ToString; /// BIP32 test vectors // TODO(tarcieri): consolidate test vectors #[test] fn round_trip() { let path_m = "m"; assert_eq!( path_m.parse::().unwrap().to_string(), path_m ); let path_m_0 = "m/0"; assert_eq!( path_m_0.parse::().unwrap().to_string(), path_m_0 ); let path_m_0_2147483647h = "m/0/2147483647'"; assert_eq!( path_m_0_2147483647h .parse::() .unwrap() .to_string(), path_m_0_2147483647h ); let path_m_0_2147483647h_1 = "m/0/2147483647'/1"; assert_eq!( path_m_0_2147483647h_1 .parse::() .unwrap() .to_string(), path_m_0_2147483647h_1 ); let path_m_0_2147483647h_1_2147483646h = "m/0/2147483647'/1/2147483646'"; assert_eq!( path_m_0_2147483647h_1_2147483646h .parse::() .unwrap() .to_string(), path_m_0_2147483647h_1_2147483646h ); let path_m_0_2147483647h_1_2147483646h_2 = "m/0/2147483647'/1/2147483646'/2"; assert_eq!( path_m_0_2147483647h_1_2147483646h_2 .parse::() .unwrap() .to_string(), path_m_0_2147483647h_1_2147483646h_2 ); } #[test] fn parent() { let path_m_0_2147483647h = "m/0/2147483647'".parse::().unwrap(); let path_m_0 = path_m_0_2147483647h.parent().unwrap(); assert_eq!("m/0", path_m_0.to_string()); let path_m = path_m_0.parent().unwrap(); assert_eq!("m", path_m.to_string()); assert_eq!(path_m.parent(), None); } } ================================================ FILE: crates/anychain-kms/src/bip32/error.rs ================================================ //! Error type. use core::fmt::{self, Display}; use hmac::digest::InvalidLength; /// Result type. pub type Result = core::result::Result; /// Error type. #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[non_exhaustive] pub enum Error { /// Base58 errors. Base58, /// BIP39-related errors. Bip39, /// Child number-related errors. ChildNumber, /// Cryptographic errors. Crypto, /// Decoding errors (not related to Base58). Decode, /// Maximum derivation depth exceeded. Depth, /// Seed length invalid. SeedLength, } impl Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Error::Base58 => f.write_str("base58 error"), Error::Bip39 => f.write_str("bip39 error"), Error::ChildNumber => f.write_str("invalid child number"), Error::Crypto => f.write_str("cryptographic error"), Error::Decode => f.write_str("decoding error"), Error::Depth => f.write_str("maximum derivation depth exceeded"), Error::SeedLength => f.write_str("seed length invalid"), } } } impl std::error::Error for Error {} impl From for Error { fn from(_: bs58::decode::Error) -> Error { Error::Base58 } } impl From for Error { fn from(_: bs58::encode::Error) -> Error { Error::Base58 } } impl From for Error { fn from(_: core::array::TryFromSliceError) -> Error { Error::Decode } } /* impl From for Error { fn from(_: hmac::crypto_mac::InvalidKeyLength) -> Error { Error::Crypto } } */ impl From for Error { fn from(_: InvalidLength) -> Error { Error::Crypto } } /* impl From for Error { fn from(_: k256::elliptic_curve::Error) -> Error { Error::Crypto } } impl From for Error { fn from(_: k256::ecdsa::Error) -> Error { Error::Crypto } } */ impl From for Error { fn from(_: libsecp256k1::Error) -> Error { Error::Crypto } } ================================================ FILE: crates/anychain-kms/src/bip32/extended_key/attrs.rs ================================================ //! Extended key attributes. use crate::bip32::{ChainCode, ChildNumber, Depth, KeyFingerprint}; /// Extended key attributes: fields common to extended keys including depth, /// fingerprints, child numbers, and chain codes. #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub struct ExtendedKeyAttrs { /// Depth in the key derivation hierarchy. pub depth: Depth, /// Parent fingerprint. pub parent_fingerprint: KeyFingerprint, /// Child number. pub child_number: ChildNumber, /// Chain code. pub chain_code: ChainCode, } ================================================ FILE: crates/anychain-kms/src/bip32/extended_key/extended_private_key.rs ================================================ //! Extended private keys use crate::bip32::{ ChildNumber, Depth, Error, ExtendedKey, ExtendedKeyAttrs, ExtendedPublicKey, HmacSha512, KeyFingerprint, Prefix, PrivateKey, PublicKey, Result, KEY_SIZE, }; use core::{ fmt::{self, Debug}, str::FromStr, }; use curve25519_dalek::scalar::Scalar; use hmac::Mac; use subtle::{Choice, ConstantTimeEq}; use zeroize::Zeroize; use { crate::bip32::DerivationPath, alloc::string::{String, ToString}, zeroize::Zeroizing, }; /// Derivation domain separator for BIP39 keys. const BIP39_DOMAIN_SEPARATOR: [u8; 12] = [ 0x42, 0x69, 0x74, 0x63, 0x6f, 0x69, 0x6e, 0x20, 0x73, 0x65, 0x65, 0x64, ]; /// Extended private secp256k1 signing key. pub type XprvSecp256k1 = ExtendedPrivateKey; /// Extended private ed25519 signing key. pub type XprvEd25519 = ExtendedPrivateKey; /// Extended private keys derived using BIP32. /// /// Generic around a [`PrivateKey`] type. When the `secp256k1` feature of this /// crate is enabled, the [`XprvSecp256k1`] type provides a convenient alias for /// extended ECDSA/secp256k1 private keys. #[derive(Clone)] pub struct ExtendedPrivateKey { /// Derived private key private_key: K, /// Extended key attributes. attrs: ExtendedKeyAttrs, } impl ExtendedPrivateKey where K: PrivateKey, { /// Maximum derivation depth. pub const MAX_DEPTH: Depth = u8::MAX; /// Derive a child key from the given [`DerivationPath`]. pub fn new_from_path(seed: S, path: &DerivationPath) -> Result where S: AsRef<[u8]>, { path.iter().fold(Self::new(seed), |maybe_key, child_num| { maybe_key.and_then(|key| key.derive_child(child_num)) }) } /// Create the root extended key for the given seed value. pub fn new(seed: S) -> Result where S: AsRef<[u8]>, { if ![16, 32, 64, 128].contains(&seed.as_ref().len()) { return Err(Error::SeedLength); } let mut hmac = HmacSha512::new_from_slice(&BIP39_DOMAIN_SEPARATOR)?; hmac.update(seed.as_ref()); let result = hmac.finalize().into_bytes(); let (secret_key, chain_code) = result.split_at(KEY_SIZE); let private_key = PrivateKey::from_bytes(secret_key.to_vec())?; let attrs = ExtendedKeyAttrs { depth: 0, parent_fingerprint: KeyFingerprint::default(), child_number: ChildNumber::default(), chain_code: chain_code.try_into()?, }; Ok(ExtendedPrivateKey { private_key, attrs }) } pub fn derive_from_path(self, path: &DerivationPath) -> Result { path.iter() .try_fold(self, |key, child_num| key.derive_child(child_num)) } /// Derive a child key for a particular [`ChildNumber`]. pub fn derive_child(&self, child_number: ChildNumber) -> Result { let depth = self.attrs.depth.checked_add(1).ok_or(Error::Depth)?; let mut hmac = HmacSha512::new_from_slice(&self.attrs.chain_code).map_err(|_| Error::Crypto)?; if child_number.is_hardened() { hmac.update(&[0]); hmac.update(&self.private_key.to_bytes()); } else { hmac.update(&self.private_key.public_key().to_bytes()); } hmac.update(&child_number.to_bytes()); let result = hmac.finalize().into_bytes(); let (child_key, chain_code) = result.split_at(KEY_SIZE); // We should technically loop here if a `secret_key` is zero or overflows // the order of the underlying elliptic curve group, incrementing the // index, however per "Child key derivation (CKD) functions": // https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions // // > "Note: this has probability lower than 1 in 2^127." // // ...so instead, we simply return an error if this were ever to happen, // as the chances of it happening are vanishingly small. let private_key = self.private_key.derive_child(child_key.to_vec())?; let attrs = ExtendedKeyAttrs { parent_fingerprint: self.private_key.public_key().fingerprint(), child_number, chain_code: chain_code.try_into()?, depth, }; Ok(ExtendedPrivateKey { private_key, attrs }) } /// Borrow the derived private key value. pub fn private_key(&self) -> &K { &self.private_key } /// Serialize the derived public key as bytes. pub fn public_key(&self) -> ExtendedPublicKey { self.into() } /// Get attributes for this key such as depth, parent fingerprint, /// child number, and chain code. pub fn attrs(&self) -> &ExtendedKeyAttrs { &self.attrs } /// Serialize the raw private key as a byte array. pub fn to_bytes(&self) -> Vec { self.private_key.to_bytes() } /// Serialize this key as an [`ExtendedKey`]. pub fn to_extended_key(&self, prefix: Prefix) -> ExtendedKey { // Add leading `0` byte let mut key_bytes = [0u8; KEY_SIZE + 1]; key_bytes[1..].copy_from_slice(&self.to_bytes()); ExtendedKey { prefix, attrs: self.attrs.clone(), key_bytes, } } /// Serialize this key as a self-[`Zeroizing`] `String`. #[cfg(feature = "alloc")] pub fn to_string(&self, prefix: Prefix) -> Zeroizing { Zeroizing::new(self.to_extended_key(prefix).to_string()) } } impl ConstantTimeEq for ExtendedPrivateKey where K: PrivateKey, { fn ct_eq(&self, other: &Self) -> Choice { let mut key_a = self.to_bytes(); let mut key_b = other.to_bytes(); let result = key_a.ct_eq(&key_b) & self.attrs.depth.ct_eq(&other.attrs.depth) & self .attrs .parent_fingerprint .ct_eq(&other.attrs.parent_fingerprint) & self.attrs.child_number.0.ct_eq(&other.attrs.child_number.0) & self.attrs.chain_code.ct_eq(&other.attrs.chain_code); key_a.zeroize(); key_b.zeroize(); result } } impl Debug for ExtendedPrivateKey where K: PrivateKey, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { // TODO(tarcieri): use `finish_non_exhaustive` when stable f.debug_struct("ExtendedPrivateKey") .field("private_key", &"...") .field("attrs", &self.attrs) .finish() } } /// NOTE: uses [`ConstantTimeEq`] internally impl Eq for ExtendedPrivateKey where K: PrivateKey {} /// NOTE: uses [`ConstantTimeEq`] internally impl PartialEq for ExtendedPrivateKey where K: PrivateKey, { fn eq(&self, other: &Self) -> bool { self.ct_eq(other).into() } } impl FromStr for ExtendedPrivateKey where K: PrivateKey, { type Err = Error; fn from_str(xprv: &str) -> Result { ExtendedKey::from_str(xprv)?.try_into() } } impl TryFrom for ExtendedPrivateKey where K: PrivateKey, { type Error = Error; fn try_from(extended_key: ExtendedKey) -> Result> { if extended_key.prefix.is_private() && extended_key.key_bytes[0] == 0 { Ok(ExtendedPrivateKey { private_key: PrivateKey::from_bytes(extended_key.key_bytes[1..].to_vec())?, attrs: extended_key.attrs.clone(), }) } else { Err(Error::Crypto) } } } #[cfg(test)] mod tests { use crate::bip32::{DerivationPath, XprvSecp256k1}; use subtle::ConstantTimeEq; #[test] fn test_constant_time_eq_same() { let seed1 = [0x11u8; 64]; // All 0x11 bytes let seed2 = [0x11u8; 64]; // All 0x11 bytes (SAME!) let path: DerivationPath = "m/44'/60'/0'/0/0".parse().unwrap(); // Derive two completely same private keys let key1 = XprvSecp256k1::new_from_path(seed1, &path).unwrap(); let key2 = XprvSecp256k1::new_from_path(seed2, &path).unwrap(); assert_eq!(key1.to_bytes(), key2.to_bytes(), "Keys should be same!"); assert!(bool::from(key1.ct_eq(&key2))); } #[test] fn test_constant_time_eq_diff() { let seed1 = [0x11u8; 64]; // All 0x11 bytes let seed2 = [0x22u8; 64]; // All 0x22 bytes (DIFFERENT!) let path: DerivationPath = "m/44'/60'/0'/0/0".parse().unwrap(); // Derive two completely different private keys let key1 = XprvSecp256k1::new_from_path(seed1, &path).unwrap(); let key2 = XprvSecp256k1::new_from_path(seed2, &path).unwrap(); assert_ne!( key1.to_bytes(), key2.to_bytes(), "Keys should be different!" ); assert!(!bool::from(key1.ct_eq(&key2))); } } ================================================ FILE: crates/anychain-kms/src/bip32/extended_key/extended_public_key.rs ================================================ //! Extended public keys use crate::bip32::{ ChildNumber, DerivationPath, Error, ExtendedKey, ExtendedKeyAttrs, ExtendedPrivateKey, HmacSha512, KeyFingerprint, Prefix, PrivateKey, PublicKey, Result, KEY_SIZE, }; use core::str::FromStr; use hmac::Mac; #[cfg(feature = "alloc")] use alloc::string::{String, ToString}; /// Extended public secp256k1 ECDSA verifiying key. pub type XpubSecp256k1 = ExtendedPublicKey; /// Extended public ed25519 EDDSA verifiying key. pub type XpubEd25519 = ExtendedPublicKey; /// Extended public keys derived using BIP32. /// /// Generic around a [`PublicKey`] type. When the `secp256k1` feature of this /// crate is enabled, the [`XpubSecp256k1`] type provides a convenient alias for /// extended ECDSA/secp256k1 public keys. #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub struct ExtendedPublicKey { /// Derived public key public_key: K, /// Extended key attributes. attrs: ExtendedKeyAttrs, } impl ExtendedPublicKey where K: PublicKey, { /// Obtain the non-extended public key value `K`. pub fn public_key(&self) -> &K { &self.public_key } /// Get attributes for this key such as depth, parent fingerprint, /// child number, and chain code. pub fn attrs(&self) -> &ExtendedKeyAttrs { &self.attrs } /// Compute a 4-byte key fingerprint for this extended public key. pub fn fingerprint(&self) -> KeyFingerprint { self.public_key().fingerprint() } pub fn derive_from_path(self, path: &DerivationPath) -> Result { path.iter() .try_fold(self, |key, child_num| key.derive_child(child_num)) } /// Derive a child key for a particular [`ChildNumber`]. pub fn derive_child(&self, child_number: ChildNumber) -> Result { if child_number.is_hardened() { // Cannot derive child public keys for hardened `ChildNumber`s return Err(Error::ChildNumber); } let depth = self.attrs.depth.checked_add(1).ok_or(Error::Depth)?; let mut hmac = HmacSha512::new_from_slice(&self.attrs.chain_code).map_err(|_| Error::Crypto)?; hmac.update(&self.public_key.to_bytes()); hmac.update(&child_number.to_bytes()); let result = hmac.finalize().into_bytes(); let (tweak, chain_code) = result.split_at(KEY_SIZE); let public_key = self.public_key.derive_child(tweak.to_vec())?; let attrs = ExtendedKeyAttrs { parent_fingerprint: self.public_key.fingerprint(), child_number, chain_code: chain_code.try_into()?, depth, }; Ok(ExtendedPublicKey { public_key, attrs }) } /// Serialize the raw public key as a byte array (e.g. SEC1-encoded). pub fn to_bytes(&self) -> Vec { self.public_key.to_bytes() } /// Serialize this key as an [`ExtendedKey`]. pub fn to_extended_key(&self, prefix: Prefix) -> ExtendedKey { ExtendedKey { prefix, attrs: self.attrs.clone(), key_bytes: { let mut key_bytes = [0u8; KEY_SIZE + 1]; let bytes = self.to_bytes(); let bytes = match bytes.len() { KEY_SIZE => [vec![0u8], bytes].concat(), _ => bytes, }; key_bytes.copy_from_slice(&bytes); key_bytes }, } } /// Serialize this key as a `String`. #[cfg(feature = "alloc")] pub fn to_string(&self, prefix: Prefix) -> String { self.to_extended_key(prefix).to_string() } } impl From<&ExtendedPrivateKey> for ExtendedPublicKey where K: PrivateKey, { fn from(xprv: &ExtendedPrivateKey) -> ExtendedPublicKey { ExtendedPublicKey { public_key: xprv.private_key().public_key(), attrs: xprv.attrs().clone(), } } } impl FromStr for ExtendedPublicKey where K: PublicKey, { type Err = Error; fn from_str(xpub: &str) -> Result { ExtendedKey::from_str(xpub)?.try_into() } } impl TryFrom for ExtendedPublicKey where K: PublicKey, { type Error = Error; fn try_from(extended_key: ExtendedKey) -> Result> { if extended_key.prefix.is_public() { Ok(ExtendedPublicKey { public_key: PublicKey::from_bytes(extended_key.key_bytes.to_vec())?, attrs: extended_key.attrs.clone(), }) } else { Err(Error::Crypto) } } } ================================================ FILE: crates/anychain-kms/src/bip32/extended_key/mod.rs ================================================ //! Parser for extended key types (i.e. `xprv` and `xpub`) pub(crate) mod attrs; pub(crate) mod extended_private_key; pub(crate) mod extended_public_key; use crate::bip32::{ChildNumber, Error, ExtendedKeyAttrs, Prefix, Result, Version, KEY_SIZE}; use core::{ fmt::{self, Display}, str::{self, FromStr}, }; use zeroize::Zeroize; /// Serialized extended key (e.g. `xprv` and `xpub`). #[derive(Clone)] pub struct ExtendedKey { /// [`Prefix`] (a.k.a. "version") of the key (e.g. `xprv`, `xpub`) pub prefix: Prefix, /// Extended key attributes. pub attrs: ExtendedKeyAttrs, /// Key material (may be public or private). /// /// Includes an extra byte for a public key's SEC1 tag. pub key_bytes: [u8; KEY_SIZE + 1], } impl ExtendedKey { /// Size of an extended key when deserialized into bytes from Base58. pub const BYTE_SIZE: usize = 78; /// Maximum size of a Base58Check-encoded extended key in bytes. /// /// Note that extended keys can also be 111-bytes. pub const MAX_BASE58_SIZE: usize = 112; /// Write a Base58-encoded key to the provided buffer, returning a `&str` /// containing the serialized data. /// /// Note that this type also impls [`Display`] and therefore you can /// obtain an owned string by calling `to_string()`. pub fn write_base58<'a>(&self, buffer: &'a mut [u8; Self::MAX_BASE58_SIZE]) -> Result<&'a str> { let mut bytes = [0u8; Self::BYTE_SIZE]; // with 4-byte checksum bytes[..4].copy_from_slice(&self.prefix.to_bytes()); bytes[4] = self.attrs.depth; bytes[5..9].copy_from_slice(&self.attrs.parent_fingerprint); bytes[9..13].copy_from_slice(&self.attrs.child_number.to_bytes()); bytes[13..45].copy_from_slice(&self.attrs.chain_code); bytes[45..78].copy_from_slice(&self.key_bytes); let base58_len = bs58::encode(&bytes).with_check().into(buffer.as_mut())?; bytes.zeroize(); str::from_utf8(&buffer[..base58_len]).map_err(|_| Error::Base58) } } impl Display for ExtendedKey { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut buf = [0u8; Self::MAX_BASE58_SIZE]; self.write_base58(&mut buf) .map_err(|_| fmt::Error) .and_then(|base58| f.write_str(base58)) } } impl FromStr for ExtendedKey { type Err = Error; fn from_str(base58: &str) -> Result { let mut bytes = [0u8; Self::BYTE_SIZE + 4]; // with 4-byte checksum let decoded_len = bs58::decode(base58).with_check(None).into(&mut bytes)?; if decoded_len != Self::BYTE_SIZE { return Err(Error::Decode); } let prefix = base58.get(..4).ok_or(Error::Decode).and_then(|chars| { Prefix::validate_str(chars)?; let version = Version::from_be_bytes(bytes[..4].try_into()?); Ok(Prefix::from_parts_unchecked(chars, version)) })?; let depth = bytes[4]; let parent_fingerprint = bytes[5..9].try_into()?; let child_number = ChildNumber::from_bytes(bytes[9..13].try_into()?); let chain_code = bytes[13..45].try_into()?; let key_bytes = bytes[45..78].try_into()?; bytes.zeroize(); let attrs = ExtendedKeyAttrs { depth, parent_fingerprint, child_number, chain_code, }; Ok(ExtendedKey { prefix, attrs, key_bytes, }) } } impl Drop for ExtendedKey { fn drop(&mut self) { self.key_bytes.zeroize(); } } // TODO(tarcieri): consolidate test vectors #[cfg(test)] mod tests { use crate::bip32::{DerivationPath, ExtendedKey}; use crate::bip32::{Prefix, XprvSecp256k1}; use alloc::string::ToString; use hex_literal::hex; #[test] fn bip32_test_vector_1_xprv() { let xprv_base58 = "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPP\ qjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi"; let xprv = xprv_base58.parse::().unwrap(); assert_eq!(xprv.prefix.as_str(), "xprv"); assert_eq!(xprv.attrs.depth, 0); assert_eq!(xprv.attrs.parent_fingerprint, [0u8; 4]); assert_eq!(xprv.attrs.child_number.0, 0); assert_eq!( xprv.attrs.chain_code, hex!("873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508") ); assert_eq!( xprv.key_bytes, hex!("00E8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A1494B917C8436B35") ); assert_eq!(&xprv.to_string(), xprv_base58); } #[test] fn bip32_test_vector_1_xpub() { let xpub_base58 = "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhe\ PY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8"; let xpub = xpub_base58.parse::().unwrap(); assert_eq!(xpub.prefix.as_str(), "xpub"); assert_eq!(xpub.attrs.depth, 0); assert_eq!(xpub.attrs.parent_fingerprint, [0u8; 4]); assert_eq!(xpub.attrs.child_number.0, 0); assert_eq!( xpub.attrs.chain_code, hex!("873DFF81C02F525623FD1FE5167EAC3A55A049DE3D314BB42EE227FFED37D508") ); assert_eq!( xpub.key_bytes, hex!("0339A36013301597DAEF41FBE593A02CC513D0B55527EC2DF1050E2E8FF49C85C2") ); assert_eq!(&xpub.to_string(), xpub_base58); } fn debug_extend_key(ek: &ExtendedKey) { println!("prefix:{}", ek.prefix.as_str()); println!("depth:{}", ek.attrs.depth); println!( "parent_fingerprint:{}", hex::encode(ek.attrs.parent_fingerprint) ); println!("child_number:{}", ek.attrs.child_number); println!("chain_code:{}", hex::encode(ek.attrs.chain_code)); println!("key_bytes:{}", hex::encode(ek.key_bytes)); } #[test] fn test_master_xprv() { let xprv_base58 = "xprv9s21ZrQH143K3BMzbzRA1EtW4bTSDzvzPWeyUjjw6DdBGwM3GDNgd7wyAmy8R6KayQHRuTVQG4yvACbv4HLsyc9BPEGzu8GtYFTZTdncGnJ"; let xprv = xprv_base58.parse::().unwrap(); debug_extend_key(&xprv); let xprv_base58_2 = "xprv9s21ZrQH143K4UgTbVuwLxTrB8u488uJxogG9CA7eAEL7hmcPtyG7zT8BtpmvibJQ8q1nxnXRUpQAo1BVa9tbvXery13KY1dSsC5A155c5k"; let xprv2 = xprv_base58_2.parse::().unwrap(); debug_extend_key(&xprv2); } #[test] fn test_xprv() { let _seed = hex::decode("4b381541583be4423346c643850da4b320e46a87ae3d2a4e6da11eba819cd4acba45d239319ac14f863b8d5ab5a0d0c64d2e8a1e7d1457df2e5a3c51c73235be").unwrap(); let seed2 = "4b381541583be4423346c643850da4b320e46a87ae3d2a4e6da11eba819cd4acba45d239319ac14f863b8d5ab5a0d0c64d2e8a1e7d1457df2e5a3c51c73235be".as_bytes(); let path: DerivationPath = "m/44'/60/0'/10001".parse().unwrap(); let xprv = XprvSecp256k1::new_from_path(seed2, &path).unwrap(); println!("xprv: {}", xprv.to_extended_key(Prefix::XPRV)); let xpub = xprv.public_key(); println!("xpub: {}", xpub.to_extended_key(Prefix::XPUB)); println!("{}", hex::encode(xpub.public_key().serialize())); // 040b4fed878e6b0ff6847e2ac9c13b556d161e1344cd270ed6cafac21f0144399d9ef31f267722fdeccba59ffd57ff84a020a2d3b416344c68e840bc7d97e77570 // 0x5a2a8410875e882aee87bf8e5f2e1ede8810617b } #[test] fn test_hex() { let raw = "2b727519fa377f4195aabe4b5047849a3a55d838d15adc773bcc1ad89ed32b59c7d091795f578bdb6a523545edb9d3da514c7e5d3c130087c3b4f17b0ad1dd39"; let bytes = raw.as_bytes(); let str = String::from_utf8(bytes.to_vec()).unwrap(); println!("{}", str.len()); } } ================================================ FILE: crates/anychain-kms/src/bip32/mod.rs ================================================ mod child_number; mod derivation_path; mod error; mod extended_key; mod prefix; mod private_key; mod public_key; pub use child_number::ChildNumber; pub use error::{Error, Result}; pub use extended_key::{ attrs::ExtendedKeyAttrs, extended_private_key::ExtendedPrivateKey, extended_public_key::ExtendedPublicKey, ExtendedKey, }; pub use extended_key::{ extended_private_key::{XprvEd25519, XprvSecp256k1}, extended_public_key::{XpubEd25519, XpubSecp256k1}, }; pub use prefix::Prefix; pub use private_key::PrivateKey; pub use public_key::PublicKey; pub use derivation_path::DerivationPath; /// Chain code: extension for both private and public keys which provides an /// additional 256-bits of entropy. pub type ChainCode = [u8; KEY_SIZE]; /// Derivation depth. pub type Depth = u8; /// BIP32 key fingerprints. pub type KeyFingerprint = [u8; 4]; /// BIP32 "versions": integer representation of the key prefix. pub type Version = u32; /// HMAC with SHA-512 pub type HmacSha512 = hmac::Hmac; pub const KEY_SIZE: usize = 32; #[cfg(test)] mod test_mod { use super::*; pub(crate) struct TestVector { pub seed: &'static str, pub ckd: [(&'static str, &'static str, &'static str); 6], } // bip32 standard test vectors const VECTORS :[TestVector;1] = [ TestVector{ seed: "000102030405060708090a0b0c0d0e0f", ckd: [ ( "m", "xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi", "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8" ), ( "m/0'", "xprv9uHRZZhk6KAJC1avXpDAp4MDc3sQKNxDiPvvkX8Br5ngLNv1TxvUxt4cV1rGL5hj6KCesnDYUhd7oWgT11eZG7XnxHrnYeSvkzY7d2bhkJ7", "xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw" ), ( "m/0'/1", "xprv9wTYmMFdV23N2TdNG573QoEsfRrWKQgWeibmLntzniatZvR9BmLnvSxqu53Kw1UmYPxLgboyZQaXwTCg8MSY3H2EU4pWcQDnRnrVA1xe8fs", "xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKkNAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ" ), ( "m/0'/1/2'", "xprv9z4pot5VBttmtdRTWfWQmoH1taj2axGVzFqSb8C9xaxKymcFzXBDptWmT7FwuEzG3ryjH4ktypQSAewRiNMjANTtpgP4mLTj34bhnZX7UiM", "xpub6D4BDPcP2GT577Vvch3R8wDkScZWzQzMMUm3PWbmWvVJrZwQY4VUNgqFJPMM3No2dFDFGTsxxpG5uJh7n7epu4trkrX7x7DogT5Uv6fcLW5" ), ( "m/0'/1/2'/2", "xprvA2JDeKCSNNZky6uBCviVfJSKyQ1mDYahRjijr5idH2WwLsEd4Hsb2Tyh8RfQMuPh7f7RtyzTtdrbdqqsunu5Mm3wDvUAKRHSC34sJ7in334", "xpub6FHa3pjLCk84BayeJxFW2SP4XRrFd1JYnxeLeU8EqN3vDfZmbqBqaGJAyiLjTAwm6ZLRQUMv1ZACTj37sR62cfN7fe5JnJ7dh8zL4fiyLHV" ), ( "m/0'/1/2'/2/1000000000", "xprvA41z7zogVVwxVSgdKUHDy1SKmdb533PjDz7J6N6mV6uS3ze1ai8FHa8kmHScGpWmj4WggLyQjgPie1rFSruoUihUZREPSL39UNdE3BBDu76", "xpub6H1LXWLaKsWFhvm6RVpEL9P4KfRZSW7abD2ttkWP3SSQvnyA8FSVqNTEcYFgJS2UaFcxupHiYkro49S8yGasTvXEYBVPamhGW6cFJodrTHy" ) ] } ]; #[test] pub fn test_vectors() { VECTORS.iter().for_each(|vector| { let seed = hex::decode(vector.seed).unwrap(); vector.ckd.iter().for_each(|item| { let path: DerivationPath = item.0.parse().unwrap(); let xprv = XprvSecp256k1::new_from_path(seed.clone(), &path).unwrap(); let xpub = xprv.public_key(); assert_eq!(item.1, xprv.to_string(Prefix::XPRV).as_str()); assert_eq!(item.2, xpub.to_string(Prefix::XPUB).as_str()); }) }) } } ================================================ FILE: crates/anychain-kms/src/bip32/prefix.rs ================================================ //! Extended key prefixes. use crate::bip32::{Error, ExtendedKey, Result, Version}; use core::{ fmt::{self, Debug, Display}, str, }; /// Constant panicking assertion. // TODO(tarcieri): use const panic when stable. // See: https://github.com/rust-lang/rust/issues/51999 macro_rules! const_assert { ($bool:expr, $msg:expr) => { [$msg][!$bool as usize] }; } /// BIP32 extended key prefixes a.k.a. "versions" (e.g. `xpub`, `xprv`) /// /// The BIP32 spec describes these as "versions" and gives examples for /// `xprv`/`xpub` (mainnet) and `tprv`/`tpub` (testnet), however in practice /// there are many more used (e.g. `ypub`, `zpub`). #[derive(Copy, Clone, Eq, PartialEq, PartialOrd, Ord)] #[non_exhaustive] pub struct Prefix { /// ASCII characters representing the prefix. chars: [u8; Self::LENGTH], /// Prefix after Base58 decoding, interpreted as a big endian integer. version: Version, } impl Prefix { /// Length of a prefix in ASCII characters. pub const LENGTH: usize = 4; /// `tprv` prefix pub const TPRV: Self = Self::from_parts_unchecked("tprv", 0x04358394); /// `tpub` prefix pub const TPUB: Self = Self::from_parts_unchecked("tpub", 0x043587cf); /// `xprv` prefix pub const XPRV: Self = Self::from_parts_unchecked("xprv", 0x0488ade4); /// `xpub` prefix pub const XPUB: Self = Self::from_parts_unchecked("xpub", 0x0488b21e); /// `yprv` prefix pub const YPRV: Self = Self::from_parts_unchecked("yprv", 0x049d7878); /// `ypub` prefix pub const YPUB: Self = Self::from_parts_unchecked("ypub", 0x049d7cb2); /// `zprv` prefix pub const ZPRV: Self = Self::from_parts_unchecked("zprv", 0x04b2430c); /// `zpub` prefix pub const ZPUB: Self = Self::from_parts_unchecked("zpub", 0x04b24746); /// Create a new prefix from the given 4-character string and version number. /// The main intended use case for this function is [`Prefix`] constants /// such as [`Prefix::XPRV`]. /// /// Use this function with care: No consistency check is performed! It is /// up to the caller to ensure that the version number matches the prefix. /// /// Panics if `s` is not 4 chars long, or any of the chars lie outside of /// the supported range: lower case (`a..=z`) or upper case (`A..=Z`) /// letters. pub const fn from_parts_unchecked(s: &str, version: Version) -> Self { // TODO(tarcieri): return `Result` when const panic is stable const_assert!(Self::validate_str(s).is_ok(), "invalid prefix"); let bytes = s.as_bytes(); let chars = [bytes[0], bytes[1], bytes[2], bytes[3]]; Self { chars, version } } /// Create a new prefix from the given encoded bytes. /// /// These bytes represent the big endian serialization of a [`Version`] integer. pub fn from_bytes(bytes: [u8; Self::LENGTH]) -> Result { Self::from_version(Version::from_be_bytes(bytes)) } /// Parse a [`Prefix`] from a 32-bit integer "version", e.g.: /// /// - 0x0488B21E => `xpub` /// - 0x0488ADE4 => `xprv` fn from_version(version: Version) -> Result { let mut bytes = [0u8; ExtendedKey::BYTE_SIZE]; bytes[..4].copy_from_slice(&version.to_be_bytes()); let mut buffer = [0u8; ExtendedKey::MAX_BASE58_SIZE]; bs58::encode(&bytes).with_check().into(buffer.as_mut())?; let s = str::from_utf8(&buffer[..4]).map_err(|_| Error::Base58)?; Self::validate_str(s)?; Ok(Self::from_parts_unchecked(s, version)) } /// Get the prefix as a string. pub fn as_str(&self) -> &str { str::from_utf8(&self.chars).expect("prefix encoding error") } /// Is this a public key? pub fn is_public(self) -> bool { &self.chars[1..] == b"pub" } /// Is this a private key? pub fn is_private(self) -> bool { &self.chars[1..] == b"prv" } /// Get the [`Version`] number. pub fn version(self) -> Version { self.version } /// Serialize the [`Version`] number as big-endian bytes. pub fn to_bytes(self) -> [u8; Self::LENGTH] { self.version.to_be_bytes() } /// Validate that the given prefix string is well-formed. // TODO(tarcieri): validate the string ends with `prv` or `pub`? pub(crate) const fn validate_str(s: &str) -> Result<&str> { if s.len() != Self::LENGTH { return Err(Error::Decode); } let mut i = 0; while i < Self::LENGTH { if s.as_bytes()[i].is_ascii_alphabetic() { i += 1; } else { return Err(Error::Decode); } } Ok(s) } } impl AsRef for Prefix { fn as_ref(&self) -> &str { self.as_str() } } impl Debug for Prefix { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Prefix") .field("chars", &self.as_str()) .field("version", &DebugVersion(self.version)) .finish() } } impl Display for Prefix { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.as_str()) } } impl From for Version { fn from(prefix: Prefix) -> Version { prefix.version() } } impl From<&Prefix> for Version { fn from(prefix: &Prefix) -> Version { prefix.version() } } impl TryFrom for Prefix { type Error = Error; fn try_from(version: Version) -> Result { Self::from_version(version) } } impl TryFrom<&[u8]> for Prefix { type Error = Error; fn try_from(bytes: &[u8]) -> Result { Self::from_bytes(bytes.try_into()?) } } /// Debugging formatting helper for [`Version`] with a `Debug` impl that /// outputs hexadecimal instead of base 10. struct DebugVersion(Version); impl Debug for DebugVersion { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:#010x}", self.0) } } #[cfg(test)] mod tests { use super::Prefix; #[test] fn constants() { assert_eq!(Prefix::TPRV, Prefix::try_from(0x04358394).unwrap()); assert_eq!(Prefix::TPRV.as_str(), "tprv"); assert_eq!(Prefix::TPUB, Prefix::try_from(0x043587CF).unwrap()); assert_eq!(Prefix::TPUB.as_str(), "tpub"); assert_eq!(Prefix::XPRV, Prefix::try_from(0x0488ADE4).unwrap()); assert_eq!(Prefix::XPRV.as_str(), "xprv"); assert_eq!(Prefix::XPUB, Prefix::try_from(0x0488B21E).unwrap()); assert_eq!(Prefix::XPUB.as_str(), "xpub"); assert_eq!(Prefix::YPRV, Prefix::try_from(0x049d7878).unwrap()); assert_eq!(Prefix::YPRV.as_str(), "yprv"); assert_eq!(Prefix::YPUB, Prefix::try_from(0x049d7cb2).unwrap()); assert_eq!(Prefix::YPUB.as_str(), "ypub"); assert_eq!(Prefix::ZPRV, Prefix::try_from(0x04b2430c).unwrap()); assert_eq!(Prefix::ZPRV.as_str(), "zprv"); assert_eq!(Prefix::ZPUB, Prefix::try_from(0x04b24746).unwrap()); assert_eq!(Prefix::ZPUB.as_str(), "zpub"); } } ================================================ FILE: crates/anychain-kms/src/bip32/private_key.rs ================================================ //! Trait for deriving child keys on a given type. use crate::bip32::{Error, PublicKey, Result, XprvEd25519, XprvSecp256k1}; use curve25519_dalek::{constants::ED25519_BASEPOINT_TABLE as G, scalar::Scalar}; use group::GroupEncoding; /// Trait for key types which can be derived using BIP32. pub trait PrivateKey: Sized { /// Public key type which corresponds to this private key. type PublicKey: PublicKey; /// Initialize this key from bytes. fn from_bytes(bytes: Vec) -> Result; /// Serialize this key as bytes. fn to_bytes(&self) -> Vec; /// Derive a child key from a parent key with provided tweak value, /// i.e. where `other` is referred to as "I sub L" in BIP32 and sourced /// from the left half of the HMAC-SHA-512 output. fn derive_child(&self, tweak: Vec) -> Result; /// Get the [`Self::PublicKey`] that corresponds to this private key. fn public_key(&self) -> Self::PublicKey; } impl PrivateKey for libsecp256k1::SecretKey { type PublicKey = libsecp256k1::PublicKey; fn from_bytes(bytes: Vec) -> Result { match libsecp256k1::SecretKey::parse_slice(&bytes) { Ok(sk) => Ok(sk), Err(_) => Err(Error::Crypto), } } fn to_bytes(&self) -> Vec { libsecp256k1::SecretKey::serialize(self).to_vec() } fn derive_child(&self, tweak: Vec) -> Result { let mut cpk = *self; match cpk.tweak_add_assign(&libsecp256k1::SecretKey::parse_slice(&tweak).unwrap()) { Ok(_) => Ok(cpk), Err(_) => Err(Error::Crypto), } } fn public_key(&self) -> Self::PublicKey { libsecp256k1::PublicKey::from_secret_key(self) } } impl From for libsecp256k1::SecretKey { fn from(xprv: XprvSecp256k1) -> libsecp256k1::SecretKey { libsecp256k1::SecretKey::from(&xprv) } } impl From<&XprvSecp256k1> for libsecp256k1::SecretKey { fn from(xprv: &XprvSecp256k1) -> libsecp256k1::SecretKey { *xprv.private_key() } } impl PrivateKey for Scalar { type PublicKey = ed25519_dalek::VerifyingKey; fn from_bytes(bytes: Vec) -> Result { let mut sk = [0u8; 32]; sk.copy_from_slice(&bytes); Ok(Scalar::from_bytes_mod_order(sk)) } fn to_bytes(&self) -> Vec { self.to_bytes().to_vec() } fn derive_child(&self, tweak: Vec) -> Result { let mut _tweak = [0u8; 32]; _tweak.copy_from_slice(&tweak); let tweak = Scalar::from_bytes_mod_order(_tweak); Ok(self + tweak) } fn public_key(&self) -> Self::PublicKey { let pk = (G * self).to_bytes(); ed25519_dalek::VerifyingKey::from_bytes(&pk).unwrap() } } impl From for Scalar { fn from(xprv: XprvEd25519) -> Scalar { Scalar::from(&xprv) } } impl From<&XprvEd25519> for Scalar { fn from(xprv: &XprvEd25519) -> Scalar { *xprv.private_key() } } #[cfg(test)] mod tests { use super::{XprvEd25519, XprvSecp256k1}; use hex_literal::hex; #[test] fn test_secp256k1_derivation() { let seed = hex!( "fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a2 9f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542" ); let path = "m/0/2147483647'/1/2147483646'/2"; let xprv = XprvSecp256k1::new_from_path(seed, &path.parse().unwrap()).unwrap(); assert_eq!( xprv, "xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j".parse().unwrap() ); } #[test] fn test_ed25519_derivation() { let seed = hex!( "fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a2 9f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542" ); let path = "m/0/2147483647'/1/2147483646'/2"; let xprv = XprvEd25519::new_from_path(seed, &path.parse().unwrap()).unwrap(); assert_eq!( xprv, "xprvA3jRL3NoAajWVMc6JWKPgQrxx5Xt6VVpgj8y6FMcBbseE4DkZEP8cfVqJQtQvyCqZpb39KZE5r7UUGwunJg9m3wksLj5x94cJv4ahGMarGU".parse().unwrap() ); } } ================================================ FILE: crates/anychain-kms/src/bip32/public_key.rs ================================================ //! Trait for deriving child keys on a given type. use crate::bip32::{KeyFingerprint, Result}; use curve25519_dalek::{ constants::ED25519_BASEPOINT_TABLE as G, edwards::EdwardsPoint, scalar::Scalar, }; use group::GroupEncoding; use ripemd::Ripemd160; use sha2::{Digest, Sha256}; use crate::bip32::Error; /// Trait for key types which can be derived using BIP32. pub trait PublicKey: Sized { /// Initialize this key from bytes. fn from_bytes(bytes: Vec) -> Result; /// Serialize this key as bytes. fn to_bytes(&self) -> Vec; /// Derive a child key from a parent key and a provided tweak value. fn derive_child(&self, tweak: Vec) -> Result; /// Compute a 4-byte key fingerprint for this public key. /// /// Default implementation uses `RIPEMD160(SHA256(public_key))`. fn fingerprint(&self) -> KeyFingerprint { let digest = Ripemd160::digest(Sha256::digest(self.to_bytes())); digest[..4].try_into().expect("digest truncated") } } impl PublicKey for libsecp256k1::PublicKey { fn from_bytes(bytes: Vec) -> Result { match libsecp256k1::PublicKey::parse_slice(&bytes, None) { Ok(pubkey) => Ok(pubkey), Err(_) => Err(Error::Crypto), } } fn to_bytes(&self) -> Vec { libsecp256k1::PublicKey::serialize_compressed(self).to_vec() } fn derive_child(&self, tweak: Vec) -> Result { let mut cpk = *self; match cpk.tweak_add_assign(&libsecp256k1::SecretKey::parse_slice(&tweak).unwrap()) { Ok(_) => Ok(cpk), Err(_) => Err(Error::Crypto), } } } impl PublicKey for ed25519_dalek::VerifyingKey { fn from_bytes(bytes: Vec) -> Result { if bytes.len() == 32 { let arr: [u8; 32] = bytes.try_into().unwrap(); Ok(ed25519_dalek::VerifyingKey::from_bytes(&arr) .or(Err(crate::bip32::Error::Crypto))?) } else if bytes.len() == 33 { let arr: [u8; 32] = bytes[1..].try_into().unwrap(); Ok(ed25519_dalek::VerifyingKey::from_bytes(&arr) .or(Err(crate::bip32::Error::Crypto))?) } else { Err(crate::bip32::Error::Crypto) } } fn to_bytes(&self) -> Vec { self.as_bytes().to_vec() } fn derive_child(&self, tweak: Vec) -> Result { let pk = self.as_bytes(); let mut _tweak = [0u8; 32]; _tweak.copy_from_slice(&tweak); let point = EdwardsPoint::from_bytes(pk).unwrap(); let tweak = &Scalar::from_bytes_mod_order(_tweak) * G; let child = point + tweak; let child = child.to_bytes(); Ok(ed25519_dalek::VerifyingKey::from_bytes(&child).unwrap()) } } #[cfg(test)] mod tests { use std::str::FromStr; use hex_literal::hex; use crate::bip32::{extended_key::extended_public_key::XpubEd25519, DerivationPath}; const SEED: [u8; 64] = hex!( "fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a2 9f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542" ); type XprvSecp256k1 = crate::bip32::ExtendedPrivateKey; #[test] fn secp256k1_xprv_derivation() { let path = "m/0/2147483647'/1/2147483646'/2"; let xprv = XprvSecp256k1::new_from_path(SEED, &path.parse().unwrap()).unwrap(); assert_eq!( xprv.public_key(), "xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt".parse().unwrap() ); } #[test] fn secp256k1_ffi_xpub_derivation() { let path = "m/0/2147483647'/1/2147483646'"; let xprv = XprvSecp256k1::new_from_path(SEED, &path.parse().unwrap()).unwrap(); let xpub = xprv.public_key().derive_child(2.into()).unwrap(); assert_eq!( xpub, "xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6EEgAtqt".parse().unwrap() ); } #[test] fn test_ed25519() { let xpub = "xpub661MyMwAqRbcGGrNUSVKfdjbzSrBSeah6YPb99PhpDyQRiYLKtC4RaASsF1k5xEW6u2tZZ1nb3A335ZbtNh9UJtwrNorMhmumn2X3r3dEn2"; let xpub = XpubEd25519::from_str(xpub).unwrap(); let path = DerivationPath::from_str("m/1/2/3").unwrap(); let child = xpub.derive_from_path(&path).unwrap(); let child = child.public_key().as_bytes(); println!("{:?}", child); } } ================================================ FILE: crates/anychain-kms/src/bip39/crypto.rs ================================================ //! These are internal helper functions used when creating a new [`Mnemonic`][Mnemonic], and when turning a [`Mnemonic`][Mnemonic] //! into a [`Seed`][Seed]. //! //! [Mnemonic]: ../mnemonic/struct.Mnemonic.html //! [Seed]: ../seed/struct.Seed.html //! extern crate rand; use self::rand::{thread_rng, RngCore}; use hmac::Hmac; use sha2::Digest; const PBKDF2_ROUNDS: u32 = 2048; const PBKDF2_BYTES: usize = 64; /// SHA256 helper function, internal to the crate /// pub(crate) fn sha256_first_byte(input: &[u8]) -> u8 { sha2::Sha256::digest(input)[0] } /// Random byte generator, used to create new mnemonics /// pub(crate) fn gen_random_bytes(byte_length: usize) -> Vec { let mut rng = thread_rng(); let mut bytes = vec![0u8; byte_length]; rng.fill_bytes(&mut bytes); bytes } /// PBKDF2 helper, used to generate [`Seed`][Seed] from [`Mnemonic`][Mnemonic] /// /// [Mnemonic]: ../mnemonic/struct.Mnemonic.html /// [Seed]: ../seed/struct.Seed.html /// pub(crate) fn pbkdf2(input: &[u8], salt: &str) -> Vec { let mut seed = vec![0u8; PBKDF2_BYTES]; let _ = pbkdf2::pbkdf2::>(input, salt.as_bytes(), PBKDF2_ROUNDS, &mut seed); seed } ================================================ FILE: crates/anychain-kms/src/bip39/error.rs ================================================ use super::MnemonicType; use thiserror::Error; #[derive(Debug, Error)] pub enum ErrorKind { #[error("invalid checksum")] InvalidChecksum, #[error("invalid word in phrase")] InvalidWord, #[error("invalid keysize: {0}")] InvalidKeysize(usize), #[error("invalid number of words in phrase: {0}")] InvalidWordLength(usize), #[error("invalid entropy length {0}bits for mnemonic type {1:?}")] InvalidEntropyLength(usize, MnemonicType), } #[cfg(test)] mod test { use super::*; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn prints_correctly() { assert_eq!( format!("{}", ErrorKind::InvalidChecksum), "invalid checksum", ); assert_eq!( format!("{}", ErrorKind::InvalidKeysize(42)), "invalid keysize: 42", ); assert_eq!( format!( "{}", ErrorKind::InvalidEntropyLength(42, MnemonicType::Words12) ), "invalid entropy length 42bits for mnemonic type Words12", ); } } ================================================ FILE: crates/anychain-kms/src/bip39/langs/chinese_simplified.txt ================================================ 的 一 是 在 不 了 有 和 人 这 中 大 为 上 个 国 我 以 要 他 时 来 用 们 生 到 作 地 于 出 就 分 对 成 会 可 主 发 年 动 同 工 也 能 下 过 子 说 产 种 面 而 方 后 多 定 行 学 法 所 民 得 经 十 三 之 进 着 等 部 度 家 电 力 里 如 水 化 高 自 二 理 起 小 物 现 实 加 量 都 两 体 制 机 当 使 点 从 业 本 去 把 性 好 应 开 它 合 还 因 由 其 些 然 前 外 天 政 四 日 那 社 义 事 平 形 相 全 表 间 样 与 关 各 重 新 线 内 数 正 心 反 你 明 看 原 又 么 利 比 或 但 质 气 第 向 道 命 此 变 条 只 没 结 解 问 意 建 月 公 无 系 军 很 情 者 最 立 代 想 已 通 并 提 直 题 党 程 展 五 果 料 象 员 革 位 入 常 文 总 次 品 式 活 设 及 管 特 件 长 求 老 头 基 资 边 流 路 级 少 图 山 统 接 知 较 将 组 见 计 别 她 手 角 期 根 论 运 农 指 几 九 区 强 放 决 西 被 干 做 必 战 先 回 则 任 取 据 处 队 南 给 色 光 门 即 保 治 北 造 百 规 热 领 七 海 口 东 导 器 压 志 世 金 增 争 济 阶 油 思 术 极 交 受 联 什 认 六 共 权 收 证 改 清 美 再 采 转 更 单 风 切 打 白 教 速 花 带 安 场 身 车 例 真 务 具 万 每 目 至 达 走 积 示 议 声 报 斗 完 类 八 离 华 名 确 才 科 张 信 马 节 话 米 整 空 元 况 今 集 温 传 土 许 步 群 广 石 记 需 段 研 界 拉 林 律 叫 且 究 观 越 织 装 影 算 低 持 音 众 书 布 复 容 儿 须 际 商 非 验 连 断 深 难 近 矿 千 周 委 素 技 备 半 办 青 省 列 习 响 约 支 般 史 感 劳 便 团 往 酸 历 市 克 何 除 消 构 府 称 太 准 精 值 号 率 族 维 划 选 标 写 存 候 毛 亲 快 效 斯 院 查 江 型 眼 王 按 格 养 易 置 派 层 片 始 却 专 状 育 厂 京 识 适 属 圆 包 火 住 调 满 县 局 照 参 红 细 引 听 该 铁 价 严 首 底 液 官 德 随 病 苏 失 尔 死 讲 配 女 黄 推 显 谈 罪 神 艺 呢 席 含 企 望 密 批 营 项 防 举 球 英 氧 势 告 李 台 落 木 帮 轮 破 亚 师 围 注 远 字 材 排 供 河 态 封 另 施 减 树 溶 怎 止 案 言 士 均 武 固 叶 鱼 波 视 仅 费 紧 爱 左 章 早 朝 害 续 轻 服 试 食 充 兵 源 判 护 司 足 某 练 差 致 板 田 降 黑 犯 负 击 范 继 兴 似 余 坚 曲 输 修 故 城 夫 够 送 笔 船 占 右 财 吃 富 春 职 觉 汉 画 功 巴 跟 虽 杂 飞 检 吸 助 升 阳 互 初 创 抗 考 投 坏 策 古 径 换 未 跑 留 钢 曾 端 责 站 简 述 钱 副 尽 帝 射 草 冲 承 独 令 限 阿 宣 环 双 请 超 微 让 控 州 良 轴 找 否 纪 益 依 优 顶 础 载 倒 房 突 坐 粉 敌 略 客 袁 冷 胜 绝 析 块 剂 测 丝 协 诉 念 陈 仍 罗 盐 友 洋 错 苦 夜 刑 移 频 逐 靠 混 母 短 皮 终 聚 汽 村 云 哪 既 距 卫 停 烈 央 察 烧 迅 境 若 印 洲 刻 括 激 孔 搞 甚 室 待 核 校 散 侵 吧 甲 游 久 菜 味 旧 模 湖 货 损 预 阻 毫 普 稳 乙 妈 植 息 扩 银 语 挥 酒 守 拿 序 纸 医 缺 雨 吗 针 刘 啊 急 唱 误 训 愿 审 附 获 茶 鲜 粮 斤 孩 脱 硫 肥 善 龙 演 父 渐 血 欢 械 掌 歌 沙 刚 攻 谓 盾 讨 晚 粒 乱 燃 矛 乎 杀 药 宁 鲁 贵 钟 煤 读 班 伯 香 介 迫 句 丰 培 握 兰 担 弦 蛋 沉 假 穿 执 答 乐 谁 顺 烟 缩 征 脸 喜 松 脚 困 异 免 背 星 福 买 染 井 概 慢 怕 磁 倍 祖 皇 促 静 补 评 翻 肉 践 尼 衣 宽 扬 棉 希 伤 操 垂 秋 宜 氢 套 督 振 架 亮 末 宪 庆 编 牛 触 映 雷 销 诗 座 居 抓 裂 胞 呼 娘 景 威 绿 晶 厚 盟 衡 鸡 孙 延 危 胶 屋 乡 临 陆 顾 掉 呀 灯 岁 措 束 耐 剧 玉 赵 跳 哥 季 课 凯 胡 额 款 绍 卷 齐 伟 蒸 殖 永 宗 苗 川 炉 岩 弱 零 杨 奏 沿 露 杆 探 滑 镇 饭 浓 航 怀 赶 库 夺 伊 灵 税 途 灭 赛 归 召 鼓 播 盘 裁 险 康 唯 录 菌 纯 借 糖 盖 横 符 私 努 堂 域 枪 润 幅 哈 竟 熟 虫 泽 脑 壤 碳 欧 遍 侧 寨 敢 彻 虑 斜 薄 庭 纳 弹 饲 伸 折 麦 湿 暗 荷 瓦 塞 床 筑 恶 户 访 塔 奇 透 梁 刀 旋 迹 卡 氯 遇 份 毒 泥 退 洗 摆 灰 彩 卖 耗 夏 择 忙 铜 献 硬 予 繁 圈 雪 函 亦 抽 篇 阵 阴 丁 尺 追 堆 雄 迎 泛 爸 楼 避 谋 吨 野 猪 旗 累 偏 典 馆 索 秦 脂 潮 爷 豆 忽 托 惊 塑 遗 愈 朱 替 纤 粗 倾 尚 痛 楚 谢 奋 购 磨 君 池 旁 碎 骨 监 捕 弟 暴 割 贯 殊 释 词 亡 壁 顿 宝 午 尘 闻 揭 炮 残 冬 桥 妇 警 综 招 吴 付 浮 遭 徐 您 摇 谷 赞 箱 隔 订 男 吹 园 纷 唐 败 宋 玻 巨 耕 坦 荣 闭 湾 键 凡 驻 锅 救 恩 剥 凝 碱 齿 截 炼 麻 纺 禁 废 盛 版 缓 净 睛 昌 婚 涉 筒 嘴 插 岸 朗 庄 街 藏 姑 贸 腐 奴 啦 惯 乘 伙 恢 匀 纱 扎 辩 耳 彪 臣 亿 璃 抵 脉 秀 萨 俄 网 舞 店 喷 纵 寸 汗 挂 洪 贺 闪 柬 爆 烯 津 稻 墙 软 勇 像 滚 厘 蒙 芳 肯 坡 柱 荡 腿 仪 旅 尾 轧 冰 贡 登 黎 削 钻 勒 逃 障 氨 郭 峰 币 港 伏 轨 亩 毕 擦 莫 刺 浪 秘 援 株 健 售 股 岛 甘 泡 睡 童 铸 汤 阀 休 汇 舍 牧 绕 炸 哲 磷 绩 朋 淡 尖 启 陷 柴 呈 徒 颜 泪 稍 忘 泵 蓝 拖 洞 授 镜 辛 壮 锋 贫 虚 弯 摩 泰 幼 廷 尊 窗 纲 弄 隶 疑 氏 宫 姐 震 瑞 怪 尤 琴 循 描 膜 违 夹 腰 缘 珠 穷 森 枝 竹 沟 催 绳 忆 邦 剩 幸 浆 栏 拥 牙 贮 礼 滤 钠 纹 罢 拍 咱 喊 袖 埃 勤 罚 焦 潜 伍 墨 欲 缝 姓 刊 饱 仿 奖 铝 鬼 丽 跨 默 挖 链 扫 喝 袋 炭 污 幕 诸 弧 励 梅 奶 洁 灾 舟 鉴 苯 讼 抱 毁 懂 寒 智 埔 寄 届 跃 渡 挑 丹 艰 贝 碰 拔 爹 戴 码 梦 芽 熔 赤 渔 哭 敬 颗 奔 铅 仲 虎 稀 妹 乏 珍 申 桌 遵 允 隆 螺 仓 魏 锐 晓 氮 兼 隐 碍 赫 拨 忠 肃 缸 牵 抢 博 巧 壳 兄 杜 讯 诚 碧 祥 柯 页 巡 矩 悲 灌 龄 伦 票 寻 桂 铺 圣 恐 恰 郑 趣 抬 荒 腾 贴 柔 滴 猛 阔 辆 妻 填 撤 储 签 闹 扰 紫 砂 递 戏 吊 陶 伐 喂 疗 瓶 婆 抚 臂 摸 忍 虾 蜡 邻 胸 巩 挤 偶 弃 槽 劲 乳 邓 吉 仁 烂 砖 租 乌 舰 伴 瓜 浅 丙 暂 燥 橡 柳 迷 暖 牌 秧 胆 详 簧 踏 瓷 谱 呆 宾 糊 洛 辉 愤 竞 隙 怒 粘 乃 绪 肩 籍 敏 涂 熙 皆 侦 悬 掘 享 纠 醒 狂 锁 淀 恨 牲 霸 爬 赏 逆 玩 陵 祝 秒 浙 貌 役 彼 悉 鸭 趋 凤 晨 畜 辈 秩 卵 署 梯 炎 滩 棋 驱 筛 峡 冒 啥 寿 译 浸 泉 帽 迟 硅 疆 贷 漏 稿 冠 嫩 胁 芯 牢 叛 蚀 奥 鸣 岭 羊 凭 串 塘 绘 酵 融 盆 锡 庙 筹 冻 辅 摄 袭 筋 拒 僚 旱 钾 鸟 漆 沈 眉 疏 添 棒 穗 硝 韩 逼 扭 侨 凉 挺 碗 栽 炒 杯 患 馏 劝 豪 辽 勃 鸿 旦 吏 拜 狗 埋 辊 掩 饮 搬 骂 辞 勾 扣 估 蒋 绒 雾 丈 朵 姆 拟 宇 辑 陕 雕 偿 蓄 崇 剪 倡 厅 咬 驶 薯 刷 斥 番 赋 奉 佛 浇 漫 曼 扇 钙 桃 扶 仔 返 俗 亏 腔 鞋 棱 覆 框 悄 叔 撞 骗 勘 旺 沸 孤 吐 孟 渠 屈 疾 妙 惜 仰 狠 胀 谐 抛 霉 桑 岗 嘛 衰 盗 渗 脏 赖 涌 甜 曹 阅 肌 哩 厉 烃 纬 毅 昨 伪 症 煮 叹 钉 搭 茎 笼 酷 偷 弓 锥 恒 杰 坑 鼻 翼 纶 叙 狱 逮 罐 络 棚 抑 膨 蔬 寺 骤 穆 冶 枯 册 尸 凸 绅 坯 牺 焰 轰 欣 晋 瘦 御 锭 锦 丧 旬 锻 垄 搜 扑 邀 亭 酯 迈 舒 脆 酶 闲 忧 酚 顽 羽 涨 卸 仗 陪 辟 惩 杭 姚 肚 捉 飘 漂 昆 欺 吾 郎 烷 汁 呵 饰 萧 雅 邮 迁 燕 撒 姻 赴 宴 烦 债 帐 斑 铃 旨 醇 董 饼 雏 姿 拌 傅 腹 妥 揉 贤 拆 歪 葡 胺 丢 浩 徽 昂 垫 挡 览 贪 慰 缴 汪 慌 冯 诺 姜 谊 凶 劣 诬 耀 昏 躺 盈 骑 乔 溪 丛 卢 抹 闷 咨 刮 驾 缆 悟 摘 铒 掷 颇 幻 柄 惠 惨 佳 仇 腊 窝 涤 剑 瞧 堡 泼 葱 罩 霍 捞 胎 苍 滨 俩 捅 湘 砍 霞 邵 萄 疯 淮 遂 熊 粪 烘 宿 档 戈 驳 嫂 裕 徙 箭 捐 肠 撑 晒 辨 殿 莲 摊 搅 酱 屏 疫 哀 蔡 堵 沫 皱 畅 叠 阁 莱 敲 辖 钩 痕 坝 巷 饿 祸 丘 玄 溜 曰 逻 彭 尝 卿 妨 艇 吞 韦 怨 矮 歇 ================================================ FILE: crates/anychain-kms/src/bip39/langs/chinese_traditional.txt ================================================ 的 一 是 在 不 了 有 和 人 這 中 大 為 上 個 國 我 以 要 他 時 來 用 們 生 到 作 地 於 出 就 分 對 成 會 可 主 發 年 動 同 工 也 能 下 過 子 說 產 種 面 而 方 後 多 定 行 學 法 所 民 得 經 十 三 之 進 著 等 部 度 家 電 力 裡 如 水 化 高 自 二 理 起 小 物 現 實 加 量 都 兩 體 制 機 當 使 點 從 業 本 去 把 性 好 應 開 它 合 還 因 由 其 些 然 前 外 天 政 四 日 那 社 義 事 平 形 相 全 表 間 樣 與 關 各 重 新 線 內 數 正 心 反 你 明 看 原 又 麼 利 比 或 但 質 氣 第 向 道 命 此 變 條 只 沒 結 解 問 意 建 月 公 無 系 軍 很 情 者 最 立 代 想 已 通 並 提 直 題 黨 程 展 五 果 料 象 員 革 位 入 常 文 總 次 品 式 活 設 及 管 特 件 長 求 老 頭 基 資 邊 流 路 級 少 圖 山 統 接 知 較 將 組 見 計 別 她 手 角 期 根 論 運 農 指 幾 九 區 強 放 決 西 被 幹 做 必 戰 先 回 則 任 取 據 處 隊 南 給 色 光 門 即 保 治 北 造 百 規 熱 領 七 海 口 東 導 器 壓 志 世 金 增 爭 濟 階 油 思 術 極 交 受 聯 什 認 六 共 權 收 證 改 清 美 再 採 轉 更 單 風 切 打 白 教 速 花 帶 安 場 身 車 例 真 務 具 萬 每 目 至 達 走 積 示 議 聲 報 鬥 完 類 八 離 華 名 確 才 科 張 信 馬 節 話 米 整 空 元 況 今 集 溫 傳 土 許 步 群 廣 石 記 需 段 研 界 拉 林 律 叫 且 究 觀 越 織 裝 影 算 低 持 音 眾 書 布 复 容 兒 須 際 商 非 驗 連 斷 深 難 近 礦 千 週 委 素 技 備 半 辦 青 省 列 習 響 約 支 般 史 感 勞 便 團 往 酸 歷 市 克 何 除 消 構 府 稱 太 準 精 值 號 率 族 維 劃 選 標 寫 存 候 毛 親 快 效 斯 院 查 江 型 眼 王 按 格 養 易 置 派 層 片 始 卻 專 狀 育 廠 京 識 適 屬 圓 包 火 住 調 滿 縣 局 照 參 紅 細 引 聽 該 鐵 價 嚴 首 底 液 官 德 隨 病 蘇 失 爾 死 講 配 女 黃 推 顯 談 罪 神 藝 呢 席 含 企 望 密 批 營 項 防 舉 球 英 氧 勢 告 李 台 落 木 幫 輪 破 亞 師 圍 注 遠 字 材 排 供 河 態 封 另 施 減 樹 溶 怎 止 案 言 士 均 武 固 葉 魚 波 視 僅 費 緊 愛 左 章 早 朝 害 續 輕 服 試 食 充 兵 源 判 護 司 足 某 練 差 致 板 田 降 黑 犯 負 擊 范 繼 興 似 餘 堅 曲 輸 修 故 城 夫 夠 送 筆 船 佔 右 財 吃 富 春 職 覺 漢 畫 功 巴 跟 雖 雜 飛 檢 吸 助 昇 陽 互 初 創 抗 考 投 壞 策 古 徑 換 未 跑 留 鋼 曾 端 責 站 簡 述 錢 副 盡 帝 射 草 衝 承 獨 令 限 阿 宣 環 雙 請 超 微 讓 控 州 良 軸 找 否 紀 益 依 優 頂 礎 載 倒 房 突 坐 粉 敵 略 客 袁 冷 勝 絕 析 塊 劑 測 絲 協 訴 念 陳 仍 羅 鹽 友 洋 錯 苦 夜 刑 移 頻 逐 靠 混 母 短 皮 終 聚 汽 村 雲 哪 既 距 衛 停 烈 央 察 燒 迅 境 若 印 洲 刻 括 激 孔 搞 甚 室 待 核 校 散 侵 吧 甲 遊 久 菜 味 舊 模 湖 貨 損 預 阻 毫 普 穩 乙 媽 植 息 擴 銀 語 揮 酒 守 拿 序 紙 醫 缺 雨 嗎 針 劉 啊 急 唱 誤 訓 願 審 附 獲 茶 鮮 糧 斤 孩 脫 硫 肥 善 龍 演 父 漸 血 歡 械 掌 歌 沙 剛 攻 謂 盾 討 晚 粒 亂 燃 矛 乎 殺 藥 寧 魯 貴 鐘 煤 讀 班 伯 香 介 迫 句 豐 培 握 蘭 擔 弦 蛋 沉 假 穿 執 答 樂 誰 順 煙 縮 徵 臉 喜 松 腳 困 異 免 背 星 福 買 染 井 概 慢 怕 磁 倍 祖 皇 促 靜 補 評 翻 肉 踐 尼 衣 寬 揚 棉 希 傷 操 垂 秋 宜 氫 套 督 振 架 亮 末 憲 慶 編 牛 觸 映 雷 銷 詩 座 居 抓 裂 胞 呼 娘 景 威 綠 晶 厚 盟 衡 雞 孫 延 危 膠 屋 鄉 臨 陸 顧 掉 呀 燈 歲 措 束 耐 劇 玉 趙 跳 哥 季 課 凱 胡 額 款 紹 卷 齊 偉 蒸 殖 永 宗 苗 川 爐 岩 弱 零 楊 奏 沿 露 桿 探 滑 鎮 飯 濃 航 懷 趕 庫 奪 伊 靈 稅 途 滅 賽 歸 召 鼓 播 盤 裁 險 康 唯 錄 菌 純 借 糖 蓋 橫 符 私 努 堂 域 槍 潤 幅 哈 竟 熟 蟲 澤 腦 壤 碳 歐 遍 側 寨 敢 徹 慮 斜 薄 庭 納 彈 飼 伸 折 麥 濕 暗 荷 瓦 塞 床 築 惡 戶 訪 塔 奇 透 梁 刀 旋 跡 卡 氯 遇 份 毒 泥 退 洗 擺 灰 彩 賣 耗 夏 擇 忙 銅 獻 硬 予 繁 圈 雪 函 亦 抽 篇 陣 陰 丁 尺 追 堆 雄 迎 泛 爸 樓 避 謀 噸 野 豬 旗 累 偏 典 館 索 秦 脂 潮 爺 豆 忽 托 驚 塑 遺 愈 朱 替 纖 粗 傾 尚 痛 楚 謝 奮 購 磨 君 池 旁 碎 骨 監 捕 弟 暴 割 貫 殊 釋 詞 亡 壁 頓 寶 午 塵 聞 揭 炮 殘 冬 橋 婦 警 綜 招 吳 付 浮 遭 徐 您 搖 谷 贊 箱 隔 訂 男 吹 園 紛 唐 敗 宋 玻 巨 耕 坦 榮 閉 灣 鍵 凡 駐 鍋 救 恩 剝 凝 鹼 齒 截 煉 麻 紡 禁 廢 盛 版 緩 淨 睛 昌 婚 涉 筒 嘴 插 岸 朗 莊 街 藏 姑 貿 腐 奴 啦 慣 乘 夥 恢 勻 紗 扎 辯 耳 彪 臣 億 璃 抵 脈 秀 薩 俄 網 舞 店 噴 縱 寸 汗 掛 洪 賀 閃 柬 爆 烯 津 稻 牆 軟 勇 像 滾 厘 蒙 芳 肯 坡 柱 盪 腿 儀 旅 尾 軋 冰 貢 登 黎 削 鑽 勒 逃 障 氨 郭 峰 幣 港 伏 軌 畝 畢 擦 莫 刺 浪 秘 援 株 健 售 股 島 甘 泡 睡 童 鑄 湯 閥 休 匯 舍 牧 繞 炸 哲 磷 績 朋 淡 尖 啟 陷 柴 呈 徒 顏 淚 稍 忘 泵 藍 拖 洞 授 鏡 辛 壯 鋒 貧 虛 彎 摩 泰 幼 廷 尊 窗 綱 弄 隸 疑 氏 宮 姐 震 瑞 怪 尤 琴 循 描 膜 違 夾 腰 緣 珠 窮 森 枝 竹 溝 催 繩 憶 邦 剩 幸 漿 欄 擁 牙 貯 禮 濾 鈉 紋 罷 拍 咱 喊 袖 埃 勤 罰 焦 潛 伍 墨 欲 縫 姓 刊 飽 仿 獎 鋁 鬼 麗 跨 默 挖 鏈 掃 喝 袋 炭 污 幕 諸 弧 勵 梅 奶 潔 災 舟 鑑 苯 訟 抱 毀 懂 寒 智 埔 寄 屆 躍 渡 挑 丹 艱 貝 碰 拔 爹 戴 碼 夢 芽 熔 赤 漁 哭 敬 顆 奔 鉛 仲 虎 稀 妹 乏 珍 申 桌 遵 允 隆 螺 倉 魏 銳 曉 氮 兼 隱 礙 赫 撥 忠 肅 缸 牽 搶 博 巧 殼 兄 杜 訊 誠 碧 祥 柯 頁 巡 矩 悲 灌 齡 倫 票 尋 桂 鋪 聖 恐 恰 鄭 趣 抬 荒 騰 貼 柔 滴 猛 闊 輛 妻 填 撤 儲 簽 鬧 擾 紫 砂 遞 戲 吊 陶 伐 餵 療 瓶 婆 撫 臂 摸 忍 蝦 蠟 鄰 胸 鞏 擠 偶 棄 槽 勁 乳 鄧 吉 仁 爛 磚 租 烏 艦 伴 瓜 淺 丙 暫 燥 橡 柳 迷 暖 牌 秧 膽 詳 簧 踏 瓷 譜 呆 賓 糊 洛 輝 憤 競 隙 怒 粘 乃 緒 肩 籍 敏 塗 熙 皆 偵 懸 掘 享 糾 醒 狂 鎖 淀 恨 牲 霸 爬 賞 逆 玩 陵 祝 秒 浙 貌 役 彼 悉 鴨 趨 鳳 晨 畜 輩 秩 卵 署 梯 炎 灘 棋 驅 篩 峽 冒 啥 壽 譯 浸 泉 帽 遲 矽 疆 貸 漏 稿 冠 嫩 脅 芯 牢 叛 蝕 奧 鳴 嶺 羊 憑 串 塘 繪 酵 融 盆 錫 廟 籌 凍 輔 攝 襲 筋 拒 僚 旱 鉀 鳥 漆 沈 眉 疏 添 棒 穗 硝 韓 逼 扭 僑 涼 挺 碗 栽 炒 杯 患 餾 勸 豪 遼 勃 鴻 旦 吏 拜 狗 埋 輥 掩 飲 搬 罵 辭 勾 扣 估 蔣 絨 霧 丈 朵 姆 擬 宇 輯 陝 雕 償 蓄 崇 剪 倡 廳 咬 駛 薯 刷 斥 番 賦 奉 佛 澆 漫 曼 扇 鈣 桃 扶 仔 返 俗 虧 腔 鞋 棱 覆 框 悄 叔 撞 騙 勘 旺 沸 孤 吐 孟 渠 屈 疾 妙 惜 仰 狠 脹 諧 拋 黴 桑 崗 嘛 衰 盜 滲 臟 賴 湧 甜 曹 閱 肌 哩 厲 烴 緯 毅 昨 偽 症 煮 嘆 釘 搭 莖 籠 酷 偷 弓 錐 恆 傑 坑 鼻 翼 綸 敘 獄 逮 罐 絡 棚 抑 膨 蔬 寺 驟 穆 冶 枯 冊 屍 凸 紳 坯 犧 焰 轟 欣 晉 瘦 禦 錠 錦 喪 旬 鍛 壟 搜 撲 邀 亭 酯 邁 舒 脆 酶 閒 憂 酚 頑 羽 漲 卸 仗 陪 闢 懲 杭 姚 肚 捉 飄 漂 昆 欺 吾 郎 烷 汁 呵 飾 蕭 雅 郵 遷 燕 撒 姻 赴 宴 煩 債 帳 斑 鈴 旨 醇 董 餅 雛 姿 拌 傅 腹 妥 揉 賢 拆 歪 葡 胺 丟 浩 徽 昂 墊 擋 覽 貪 慰 繳 汪 慌 馮 諾 姜 誼 兇 劣 誣 耀 昏 躺 盈 騎 喬 溪 叢 盧 抹 悶 諮 刮 駕 纜 悟 摘 鉺 擲 頗 幻 柄 惠 慘 佳 仇 臘 窩 滌 劍 瞧 堡 潑 蔥 罩 霍 撈 胎 蒼 濱 倆 捅 湘 砍 霞 邵 萄 瘋 淮 遂 熊 糞 烘 宿 檔 戈 駁 嫂 裕 徙 箭 捐 腸 撐 曬 辨 殿 蓮 攤 攪 醬 屏 疫 哀 蔡 堵 沫 皺 暢 疊 閣 萊 敲 轄 鉤 痕 壩 巷 餓 禍 丘 玄 溜 曰 邏 彭 嘗 卿 妨 艇 吞 韋 怨 矮 歇 ================================================ FILE: crates/anychain-kms/src/bip39/langs/english.txt ================================================ abandon ability able about above absent absorb abstract absurd abuse access accident account accuse achieve acid acoustic acquire across act action actor actress actual adapt add addict address adjust admit adult advance advice aerobic affair afford afraid again age agent agree ahead aim air airport aisle alarm album alcohol alert alien all alley allow almost alone alpha already also alter always amateur amazing among amount amused analyst anchor ancient anger angle angry animal ankle announce annual another answer antenna antique anxiety any apart apology appear apple approve april arch arctic area arena argue arm armed armor army around arrange arrest arrive arrow art artefact artist artwork ask aspect assault asset assist assume asthma athlete atom attack attend attitude attract auction audit august aunt author auto autumn average avocado avoid awake aware away awesome awful awkward axis baby bachelor bacon badge bag balance balcony ball bamboo banana banner bar barely bargain barrel base basic basket battle beach bean beauty because become beef before begin behave behind believe below belt bench benefit best betray better between beyond bicycle bid bike bind biology bird birth bitter black blade blame blanket blast bleak bless blind blood blossom blouse blue blur blush board boat body boil bomb bone bonus book boost border boring borrow boss bottom bounce box boy bracket brain brand brass brave bread breeze brick bridge brief bright bring brisk broccoli broken bronze broom brother brown brush bubble buddy budget buffalo build bulb bulk bullet bundle bunker burden burger burst bus business busy butter buyer buzz cabbage cabin cable cactus cage cake call calm camera camp can canal cancel candy cannon canoe canvas canyon capable capital captain car carbon card cargo carpet carry cart case cash casino castle casual cat catalog catch category cattle caught cause caution cave ceiling celery cement census century cereal certain chair chalk champion change chaos chapter charge chase chat cheap check cheese chef cherry chest chicken chief child chimney choice choose chronic chuckle chunk churn cigar cinnamon circle citizen city civil claim clap clarify claw clay clean clerk clever click client cliff climb clinic clip clock clog close cloth cloud clown club clump cluster clutch coach coast coconut code coffee coil coin collect color column combine come comfort comic common company concert conduct confirm congress connect consider control convince cook cool copper copy coral core corn correct cost cotton couch country couple course cousin cover coyote crack cradle craft cram crane crash crater crawl crazy cream credit creek crew cricket crime crisp critic crop cross crouch crowd crucial cruel cruise crumble crunch crush cry crystal cube culture cup cupboard curious current curtain curve cushion custom cute cycle dad damage damp dance danger daring dash daughter dawn day deal debate debris decade december decide decline decorate decrease deer defense define defy degree delay deliver demand demise denial dentist deny depart depend deposit depth deputy derive describe desert design desk despair destroy detail detect develop device devote diagram dial diamond diary dice diesel diet differ digital dignity dilemma dinner dinosaur direct dirt disagree discover disease dish dismiss disorder display distance divert divide divorce dizzy doctor document dog doll dolphin domain donate donkey donor door dose double dove draft dragon drama drastic draw dream dress drift drill drink drip drive drop drum dry duck dumb dune during dust dutch duty dwarf dynamic eager eagle early earn earth easily east easy echo ecology economy edge edit educate effort egg eight either elbow elder electric elegant element elephant elevator elite else embark embody embrace emerge emotion employ empower empty enable enact end endless endorse enemy energy enforce engage engine enhance enjoy enlist enough enrich enroll ensure enter entire entry envelope episode equal equip era erase erode erosion error erupt escape essay essence estate eternal ethics evidence evil evoke evolve exact example excess exchange excite exclude excuse execute exercise exhaust exhibit exile exist exit exotic expand expect expire explain expose express extend extra eye eyebrow fabric face faculty fade faint faith fall false fame family famous fan fancy fantasy farm fashion fat fatal father fatigue fault favorite feature february federal fee feed feel female fence festival fetch fever few fiber fiction field figure file film filter final find fine finger finish fire firm first fiscal fish fit fitness fix flag flame flash flat flavor flee flight flip float flock floor flower fluid flush fly foam focus fog foil fold follow food foot force forest forget fork fortune forum forward fossil foster found fox fragile frame frequent fresh friend fringe frog front frost frown frozen fruit fuel fun funny furnace fury future gadget gain galaxy gallery game gap garage garbage garden garlic garment gas gasp gate gather gauge gaze general genius genre gentle genuine gesture ghost giant gift giggle ginger giraffe girl give glad glance glare glass glide glimpse globe gloom glory glove glow glue goat goddess gold good goose gorilla gospel gossip govern gown grab grace grain grant grape grass gravity great green grid grief grit grocery group grow grunt guard guess guide guilt guitar gun gym habit hair half hammer hamster hand happy harbor hard harsh harvest hat have hawk hazard head health heart heavy hedgehog height hello helmet help hen hero hidden high hill hint hip hire history hobby hockey hold hole holiday hollow home honey hood hope horn horror horse hospital host hotel hour hover hub huge human humble humor hundred hungry hunt hurdle hurry hurt husband hybrid ice icon idea identify idle ignore ill illegal illness image imitate immense immune impact impose improve impulse inch include income increase index indicate indoor industry infant inflict inform inhale inherit initial inject injury inmate inner innocent input inquiry insane insect inside inspire install intact interest into invest invite involve iron island isolate issue item ivory jacket jaguar jar jazz jealous jeans jelly jewel job join joke journey joy judge juice jump jungle junior junk just kangaroo keen keep ketchup key kick kid kidney kind kingdom kiss kit kitchen kite kitten kiwi knee knife knock know lab label labor ladder lady lake lamp language laptop large later latin laugh laundry lava law lawn lawsuit layer lazy leader leaf learn leave lecture left leg legal legend leisure lemon lend length lens leopard lesson letter level liar liberty library license life lift light like limb limit link lion liquid list little live lizard load loan lobster local lock logic lonely long loop lottery loud lounge love loyal lucky luggage lumber lunar lunch luxury lyrics machine mad magic magnet maid mail main major make mammal man manage mandate mango mansion manual maple marble march margin marine market marriage mask mass master match material math matrix matter maximum maze meadow mean measure meat mechanic medal media melody melt member memory mention menu mercy merge merit merry mesh message metal method middle midnight milk million mimic mind minimum minor minute miracle mirror misery miss mistake mix mixed mixture mobile model modify mom moment monitor monkey monster month moon moral more morning mosquito mother motion motor mountain mouse move movie much muffin mule multiply muscle museum mushroom music must mutual myself mystery myth naive name napkin narrow nasty nation nature near neck need negative neglect neither nephew nerve nest net network neutral never news next nice night noble noise nominee noodle normal north nose notable note nothing notice novel now nuclear number nurse nut oak obey object oblige obscure observe obtain obvious occur ocean october odor off offer office often oil okay old olive olympic omit once one onion online only open opera opinion oppose option orange orbit orchard order ordinary organ orient original orphan ostrich other outdoor outer output outside oval oven over own owner oxygen oyster ozone pact paddle page pair palace palm panda panel panic panther paper parade parent park parrot party pass patch path patient patrol pattern pause pave payment peace peanut pear peasant pelican pen penalty pencil people pepper perfect permit person pet phone photo phrase physical piano picnic picture piece pig pigeon pill pilot pink pioneer pipe pistol pitch pizza place planet plastic plate play please pledge pluck plug plunge poem poet point polar pole police pond pony pool popular portion position possible post potato pottery poverty powder power practice praise predict prefer prepare present pretty prevent price pride primary print priority prison private prize problem process produce profit program project promote proof property prosper protect proud provide public pudding pull pulp pulse pumpkin punch pupil puppy purchase purity purpose purse push put puzzle pyramid quality quantum quarter question quick quit quiz quote rabbit raccoon race rack radar radio rail rain raise rally ramp ranch random range rapid rare rate rather raven raw razor ready real reason rebel rebuild recall receive recipe record recycle reduce reflect reform refuse region regret regular reject relax release relief rely remain remember remind remove render renew rent reopen repair repeat replace report require rescue resemble resist resource response result retire retreat return reunion reveal review reward rhythm rib ribbon rice rich ride ridge rifle right rigid ring riot ripple risk ritual rival river road roast robot robust rocket romance roof rookie room rose rotate rough round route royal rubber rude rug rule run runway rural sad saddle sadness safe sail salad salmon salon salt salute same sample sand satisfy satoshi sauce sausage save say scale scan scare scatter scene scheme school science scissors scorpion scout scrap screen script scrub sea search season seat second secret section security seed seek segment select sell seminar senior sense sentence series service session settle setup seven shadow shaft shallow share shed shell sheriff shield shift shine ship shiver shock shoe shoot shop short shoulder shove shrimp shrug shuffle shy sibling sick side siege sight sign silent silk silly silver similar simple since sing siren sister situate six size skate sketch ski skill skin skirt skull slab slam sleep slender slice slide slight slim slogan slot slow slush small smart smile smoke smooth snack snake snap sniff snow soap soccer social sock soda soft solar soldier solid solution solve someone song soon sorry sort soul sound soup source south space spare spatial spawn speak special speed spell spend sphere spice spider spike spin spirit split spoil sponsor spoon sport spot spray spread spring spy square squeeze squirrel stable stadium staff stage stairs stamp stand start state stay steak steel stem step stereo stick still sting stock stomach stone stool story stove strategy street strike strong struggle student stuff stumble style subject submit subway success such sudden suffer sugar suggest suit summer sun sunny sunset super supply supreme sure surface surge surprise surround survey suspect sustain swallow swamp swap swarm swear sweet swift swim swing switch sword symbol symptom syrup system table tackle tag tail talent talk tank tape target task taste tattoo taxi teach team tell ten tenant tennis tent term test text thank that theme then theory there they thing this thought three thrive throw thumb thunder ticket tide tiger tilt timber time tiny tip tired tissue title toast tobacco today toddler toe together toilet token tomato tomorrow tone tongue tonight tool tooth top topic topple torch tornado tortoise toss total tourist toward tower town toy track trade traffic tragic train transfer trap trash travel tray treat tree trend trial tribe trick trigger trim trip trophy trouble truck true truly trumpet trust truth try tube tuition tumble tuna tunnel turkey turn turtle twelve twenty twice twin twist two type typical ugly umbrella unable unaware uncle uncover under undo unfair unfold unhappy uniform unique unit universe unknown unlock until unusual unveil update upgrade uphold upon upper upset urban urge usage use used useful useless usual utility vacant vacuum vague valid valley valve van vanish vapor various vast vault vehicle velvet vendor venture venue verb verify version very vessel veteran viable vibrant vicious victory video view village vintage violin virtual virus visa visit visual vital vivid vocal voice void volcano volume vote voyage wage wagon wait walk wall walnut want warfare warm warrior wash wasp waste water wave way wealth weapon wear weasel weather web wedding weekend weird welcome west wet whale what wheat wheel when where whip whisper wide width wife wild will win window wine wing wink winner winter wire wisdom wise wish witness wolf woman wonder wood wool word work world worry worth wrap wreck wrestle wrist write wrong yard year yellow you young youth zebra zero zone zoo ================================================ FILE: crates/anychain-kms/src/bip39/langs/french.txt ================================================ abaisser abandon abdiquer abeille abolir aborder aboutir aboyer abrasif abreuver abriter abroger abrupt absence absolu absurde abusif abyssal académie acajou acarien accabler accepter acclamer accolade accroche accuser acerbe achat acheter aciduler acier acompte acquérir acronyme acteur actif actuel adepte adéquat adhésif adjectif adjuger admettre admirer adopter adorer adoucir adresse adroit adulte adverbe aérer aéronef affaire affecter affiche affreux affubler agacer agencer agile agiter agrafer agréable agrume aider aiguille ailier aimable aisance ajouter ajuster alarmer alchimie alerte algèbre algue aliéner aliment alléger alliage allouer allumer alourdir alpaga altesse alvéole amateur ambigu ambre aménager amertume amidon amiral amorcer amour amovible amphibie ampleur amusant analyse anaphore anarchie anatomie ancien anéantir angle angoisse anguleux animal annexer annonce annuel anodin anomalie anonyme anormal antenne antidote anxieux apaiser apéritif aplanir apologie appareil appeler apporter appuyer aquarium aqueduc arbitre arbuste ardeur ardoise argent arlequin armature armement armoire armure arpenter arracher arriver arroser arsenic artériel article aspect asphalte aspirer assaut asservir assiette associer assurer asticot astre astuce atelier atome atrium atroce attaque attentif attirer attraper aubaine auberge audace audible augurer aurore automne autruche avaler avancer avarice avenir averse aveugle aviateur avide avion aviser avoine avouer avril axial axiome badge bafouer bagage baguette baignade balancer balcon baleine balisage bambin bancaire bandage banlieue bannière banquier barbier baril baron barque barrage bassin bastion bataille bateau batterie baudrier bavarder belette bélier belote bénéfice berceau berger berline bermuda besace besogne bétail beurre biberon bicycle bidule bijou bilan bilingue billard binaire biologie biopsie biotype biscuit bison bistouri bitume bizarre blafard blague blanchir blessant blinder blond bloquer blouson bobard bobine boire boiser bolide bonbon bondir bonheur bonifier bonus bordure borne botte boucle boueux bougie boulon bouquin bourse boussole boutique boxeur branche brasier brave brebis brèche breuvage bricoler brigade brillant brioche brique brochure broder bronzer brousse broyeur brume brusque brutal bruyant buffle buisson bulletin bureau burin bustier butiner butoir buvable buvette cabanon cabine cachette cadeau cadre caféine caillou caisson calculer calepin calibre calmer calomnie calvaire camarade caméra camion campagne canal caneton canon cantine canular capable caporal caprice capsule capter capuche carabine carbone caresser caribou carnage carotte carreau carton cascade casier casque cassure causer caution cavalier caverne caviar cédille ceinture céleste cellule cendrier censurer central cercle cérébral cerise cerner cerveau cesser chagrin chaise chaleur chambre chance chapitre charbon chasseur chaton chausson chavirer chemise chenille chéquier chercher cheval chien chiffre chignon chimère chiot chlorure chocolat choisir chose chouette chrome chute cigare cigogne cimenter cinéma cintrer circuler cirer cirque citerne citoyen citron civil clairon clameur claquer classe clavier client cligner climat clivage cloche clonage cloporte cobalt cobra cocasse cocotier coder codifier coffre cogner cohésion coiffer coincer colère colibri colline colmater colonel combat comédie commande compact concert conduire confier congeler connoter consonne contact convexe copain copie corail corbeau cordage corniche corpus correct cortège cosmique costume coton coude coupure courage couteau couvrir coyote crabe crainte cravate crayon créature créditer crémeux creuser crevette cribler crier cristal critère croire croquer crotale crucial cruel crypter cubique cueillir cuillère cuisine cuivre culminer cultiver cumuler cupide curatif curseur cyanure cycle cylindre cynique daigner damier danger danseur dauphin débattre débiter déborder débrider débutant décaler décembre déchirer décider déclarer décorer décrire décupler dédale déductif déesse défensif défiler défrayer dégager dégivrer déglutir dégrafer déjeuner délice déloger demander demeurer démolir dénicher dénouer dentelle dénuder départ dépenser déphaser déplacer déposer déranger dérober désastre descente désert désigner désobéir dessiner destrier détacher détester détourer détresse devancer devenir deviner devoir diable dialogue diamant dicter différer digérer digital digne diluer dimanche diminuer dioxyde directif diriger discuter disposer dissiper distance divertir diviser docile docteur dogme doigt domaine domicile dompter donateur donjon donner dopamine dortoir dorure dosage doseur dossier dotation douanier double douceur douter doyen dragon draper dresser dribbler droiture duperie duplexe durable durcir dynastie éblouir écarter écharpe échelle éclairer éclipse éclore écluse école économie écorce écouter écraser écrémer écrivain écrou écume écureuil édifier éduquer effacer effectif effigie effort effrayer effusion égaliser égarer éjecter élaborer élargir électron élégant éléphant élève éligible élitisme éloge élucider éluder emballer embellir embryon émeraude émission emmener émotion émouvoir empereur employer emporter emprise émulsion encadrer enchère enclave encoche endiguer endosser endroit enduire énergie enfance enfermer enfouir engager engin englober énigme enjamber enjeu enlever ennemi ennuyeux enrichir enrobage enseigne entasser entendre entier entourer entraver énumérer envahir enviable envoyer enzyme éolien épaissir épargne épatant épaule épicerie épidémie épier épilogue épine épisode épitaphe époque épreuve éprouver épuisant équerre équipe ériger érosion erreur éruption escalier espadon espèce espiègle espoir esprit esquiver essayer essence essieu essorer estime estomac estrade étagère étaler étanche étatique éteindre étendoir éternel éthanol éthique ethnie étirer étoffer étoile étonnant étourdir étrange étroit étude euphorie évaluer évasion éventail évidence éviter évolutif évoquer exact exagérer exaucer exceller excitant exclusif excuse exécuter exemple exercer exhaler exhorter exigence exiler exister exotique expédier explorer exposer exprimer exquis extensif extraire exulter fable fabuleux facette facile facture faiblir falaise fameux famille farceur farfelu farine farouche fasciner fatal fatigue faucon fautif faveur favori fébrile féconder fédérer félin femme fémur fendoir féodal fermer féroce ferveur festival feuille feutre février fiasco ficeler fictif fidèle figure filature filetage filière filleul filmer filou filtrer financer finir fiole firme fissure fixer flairer flamme flasque flatteur fléau flèche fleur flexion flocon flore fluctuer fluide fluvial folie fonderie fongible fontaine forcer forgeron formuler fortune fossile foudre fougère fouiller foulure fourmi fragile fraise franchir frapper frayeur frégate freiner frelon frémir frénésie frère friable friction frisson frivole froid fromage frontal frotter fruit fugitif fuite fureur furieux furtif fusion futur gagner galaxie galerie gambader garantir gardien garnir garrigue gazelle gazon géant gélatine gélule gendarme général génie genou gentil géologie géomètre géranium germe gestuel geyser gibier gicler girafe givre glace glaive glisser globe gloire glorieux golfeur gomme gonfler gorge gorille goudron gouffre goulot goupille gourmand goutte graduel graffiti graine grand grappin gratuit gravir grenat griffure griller grimper grogner gronder grotte groupe gruger grutier gruyère guépard guerrier guide guimauve guitare gustatif gymnaste gyrostat habitude hachoir halte hameau hangar hanneton haricot harmonie harpon hasard hélium hématome herbe hérisson hermine héron hésiter heureux hiberner hibou hilarant histoire hiver homard hommage homogène honneur honorer honteux horde horizon horloge hormone horrible houleux housse hublot huileux humain humble humide humour hurler hydromel hygiène hymne hypnose idylle ignorer iguane illicite illusion image imbiber imiter immense immobile immuable impact impérial implorer imposer imprimer imputer incarner incendie incident incliner incolore indexer indice inductif inédit ineptie inexact infini infliger informer infusion ingérer inhaler inhiber injecter injure innocent inoculer inonder inscrire insecte insigne insolite inspirer instinct insulter intact intense intime intrigue intuitif inutile invasion inventer inviter invoquer ironique irradier irréel irriter isoler ivoire ivresse jaguar jaillir jambe janvier jardin jauger jaune javelot jetable jeton jeudi jeunesse joindre joncher jongler joueur jouissif journal jovial joyau joyeux jubiler jugement junior jupon juriste justice juteux juvénile kayak kimono kiosque label labial labourer lacérer lactose lagune laine laisser laitier lambeau lamelle lampe lanceur langage lanterne lapin largeur larme laurier lavabo lavoir lecture légal léger légume lessive lettre levier lexique lézard liasse libérer libre licence licorne liège lièvre ligature ligoter ligue limer limite limonade limpide linéaire lingot lionceau liquide lisière lister lithium litige littoral livreur logique lointain loisir lombric loterie louer lourd loutre louve loyal lubie lucide lucratif lueur lugubre luisant lumière lunaire lundi luron lutter luxueux machine magasin magenta magique maigre maillon maintien mairie maison majorer malaxer maléfice malheur malice mallette mammouth mandater maniable manquant manteau manuel marathon marbre marchand mardi maritime marqueur marron marteler mascotte massif matériel matière matraque maudire maussade mauve maximal méchant méconnu médaille médecin méditer méduse meilleur mélange mélodie membre mémoire menacer mener menhir mensonge mentor mercredi mérite merle messager mesure métal météore méthode métier meuble miauler microbe miette mignon migrer milieu million mimique mince minéral minimal minorer minute miracle miroiter missile mixte mobile moderne moelleux mondial moniteur monnaie monotone monstre montagne monument moqueur morceau morsure mortier moteur motif mouche moufle moulin mousson mouton mouvant multiple munition muraille murène murmure muscle muséum musicien mutation muter mutuel myriade myrtille mystère mythique nageur nappe narquois narrer natation nation nature naufrage nautique navire nébuleux nectar néfaste négation négliger négocier neige nerveux nettoyer neurone neutron neveu niche nickel nitrate niveau noble nocif nocturne noirceur noisette nomade nombreux nommer normatif notable notifier notoire nourrir nouveau novateur novembre novice nuage nuancer nuire nuisible numéro nuptial nuque nutritif obéir objectif obliger obscur observer obstacle obtenir obturer occasion occuper océan octobre octroyer octupler oculaire odeur odorant offenser officier offrir ogive oiseau oisillon olfactif olivier ombrage omettre onctueux onduler onéreux onirique opale opaque opérer opinion opportun opprimer opter optique orageux orange orbite ordonner oreille organe orgueil orifice ornement orque ortie osciller osmose ossature otarie ouragan ourson outil outrager ouvrage ovation oxyde oxygène ozone paisible palace palmarès palourde palper panache panda pangolin paniquer panneau panorama pantalon papaye papier papoter papyrus paradoxe parcelle paresse parfumer parler parole parrain parsemer partager parure parvenir passion pastèque paternel patience patron pavillon pavoiser payer paysage peigne peintre pelage pélican pelle pelouse peluche pendule pénétrer pénible pensif pénurie pépite péplum perdrix perforer période permuter perplexe persil perte peser pétale petit pétrir peuple pharaon phobie phoque photon phrase physique piano pictural pièce pierre pieuvre pilote pinceau pipette piquer pirogue piscine piston pivoter pixel pizza placard plafond plaisir planer plaque plastron plateau pleurer plexus pliage plomb plonger pluie plumage pochette poésie poète pointe poirier poisson poivre polaire policier pollen polygone pommade pompier ponctuel pondérer poney portique position posséder posture potager poteau potion pouce poulain poumon pourpre poussin pouvoir prairie pratique précieux prédire préfixe prélude prénom présence prétexte prévoir primitif prince prison priver problème procéder prodige profond progrès proie projeter prologue promener propre prospère protéger prouesse proverbe prudence pruneau psychose public puceron puiser pulpe pulsar punaise punitif pupitre purifier puzzle pyramide quasar querelle question quiétude quitter quotient racine raconter radieux ragondin raideur raisin ralentir rallonge ramasser rapide rasage ratisser ravager ravin rayonner réactif réagir réaliser réanimer recevoir réciter réclamer récolter recruter reculer recycler rédiger redouter refaire réflexe réformer refrain refuge régalien région réglage régulier réitérer rejeter rejouer relatif relever relief remarque remède remise remonter remplir remuer renard renfort renifler renoncer rentrer renvoi replier reporter reprise reptile requin réserve résineux résoudre respect rester résultat rétablir retenir réticule retomber retracer réunion réussir revanche revivre révolte révulsif richesse rideau rieur rigide rigoler rincer riposter risible risque rituel rival rivière rocheux romance rompre ronce rondin roseau rosier rotatif rotor rotule rouge rouille rouleau routine royaume ruban rubis ruche ruelle rugueux ruiner ruisseau ruser rustique rythme sabler saboter sabre sacoche safari sagesse saisir salade salive salon saluer samedi sanction sanglier sarcasme sardine saturer saugrenu saumon sauter sauvage savant savonner scalpel scandale scélérat scénario sceptre schéma science scinder score scrutin sculpter séance sécable sécher secouer sécréter sédatif séduire seigneur séjour sélectif semaine sembler semence séminal sénateur sensible sentence séparer séquence serein sergent sérieux serrure sérum service sésame sévir sevrage sextuple sidéral siècle siéger siffler sigle signal silence silicium simple sincère sinistre siphon sirop sismique situer skier social socle sodium soigneux soldat soleil solitude soluble sombre sommeil somnoler sonde songeur sonnette sonore sorcier sortir sosie sottise soucieux soudure souffle soulever soupape source soutirer souvenir spacieux spatial spécial sphère spiral stable station sternum stimulus stipuler strict studieux stupeur styliste sublime substrat subtil subvenir succès sucre suffixe suggérer suiveur sulfate superbe supplier surface suricate surmener surprise sursaut survie suspect syllabe symbole symétrie synapse syntaxe système tabac tablier tactile tailler talent talisman talonner tambour tamiser tangible tapis taquiner tarder tarif tartine tasse tatami tatouage taupe taureau taxer témoin temporel tenaille tendre teneur tenir tension terminer terne terrible tétine texte thème théorie thérapie thorax tibia tiède timide tirelire tiroir tissu titane titre tituber toboggan tolérant tomate tonique tonneau toponyme torche tordre tornade torpille torrent torse tortue totem toucher tournage tousser toxine traction trafic tragique trahir train trancher travail trèfle tremper trésor treuil triage tribunal tricoter trilogie triomphe tripler triturer trivial trombone tronc tropical troupeau tuile tulipe tumulte tunnel turbine tuteur tutoyer tuyau tympan typhon typique tyran ubuesque ultime ultrason unanime unifier union unique unitaire univers uranium urbain urticant usage usine usuel usure utile utopie vacarme vaccin vagabond vague vaillant vaincre vaisseau valable valise vallon valve vampire vanille vapeur varier vaseux vassal vaste vecteur vedette végétal véhicule veinard véloce vendredi vénérer venger venimeux ventouse verdure vérin vernir verrou verser vertu veston vétéran vétuste vexant vexer viaduc viande victoire vidange vidéo vignette vigueur vilain village vinaigre violon vipère virement virtuose virus visage viseur vision visqueux visuel vital vitesse viticole vitrine vivace vivipare vocation voguer voile voisin voiture volaille volcan voltiger volume vorace vortex voter vouloir voyage voyelle wagon xénon yacht zèbre zénith zeste zoologie ================================================ FILE: crates/anychain-kms/src/bip39/langs/italian.txt ================================================ abaco abbaglio abbinato abete abisso abolire abrasivo abrogato accadere accenno accusato acetone achille acido acqua acre acrilico acrobata acuto adagio addebito addome adeguato aderire adipe adottare adulare affabile affetto affisso affranto aforisma afoso africano agave agente agevole aggancio agire agitare agonismo agricolo agrumeto aguzzo alabarda alato albatro alberato albo albume alce alcolico alettone alfa algebra aliante alibi alimento allagato allegro allievo allodola allusivo almeno alogeno alpaca alpestre altalena alterno alticcio altrove alunno alveolo alzare amalgama amanita amarena ambito ambrato ameba america ametista amico ammasso ammenda ammirare ammonito amore ampio ampliare amuleto anacardo anagrafe analista anarchia anatra anca ancella ancora andare andrea anello angelo angolare angusto anima annegare annidato anno annuncio anonimo anticipo anzi apatico apertura apode apparire appetito appoggio approdo appunto aprile arabica arachide aragosta araldica arancio aratura arazzo arbitro archivio ardito arenile argento argine arguto aria armonia arnese arredato arringa arrosto arsenico arso artefice arzillo asciutto ascolto asepsi asettico asfalto asino asola aspirato aspro assaggio asse assoluto assurdo asta astenuto astice astratto atavico ateismo atomico atono attesa attivare attorno attrito attuale ausilio austria autista autonomo autunno avanzato avere avvenire avviso avvolgere azione azoto azzimo azzurro babele baccano bacino baco badessa badilata bagnato baita balcone baldo balena ballata balzano bambino bandire baraonda barbaro barca baritono barlume barocco basilico basso batosta battuto baule bava bavosa becco beffa belgio belva benda benevole benigno benzina bere berlina beta bibita bici bidone bifido biga bilancia bimbo binocolo biologo bipede bipolare birbante birra biscotto bisesto bisnonno bisonte bisturi bizzarro blando blatta bollito bonifico bordo bosco botanico bottino bozzolo braccio bradipo brama branca bravura bretella brevetto brezza briglia brillante brindare broccolo brodo bronzina brullo bruno bubbone buca budino buffone buio bulbo buono burlone burrasca bussola busta cadetto caduco calamaro calcolo calesse calibro calmo caloria cambusa camerata camicia cammino camola campale canapa candela cane canino canotto cantina capace capello capitolo capogiro cappero capra capsula carapace carcassa cardo carisma carovana carretto cartolina casaccio cascata caserma caso cassone castello casuale catasta catena catrame cauto cavillo cedibile cedrata cefalo celebre cellulare cena cenone centesimo ceramica cercare certo cerume cervello cesoia cespo ceto chela chiaro chicca chiedere chimera china chirurgo chitarra ciao ciclismo cifrare cigno cilindro ciottolo circa cirrosi citrico cittadino ciuffo civetta civile classico clinica cloro cocco codardo codice coerente cognome collare colmato colore colposo coltivato colza coma cometa commando comodo computer comune conciso condurre conferma congelare coniuge connesso conoscere consumo continuo convegno coperto copione coppia copricapo corazza cordata coricato cornice corolla corpo corredo corsia cortese cosmico costante cottura covato cratere cravatta creato credere cremoso crescita creta criceto crinale crisi critico croce cronaca crostata cruciale crusca cucire cuculo cugino cullato cupola curatore cursore curvo cuscino custode dado daino dalmata damerino daniela dannoso danzare datato davanti davvero debutto decennio deciso declino decollo decreto dedicato definito deforme degno delegare delfino delirio delta demenza denotato dentro deposito derapata derivare deroga descritto deserto desiderio desumere detersivo devoto diametro dicembre diedro difeso diffuso digerire digitale diluvio dinamico dinnanzi dipinto diploma dipolo diradare dire dirotto dirupo disagio discreto disfare disgelo disposto distanza disumano dito divano divelto dividere divorato doblone docente doganale dogma dolce domato domenica dominare dondolo dono dormire dote dottore dovuto dozzina drago druido dubbio dubitare ducale duna duomo duplice duraturo ebano eccesso ecco eclissi economia edera edicola edile editoria educare egemonia egli egoismo egregio elaborato elargire elegante elencato eletto elevare elfico elica elmo elsa eluso emanato emblema emesso emiro emotivo emozione empirico emulo endemico enduro energia enfasi enoteca entrare enzima epatite epilogo episodio epocale eppure equatore erario erba erboso erede eremita erigere ermetico eroe erosivo errante esagono esame esanime esaudire esca esempio esercito esibito esigente esistere esito esofago esortato esoso espanso espresso essenza esso esteso estimare estonia estroso esultare etilico etnico etrusco etto euclideo europa evaso evidenza evitato evoluto evviva fabbrica faccenda fachiro falco famiglia fanale fanfara fango fantasma fare farfalla farinoso farmaco fascia fastoso fasullo faticare fato favoloso febbre fecola fede fegato felpa feltro femmina fendere fenomeno fermento ferro fertile fessura festivo fetta feudo fiaba fiducia fifa figurato filo finanza finestra finire fiore fiscale fisico fiume flacone flamenco flebo flemma florido fluente fluoro fobico focaccia focoso foderato foglio folata folclore folgore fondente fonetico fonia fontana forbito forchetta foresta formica fornaio foro fortezza forzare fosfato fosso fracasso frana frassino fratello freccetta frenata fresco frigo frollino fronde frugale frutta fucilata fucsia fuggente fulmine fulvo fumante fumetto fumoso fune funzione fuoco furbo furgone furore fuso futile gabbiano gaffe galateo gallina galoppo gambero gamma garanzia garbo garofano garzone gasdotto gasolio gastrico gatto gaudio gazebo gazzella geco gelatina gelso gemello gemmato gene genitore gennaio genotipo gergo ghepardo ghiaccio ghisa giallo gilda ginepro giocare gioiello giorno giove girato girone gittata giudizio giurato giusto globulo glutine gnomo gobba golf gomito gommone gonfio gonna governo gracile grado grafico grammo grande grattare gravoso grazia greca gregge grifone grigio grinza grotta gruppo guadagno guaio guanto guardare gufo guidare ibernato icona identico idillio idolo idra idrico idrogeno igiene ignaro ignorato ilare illeso illogico illudere imballo imbevuto imbocco imbuto immane immerso immolato impacco impeto impiego importo impronta inalare inarcare inattivo incanto incendio inchino incisivo incluso incontro incrocio incubo indagine india indole inedito infatti infilare inflitto ingaggio ingegno inglese ingordo ingrosso innesco inodore inoltrare inondato insano insetto insieme insonnia insulina intasato intero intonaco intuito inumidire invalido invece invito iperbole ipnotico ipotesi ippica iride irlanda ironico irrigato irrorare isolato isotopo isterico istituto istrice italia iterare labbro labirinto lacca lacerato lacrima lacuna laddove lago lampo lancetta lanterna lardoso larga laringe lastra latenza latino lattuga lavagna lavoro legale leggero lembo lentezza lenza leone lepre lesivo lessato lesto letterale leva levigato libero lido lievito lilla limatura limitare limpido lineare lingua liquido lira lirica lisca lite litigio livrea locanda lode logica lombare londra longevo loquace lorenzo loto lotteria luce lucidato lumaca luminoso lungo lupo luppolo lusinga lusso lutto macabro macchina macero macinato madama magico maglia magnete magro maiolica malafede malgrado malinteso malsano malto malumore mana mancia mandorla mangiare manifesto mannaro manovra mansarda mantide manubrio mappa maratona marcire maretta marmo marsupio maschera massaia mastino materasso matricola mattone maturo mazurca meandro meccanico mecenate medesimo meditare mega melassa melis melodia meninge meno mensola mercurio merenda merlo meschino mese messere mestolo metallo metodo mettere miagolare mica micelio michele microbo midollo miele migliore milano milite mimosa minerale mini minore mirino mirtillo miscela missiva misto misurare mitezza mitigare mitra mittente mnemonico modello modifica modulo mogano mogio mole molosso monastero monco mondina monetario monile monotono monsone montato monviso mora mordere morsicato mostro motivato motosega motto movenza movimento mozzo mucca mucosa muffa mughetto mugnaio mulatto mulinello multiplo mummia munto muovere murale musa muscolo musica mutevole muto nababbo nafta nanometro narciso narice narrato nascere nastrare naturale nautica naviglio nebulosa necrosi negativo negozio nemmeno neofita neretto nervo nessuno nettuno neutrale neve nevrotico nicchia ninfa nitido nobile nocivo nodo nome nomina nordico normale norvegese nostrano notare notizia notturno novella nucleo nulla numero nuovo nutrire nuvola nuziale oasi obbedire obbligo obelisco oblio obolo obsoleto occasione occhio occidente occorrere occultare ocra oculato odierno odorare offerta offrire offuscato oggetto oggi ognuno olandese olfatto oliato oliva ologramma oltre omaggio ombelico ombra omega omissione ondoso onere onice onnivoro onorevole onta operato opinione opposto oracolo orafo ordine orecchino orefice orfano organico origine orizzonte orma ormeggio ornativo orologio orrendo orribile ortensia ortica orzata orzo osare oscurare osmosi ospedale ospite ossa ossidare ostacolo oste otite otre ottagono ottimo ottobre ovale ovest ovino oviparo ovocito ovunque ovviare ozio pacchetto pace pacifico padella padrone paese paga pagina palazzina palesare pallido palo palude pandoro pannello paolo paonazzo paprica parabola parcella parere pargolo pari parlato parola partire parvenza parziale passivo pasticca patacca patologia pattume pavone peccato pedalare pedonale peggio peloso penare pendice penisola pennuto penombra pensare pentola pepe pepita perbene percorso perdonato perforare pergamena periodo permesso perno perplesso persuaso pertugio pervaso pesatore pesista peso pestifero petalo pettine petulante pezzo piacere pianta piattino piccino picozza piega pietra piffero pigiama pigolio pigro pila pilifero pillola pilota pimpante pineta pinna pinolo pioggia piombo piramide piretico pirite pirolisi pitone pizzico placebo planare plasma platano plenario pochezza poderoso podismo poesia poggiare polenta poligono pollice polmonite polpetta polso poltrona polvere pomice pomodoro ponte popoloso porfido poroso porpora porre portata posa positivo possesso postulato potassio potere pranzo prassi pratica precluso predica prefisso pregiato prelievo premere prenotare preparato presenza pretesto prevalso prima principe privato problema procura produrre profumo progetto prolunga promessa pronome proposta proroga proteso prova prudente prugna prurito psiche pubblico pudica pugilato pugno pulce pulito pulsante puntare pupazzo pupilla puro quadro qualcosa quasi querela quota raccolto raddoppio radicale radunato raffica ragazzo ragione ragno ramarro ramingo ramo randagio rantolare rapato rapina rappreso rasatura raschiato rasente rassegna rastrello rata ravveduto reale recepire recinto recluta recondito recupero reddito redimere regalato registro regola regresso relazione remare remoto renna replica reprimere reputare resa residente responso restauro rete retina retorica rettifica revocato riassunto ribadire ribelle ribrezzo ricarica ricco ricevere riciclato ricordo ricreduto ridicolo ridurre rifasare riflesso riforma rifugio rigare rigettato righello rilassato rilevato rimanere rimbalzo rimedio rimorchio rinascita rincaro rinforzo rinnovo rinomato rinsavito rintocco rinuncia rinvenire riparato ripetuto ripieno riportare ripresa ripulire risata rischio riserva risibile riso rispetto ristoro risultato risvolto ritardo ritegno ritmico ritrovo riunione riva riverso rivincita rivolto rizoma roba robotico robusto roccia roco rodaggio rodere roditore rogito rollio romantico rompere ronzio rosolare rospo rotante rotondo rotula rovescio rubizzo rubrica ruga rullino rumine rumoroso ruolo rupe russare rustico sabato sabbiare sabotato sagoma salasso saldatura salgemma salivare salmone salone saltare saluto salvo sapere sapido saporito saraceno sarcasmo sarto sassoso satellite satira satollo saturno savana savio saziato sbadiglio sbalzo sbancato sbarra sbattere sbavare sbendare sbirciare sbloccato sbocciato sbrinare sbruffone sbuffare scabroso scadenza scala scambiare scandalo scapola scarso scatenare scavato scelto scenico scettro scheda schiena sciarpa scienza scindere scippo sciroppo scivolo sclerare scodella scolpito scomparto sconforto scoprire scorta scossone scozzese scriba scrollare scrutinio scuderia scultore scuola scuro scusare sdebitare sdoganare seccatura secondo sedano seggiola segnalato segregato seguito selciato selettivo sella selvaggio semaforo sembrare seme seminato sempre senso sentire sepolto sequenza serata serbato sereno serio serpente serraglio servire sestina setola settimana sfacelo sfaldare sfamato sfarzoso sfaticato sfera sfida sfilato sfinge sfocato sfoderare sfogo sfoltire sforzato sfratto sfruttato sfuggito sfumare sfuso sgabello sgarbato sgonfiare sgorbio sgrassato sguardo sibilo siccome sierra sigla signore silenzio sillaba simbolo simpatico simulato sinfonia singolo sinistro sino sintesi sinusoide sipario sisma sistole situato slitta slogatura sloveno smarrito smemorato smentito smeraldo smilzo smontare smottato smussato snellire snervato snodo sobbalzo sobrio soccorso sociale sodale soffitto sogno soldato solenne solido sollazzo solo solubile solvente somatico somma sonda sonetto sonnifero sopire soppeso sopra sorgere sorpasso sorriso sorso sorteggio sorvolato sospiro sosta sottile spada spalla spargere spatola spavento spazzola specie spedire spegnere spelatura speranza spessore spettrale spezzato spia spigoloso spillato spinoso spirale splendido sportivo sposo spranga sprecare spronato spruzzo spuntino squillo sradicare srotolato stabile stacco staffa stagnare stampato stantio starnuto stasera statuto stelo steppa sterzo stiletto stima stirpe stivale stizzoso stonato storico strappo stregato stridulo strozzare strutto stuccare stufo stupendo subentro succoso sudore suggerito sugo sultano suonare superbo supporto surgelato surrogato sussurro sutura svagare svedese sveglio svelare svenuto svezia sviluppo svista svizzera svolta svuotare tabacco tabulato tacciare taciturno tale talismano tampone tannino tara tardivo targato tariffa tarpare tartaruga tasto tattico taverna tavolata tazza teca tecnico telefono temerario tempo temuto tendone tenero tensione tentacolo teorema terme terrazzo terzetto tesi tesserato testato tetro tettoia tifare tigella timbro tinto tipico tipografo tiraggio tiro titanio titolo titubante tizio tizzone toccare tollerare tolto tombola tomo tonfo tonsilla topazio topologia toppa torba tornare torrone tortora toscano tossire tostatura totano trabocco trachea trafila tragedia tralcio tramonto transito trapano trarre trasloco trattato trave treccia tremolio trespolo tributo tricheco trifoglio trillo trincea trio tristezza triturato trivella tromba trono troppo trottola trovare truccato tubatura tuffato tulipano tumulto tunisia turbare turchino tuta tutela ubicato uccello uccisore udire uditivo uffa ufficio uguale ulisse ultimato umano umile umorismo uncinetto ungere ungherese unicorno unificato unisono unitario unte uovo upupa uragano urgenza urlo usanza usato uscito usignolo usuraio utensile utilizzo utopia vacante vaccinato vagabondo vagliato valanga valgo valico valletta valoroso valutare valvola vampata vangare vanitoso vano vantaggio vanvera vapore varano varcato variante vasca vedetta vedova veduto vegetale veicolo velcro velina velluto veloce venato vendemmia vento verace verbale vergogna verifica vero verruca verticale vescica vessillo vestale veterano vetrina vetusto viandante vibrante vicenda vichingo vicinanza vidimare vigilia vigneto vigore vile villano vimini vincitore viola vipera virgola virologo virulento viscoso visione vispo vissuto visura vita vitello vittima vivanda vivido viziare voce voga volatile volere volpe voragine vulcano zampogna zanna zappato zattera zavorra zefiro zelante zelo zenzero zerbino zibetto zinco zircone zitto zolla zotico zucchero zufolo zulu zuppa ================================================ FILE: crates/anychain-kms/src/bip39/langs/japanese.txt ================================================ あいこくしん あいさつ あいだ あおぞら あかちゃん あきる あけがた あける あこがれる あさい あさひ あしあと あじわう あずかる あずき あそぶ あたえる あたためる あたりまえ あたる あつい あつかう あっしゅく あつまり あつめる あてな あてはまる あひる あぶら あぶる あふれる あまい あまど あまやかす あまり あみもの あめりか あやまる あゆむ あらいぐま あらし あらすじ あらためる あらゆる あらわす ありがとう あわせる あわてる あんい あんがい あんこ あんぜん あんてい あんない あんまり いいだす いおん いがい いがく いきおい いきなり いきもの いきる いくじ いくぶん いけばな いけん いこう いこく いこつ いさましい いさん いしき いじゅう いじょう いじわる いずみ いずれ いせい いせえび いせかい いせき いぜん いそうろう いそがしい いだい いだく いたずら いたみ いたりあ いちおう いちじ いちど いちば いちぶ いちりゅう いつか いっしゅん いっせい いっそう いったん いっち いってい いっぽう いてざ いてん いどう いとこ いない いなか いねむり いのち いのる いはつ いばる いはん いびき いひん いふく いへん いほう いみん いもうと いもたれ いもり いやがる いやす いよかん いよく いらい いらすと いりぐち いりょう いれい いれもの いれる いろえんぴつ いわい いわう いわかん いわば いわゆる いんげんまめ いんさつ いんしょう いんよう うえき うえる うおざ うがい うかぶ うかべる うきわ うくらいな うくれれ うけたまわる うけつけ うけとる うけもつ うける うごかす うごく うこん うさぎ うしなう うしろがみ うすい うすぎ うすぐらい うすめる うせつ うちあわせ うちがわ うちき うちゅう うっかり うつくしい うったえる うつる うどん うなぎ うなじ うなずく うなる うねる うのう うぶげ うぶごえ うまれる うめる うもう うやまう うよく うらがえす うらぐち うらない うりあげ うりきれ うるさい うれしい うれゆき うれる うろこ うわき うわさ うんこう うんちん うんてん うんどう えいえん えいが えいきょう えいご えいせい えいぶん えいよう えいわ えおり えがお えがく えきたい えくせる えしゃく えすて えつらん えのぐ えほうまき えほん えまき えもじ えもの えらい えらぶ えりあ えんえん えんかい えんぎ えんげき えんしゅう えんぜつ えんそく えんちょう えんとつ おいかける おいこす おいしい おいつく おうえん おうさま おうじ おうせつ おうたい おうふく おうべい おうよう おえる おおい おおう おおどおり おおや おおよそ おかえり おかず おがむ おかわり おぎなう おきる おくさま おくじょう おくりがな おくる おくれる おこす おこなう おこる おさえる おさない おさめる おしいれ おしえる おじぎ おじさん おしゃれ おそらく おそわる おたがい おたく おだやか おちつく おっと おつり おでかけ おとしもの おとなしい おどり おどろかす おばさん おまいり おめでとう おもいで おもう おもたい おもちゃ おやつ おやゆび およぼす おらんだ おろす おんがく おんけい おんしゃ おんせん おんだん おんちゅう おんどけい かあつ かいが がいき がいけん がいこう かいさつ かいしゃ かいすいよく かいぜん かいぞうど かいつう かいてん かいとう かいふく がいへき かいほう かいよう がいらい かいわ かえる かおり かかえる かがく かがし かがみ かくご かくとく かざる がぞう かたい かたち がちょう がっきゅう がっこう がっさん がっしょう かなざわし かのう がはく かぶか かほう かほご かまう かまぼこ かめれおん かゆい かようび からい かるい かろう かわく かわら がんか かんけい かんこう かんしゃ かんそう かんたん かんち がんばる きあい きあつ きいろ ぎいん きうい きうん きえる きおう きおく きおち きおん きかい きかく きかんしゃ ききて きくばり きくらげ きけんせい きこう きこえる きこく きさい きさく きさま きさらぎ ぎじかがく ぎしき ぎじたいけん ぎじにってい ぎじゅつしゃ きすう きせい きせき きせつ きそう きぞく きぞん きたえる きちょう きつえん ぎっちり きつつき きつね きてい きどう きどく きない きなが きなこ きぬごし きねん きのう きのした きはく きびしい きひん きふく きぶん きぼう きほん きまる きみつ きむずかしい きめる きもだめし きもち きもの きゃく きやく ぎゅうにく きよう きょうりゅう きらい きらく きりん きれい きれつ きろく ぎろん きわめる ぎんいろ きんかくじ きんじょ きんようび ぐあい くいず くうかん くうき くうぐん くうこう ぐうせい くうそう ぐうたら くうふく くうぼ くかん くきょう くげん ぐこう くさい くさき くさばな くさる くしゃみ くしょう くすのき くすりゆび くせげ くせん ぐたいてき くださる くたびれる くちこみ くちさき くつした ぐっすり くつろぐ くとうてん くどく くなん くねくね くのう くふう くみあわせ くみたてる くめる くやくしょ くらす くらべる くるま くれる くろう くわしい ぐんかん ぐんしょく ぐんたい ぐんて けあな けいかく けいけん けいこ けいさつ げいじゅつ けいたい げいのうじん けいれき けいろ けおとす けおりもの げきか げきげん げきだん げきちん げきとつ げきは げきやく げこう げこくじょう げざい けさき げざん けしき けしごむ けしょう げすと けたば けちゃっぷ けちらす けつあつ けつい けつえき けっこん けつじょ けっせき けってい けつまつ げつようび げつれい けつろん げどく けとばす けとる けなげ けなす けなみ けぬき げねつ けねん けはい げひん けぶかい げぼく けまり けみかる けむし けむり けもの けらい けろけろ けわしい けんい けんえつ けんお けんか げんき けんげん けんこう けんさく けんしゅう けんすう げんそう けんちく けんてい けんとう けんない けんにん げんぶつ けんま けんみん けんめい けんらん けんり こあくま こいぬ こいびと ごうい こうえん こうおん こうかん ごうきゅう ごうけい こうこう こうさい こうじ こうすい ごうせい こうそく こうたい こうちゃ こうつう こうてい こうどう こうない こうはい ごうほう ごうまん こうもく こうりつ こえる こおり ごかい ごがつ ごかん こくご こくさい こくとう こくない こくはく こぐま こけい こける ここのか こころ こさめ こしつ こすう こせい こせき こぜん こそだて こたい こたえる こたつ こちょう こっか こつこつ こつばん こつぶ こてい こてん ことがら ことし ことば ことり こなごな こねこね このまま このみ このよ ごはん こひつじ こふう こふん こぼれる ごまあぶら こまかい ごますり こまつな こまる こむぎこ こもじ こもち こもの こもん こやく こやま こゆう こゆび こよい こよう こりる これくしょん ころっけ こわもて こわれる こんいん こんかい こんき こんしゅう こんすい こんだて こんとん こんなん こんびに こんぽん こんまけ こんや こんれい こんわく ざいえき さいかい さいきん ざいげん ざいこ さいしょ さいせい ざいたく ざいちゅう さいてき ざいりょう さうな さかいし さがす さかな さかみち さがる さぎょう さくし さくひん さくら さこく さこつ さずかる ざせき さたん さつえい ざつおん ざっか ざつがく さっきょく ざっし さつじん ざっそう さつたば さつまいも さてい さといも さとう さとおや さとし さとる さのう さばく さびしい さべつ さほう さほど さます さみしい さみだれ さむけ さめる さやえんどう さゆう さよう さよく さらだ ざるそば さわやか さわる さんいん さんか さんきゃく さんこう さんさい ざんしょ さんすう さんせい さんそ さんち さんま さんみ さんらん しあい しあげ しあさって しあわせ しいく しいん しうち しえい しおけ しかい しかく じかん しごと しすう じだい したうけ したぎ したて したみ しちょう しちりん しっかり しつじ しつもん してい してき してつ じてん じどう しなぎれ しなもの しなん しねま しねん しのぐ しのぶ しはい しばかり しはつ しはらい しはん しひょう しふく じぶん しへい しほう しほん しまう しまる しみん しむける じむしょ しめい しめる しもん しゃいん しゃうん しゃおん じゃがいも しやくしょ しゃくほう しゃけん しゃこ しゃざい しゃしん しゃせん しゃそう しゃたい しゃちょう しゃっきん じゃま しゃりん しゃれい じゆう じゅうしょ しゅくはく じゅしん しゅっせき しゅみ しゅらば じゅんばん しょうかい しょくたく しょっけん しょどう しょもつ しらせる しらべる しんか しんこう じんじゃ しんせいじ しんちく しんりん すあげ すあし すあな ずあん すいえい すいか すいとう ずいぶん すいようび すうがく すうじつ すうせん すおどり すきま すくう すくない すける すごい すこし ずさん すずしい すすむ すすめる すっかり ずっしり ずっと すてき すてる すねる すのこ すはだ すばらしい ずひょう ずぶぬれ すぶり すふれ すべて すべる ずほう すぼん すまい すめし すもう すやき すらすら するめ すれちがう すろっと すわる すんぜん すんぽう せあぶら せいかつ せいげん せいじ せいよう せおう せかいかん せきにん せきむ せきゆ せきらんうん せけん せこう せすじ せたい せたけ せっかく せっきゃく ぜっく せっけん せっこつ せっさたくま せつぞく せつだん せつでん せっぱん せつび せつぶん せつめい せつりつ せなか せのび せはば せびろ せぼね せまい せまる せめる せもたれ せりふ ぜんあく せんい せんえい せんか せんきょ せんく せんげん ぜんご せんさい せんしゅ せんすい せんせい せんぞ せんたく せんちょう せんてい せんとう せんぬき せんねん せんぱい ぜんぶ ぜんぽう せんむ せんめんじょ せんもん せんやく せんゆう せんよう ぜんら ぜんりゃく せんれい せんろ そあく そいとげる そいね そうがんきょう そうき そうご そうしん そうだん そうなん そうび そうめん そうり そえもの そえん そがい そげき そこう そこそこ そざい そしな そせい そせん そそぐ そだてる そつう そつえん そっかん そつぎょう そっけつ そっこう そっせん そっと そとがわ そとづら そなえる そなた そふぼ そぼく そぼろ そまつ そまる そむく そむりえ そめる そもそも そよかぜ そらまめ そろう そんかい そんけい そんざい そんしつ そんぞく そんちょう ぞんび ぞんぶん そんみん たあい たいいん たいうん たいえき たいおう だいがく たいき たいぐう たいけん たいこ たいざい だいじょうぶ だいすき たいせつ たいそう だいたい たいちょう たいてい だいどころ たいない たいねつ たいのう たいはん だいひょう たいふう たいへん たいほ たいまつばな たいみんぐ たいむ たいめん たいやき たいよう たいら たいりょく たいる たいわん たうえ たえる たおす たおる たおれる たかい たかね たきび たくさん たこく たこやき たさい たしざん だじゃれ たすける たずさわる たそがれ たたかう たたく ただしい たたみ たちばな だっかい だっきゃく だっこ だっしゅつ だったい たてる たとえる たなばた たにん たぬき たのしみ たはつ たぶん たべる たぼう たまご たまる だむる ためいき ためす ためる たもつ たやすい たよる たらす たりきほんがん たりょう たりる たると たれる たれんと たろっと たわむれる だんあつ たんい たんおん たんか たんき たんけん たんご たんさん たんじょうび だんせい たんそく たんたい だんち たんてい たんとう だんな たんにん だんねつ たんのう たんぴん だんぼう たんまつ たんめい だんれつ だんろ だんわ ちあい ちあん ちいき ちいさい ちえん ちかい ちから ちきゅう ちきん ちけいず ちけん ちこく ちさい ちしき ちしりょう ちせい ちそう ちたい ちたん ちちおや ちつじょ ちてき ちてん ちぬき ちぬり ちのう ちひょう ちへいせん ちほう ちまた ちみつ ちみどろ ちめいど ちゃんこなべ ちゅうい ちゆりょく ちょうし ちょさくけん ちらし ちらみ ちりがみ ちりょう ちるど ちわわ ちんたい ちんもく ついか ついたち つうか つうじょう つうはん つうわ つかう つかれる つくね つくる つけね つける つごう つたえる つづく つつじ つつむ つとめる つながる つなみ つねづね つのる つぶす つまらない つまる つみき つめたい つもり つもる つよい つるぼ つるみく つわもの つわり てあし てあて てあみ ていおん ていか ていき ていけい ていこく ていさつ ていし ていせい ていたい ていど ていねい ていひょう ていへん ていぼう てうち ておくれ てきとう てくび でこぼこ てさぎょう てさげ てすり てそう てちがい てちょう てつがく てつづき でっぱ てつぼう てつや でぬかえ てぬき てぬぐい てのひら てはい てぶくろ てふだ てほどき てほん てまえ てまきずし てみじか てみやげ てらす てれび てわけ てわたし でんあつ てんいん てんかい てんき てんぐ てんけん てんごく てんさい てんし てんすう でんち てんてき てんとう てんない てんぷら てんぼうだい てんめつ てんらんかい でんりょく でんわ どあい といれ どうかん とうきゅう どうぐ とうし とうむぎ とおい とおか とおく とおす とおる とかい とかす ときおり ときどき とくい とくしゅう とくてん とくに とくべつ とけい とける とこや とさか としょかん とそう とたん とちゅう とっきゅう とっくん とつぜん とつにゅう とどける ととのえる とない となえる となり とのさま とばす どぶがわ とほう とまる とめる ともだち ともる どようび とらえる とんかつ どんぶり ないかく ないこう ないしょ ないす ないせん ないそう なおす ながい なくす なげる なこうど なさけ なたでここ なっとう なつやすみ ななおし なにごと なにもの なにわ なのか なふだ なまいき なまえ なまみ なみだ なめらか なめる なやむ ならう ならび ならぶ なれる なわとび なわばり にあう にいがた にうけ におい にかい にがて にきび にくしみ にくまん にげる にさんかたんそ にしき にせもの にちじょう にちようび にっか にっき にっけい にっこう にっさん にっしょく にっすう にっせき にってい になう にほん にまめ にもつ にやり にゅういん にりんしゃ にわとり にんい にんか にんき にんげん にんしき にんずう にんそう にんたい にんち にんてい にんにく にんぷ にんまり にんむ にんめい にんよう ぬいくぎ ぬかす ぬぐいとる ぬぐう ぬくもり ぬすむ ぬまえび ぬめり ぬらす ぬんちゃく ねあげ ねいき ねいる ねいろ ねぐせ ねくたい ねくら ねこぜ ねこむ ねさげ ねすごす ねそべる ねだん ねつい ねっしん ねつぞう ねったいぎょ ねぶそく ねふだ ねぼう ねほりはほり ねまき ねまわし ねみみ ねむい ねむたい ねもと ねらう ねわざ ねんいり ねんおし ねんかん ねんきん ねんぐ ねんざ ねんし ねんちゃく ねんど ねんぴ ねんぶつ ねんまつ ねんりょう ねんれい のいず のおづま のがす のきなみ のこぎり のこす のこる のせる のぞく のぞむ のたまう のちほど のっく のばす のはら のべる のぼる のみもの のやま のらいぬ のらねこ のりもの のりゆき のれん のんき ばあい はあく ばあさん ばいか ばいく はいけん はいご はいしん はいすい はいせん はいそう はいち ばいばい はいれつ はえる はおる はかい ばかり はかる はくしゅ はけん はこぶ はさみ はさん はしご ばしょ はしる はせる ぱそこん はそん はたん はちみつ はつおん はっかく はづき はっきり はっくつ はっけん はっこう はっさん はっしん はったつ はっちゅう はってん はっぴょう はっぽう はなす はなび はにかむ はぶらし はみがき はむかう はめつ はやい はやし はらう はろうぃん はわい はんい はんえい はんおん はんかく はんきょう ばんぐみ はんこ はんしゃ はんすう はんだん ぱんち ぱんつ はんてい はんとし はんのう はんぱ はんぶん はんぺん はんぼうき はんめい はんらん はんろん ひいき ひうん ひえる ひかく ひかり ひかる ひかん ひくい ひけつ ひこうき ひこく ひさい ひさしぶり ひさん びじゅつかん ひしょ ひそか ひそむ ひたむき ひだり ひたる ひつぎ ひっこし ひっし ひつじゅひん ひっす ひつぜん ぴったり ぴっちり ひつよう ひてい ひとごみ ひなまつり ひなん ひねる ひはん ひびく ひひょう ひほう ひまわり ひまん ひみつ ひめい ひめじし ひやけ ひやす ひよう びょうき ひらがな ひらく ひりつ ひりょう ひるま ひるやすみ ひれい ひろい ひろう ひろき ひろゆき ひんかく ひんけつ ひんこん ひんしゅ ひんそう ぴんち ひんぱん びんぼう ふあん ふいうち ふうけい ふうせん ぷうたろう ふうとう ふうふ ふえる ふおん ふかい ふきん ふくざつ ふくぶくろ ふこう ふさい ふしぎ ふじみ ふすま ふせい ふせぐ ふそく ぶたにく ふたん ふちょう ふつう ふつか ふっかつ ふっき ふっこく ぶどう ふとる ふとん ふのう ふはい ふひょう ふへん ふまん ふみん ふめつ ふめん ふよう ふりこ ふりる ふるい ふんいき ぶんがく ぶんぐ ふんしつ ぶんせき ふんそう ぶんぽう へいあん へいおん へいがい へいき へいげん へいこう へいさ へいしゃ へいせつ へいそ へいたく へいてん へいねつ へいわ へきが へこむ べにいろ べにしょうが へらす へんかん べんきょう べんごし へんさい へんたい べんり ほあん ほいく ぼうぎょ ほうこく ほうそう ほうほう ほうもん ほうりつ ほえる ほおん ほかん ほきょう ぼきん ほくろ ほけつ ほけん ほこう ほこる ほしい ほしつ ほしゅ ほしょう ほせい ほそい ほそく ほたて ほたる ぽちぶくろ ほっきょく ほっさ ほったん ほとんど ほめる ほんい ほんき ほんけ ほんしつ ほんやく まいにち まかい まかせる まがる まける まこと まさつ まじめ ますく まぜる まつり まとめ まなぶ まぬけ まねく まほう まもる まゆげ まよう まろやか まわす まわり まわる まんが まんきつ まんぞく まんなか みいら みうち みえる みがく みかた みかん みけん みこん みじかい みすい みすえる みせる みっか みつかる みつける みてい みとめる みなと みなみかさい みねらる みのう みのがす みほん みもと みやげ みらい みりょく みわく みんか みんぞく むいか むえき むえん むかい むかう むかえ むかし むぎちゃ むける むげん むさぼる むしあつい むしば むじゅん むしろ むすう むすこ むすぶ むすめ むせる むせん むちゅう むなしい むのう むやみ むよう むらさき むりょう むろん めいあん めいうん めいえん めいかく めいきょく めいさい めいし めいそう めいぶつ めいれい めいわく めぐまれる めざす めした めずらしい めだつ めまい めやす めんきょ めんせき めんどう もうしあげる もうどうけん もえる もくし もくてき もくようび もちろん もどる もらう もんく もんだい やおや やける やさい やさしい やすい やすたろう やすみ やせる やそう やたい やちん やっと やっぱり やぶる やめる ややこしい やよい やわらかい ゆうき ゆうびんきょく ゆうべ ゆうめい ゆけつ ゆしゅつ ゆせん ゆそう ゆたか ゆちゃく ゆでる ゆにゅう ゆびわ ゆらい ゆれる ようい ようか ようきゅう ようじ ようす ようちえん よかぜ よかん よきん よくせい よくぼう よけい よごれる よさん よしゅう よそう よそく よっか よてい よどがわく よねつ よやく よゆう よろこぶ よろしい らいう らくがき らくご らくさつ らくだ らしんばん らせん らぞく らたい らっか られつ りえき りかい りきさく りきせつ りくぐん りくつ りけん りこう りせい りそう りそく りてん りねん りゆう りゅうがく りよう りょうり りょかん りょくちゃ りょこう りりく りれき りろん りんご るいけい るいさい るいじ るいせき るすばん るりがわら れいかん れいぎ れいせい れいぞうこ れいとう れいぼう れきし れきだい れんあい れんけい れんこん れんさい れんしゅう れんぞく れんらく ろうか ろうご ろうじん ろうそく ろくが ろこつ ろじうら ろしゅつ ろせん ろてん ろめん ろれつ ろんぎ ろんぱ ろんぶん ろんり わかす わかめ わかやま わかれる わしつ わじまし わすれもの わらう われる ================================================ FILE: crates/anychain-kms/src/bip39/langs/korean.txt ================================================ 가격 가끔 가난 가능 가득 가르침 가뭄 가방 가상 가슴 가운데 가을 가이드 가입 가장 가정 가족 가죽 각오 각자 간격 간부 간섭 간장 간접 간판 갈등 갈비 갈색 갈증 감각 감기 감소 감수성 감자 감정 갑자기 강남 강당 강도 강력히 강변 강북 강사 강수량 강아지 강원도 강의 강제 강조 같이 개구리 개나리 개방 개별 개선 개성 개인 객관적 거실 거액 거울 거짓 거품 걱정 건강 건물 건설 건조 건축 걸음 검사 검토 게시판 게임 겨울 견해 결과 결국 결론 결석 결승 결심 결정 결혼 경계 경고 경기 경력 경복궁 경비 경상도 경영 경우 경쟁 경제 경주 경찰 경치 경향 경험 계곡 계단 계란 계산 계속 계약 계절 계층 계획 고객 고구려 고궁 고급 고등학생 고무신 고민 고양이 고장 고전 고집 고춧가루 고통 고향 곡식 골목 골짜기 골프 공간 공개 공격 공군 공급 공기 공동 공무원 공부 공사 공식 공업 공연 공원 공장 공짜 공책 공통 공포 공항 공휴일 과목 과일 과장 과정 과학 관객 관계 관광 관념 관람 관련 관리 관습 관심 관점 관찰 광경 광고 광장 광주 괴로움 굉장히 교과서 교문 교복 교실 교양 교육 교장 교직 교통 교환 교훈 구경 구름 구멍 구별 구분 구석 구성 구속 구역 구입 구청 구체적 국가 국기 국내 국립 국물 국민 국수 국어 국왕 국적 국제 국회 군대 군사 군인 궁극적 권리 권위 권투 귀국 귀신 규정 규칙 균형 그날 그냥 그늘 그러나 그룹 그릇 그림 그제서야 그토록 극복 극히 근거 근교 근래 근로 근무 근본 근원 근육 근처 글씨 글자 금강산 금고 금년 금메달 금액 금연 금요일 금지 긍정적 기간 기관 기념 기능 기독교 기둥 기록 기름 기법 기본 기분 기쁨 기숙사 기술 기억 기업 기온 기운 기원 기적 기준 기침 기혼 기획 긴급 긴장 길이 김밥 김치 김포공항 깍두기 깜빡 깨달음 깨소금 껍질 꼭대기 꽃잎 나들이 나란히 나머지 나물 나침반 나흘 낙엽 난방 날개 날씨 날짜 남녀 남대문 남매 남산 남자 남편 남학생 낭비 낱말 내년 내용 내일 냄비 냄새 냇물 냉동 냉면 냉방 냉장고 넥타이 넷째 노동 노란색 노력 노인 녹음 녹차 녹화 논리 논문 논쟁 놀이 농구 농담 농민 농부 농업 농장 농촌 높이 눈동자 눈물 눈썹 뉴욕 느낌 늑대 능동적 능력 다방 다양성 다음 다이어트 다행 단계 단골 단독 단맛 단순 단어 단위 단점 단체 단추 단편 단풍 달걀 달러 달력 달리 닭고기 담당 담배 담요 담임 답변 답장 당근 당분간 당연히 당장 대규모 대낮 대단히 대답 대도시 대략 대량 대륙 대문 대부분 대신 대응 대장 대전 대접 대중 대책 대출 대충 대통령 대학 대한민국 대합실 대형 덩어리 데이트 도대체 도덕 도둑 도망 도서관 도심 도움 도입 도자기 도저히 도전 도중 도착 독감 독립 독서 독일 독창적 동화책 뒷모습 뒷산 딸아이 마누라 마늘 마당 마라톤 마련 마무리 마사지 마약 마요네즈 마을 마음 마이크 마중 마지막 마찬가지 마찰 마흔 막걸리 막내 막상 만남 만두 만세 만약 만일 만점 만족 만화 많이 말기 말씀 말투 맘대로 망원경 매년 매달 매력 매번 매스컴 매일 매장 맥주 먹이 먼저 먼지 멀리 메일 며느리 며칠 면담 멸치 명단 명령 명예 명의 명절 명칭 명함 모금 모니터 모델 모든 모범 모습 모양 모임 모조리 모집 모퉁이 목걸이 목록 목사 목소리 목숨 목적 목표 몰래 몸매 몸무게 몸살 몸속 몸짓 몸통 몹시 무관심 무궁화 무더위 무덤 무릎 무슨 무엇 무역 무용 무조건 무지개 무척 문구 문득 문법 문서 문제 문학 문화 물가 물건 물결 물고기 물론 물리학 물음 물질 물체 미국 미디어 미사일 미술 미역 미용실 미움 미인 미팅 미혼 민간 민족 민주 믿음 밀가루 밀리미터 밑바닥 바가지 바구니 바나나 바늘 바닥 바닷가 바람 바이러스 바탕 박물관 박사 박수 반대 반드시 반말 반발 반성 반응 반장 반죽 반지 반찬 받침 발가락 발걸음 발견 발달 발레 발목 발바닥 발생 발음 발자국 발전 발톱 발표 밤하늘 밥그릇 밥맛 밥상 밥솥 방금 방면 방문 방바닥 방법 방송 방식 방안 방울 방지 방학 방해 방향 배경 배꼽 배달 배드민턴 백두산 백색 백성 백인 백제 백화점 버릇 버섯 버튼 번개 번역 번지 번호 벌금 벌레 벌써 범위 범인 범죄 법률 법원 법적 법칙 베이징 벨트 변경 변동 변명 변신 변호사 변화 별도 별명 별일 병실 병아리 병원 보관 보너스 보라색 보람 보름 보상 보안 보자기 보장 보전 보존 보통 보편적 보험 복도 복사 복숭아 복습 볶음 본격적 본래 본부 본사 본성 본인 본질 볼펜 봉사 봉지 봉투 부근 부끄러움 부담 부동산 부문 부분 부산 부상 부엌 부인 부작용 부장 부정 부족 부지런히 부친 부탁 부품 부회장 북부 북한 분노 분량 분리 분명 분석 분야 분위기 분필 분홍색 불고기 불과 불교 불꽃 불만 불법 불빛 불안 불이익 불행 브랜드 비극 비난 비닐 비둘기 비디오 비로소 비만 비명 비밀 비바람 비빔밥 비상 비용 비율 비중 비타민 비판 빌딩 빗물 빗방울 빗줄기 빛깔 빨간색 빨래 빨리 사건 사계절 사나이 사냥 사람 사랑 사립 사모님 사물 사방 사상 사생활 사설 사슴 사실 사업 사용 사월 사장 사전 사진 사촌 사춘기 사탕 사투리 사흘 산길 산부인과 산업 산책 살림 살인 살짝 삼계탕 삼국 삼십 삼월 삼촌 상관 상금 상대 상류 상반기 상상 상식 상업 상인 상자 상점 상처 상추 상태 상표 상품 상황 새벽 색깔 색연필 생각 생명 생물 생방송 생산 생선 생신 생일 생활 서랍 서른 서명 서민 서비스 서양 서울 서적 서점 서쪽 서클 석사 석유 선거 선물 선배 선생 선수 선원 선장 선전 선택 선풍기 설거지 설날 설렁탕 설명 설문 설사 설악산 설치 설탕 섭씨 성공 성당 성명 성별 성인 성장 성적 성질 성함 세금 세미나 세상 세월 세종대왕 세탁 센터 센티미터 셋째 소규모 소극적 소금 소나기 소년 소득 소망 소문 소설 소속 소아과 소용 소원 소음 소중히 소지품 소질 소풍 소형 속담 속도 속옷 손가락 손길 손녀 손님 손등 손목 손뼉 손실 손질 손톱 손해 솔직히 솜씨 송아지 송이 송편 쇠고기 쇼핑 수건 수년 수단 수돗물 수동적 수면 수명 수박 수상 수석 수술 수시로 수업 수염 수영 수입 수준 수집 수출 수컷 수필 수학 수험생 수화기 숙녀 숙소 숙제 순간 순서 순수 순식간 순위 숟가락 술병 술집 숫자 스님 스물 스스로 스승 스웨터 스위치 스케이트 스튜디오 스트레스 스포츠 슬쩍 슬픔 습관 습기 승객 승리 승부 승용차 승진 시각 시간 시골 시금치 시나리오 시댁 시리즈 시멘트 시민 시부모 시선 시설 시스템 시아버지 시어머니 시월 시인 시일 시작 시장 시절 시점 시중 시즌 시집 시청 시합 시험 식구 식기 식당 식량 식료품 식물 식빵 식사 식생활 식초 식탁 식품 신고 신규 신념 신문 신발 신비 신사 신세 신용 신제품 신청 신체 신화 실감 실내 실력 실례 실망 실수 실습 실시 실장 실정 실질적 실천 실체 실컷 실태 실패 실험 실현 심리 심부름 심사 심장 심정 심판 쌍둥이 씨름 씨앗 아가씨 아나운서 아드님 아들 아쉬움 아스팔트 아시아 아울러 아저씨 아줌마 아직 아침 아파트 아프리카 아픔 아홉 아흔 악기 악몽 악수 안개 안경 안과 안내 안녕 안동 안방 안부 안주 알루미늄 알코올 암시 암컷 압력 앞날 앞문 애인 애정 액수 앨범 야간 야단 야옹 약간 약국 약속 약수 약점 약품 약혼녀 양념 양력 양말 양배추 양주 양파 어둠 어려움 어른 어젯밤 어쨌든 어쩌다가 어쩐지 언니 언덕 언론 언어 얼굴 얼른 얼음 얼핏 엄마 업무 업종 업체 엉덩이 엉망 엉터리 엊그제 에너지 에어컨 엔진 여건 여고생 여관 여군 여권 여대생 여덟 여동생 여든 여론 여름 여섯 여성 여왕 여인 여전히 여직원 여학생 여행 역사 역시 역할 연결 연구 연극 연기 연락 연설 연세 연속 연습 연애 연예인 연인 연장 연주 연출 연필 연합 연휴 열기 열매 열쇠 열심히 열정 열차 열흘 염려 엽서 영국 영남 영상 영양 영역 영웅 영원히 영하 영향 영혼 영화 옆구리 옆방 옆집 예감 예금 예방 예산 예상 예선 예술 예습 예식장 예약 예전 예절 예정 예컨대 옛날 오늘 오락 오랫동안 오렌지 오로지 오른발 오븐 오십 오염 오월 오전 오직 오징어 오페라 오피스텔 오히려 옥상 옥수수 온갖 온라인 온몸 온종일 온통 올가을 올림픽 올해 옷차림 와이셔츠 와인 완성 완전 왕비 왕자 왜냐하면 왠지 외갓집 외국 외로움 외삼촌 외출 외침 외할머니 왼발 왼손 왼쪽 요금 요일 요즘 요청 용기 용서 용어 우산 우선 우승 우연히 우정 우체국 우편 운동 운명 운반 운전 운행 울산 울음 움직임 웃어른 웃음 워낙 원고 원래 원서 원숭이 원인 원장 원피스 월급 월드컵 월세 월요일 웨이터 위반 위법 위성 위원 위험 위협 윗사람 유난히 유럽 유명 유물 유산 유적 유치원 유학 유행 유형 육군 육상 육십 육체 은행 음력 음료 음반 음성 음식 음악 음주 의견 의논 의문 의복 의식 의심 의외로 의욕 의원 의학 이것 이곳 이념 이놈 이달 이대로 이동 이렇게 이력서 이론적 이름 이민 이발소 이별 이불 이빨 이상 이성 이슬 이야기 이용 이웃 이월 이윽고 이익 이전 이중 이튿날 이틀 이혼 인간 인격 인공 인구 인근 인기 인도 인류 인물 인생 인쇄 인연 인원 인재 인종 인천 인체 인터넷 인하 인형 일곱 일기 일단 일대 일등 일반 일본 일부 일상 일생 일손 일요일 일월 일정 일종 일주일 일찍 일체 일치 일행 일회용 임금 임무 입대 입력 입맛 입사 입술 입시 입원 입장 입학 자가용 자격 자극 자동 자랑 자부심 자식 자신 자연 자원 자율 자전거 자정 자존심 자판 작가 작년 작성 작업 작용 작은딸 작품 잔디 잔뜩 잔치 잘못 잠깐 잠수함 잠시 잠옷 잠자리 잡지 장관 장군 장기간 장래 장례 장르 장마 장면 장모 장미 장비 장사 장소 장식 장애인 장인 장점 장차 장학금 재능 재빨리 재산 재생 재작년 재정 재채기 재판 재학 재활용 저것 저고리 저곳 저녁 저런 저렇게 저번 저울 저절로 저축 적극 적당히 적성 적용 적응 전개 전공 전기 전달 전라도 전망 전문 전반 전부 전세 전시 전용 전자 전쟁 전주 전철 전체 전통 전혀 전후 절대 절망 절반 절약 절차 점검 점수 점심 점원 점점 점차 접근 접시 접촉 젓가락 정거장 정도 정류장 정리 정말 정면 정문 정반대 정보 정부 정비 정상 정성 정오 정원 정장 정지 정치 정확히 제공 제과점 제대로 제목 제발 제법 제삿날 제안 제일 제작 제주도 제출 제품 제한 조각 조건 조금 조깅 조명 조미료 조상 조선 조용히 조절 조정 조직 존댓말 존재 졸업 졸음 종교 종로 종류 종소리 종업원 종종 종합 좌석 죄인 주관적 주름 주말 주머니 주먹 주문 주민 주방 주변 주식 주인 주일 주장 주전자 주택 준비 줄거리 줄기 줄무늬 중간 중계방송 중국 중년 중단 중독 중반 중부 중세 중소기업 중순 중앙 중요 중학교 즉석 즉시 즐거움 증가 증거 증권 증상 증세 지각 지갑 지경 지극히 지금 지급 지능 지름길 지리산 지방 지붕 지식 지역 지우개 지원 지적 지점 지진 지출 직선 직업 직원 직장 진급 진동 진로 진료 진리 진짜 진찰 진출 진통 진행 질문 질병 질서 짐작 집단 집안 집중 짜증 찌꺼기 차남 차라리 차량 차림 차별 차선 차츰 착각 찬물 찬성 참가 참기름 참새 참석 참여 참외 참조 찻잔 창가 창고 창구 창문 창밖 창작 창조 채널 채점 책가방 책방 책상 책임 챔피언 처벌 처음 천국 천둥 천장 천재 천천히 철도 철저히 철학 첫날 첫째 청년 청바지 청소 청춘 체계 체력 체온 체육 체중 체험 초등학생 초반 초밥 초상화 초순 초여름 초원 초저녁 초점 초청 초콜릿 촛불 총각 총리 총장 촬영 최근 최상 최선 최신 최악 최종 추석 추억 추진 추천 추측 축구 축소 축제 축하 출근 출발 출산 출신 출연 출입 출장 출판 충격 충고 충돌 충분히 충청도 취업 취직 취향 치약 친구 친척 칠십 칠월 칠판 침대 침묵 침실 칫솔 칭찬 카메라 카운터 칼국수 캐릭터 캠퍼스 캠페인 커튼 컨디션 컬러 컴퓨터 코끼리 코미디 콘서트 콜라 콤플렉스 콩나물 쾌감 쿠데타 크림 큰길 큰딸 큰소리 큰아들 큰어머니 큰일 큰절 클래식 클럽 킬로 타입 타자기 탁구 탁자 탄생 태권도 태양 태풍 택시 탤런트 터널 터미널 테니스 테스트 테이블 텔레비전 토론 토마토 토요일 통계 통과 통로 통신 통역 통일 통장 통제 통증 통합 통화 퇴근 퇴원 퇴직금 튀김 트럭 특급 특별 특성 특수 특징 특히 튼튼히 티셔츠 파란색 파일 파출소 판결 판단 판매 판사 팔십 팔월 팝송 패션 팩스 팩시밀리 팬티 퍼센트 페인트 편견 편의 편지 편히 평가 평균 평생 평소 평양 평일 평화 포스터 포인트 포장 포함 표면 표정 표준 표현 품목 품질 풍경 풍속 풍습 프랑스 프린터 플라스틱 피곤 피망 피아노 필름 필수 필요 필자 필통 핑계 하느님 하늘 하드웨어 하룻밤 하반기 하숙집 하순 하여튼 하지만 하천 하품 하필 학과 학교 학급 학기 학년 학력 학번 학부모 학비 학생 학술 학습 학용품 학원 학위 학자 학점 한계 한글 한꺼번에 한낮 한눈 한동안 한때 한라산 한마디 한문 한번 한복 한식 한여름 한쪽 할머니 할아버지 할인 함께 함부로 합격 합리적 항공 항구 항상 항의 해결 해군 해답 해당 해물 해석 해설 해수욕장 해안 핵심 핸드백 햄버거 햇볕 햇살 행동 행복 행사 행운 행위 향기 향상 향수 허락 허용 헬기 현관 현금 현대 현상 현실 현장 현재 현지 혈액 협력 형부 형사 형수 형식 형제 형태 형편 혜택 호기심 호남 호랑이 호박 호텔 호흡 혹시 홀로 홈페이지 홍보 홍수 홍차 화면 화분 화살 화요일 화장 화학 확보 확인 확장 확정 환갑 환경 환영 환율 환자 활기 활동 활발히 활용 활짝 회견 회관 회복 회색 회원 회장 회전 횟수 횡단보도 효율적 후반 후춧가루 훈련 훨씬 휴식 휴일 흉내 흐름 흑백 흑인 흔적 흔히 흥미 흥분 희곡 희망 희생 흰색 힘껏 ================================================ FILE: crates/anychain-kms/src/bip39/langs/spanish.txt ================================================ ábaco abdomen abeja abierto abogado abono aborto abrazo abrir abuelo abuso acabar academia acceso acción aceite acelga acento aceptar ácido aclarar acné acoger acoso activo acto actriz actuar acudir acuerdo acusar adicto admitir adoptar adorno aduana adulto aéreo afectar afición afinar afirmar ágil agitar agonía agosto agotar agregar agrio agua agudo águila aguja ahogo ahorro aire aislar ajedrez ajeno ajuste alacrán alambre alarma alba álbum alcalde aldea alegre alejar alerta aleta alfiler alga algodón aliado aliento alivio alma almeja almíbar altar alteza altivo alto altura alumno alzar amable amante amapola amargo amasar ámbar ámbito ameno amigo amistad amor amparo amplio ancho anciano ancla andar andén anemia ángulo anillo ánimo anís anotar antena antiguo antojo anual anular anuncio añadir añejo año apagar aparato apetito apio aplicar apodo aporte apoyo aprender aprobar apuesta apuro arado araña arar árbitro árbol arbusto archivo arco arder ardilla arduo área árido aries armonía arnés aroma arpa arpón arreglo arroz arruga arte artista asa asado asalto ascenso asegurar aseo asesor asiento asilo asistir asno asombro áspero astilla astro astuto asumir asunto atajo ataque atar atento ateo ático atleta átomo atraer atroz atún audaz audio auge aula aumento ausente autor aval avance avaro ave avellana avena avestruz avión aviso ayer ayuda ayuno azafrán azar azote azúcar azufre azul baba babor bache bahía baile bajar balanza balcón balde bambú banco banda baño barba barco barniz barro báscula bastón basura batalla batería batir batuta baúl bazar bebé bebida bello besar beso bestia bicho bien bingo blanco bloque blusa boa bobina bobo boca bocina boda bodega boina bola bolero bolsa bomba bondad bonito bono bonsái borde borrar bosque bote botín bóveda bozal bravo brazo brecha breve brillo brinco brisa broca broma bronce brote bruja brusco bruto buceo bucle bueno buey bufanda bufón búho buitre bulto burbuja burla burro buscar butaca buzón caballo cabeza cabina cabra cacao cadáver cadena caer café caída caimán caja cajón cal calamar calcio caldo calidad calle calma calor calvo cama cambio camello camino campo cáncer candil canela canguro canica canto caña cañón caoba caos capaz capitán capote captar capucha cara carbón cárcel careta carga cariño carne carpeta carro carta casa casco casero caspa castor catorce catre caudal causa cazo cebolla ceder cedro celda célebre celoso célula cemento ceniza centro cerca cerdo cereza cero cerrar certeza césped cetro chacal chaleco champú chancla chapa charla chico chiste chivo choque choza chuleta chupar ciclón ciego cielo cien cierto cifra cigarro cima cinco cine cinta ciprés circo ciruela cisne cita ciudad clamor clan claro clase clave cliente clima clínica cobre cocción cochino cocina coco código codo cofre coger cohete cojín cojo cola colcha colegio colgar colina collar colmo columna combate comer comida cómodo compra conde conejo conga conocer consejo contar copa copia corazón corbata corcho cordón corona correr coser cosmos costa cráneo cráter crear crecer creído crema cría crimen cripta crisis cromo crónica croqueta crudo cruz cuadro cuarto cuatro cubo cubrir cuchara cuello cuento cuerda cuesta cueva cuidar culebra culpa culto cumbre cumplir cuna cuneta cuota cupón cúpula curar curioso curso curva cutis dama danza dar dardo dátil deber débil década decir dedo defensa definir dejar delfín delgado delito demora denso dental deporte derecho derrota desayuno deseo desfile desnudo destino desvío detalle detener deuda día diablo diadema diamante diana diario dibujo dictar diente dieta diez difícil digno dilema diluir dinero directo dirigir disco diseño disfraz diva divino doble doce dolor domingo don donar dorado dormir dorso dos dosis dragón droga ducha duda duelo dueño dulce dúo duque durar dureza duro ébano ebrio echar eco ecuador edad edición edificio editor educar efecto eficaz eje ejemplo elefante elegir elemento elevar elipse élite elixir elogio eludir embudo emitir emoción empate empeño empleo empresa enano encargo enchufe encía enemigo enero enfado enfermo engaño enigma enlace enorme enredo ensayo enseñar entero entrar envase envío época equipo erizo escala escena escolar escribir escudo esencia esfera esfuerzo espada espejo espía esposa espuma esquí estar este estilo estufa etapa eterno ética etnia evadir evaluar evento evitar exacto examen exceso excusa exento exigir exilio existir éxito experto explicar exponer extremo fábrica fábula fachada fácil factor faena faja falda fallo falso faltar fama familia famoso faraón farmacia farol farsa fase fatiga fauna favor fax febrero fecha feliz feo feria feroz fértil fervor festín fiable fianza fiar fibra ficción ficha fideo fiebre fiel fiera fiesta figura fijar fijo fila filete filial filtro fin finca fingir finito firma flaco flauta flecha flor flota fluir flujo flúor fobia foca fogata fogón folio folleto fondo forma forro fortuna forzar fosa foto fracaso frágil franja frase fraude freír freno fresa frío frito fruta fuego fuente fuerza fuga fumar función funda furgón furia fusil fútbol futuro gacela gafas gaita gajo gala galería gallo gamba ganar gancho ganga ganso garaje garza gasolina gastar gato gavilán gemelo gemir gen género genio gente geranio gerente germen gesto gigante gimnasio girar giro glaciar globo gloria gol golfo goloso golpe goma gordo gorila gorra gota goteo gozar grada gráfico grano grasa gratis grave grieta grillo gripe gris grito grosor grúa grueso grumo grupo guante guapo guardia guerra guía guiño guion guiso guitarra gusano gustar haber hábil hablar hacer hacha hada hallar hamaca harina haz hazaña hebilla hebra hecho helado helio hembra herir hermano héroe hervir hielo hierro hígado higiene hijo himno historia hocico hogar hoguera hoja hombre hongo honor honra hora hormiga horno hostil hoyo hueco huelga huerta hueso huevo huida huir humano húmedo humilde humo hundir huracán hurto icono ideal idioma ídolo iglesia iglú igual ilegal ilusión imagen imán imitar impar imperio imponer impulso incapaz índice inerte infiel informe ingenio inicio inmenso inmune innato insecto instante interés íntimo intuir inútil invierno ira iris ironía isla islote jabalí jabón jamón jarabe jardín jarra jaula jazmín jefe jeringa jinete jornada joroba joven joya juerga jueves juez jugador jugo juguete juicio junco jungla junio juntar júpiter jurar justo juvenil juzgar kilo koala labio lacio lacra lado ladrón lagarto lágrima laguna laico lamer lámina lámpara lana lancha langosta lanza lápiz largo larva lástima lata látex latir laurel lavar lazo leal lección leche lector leer legión legumbre lejano lengua lento leña león leopardo lesión letal letra leve leyenda libertad libro licor líder lidiar lienzo liga ligero lima límite limón limpio lince lindo línea lingote lino linterna líquido liso lista litera litio litro llaga llama llanto llave llegar llenar llevar llorar llover lluvia lobo loción loco locura lógica logro lombriz lomo lonja lote lucha lucir lugar lujo luna lunes lupa lustro luto luz maceta macho madera madre maduro maestro mafia magia mago maíz maldad maleta malla malo mamá mambo mamut manco mando manejar manga maniquí manjar mano manso manta mañana mapa máquina mar marco marea marfil margen marido mármol marrón martes marzo masa máscara masivo matar materia matiz matriz máximo mayor mazorca mecha medalla medio médula mejilla mejor melena melón memoria menor mensaje mente menú mercado merengue mérito mes mesón meta meter método metro mezcla miedo miel miembro miga mil milagro militar millón mimo mina minero mínimo minuto miope mirar misa miseria misil mismo mitad mito mochila moción moda modelo moho mojar molde moler molino momento momia monarca moneda monja monto moño morada morder moreno morir morro morsa mortal mosca mostrar motivo mover móvil mozo mucho mudar mueble muela muerte muestra mugre mujer mula muleta multa mundo muñeca mural muro músculo museo musgo música muslo nácar nación nadar naipe naranja nariz narrar nasal natal nativo natural náusea naval nave navidad necio néctar negar negocio negro neón nervio neto neutro nevar nevera nicho nido niebla nieto niñez niño nítido nivel nobleza noche nómina noria norma norte nota noticia novato novela novio nube nuca núcleo nudillo nudo nuera nueve nuez nulo número nutria oasis obeso obispo objeto obra obrero observar obtener obvio oca ocaso océano ochenta ocho ocio ocre octavo octubre oculto ocupar ocurrir odiar odio odisea oeste ofensa oferta oficio ofrecer ogro oído oír ojo ola oleada olfato olivo olla olmo olor olvido ombligo onda onza opaco opción ópera opinar oponer optar óptica opuesto oración orador oral órbita orca orden oreja órgano orgía orgullo oriente origen orilla oro orquesta oruga osadía oscuro osezno oso ostra otoño otro oveja óvulo óxido oxígeno oyente ozono pacto padre paella página pago país pájaro palabra palco paleta pálido palma paloma palpar pan panal pánico pantera pañuelo papá papel papilla paquete parar parcela pared parir paro párpado parque párrafo parte pasar paseo pasión paso pasta pata patio patria pausa pauta pavo payaso peatón pecado pecera pecho pedal pedir pegar peine pelar peldaño pelea peligro pellejo pelo peluca pena pensar peñón peón peor pepino pequeño pera percha perder pereza perfil perico perla permiso perro persona pesa pesca pésimo pestaña pétalo petróleo pez pezuña picar pichón pie piedra pierna pieza pijama pilar piloto pimienta pino pintor pinza piña piojo pipa pirata pisar piscina piso pista pitón pizca placa plan plata playa plaza pleito pleno plomo pluma plural pobre poco poder podio poema poesía poeta polen policía pollo polvo pomada pomelo pomo pompa poner porción portal posada poseer posible poste potencia potro pozo prado precoz pregunta premio prensa preso previo primo príncipe prisión privar proa probar proceso producto proeza profesor programa prole promesa pronto propio próximo prueba público puchero pudor pueblo puerta puesto pulga pulir pulmón pulpo pulso puma punto puñal puño pupa pupila puré quedar queja quemar querer queso quieto química quince quitar rábano rabia rabo ración radical raíz rama rampa rancho rango rapaz rápido rapto rasgo raspa rato rayo raza razón reacción realidad rebaño rebote recaer receta rechazo recoger recreo recto recurso red redondo reducir reflejo reforma refrán refugio regalo regir regla regreso rehén reino reír reja relato relevo relieve relleno reloj remar remedio remo rencor rendir renta reparto repetir reposo reptil res rescate resina respeto resto resumen retiro retorno retrato reunir revés revista rey rezar rico riego rienda riesgo rifa rígido rigor rincón riñón río riqueza risa ritmo rito rizo roble roce rociar rodar rodeo rodilla roer rojizo rojo romero romper ron ronco ronda ropa ropero rosa rosca rostro rotar rubí rubor rudo rueda rugir ruido ruina ruleta rulo rumbo rumor ruptura ruta rutina sábado saber sabio sable sacar sagaz sagrado sala saldo salero salir salmón salón salsa salto salud salvar samba sanción sandía sanear sangre sanidad sano santo sapo saque sardina sartén sastre satán sauna saxofón sección seco secreto secta sed seguir seis sello selva semana semilla senda sensor señal señor separar sepia sequía ser serie sermón servir sesenta sesión seta setenta severo sexo sexto sidra siesta siete siglo signo sílaba silbar silencio silla símbolo simio sirena sistema sitio situar sobre socio sodio sol solapa soldado soledad sólido soltar solución sombra sondeo sonido sonoro sonrisa sopa soplar soporte sordo sorpresa sorteo sostén sótano suave subir suceso sudor suegra suelo sueño suerte sufrir sujeto sultán sumar superar suplir suponer supremo sur surco sureño surgir susto sutil tabaco tabique tabla tabú taco tacto tajo talar talco talento talla talón tamaño tambor tango tanque tapa tapete tapia tapón taquilla tarde tarea tarifa tarjeta tarot tarro tarta tatuaje tauro taza tazón teatro techo tecla técnica tejado tejer tejido tela teléfono tema temor templo tenaz tender tener tenis tenso teoría terapia terco término ternura terror tesis tesoro testigo tetera texto tez tibio tiburón tiempo tienda tierra tieso tigre tijera tilde timbre tímido timo tinta tío típico tipo tira tirón titán títere título tiza toalla tobillo tocar tocino todo toga toldo tomar tono tonto topar tope toque tórax torero tormenta torneo toro torpedo torre torso tortuga tos tosco toser tóxico trabajo tractor traer tráfico trago traje tramo trance trato trauma trazar trébol tregua treinta tren trepar tres tribu trigo tripa triste triunfo trofeo trompa tronco tropa trote trozo truco trueno trufa tubería tubo tuerto tumba tumor túnel túnica turbina turismo turno tutor ubicar úlcera umbral unidad unir universo uno untar uña urbano urbe urgente urna usar usuario útil utopía uva vaca vacío vacuna vagar vago vaina vajilla vale válido valle valor válvula vampiro vara variar varón vaso vecino vector vehículo veinte vejez vela velero veloz vena vencer venda veneno vengar venir venta venus ver verano verbo verde vereda verja verso verter vía viaje vibrar vicio víctima vida vídeo vidrio viejo viernes vigor vil villa vinagre vino viñedo violín viral virgo virtud visor víspera vista vitamina viudo vivaz vivero vivir vivo volcán volumen volver voraz votar voto voz vuelo vulgar yacer yate yegua yema yerno yeso yodo yoga yogur zafiro zanja zapato zarza zona zorro zumo zurdo ================================================ FILE: crates/anychain-kms/src/bip39/language.rs ================================================ use super::util::{Bits, Bits11}; use super::ErrorKind; use rustc_hash::FxHashMap; pub struct WordMap { inner: FxHashMap<&'static str, Bits11>, } pub struct WordList { inner: Vec<&'static str>, } impl WordMap { pub fn get_bits(&self, word: &str) -> Result { match self.inner.get(word) { Some(n) => Ok(*n), None => Err(ErrorKind::InvalidWord)?, } } } impl WordList { pub fn get_word(&self, bits: Bits11) -> &'static str { self.inner[bits.bits() as usize] } pub fn get_words_by_prefix(&self, prefix: &str) -> &[&'static str] { let start = self.inner.binary_search(&prefix).unwrap_or_else(|idx| idx); let count = self.inner[start..] .iter() .take_while(|word| word.starts_with(prefix)) .count(); &self.inner[start..start + count] } } mod lazy { use super::{Bits11, WordList, WordMap}; use once_cell::sync::Lazy; /// lazy generation of the word list fn gen_wordlist(lang_words: &'static str) -> WordList { let inner: Vec<_> = lang_words.split_whitespace().collect(); debug_assert!(inner.len() == 2048, "Invalid wordlist length"); WordList { inner } } /// lazy generation of the word map fn gen_wordmap(wordlist: &WordList) -> WordMap { let inner = wordlist .inner .iter() .enumerate() .map(|(i, item)| (*item, Bits11::from(i as u16))) .collect(); WordMap { inner } } pub static WORDLIST_ENGLISH: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/english.txt"))); pub static WORDLIST_CHINESE_SIMPLIFIED: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/chinese_simplified.txt"))); #[cfg(feature = "chinese-traditional")] pub static WORDLIST_CHINESE_TRADITIONAL: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/chinese_traditional.txt"))); #[cfg(feature = "french")] pub static WORDLIST_FRENCH: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/french.txt"))); #[cfg(feature = "italian")] pub static WORDLIST_ITALIAN: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/italian.txt"))); #[cfg(feature = "japanese")] pub static WORDLIST_JAPANESE: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/japanese.txt"))); #[cfg(feature = "korean")] pub static WORDLIST_KOREAN: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/korean.txt"))); #[cfg(feature = "spanish")] pub static WORDLIST_SPANISH: Lazy = Lazy::new(|| gen_wordlist(include_str!("langs/spanish.txt"))); pub static WORDMAP_ENGLISH: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_ENGLISH)); pub static WORDMAP_CHINESE_SIMPLIFIED: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_CHINESE_SIMPLIFIED)); #[cfg(feature = "chinese-traditional")] pub static WORDMAP_CHINESE_TRADITIONAL: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_CHINESE_TRADITIONAL)); #[cfg(feature = "french")] pub static WORDMAP_FRENCH: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_FRENCH)); #[cfg(feature = "italian")] pub static WORDMAP_ITALIAN: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_ITALIAN)); #[cfg(feature = "japanese")] pub static WORDMAP_JAPANESE: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_JAPANESE)); #[cfg(feature = "korean")] pub static WORDMAP_KOREAN: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_KOREAN)); #[cfg(feature = "spanish")] pub static WORDMAP_SPANISH: Lazy = Lazy::new(|| gen_wordmap(&WORDLIST_SPANISH)); } /// The language determines which words will be used in a mnemonic phrase, but also indirectly /// determines the binary value of each word when a [`Mnemonic`][Mnemonic] is turned into a [`Seed`][Seed]. /// /// These are not of much use right now, and may even be removed from the crate, as there is no /// official language specified by the standard except English. /// /// [Mnemonic]: ./mnemonic/struct.Mnemonic.html /// [Seed]: ./seed/struct.Seed.html #[derive(Debug, Clone, Copy, PartialEq, Default)] pub enum Language { #[default] English, ChineseSimplified, #[cfg(feature = "chinese-traditional")] ChineseTraditional, #[cfg(feature = "french")] French, #[cfg(feature = "italian")] Italian, #[cfg(feature = "japanese")] Japanese, #[cfg(feature = "korean")] Korean, #[cfg(feature = "spanish")] Spanish, } impl Language { /// Construct a word list from its language code. Returns None /// if the language code is not valid or not supported. pub fn from_language_code(language_code: &str) -> Option { match &language_code.to_ascii_lowercase()[..] { "en" => Some(Language::English), #[cfg(feature = "chinese-simplified")] "zh-hans" => Some(Language::ChineseSimplified), #[cfg(feature = "chinese-simplified")] "zh-cn" => Some(Language::ChineseSimplified), #[cfg(feature = "chinese-traditional")] "zh-hant" => Some(Language::ChineseTraditional), #[cfg(feature = "chinese-traditional")] "zh-tw" => Some(Language::ChineseTraditional), #[cfg(feature = "french")] "fr" => Some(Language::French), #[cfg(feature = "italian")] "it" => Some(Language::Italian), #[cfg(feature = "japanese")] "ja" => Some(Language::Japanese), #[cfg(feature = "korean")] "ko" => Some(Language::Korean), #[cfg(feature = "spanish")] "es" => Some(Language::Spanish), _ => None, } } pub fn from_phrase(phrase: &str) -> Option { let mut iter = phrase.split_whitespace(); iter.next(); // skip the first word, which might not be included in the bip32 chinese wordlist. match iter.next() { Some(word) => { if lazy::WORDMAP_ENGLISH.get_bits(word).is_ok() { Some(Language::English) } else if lazy::WORDMAP_CHINESE_SIMPLIFIED.get_bits(word).is_ok() { Some(Language::ChineseSimplified) } else { None } } _ => None, } } /// Get the word list for this language pub fn wordlist(&self) -> &'static WordList { match *self { Language::English => &lazy::WORDLIST_ENGLISH, Language::ChineseSimplified => &lazy::WORDLIST_CHINESE_SIMPLIFIED, #[cfg(feature = "chinese-traditional")] Language::ChineseTraditional => &lazy::WORDLIST_CHINESE_TRADITIONAL, #[cfg(feature = "french")] Language::French => &lazy::WORDLIST_FRENCH, #[cfg(feature = "italian")] Language::Italian => &lazy::WORDLIST_ITALIAN, #[cfg(feature = "japanese")] Language::Japanese => &lazy::WORDLIST_JAPANESE, #[cfg(feature = "korean")] Language::Korean => &lazy::WORDLIST_KOREAN, #[cfg(feature = "spanish")] Language::Spanish => &lazy::WORDLIST_SPANISH, } } /// Get a WordMap that allows word -> index lookups in the word list /// /// The index of an individual word in the word list is used as the binary value of that word /// when the phrase is turned into a Seed pub fn wordmap(&self) -> &'static WordMap { match *self { Language::English => &lazy::WORDMAP_ENGLISH, Language::ChineseSimplified => &lazy::WORDMAP_CHINESE_SIMPLIFIED, #[cfg(feature = "chinese-traditional")] Language::ChineseTraditional => &lazy::WORDMAP_CHINESE_TRADITIONAL, #[cfg(feature = "french")] Language::French => &lazy::WORDMAP_FRENCH, #[cfg(feature = "italian")] Language::Italian => &lazy::WORDMAP_ITALIAN, #[cfg(feature = "japanese")] Language::Japanese => &lazy::WORDMAP_JAPANESE, #[cfg(feature = "korean")] Language::Korean => &lazy::WORDMAP_KOREAN, #[cfg(feature = "spanish")] Language::Spanish => &lazy::WORDMAP_SPANISH, } } } #[cfg(test)] mod test { use super::lazy; use super::Language; use super::WordList; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn words_by_prefix() { let wl = &lazy::WORDLIST_ENGLISH; let res = wl.get_words_by_prefix("woo"); assert_eq!(res, ["wood", "wool"]); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn all_words_by_prefix() { let wl = &lazy::WORDLIST_ENGLISH; let res = wl.get_words_by_prefix(""); assert_eq!(res.len(), 2048); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn words_by_invalid_prefix() { let wl = &lazy::WORDLIST_ENGLISH; let res = wl.get_words_by_prefix("woof"); assert!(res.is_empty()); } fn is_wordlist_nfkd(wl: &WordList) -> bool { for idx in 0..2047 { let word = wl.get_word(idx.into()); if !unicode_normalization::is_nfkd(word) { return false; } } true } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "chinese-simplified")] fn chinese_simplified_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_CHINESE_SIMPLIFIED)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "chinese-traditional")] fn chinese_traditional_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_CHINESE_TRADITIONAL)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "french")] fn french_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_FRENCH)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "italian")] fn italian_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_ITALIAN)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "japanese")] fn japanese_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_JAPANESE)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "korean")] fn korean_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_KOREAN)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "spanish")] fn spanish_wordlist_is_nfkd() { assert!(is_wordlist_nfkd(&lazy::WORDLIST_SPANISH)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn from_language_code_en() { assert_eq!( Language::from_language_code("En").expect("en is a valid language"), Language::English ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "chinese-simplified")] fn from_language_code_cn_hans() { assert_eq!( Language::from_language_code("Zh-Hans").expect("zh-hans is a valid language"), Language::ChineseSimplified ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "chinese-traditional")] fn from_language_code_cn_hant() { assert_eq!( Language::from_language_code("zh-hanT").expect("zh-hant is a valid language"), Language::ChineseTraditional ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "french")] fn from_language_code_fr() { assert_eq!( Language::from_language_code("fr").expect("fr is a valid language"), Language::French ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "italian")] fn from_language_code_it() { assert_eq!( Language::from_language_code("It").expect("it is a valid language"), Language::Italian ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "japanese")] fn from_language_code_ja() { assert_eq!( Language::from_language_code("Ja").expect("ja is a valid language"), Language::Japanese ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "korean")] fn from_language_code_ko() { assert_eq!( Language::from_language_code("kO").expect("ko is a valid language"), Language::Korean ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "spanish")] fn from_language_code_es() { assert_eq!( Language::from_language_code("ES").expect("es is a valid language"), Language::Spanish ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn from_invalid_language_code() { assert_eq!(Language::from_language_code("not a real language"), None); } #[test] fn test_ffrom_phrase() { let language = Language::from_phrase( "heavy face learn track claw jaguar pigeon uncle seven enough glow where", ); assert_eq!(Some(Language::English), language); } } ================================================ FILE: crates/anychain-kms/src/bip39/mnemonic.rs ================================================ use super::crypto::{gen_random_bytes, sha256_first_byte}; use super::util::{checksum, BitWriter, IterExt}; use super::ErrorKind; use super::Language; use super::MnemonicType; use anyhow::Error; use encoding::{all::GB18030, EncoderTrap, Encoding}; use std::fmt; use std::mem; use unicode_normalization::UnicodeNormalization; use zeroize::Zeroizing; /// The primary type in this crate, most tasks require creating or using one. /// /// To create a *new* [`Mnemonic`][Mnemonic] from a randomly generated key, call [`Mnemonic::new()`][Mnemonic::new()]. /// /// To get a [`Mnemonic`][Mnemonic] instance for an existing mnemonic phrase, including /// those generated by other software or hardware wallets, use [`Mnemonic::from_phrase()`][Mnemonic::from_phrase()]. /// /// You can get the HD wallet [`Seed`][Seed] from a [`Mnemonic`][Mnemonic] by calling [`Seed::new()`][Seed::new()]. /// From there you can either get the raw byte value with [`Seed::as_bytes()`][Seed::as_bytes()], or the hex /// representation using Rust formatting: `format!("{:X}", seed)`. /// /// You can also get the original entropy value back from a [`Mnemonic`][Mnemonic] with [`Mnemonic::entropy()`][Mnemonic::entropy()], /// but beware that the entropy value is **not the same thing** as an HD wallet seed, and should /// *never* be used that way. /// /// [`Mnemonic`][Mnemonic] implements Zeroize, so it's bytes will be zeroed when it's dropped. /// /// [Mnemonic]: ./mnemonic/struct.Mnemonic.html /// [Mnemonic::new()]: ./mnemonic/struct.Mnemonic.html#method.new /// [Mnemonic::from_phrase()]: ./mnemonic/struct.Mnemonic.html#method.from_phrase /// [Mnemonic::entropy()]: ./mnemonic/struct.Mnemonic.html#method.entropy /// [Seed]: ./seed/struct.Seed.html /// [Seed::new()]: ./seed/struct.Seed.html#method.new /// [Seed::as_bytes()]: ./seed/struct.Seed.html#method.as_bytes /// #[derive(Clone)] pub struct Mnemonic { phrase: Zeroizing, lang: Language, entropy: Zeroizing>, } impl Mnemonic { /// Generates a new [`Mnemonic`][Mnemonic] /// /// Use [`Mnemonic::phrase()`][Mnemonic::phrase()] to get an `str` slice of the generated phrase. /// /// # Example /// /// ``` /// use crate::anychain_kms::bip39::{Mnemonic, MnemonicType, Language}; /// /// let mnemonic = Mnemonic::new(MnemonicType::Words12, Language::English); /// let phrase = mnemonic.phrase(); /// /// println!("phrase: {}", phrase); /// /// assert_eq!(phrase.split(" ").count(), 12); /// ``` /// /// [Mnemonic]: ./mnemonic/struct.Mnemonic.html /// [Mnemonic::phrase()]: ./mnemonic/struct.Mnemonic.html#method.phrase pub fn new(mtype: MnemonicType, lang: Language) -> Mnemonic { let entropy = gen_random_bytes(mtype.entropy_bits() / 8); Mnemonic::from_entropy_unchecked(entropy, lang) } /// Create a [`Mnemonic`][Mnemonic] from pre-generated entropy /// /// # Example /// /// ``` /// use crate::anychain_kms::bip39::{Mnemonic, MnemonicType, Language}; /// /// let entropy = &[0x33, 0xE4, 0x6B, 0xB1, 0x3A, 0x74, 0x6E, 0xA4, 0x1C, 0xDD, 0xE4, 0x5C, 0x90, 0x84, 0x6A, 0x79]; /// let mnemonic = Mnemonic::from_entropy(entropy, Language::English).unwrap(); /// /// assert_eq!("crop cash unable insane eight faith inflict route frame loud box vibrant", mnemonic.phrase()); /// assert_eq!("33E46BB13A746EA41CDDE45C90846A79", format!("{:X}", mnemonic)); /// ``` /// /// [Mnemonic]: ../mnemonic/struct.Mnemonic.html pub fn from_entropy(entropy: &[u8], lang: Language) -> Result { // Validate entropy size MnemonicType::for_key_size(entropy.len() * 8)?; Ok(Self::from_entropy_unchecked(entropy, lang)) } fn from_entropy_unchecked(entropy: E, lang: Language) -> Mnemonic where E: Into>, { let entropy = Zeroizing::new(entropy.into()); let wordlist = lang.wordlist(); let checksum_byte = sha256_first_byte(&entropy); // First, create a byte iterator for the given entropy and the first byte of the // hash of the entropy that will serve as the checksum (up to 8 bits for biggest // entropy source). // // Then we transform that into a bits iterator that returns 11 bits at a // time (as u16), which we can map to the words on the `wordlist`. // // Given the entropy is of correct size, this ought to give us the correct word // count. let phrase = Zeroizing::new( entropy .iter() .chain(Some(&checksum_byte)) .bits() .map(|bits| wordlist.get_word(bits)) .join(" "), ); Mnemonic { phrase, lang, entropy, } } /// Create a [`Mnemonic`][Mnemonic] from an existing mnemonic phrase /// /// The phrase supplied will be checked for word length and validated according to the checksum /// specified in BIP0039 /// /// # Example /// /// ``` /// use crate::anychain_kms::bip39::{Mnemonic, Language}; /// /// let phrase = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); /// /// assert_eq!(phrase, mnemonic.phrase()); /// ``` /// /// [Mnemonic]: ../mnemonic/struct.Mnemonic.html pub fn from_phrase(phrase: &str, lang: Language) -> Result { let phrase = Zeroizing::new( phrase .split_whitespace() .map(|w| w.nfkd()) .join::(" "), ); // this also validates the checksum and phrase length before returning the entropy so we // can store it. We don't use the validate function here to avoid having a public API that // takes a phrase string and returns the entropy directly. let entropy = Zeroizing::new(Mnemonic::phrase_to_entropy(&phrase, lang)?); let mnemonic = Mnemonic { phrase, lang, entropy, }; Ok(mnemonic) } /// Validate a mnemonic phrase /// /// The phrase supplied will be checked for word length and validated according to the checksum /// specified in BIP0039. /// /// # Example /// /// ``` /// use crate::anychain_kms::bip39::{Mnemonic, Language}; /// /// let test_mnemonic = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// assert!(Mnemonic::validate(test_mnemonic, Language::English).is_ok()); /// ``` pub fn validate(phrase: &str, lang: Language) -> Result<(), Error> { Mnemonic::phrase_to_entropy(phrase, lang)?; Ok(()) } /// Calculate the checksum, verify it and return the entropy /// /// Only intended for internal use, as returning a `Vec` that looks a bit like it could be /// used as the seed is likely to cause problems for someone eventually. All the other functions /// that return something like that are explicit about what it is and what to use it for. fn phrase_to_entropy(phrase: &str, lang: Language) -> Result, Error> { let wordmap = lang.wordmap(); // Preallocate enough space for the longest possible word list let mut bits = BitWriter::with_capacity(264); for word in phrase.split(' ') { bits.push(wordmap.get_bits(word)?); } let mtype = MnemonicType::for_word_count(bits.len() / 11)?; debug_assert!( bits.len() == mtype.total_bits(), "Insufficient amount of bits to validate" ); let mut entropy = bits.into_bytes(); let entropy_bytes = mtype.entropy_bits() / 8; let actual_checksum = checksum(entropy[entropy_bytes], mtype.checksum_bits()); // Truncate to get rid of the byte containing the checksum entropy.truncate(entropy_bytes); let checksum_byte = sha256_first_byte(&entropy); let expected_checksum = checksum(checksum_byte, mtype.checksum_bits()); if actual_checksum != expected_checksum { Err(ErrorKind::InvalidChecksum)?; } Ok(entropy) } /// Get the mnemonic phrase as a string reference. pub fn phrase(&self) -> &str { &self.phrase } /// Consume the `Mnemonic` and return the phrase as a `String`. pub fn into_phrase(mut self) -> String { // Create an empty string and swap values with the mnemonic's phrase. // This allows `Mnemonic` to implement `Drop`, while still returning the phrase. mem::take(&mut self.phrase) } /// Get the original entropy value of the mnemonic phrase as a slice. /// /// # Example /// /// ``` /// use crate::anychain_kms::bip39::{Mnemonic, Language}; /// /// let phrase = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); /// /// let entropy: &[u8] = mnemonic.entropy(); /// ``` /// /// **Note:** You shouldn't use the generated entropy as secrets, for that generate a new /// `Seed` from the `Mnemonic`. pub fn entropy(&self) -> &[u8] { &self.entropy } /// Get the [`Language`][Language] /// /// [Language]: ../language/struct.Language.html pub fn language(&self) -> Language { self.lang } pub fn as_bytes(&self) -> Vec { match self.lang { Language::ChineseSimplified => { GB18030.encode(self.phrase(), EncoderTrap::Strict).unwrap() } _ => self.phrase().as_bytes().to_vec(), } } } impl AsRef for Mnemonic { fn as_ref(&self) -> &str { self.phrase() } } impl fmt::Display for Mnemonic { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(self.phrase(), f) } } impl fmt::Debug for Mnemonic { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(self.phrase(), f) } } impl fmt::LowerHex for Mnemonic { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if f.alternate() { f.write_str("0x")?; } for byte in self.entropy() { write!(f, "{:02x}", byte)?; } Ok(()) } } impl fmt::UpperHex for Mnemonic { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if f.alternate() { f.write_str("0x")?; } for byte in self.entropy() { write!(f, "{:02X}", byte)?; } Ok(()) } } impl From for String { fn from(val: Mnemonic) -> String { val.into_phrase() } } #[cfg(test)] mod test { use super::*; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn back_to_back() { let m1 = Mnemonic::new(MnemonicType::Words12, Language::English); let m2 = Mnemonic::from_phrase(m1.phrase(), Language::English).unwrap(); let m3 = Mnemonic::from_entropy(m1.entropy(), Language::English).unwrap(); assert_eq!(m1.entropy(), m2.entropy(), "Entropy must be the same"); assert_eq!(m1.entropy(), m3.entropy(), "Entropy must be the same"); assert_eq!(m1.phrase(), m2.phrase(), "Phrase must be the same"); assert_eq!(m1.phrase(), m3.phrase(), "Phrase must be the same"); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn mnemonic_from_entropy() { let entropy = &[ 0x33, 0xE4, 0x6B, 0xB1, 0x3A, 0x74, 0x6E, 0xA4, 0x1C, 0xDD, 0xE4, 0x5C, 0x90, 0x84, 0x6A, 0x79, ]; let phrase = "crop cash unable insane eight faith inflict route frame loud box vibrant"; let mnemonic = Mnemonic::from_entropy(entropy, Language::English).unwrap(); assert_eq!(phrase, mnemonic.phrase()); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn mnemonic_from_phrase() { let entropy = &[ 0x33, 0xE4, 0x6B, 0xB1, 0x3A, 0x74, 0x6E, 0xA4, 0x1C, 0xDD, 0xE4, 0x5C, 0x90, 0x84, 0x6A, 0x79, ]; let phrase = "crop cash unable insane eight faith inflict route frame loud box vibrant"; let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); assert_eq!(entropy, mnemonic.entropy()); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn mnemonic_format() { let mnemonic = Mnemonic::new(MnemonicType::Words15, Language::English); assert_eq!(mnemonic.phrase(), format!("{}", mnemonic)); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn mnemonic_hex_format() { let entropy = &[ 0x03, 0xE4, 0x6B, 0xB1, 0x3A, 0x74, 0x6E, 0xA4, 0x1C, 0xDD, 0xE4, 0x5C, 0x90, 0x84, 0x6A, 0x79, ]; let mnemonic = Mnemonic::from_entropy(entropy, Language::English).unwrap(); assert_eq!( format!("{:x}", mnemonic), "03e46bb13a746ea41cdde45c90846a79" ); assert_eq!( format!("{:X}", mnemonic), "03E46BB13A746EA41CDDE45C90846A79" ); assert_eq!( format!("{:#x}", mnemonic), "0x03e46bb13a746ea41cdde45c90846a79" ); assert_eq!( format!("{:#X}", mnemonic), "0x03E46BB13A746EA41CDDE45C90846A79" ); } } ================================================ FILE: crates/anychain-kms/src/bip39/mnemonic_type.rs ================================================ use super::ErrorKind; use anyhow::Error; use std::fmt; const ENTROPY_OFFSET: usize = 8; /// Determines the number of words that will be present in a [`Mnemonic`][Mnemonic] phrase /// /// Also directly affects the amount of entropy that will be used to create a [`Mnemonic`][Mnemonic], /// and therefore the cryptographic strength of the HD wallet keys/addresses that can be derived from /// it using the [`Seed`][Seed]. /// /// For example, a 12 word mnemonic phrase is essentially a friendly representation of a 128-bit key, /// while a 24 word mnemonic phrase is essentially a 256-bit key. /// /// If you know you want a specific phrase length, you can use the enum variant directly, for example /// `MnemonicType::Words12`. /// /// You can also get a `MnemonicType` that corresponds to one of the standard BIP39 key sizes by /// passing arbitrary `usize` values: /// /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let mnemonic_type = MnemonicType::for_key_size(128).unwrap(); /// ``` /// /// [MnemonicType]: ../mnemonic_type/struct.MnemonicType.html /// [Mnemonic]: ../mnemonic/struct.Mnemonic.html /// [Seed]: ../seed/struct.Seed.html /// #[derive(Debug, Copy, Clone, Default)] pub enum MnemonicType { // ... = (entropy_bits << ...) | checksum_bits #[default] Words12 = (128 << ENTROPY_OFFSET) | 4, Words15 = (160 << ENTROPY_OFFSET) | 5, Words18 = (192 << ENTROPY_OFFSET) | 6, Words21 = (224 << ENTROPY_OFFSET) | 7, Words24 = (256 << ENTROPY_OFFSET) | 8, } impl MnemonicType { /// Get a `MnemonicType` for a mnemonic phrase with a specific number of words /// /// Specifying a word count not provided for by the BIP39 standard will return an `Error` /// of kind `ErrorKind::InvalidWordLength`. /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let mnemonic_type = MnemonicType::for_word_count(12).unwrap(); /// ``` pub fn for_word_count(size: usize) -> Result { let mnemonic_type = match size { 12 => MnemonicType::Words12, 15 => MnemonicType::Words15, 18 => MnemonicType::Words18, 21 => MnemonicType::Words21, 24 => MnemonicType::Words24, _ => Err(ErrorKind::InvalidWordLength(size))?, }; Ok(mnemonic_type) } /// Get a `MnemonicType` for a mnemonic phrase representing the given key size as bits /// /// Specifying a key size not provided for by the BIP39 standard will return an `Error` /// of kind `ErrorKind::InvalidKeysize`. /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let mnemonic_type = MnemonicType::for_key_size(128).unwrap(); /// ``` pub fn for_key_size(size: usize) -> Result { let mnemonic_type = match size { 128 => MnemonicType::Words12, 160 => MnemonicType::Words15, 192 => MnemonicType::Words18, 224 => MnemonicType::Words21, 256 => MnemonicType::Words24, _ => Err(ErrorKind::InvalidKeysize(size))?, }; Ok(mnemonic_type) } /// Get a `MnemonicType` for an existing mnemonic phrase /// /// This can be used when you need information about a mnemonic phrase based on the number of /// words, for example you can get the entropy value using [`MnemonicType::entropy_bits`][MnemonicType::entropy_bits()]. /// /// Specifying a phrase that does not match one of the standard BIP39 phrase lengths will return /// an `Error` of kind `ErrorKind::InvalidWordLength`. The phrase will not be validated in any /// other way. /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let test_mnemonic = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// let mnemonic_type = MnemonicType::for_phrase(test_mnemonic).unwrap(); /// /// let entropy_bits = mnemonic_type.entropy_bits(); /// ``` /// /// [MnemonicType::entropy_bits()]: ./enum.MnemonicType.html#method.entropy_bits pub fn for_phrase(phrase: &str) -> Result { let word_count = phrase.split(' ').count(); Self::for_word_count(word_count) } /// Return the number of entropy+checksum bits /// /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let test_mnemonic = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// let mnemonic_type = MnemonicType::for_phrase(test_mnemonic).unwrap(); /// /// let total_bits = mnemonic_type.total_bits(); /// ``` pub fn total_bits(&self) -> usize { self.entropy_bits() + self.checksum_bits() as usize } /// Return the number of entropy bits /// /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let test_mnemonic = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// let mnemonic_type = MnemonicType::for_phrase(test_mnemonic).unwrap(); /// /// let entropy_bits = mnemonic_type.entropy_bits(); /// ``` pub fn entropy_bits(&self) -> usize { (*self as usize) >> ENTROPY_OFFSET } /// Return the number of checksum bits /// /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let test_mnemonic = "park remain person kitchen mule spell knee armed position rail grid ankle"; /// /// let mnemonic_type = MnemonicType::for_phrase(test_mnemonic).unwrap(); /// /// let checksum_bits = mnemonic_type.checksum_bits(); /// ``` pub fn checksum_bits(&self) -> u8 { (*self as usize) as u8 } /// Return the number of words /// /// /// # Example /// ``` /// use crate::anychain_kms::bip39::{MnemonicType}; /// /// let mnemonic_type = MnemonicType::Words12; /// /// let word_count = mnemonic_type.word_count(); /// ``` pub fn word_count(&self) -> usize { self.total_bits() / 11 } } impl fmt::Display for MnemonicType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!( f, "{} words ({}bits)", self.word_count(), self.entropy_bits() ) } } #[cfg(test)] mod test { use super::*; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn word_count() { assert_eq!(MnemonicType::Words12.word_count(), 12); assert_eq!(MnemonicType::Words15.word_count(), 15); assert_eq!(MnemonicType::Words18.word_count(), 18); assert_eq!(MnemonicType::Words21.word_count(), 21); assert_eq!(MnemonicType::Words24.word_count(), 24); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn entropy_bits() { assert_eq!(MnemonicType::Words12.entropy_bits(), 128); assert_eq!(MnemonicType::Words15.entropy_bits(), 160); assert_eq!(MnemonicType::Words18.entropy_bits(), 192); assert_eq!(MnemonicType::Words21.entropy_bits(), 224); assert_eq!(MnemonicType::Words24.entropy_bits(), 256); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] fn checksum_bits() { assert_eq!(MnemonicType::Words12.checksum_bits(), 4); assert_eq!(MnemonicType::Words15.checksum_bits(), 5); assert_eq!(MnemonicType::Words18.checksum_bits(), 6); assert_eq!(MnemonicType::Words21.checksum_bits(), 7); assert_eq!(MnemonicType::Words24.checksum_bits(), 8); } } ================================================ FILE: crates/anychain-kms/src/bip39/mod.rs ================================================ mod crypto; mod error; mod language; mod mnemonic; mod mnemonic_type; mod seed; mod util; pub use error::ErrorKind; pub use language::Language; pub use mnemonic::Mnemonic; pub use mnemonic_type::MnemonicType; pub use seed::Seed; /** * BIP39 standard test vectors * ref: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki#Test_vectors */ #[cfg(test)] mod test_mod { use super::*; use crate::bip32::{Prefix, XprvSecp256k1}; const VECTORS: [[&str;4];24] = [ [ "00000000000000000000000000000000", "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", "c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04", "xprv9s21ZrQH143K3h3fDYiay8mocZ3afhfULfb5GX8kCBdno77K4HiA15Tg23wpbeF1pLfs1c5SPmYHrEpTuuRhxMwvKDwqdKiGJS9XFKzUsAF" ], [ "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", "legal winner thank year wave sausage worth useful legal winner thank yellow", "2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607", "xprv9s21ZrQH143K2gA81bYFHqU68xz1cX2APaSq5tt6MFSLeXnCKV1RVUJt9FWNTbrrryem4ZckN8k4Ls1H6nwdvDTvnV7zEXs2HgPezuVccsq" ], [ "80808080808080808080808080808080", "letter advice cage absurd amount doctor acoustic avoid letter advice cage above", "d71de856f81a8acc65e6fc851a38d4d7ec216fd0796d0a6827a3ad6ed5511a30fa280f12eb2e47ed2ac03b5c462a0358d18d69fe4f985ec81778c1b370b652a8", "xprv9s21ZrQH143K2shfP28KM3nr5Ap1SXjz8gc2rAqqMEynmjt6o1qboCDpxckqXavCwdnYds6yBHZGKHv7ef2eTXy461PXUjBFQg6PrwY4Gzq" ], [ "ffffffffffffffffffffffffffffffff", "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong", "ac27495480225222079d7be181583751e86f571027b0497b5b5d11218e0a8a13332572917f0f8e5a589620c6f15b11c61dee327651a14c34e18231052e48c069", "xprv9s21ZrQH143K2V4oox4M8Zmhi2Fjx5XK4Lf7GKRvPSgydU3mjZuKGCTg7UPiBUD7ydVPvSLtg9hjp7MQTYsW67rZHAXeccqYqrsx8LcXnyd" ], [ "000000000000000000000000000000000000000000000000", "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon agent", "035895f2f481b1b0f01fcf8c289c794660b289981a78f8106447707fdd9666ca06da5a9a565181599b79f53b844d8a71dd9f439c52a3d7b3e8a79c906ac845fa", "xprv9s21ZrQH143K3mEDrypcZ2usWqFgzKB6jBBx9B6GfC7fu26X6hPRzVjzkqkPvDqp6g5eypdk6cyhGnBngbjeHTe4LsuLG1cCmKJka5SMkmU" ], [ "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal will", "f2b94508732bcbacbcc020faefecfc89feafa6649a5491b8c952cede496c214a0c7b3c392d168748f2d4a612bada0753b52a1c7ac53c1e93abd5c6320b9e95dd", "xprv9s21ZrQH143K3Lv9MZLj16np5GzLe7tDKQfVusBni7toqJGcnKRtHSxUwbKUyUWiwpK55g1DUSsw76TF1T93VT4gz4wt5RM23pkaQLnvBh7" ], [ "808080808080808080808080808080808080808080808080", "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter always", "107d7c02a5aa6f38c58083ff74f04c607c2d2c0ecc55501dadd72d025b751bc27fe913ffb796f841c49b1d33b610cf0e91d3aa239027f5e99fe4ce9e5088cd65", "xprv9s21ZrQH143K3VPCbxbUtpkh9pRG371UCLDz3BjceqP1jz7XZsQ5EnNkYAEkfeZp62cDNj13ZTEVG1TEro9sZ9grfRmcYWLBhCocViKEJae" ], [ "ffffffffffffffffffffffffffffffffffffffffffffffff", "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo when", "0cd6e5d827bb62eb8fc1e262254223817fd068a74b5b449cc2f667c3f1f985a76379b43348d952e2265b4cd129090758b3e3c2c49103b5051aac2eaeb890a528", "xprv9s21ZrQH143K36Ao5jHRVhFGDbLP6FCx8BEEmpru77ef3bmA928BxsqvVM27WnvvyfWywiFN8K6yToqMaGYfzS6Db1EHAXT5TuyCLBXUfdm" ], [ "0000000000000000000000000000000000000000000000000000000000000000", "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art", "bda85446c68413707090a52022edd26a1c9462295029f2e60cd7c4f2bbd3097170af7a4d73245cafa9c3cca8d561a7c3de6f5d4a10be8ed2a5e608d68f92fcc8", "xprv9s21ZrQH143K32qBagUJAMU2LsHg3ka7jqMcV98Y7gVeVyNStwYS3U7yVVoDZ4btbRNf4h6ibWpY22iRmXq35qgLs79f312g2kj5539ebPM" ], [ "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f", "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title", "bc09fca1804f7e69da93c2f2028eb238c227f2e9dda30cd63699232578480a4021b146ad717fbb7e451ce9eb835f43620bf5c514db0f8add49f5d121449d3e87", "xprv9s21ZrQH143K3Y1sd2XVu9wtqxJRvybCfAetjUrMMco6r3v9qZTBeXiBZkS8JxWbcGJZyio8TrZtm6pkbzG8SYt1sxwNLh3Wx7to5pgiVFU" ], [ "8080808080808080808080808080808080808080808080808080808080808080", "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless", "c0c519bd0e91a2ed54357d9d1ebef6f5af218a153624cf4f2da911a0ed8f7a09e2ef61af0aca007096df430022f7a2b6fb91661a9589097069720d015e4e982f", "xprv9s21ZrQH143K3CSnQNYC3MqAAqHwxeTLhDbhF43A4ss4ciWNmCY9zQGvAKUSqVUf2vPHBTSE1rB2pg4avopqSiLVzXEU8KziNnVPauTqLRo" ], [ "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote", "dd48c104698c30cfe2b6142103248622fb7bb0ff692eebb00089b32d22484e1613912f0a5b694407be899ffd31ed3992c456cdf60f5d4564b8ba3f05a69890ad", "xprv9s21ZrQH143K2WFF16X85T2QCpndrGwx6GueB72Zf3AHwHJaknRXNF37ZmDrtHrrLSHvbuRejXcnYxoZKvRquTPyp2JiNG3XcjQyzSEgqCB" ], [ "9e885d952ad362caeb4efe34a8e91bd2", "ozone drill grab fiber curtain grace pudding thank cruise elder eight picnic", "274ddc525802f7c828d8ef7ddbcdc5304e87ac3535913611fbbfa986d0c9e5476c91689f9c8a54fd55bd38606aa6a8595ad213d4c9c9f9aca3fb217069a41028", "xprv9s21ZrQH143K2oZ9stBYpoaZ2ktHj7jLz7iMqpgg1En8kKFTXJHsjxry1JbKH19YrDTicVwKPehFKTbmaxgVEc5TpHdS1aYhB2s9aFJBeJH" ], [ "6610b25967cdcca9d59875f5cb50b0ea75433311869e930b", "gravity machine north sort system female filter attitude volume fold club stay feature office ecology stable narrow fog", "628c3827a8823298ee685db84f55caa34b5cc195a778e52d45f59bcf75aba68e4d7590e101dc414bc1bbd5737666fbbef35d1f1903953b66624f910feef245ac", "xprv9s21ZrQH143K3uT8eQowUjsxrmsA9YUuQQK1RLqFufzybxD6DH6gPY7NjJ5G3EPHjsWDrs9iivSbmvjc9DQJbJGatfa9pv4MZ3wjr8qWPAK" ], [ "68a79eaca2324873eacc50cb9c6eca8cc68ea5d936f98787c60c7ebc74e6ce7c", "hamster diagram private dutch cause delay private meat slide toddler razor book happy fancy gospel tennis maple dilemma loan word shrug inflict delay length", "64c87cde7e12ecf6704ab95bb1408bef047c22db4cc7491c4271d170a1b213d20b385bc1588d9c7b38f1b39d415665b8a9030c9ec653d75e65f847d8fc1fc440", "xprv9s21ZrQH143K2XTAhys3pMNcGn261Fi5Ta2Pw8PwaVPhg3D8DWkzWQwjTJfskj8ofb81i9NP2cUNKxwjueJHHMQAnxtivTA75uUFqPFeWzk" ], [ "c0ba5a8e914111210f2bd131f3d5e08d", "scheme spot photo card baby mountain device kick cradle pact join borrow", "ea725895aaae8d4c1cf682c1bfd2d358d52ed9f0f0591131b559e2724bb234fca05aa9c02c57407e04ee9dc3b454aa63fbff483a8b11de949624b9f1831a9612", "xprv9s21ZrQH143K3FperxDp8vFsFycKCRcJGAFmcV7umQmcnMZaLtZRt13QJDsoS5F6oYT6BB4sS6zmTmyQAEkJKxJ7yByDNtRe5asP2jFGhT6" ], [ "6d9be1ee6ebd27a258115aad99b7317b9c8d28b6d76431c3", "horn tenant knee talent sponsor spell gate clip pulse soap slush warm silver nephew swap uncle crack brave", "fd579828af3da1d32544ce4db5c73d53fc8acc4ddb1e3b251a31179cdb71e853c56d2fcb11aed39898ce6c34b10b5382772db8796e52837b54468aeb312cfc3d", "xprv9s21ZrQH143K3R1SfVZZLtVbXEB9ryVxmVtVMsMwmEyEvgXN6Q84LKkLRmf4ST6QrLeBm3jQsb9gx1uo23TS7vo3vAkZGZz71uuLCcywUkt" ], [ "9f6a2878b2520799a44ef18bc7df394e7061a224d2c33cd015b157d746869863", "panda eyebrow bullet gorilla call smoke muffin taste mesh discover soft ostrich alcohol speed nation flash devote level hobby quick inner drive ghost inside", "72be8e052fc4919d2adf28d5306b5474b0069df35b02303de8c1729c9538dbb6fc2d731d5f832193cd9fb6aeecbc469594a70e3dd50811b5067f3b88b28c3e8d", "xprv9s21ZrQH143K2WNnKmssvZYM96VAr47iHUQUTUyUXH3sAGNjhJANddnhw3i3y3pBbRAVk5M5qUGFr4rHbEWwXgX4qrvrceifCYQJbbFDems" ], [ "23db8160a31d3e0dca3688ed941adbf3", "cat swing flag economy stadium alone churn speed unique patch report train", "deb5f45449e615feff5640f2e49f933ff51895de3b4381832b3139941c57b59205a42480c52175b6efcffaa58a2503887c1e8b363a707256bdd2b587b46541f5", "xprv9s21ZrQH143K4G28omGMogEoYgDQuigBo8AFHAGDaJdqQ99QKMQ5J6fYTMfANTJy6xBmhvsNZ1CJzRZ64PWbnTFUn6CDV2FxoMDLXdk95DQ" ], [ "8197a4a47f0425faeaa69deebc05ca29c0a5b5cc76ceacc0", "light rule cinnamon wrap drastic word pride squirrel upgrade then income fatal apart sustain crack supply proud access", "4cbdff1ca2db800fd61cae72a57475fdc6bab03e441fd63f96dabd1f183ef5b782925f00105f318309a7e9c3ea6967c7801e46c8a58082674c860a37b93eda02", "xprv9s21ZrQH143K3wtsvY8L2aZyxkiWULZH4vyQE5XkHTXkmx8gHo6RUEfH3Jyr6NwkJhvano7Xb2o6UqFKWHVo5scE31SGDCAUsgVhiUuUDyh" ], [ "066dca1a2bb7e8a1db2832148ce9933eea0f3ac9548d793112d9a95c9407efad", "all hour make first leader extend hole alien behind guard gospel lava path output census museum junior mass reopen famous sing advance salt reform", "26e975ec644423f4a4c4f4215ef09b4bd7ef924e85d1d17c4cf3f136c2863cf6df0a475045652c57eb5fb41513ca2a2d67722b77e954b4b3fc11f7590449191d", "xprv9s21ZrQH143K3rEfqSM4QZRVmiMuSWY9wugscmaCjYja3SbUD3KPEB1a7QXJoajyR2T1SiXU7rFVRXMV9XdYVSZe7JoUXdP4SRHTxsT1nzm" ], [ "f30f8c1da665478f49b001d94c5fc452", "vessel ladder alter error federal sibling chat ability sun glass valve picture", "2aaa9242daafcee6aa9d7269f17d4efe271e1b9a529178d7dc139cd18747090bf9d60295d0ce74309a78852a9caadf0af48aae1c6253839624076224374bc63f", "xprv9s21ZrQH143K2QWV9Wn8Vvs6jbqfF1YbTCdURQW9dLFKDovpKaKrqS3SEWsXCu6ZNky9PSAENg6c9AQYHcg4PjopRGGKmdD313ZHszymnps" ], [ "c10ec20dc3cd9f652c7fac2f1230f7a3c828389a14392f05", "scissors invite lock maple supreme raw rapid void congress muscle digital elegant little brisk hair mango congress clump", "7b4a10be9d98e6cba265566db7f136718e1398c71cb581e1b2f464cac1ceedf4f3e274dc270003c670ad8d02c4558b2f8e39edea2775c9e232c7cb798b069e88", "xprv9s21ZrQH143K4aERa2bq7559eMCCEs2QmmqVjUuzfy5eAeDX4mqZffkYwpzGQRE2YEEeLVRoH4CSHxianrFaVnMN2RYaPUZJhJx8S5j6puX" ], [ "f585c11aec520db57dd353c69554b21a89b20fb0650966fa0a9d6f74fd989d8f", "void come effort suffer camp survey warrior heavy shoot primary clutch crush open amazing screen patrol group space point ten exist slush involve unfold", "01f5bced59dec48e362f2c45b5de68b9fd6c92c6634f44d6d40aab69056506f0e35524a518034ddc1192e1dacd32c1ed3eaa3c3b131c88ed8e7e54c49a5d0998", "xprv9s21ZrQH143K39rnQJknpH1WEPFJrzmAqqasiDcVrNuk926oizzJDDQkdiTvNPr2FYDYzWgiMiC63YmfPAa2oPyNB23r2g7d1yiK6WpqaQS" ] ]; #[test] fn test_vectors() { VECTORS.iter().for_each(|item| { let mnemonic = Mnemonic::from_phrase(item[1], Language::English).unwrap(); let seed = Seed::new(&mnemonic, "TREZOR"); assert_eq!(item[0], hex::encode(mnemonic.entropy())); assert_eq!(item[1], mnemonic.phrase()); assert_eq!(item[2], format!("{:x}", seed)); let xprv = XprvSecp256k1::new(seed).unwrap(); assert_eq!(item[3], xprv.to_extended_key(Prefix::XPRV).to_string()); }) } } ================================================ FILE: crates/anychain-kms/src/bip39/seed.rs ================================================ use super::crypto::pbkdf2; use super::Mnemonic; use std::fmt; use unicode_normalization::UnicodeNormalization; use zeroize::Zeroize; /// The secret value used to derive HD wallet addresses from a [`Mnemonic`][Mnemonic] phrase. /// /// Because it is not possible to create a [`Mnemonic`][Mnemonic] instance that is invalid, it is /// therefore impossible to have a [`Seed`][Seed] instance that is invalid. This guarantees that only /// a valid, intact mnemonic phrase can be used to derive HD wallet addresses. /// /// To get the raw byte value use [`Seed::as_bytes()`][Seed::as_bytes()]. These can be used to derive /// HD wallet addresses using another crate (deriving HD wallet addresses is outside the scope of this /// crate and the BIP39 standard). /// /// [`Seed`][Seed] implements [`Zeroize`][Zeroize], so it's bytes will be zeroed when it's dropped. /// /// [Mnemonic]: ./mnemonic/struct.Mnemonic.html /// [Seed]: ./seed/struct.Seed.html /// [Seed::as_bytes()]: ./seed/struct.Seed.html#method.as_bytes #[derive(Clone)] pub struct Seed { bytes: Vec, } impl Seed { /// Generates the seed from the [`Mnemonic`][Mnemonic] and the password. /// /// [Mnemonic]: ./mnemonic/struct.Mnemonic.html pub fn new(mnemonic: &Mnemonic, password: &str) -> Self { let salt = format!("mnemonic{}", password); let normalized_salt = salt.nfkd().to_string(); let bytes = pbkdf2(&mnemonic.as_bytes(), &normalized_salt); Self { bytes } } /// Get the seed value as a byte slice pub fn as_bytes(&self) -> &[u8] { &self.bytes } } impl AsRef<[u8]> for Seed { fn as_ref(&self) -> &[u8] { self.as_bytes() } } impl fmt::Debug for Seed { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:#X}", self) } } impl fmt::LowerHex for Seed { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if f.alternate() { f.write_str("0x")?; } for byte in &self.bytes { write!(f, "{:02x}", byte)?; } Ok(()) } } impl fmt::UpperHex for Seed { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if f.alternate() { f.write_str("0x")?; } for byte in &self.bytes { write!(f, "{:02X}", byte)?; } Ok(()) } } impl Drop for Seed { fn drop(&mut self) { self.bytes.zeroize(); } } #[cfg(test)] mod test { use super::*; use crate::bip39::Language; #[cfg(target_arch = "wasm32")] use wasm_bindgen_test::*; #[test] fn seed_hex_format() { let entropy = &[ 0x33, 0xE4, 0x6B, 0xB1, 0x3A, 0x74, 0x6E, 0xA4, 0x1C, 0xDD, 0xE4, 0x5C, 0x90, 0x84, 0x6A, 0x79, ]; let mnemonic = Mnemonic::from_entropy(entropy, Language::English).unwrap(); let seed = Seed::new(&mnemonic, "password"); assert_eq!(format!("{:x}", seed), "0bde96f14c35a66235478e0c16c152fcaf6301e4d9a81d3febc50879fe7e5438e6a8dd3e39bdf3ab7b12d6b44218710e17d7a2844ee9633fab0e03d9a6c8569b"); assert_eq!(format!("{:X}", seed), "0BDE96F14C35A66235478E0C16C152FCAF6301E4D9A81D3FEBC50879FE7E5438E6A8DD3E39BDF3AB7B12D6B44218710E17D7A2844EE9633FAB0E03D9A6C8569B"); assert_eq!(format!("{:#x}", seed), "0x0bde96f14c35a66235478e0c16c152fcaf6301e4d9a81d3febc50879fe7e5438e6a8dd3e39bdf3ab7b12d6b44218710e17d7a2844ee9633fab0e03d9a6c8569b"); assert_eq!(format!("{:#X}", seed), "0x0BDE96F14C35A66235478E0C16C152FCAF6301E4D9A81D3FEBC50879FE7E5438E6A8DD3E39BDF3AB7B12D6B44218710E17D7A2844EE9633FAB0E03D9A6C8569B"); } fn test_unicode_normalization( lang: Language, phrase: &str, password: &str, expected_seed_hex: &str, ) { let mnemonic = Mnemonic::from_phrase(phrase, lang).unwrap(); let seed = Seed::new(&mnemonic, password); assert_eq!(format!("{:x}", seed), expected_seed_hex); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] /// Test vector is derived from https://github.com/infincia/bip39-rs/issues/26#issuecomment-586476647 #[cfg(feature = "spanish")] fn issue_26() { test_unicode_normalization( Language::Spanish, "camello pomelo toque oponer urgente lástima merengue cutis tirón pudor pomo barco", "el español se habla en muchos países", "67a2cf87b9d110dd5210275fd4d7a107a0a0dd9446e02f3822f177365786ae440b8873693c88f732834af90785753d989a367f7094230901b204c567718ce6be", ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] /// https://github.com/MetacoSA/NBitcoin/blob/master/NBitcoin.Tests/data/bip39_vectors.en.json fn password_is_unicode_normalized() { test_unicode_normalization( Language::English, "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about", "nullius à nym.zone ¹teſts² English", "61f3aa13adcf5f4b8661fc062501d67eca3a53fc0ed129076ad7a22983b6b5ed0e84e47b24cff23b7fca57e127f62f28c1584ed487872d4bfbc773257bdbc434", ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] /// https://github.com/bip32JP/bip32JP.github.io/commit/360c05a6439e5c461bbe5e84c7567ec38eb4ac5f #[cfg(feature = "japanese")] fn japanese_normalization_1() { test_unicode_normalization( Language::Japanese, "あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あいこくしん あおぞら", "㍍ガバヴァぱばぐゞちぢ十人十色", "a262d6fb6122ecf45be09c50492b31f92e9beb7d9a845987a02cefda57a15f9c467a17872029a9e92299b5cbdf306e3a0ee620245cbd508959b6cb7ca637bd55", ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "japanese")] fn japanese_normalization_2() { test_unicode_normalization( Language::Japanese, "うちゅう ふそく ひしょ がちょう うけもつ めいそう みかん そざい いばる うけとる さんま さこつ おうさま ぱんつ しひょう めした たはつ いちぶ つうじょう てさぎょう きつね みすえる いりぐち かめれおん", "㍍ガバヴァぱばぐゞちぢ十人十色", "346b7321d8c04f6f37b49fdf062a2fddc8e1bf8f1d33171b65074531ec546d1d3469974beccb1a09263440fc92e1042580a557fdce314e27ee4eabb25fa5e5fe", ); } #[cfg_attr(all(target_arch = "wasm32"), wasm_bindgen_test)] #[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg(feature = "french")] fn french_normalization() { test_unicode_normalization( Language::French, "paternel xénon curatif séparer docile capable exigence boulon styliste plexus surface embryon crayon gorge exister", "nullius à nym.zone ¹teſts² Français", "cff9ffd2b23549e73601db4129a334c81b28a40f0ee819b5d6a54c409999f0dfb6b89df17cae6408c96786165c205403d283baadc03ffdd391a490923b7d9493", ); } } ================================================ FILE: crates/anychain-kms/src/bip39/util.rs ================================================ use unicode_normalization::Decompositions; pub(crate) trait IterExt: Iterator { fn join(&mut self, glue: &str) -> R where R: From, Self::Item: Joinable, { let first = match self.next() { Some(first) => first, None => return String::new().into(), }; let (lower, _) = self.size_hint(); let mut buffer = String::with_capacity(lower * (10 + glue.len())); first.write_into(&mut buffer); for item in self { buffer.push_str(glue); item.write_into(&mut buffer); } buffer.into() } fn bits(self) -> BitIter where Out: Bits, Self::Item: Bits, Self: Sized, { BitIter::new(self) } } pub(crate) trait Joinable { fn write_into(self, buf: &mut String); } /// Allow iterator joining on str slices impl Joinable for &str { fn write_into(self, buf: &mut String) { buf.push_str(self); } } /// Allow iterator joining on unicode_normalization iterators impl> Joinable for Decompositions { fn write_into(self, buf: &mut String) { buf.extend(self); } } impl IterExt for I {} pub(crate) trait Bits { const SIZE: usize; fn bits(self) -> u32; } impl Bits for u8 { const SIZE: usize = 8; fn bits(self) -> u32 { self as u32 } } impl Bits for &u8 { const SIZE: usize = 8; fn bits(self) -> u32 { *self as u32 } } #[derive(Clone, Copy, Debug)] pub struct Bits11(u16); impl Bits for Bits11 { const SIZE: usize = 11; fn bits(self) -> u32 { self.0 as u32 } } impl From for Bits11 { fn from(val: u16) -> Self { Bits11(val) } } impl From for u16 { fn from(val: Bits11) -> Self { val.0 } } pub(crate) struct BitWriter { offset: usize, remainder: u32, inner: Vec, } impl BitWriter { pub fn with_capacity(capacity: usize) -> Self { let mut bytes = capacity / 8; #[allow(clippy::manual_is_multiple_of)] if capacity % 8 != 0 { bytes += 1; } Self { offset: 0, remainder: 0, inner: Vec::with_capacity(bytes), } } pub fn push(&mut self, source: B) { let shift = 32 - B::SIZE; self.remainder |= (source.bits() << shift) >> self.offset; self.offset += B::SIZE; while self.offset >= 8 { self.inner.push((self.remainder >> 24) as u8); self.remainder <<= 8; self.offset -= 8; } } pub fn len(&self) -> usize { self.inner.len() * 8 + self.offset } pub fn into_bytes(mut self) -> Vec { if self.offset != 0 { self.inner.push((self.remainder >> 24) as u8); } self.inner } } pub(crate) struct BitIter + Sized> { _phantom: ::std::marker::PhantomData, source: I, read: usize, buffer: u64, } impl BitIter where In: Bits, Out: Bits, I: Iterator, { fn new(source: I) -> Self { let source = source; BitIter { _phantom: ::std::marker::PhantomData, source, read: 0, buffer: 0, } } } impl Iterator for BitIter where In: Bits, Out: Bits + From, I: Iterator, { type Item = Out; fn next(&mut self) -> Option { while self.read < Out::SIZE { let bits = self.source.next()?.bits() as u64; self.read += In::SIZE; self.buffer |= bits << (64 - self.read); } let result = (self.buffer >> (64 - Out::SIZE)) as u16; self.buffer <<= Out::SIZE; self.read -= Out::SIZE; Some(result.into()) } fn size_hint(&self) -> (usize, Option) { let (lower, upper) = self.source.size_hint(); ( (lower * In::SIZE) / Out::SIZE, upper.map(|n| (n * In::SIZE) / Out::SIZE), ) } } /// Extract the first `bits` from the `source` byte pub(crate) fn checksum(source: u8, bits: u8) -> u8 { debug_assert!(bits <= 8, "Can operate on 8-bit integers only"); source >> (8 - bits) } ================================================ FILE: crates/anychain-kms/src/crypto.rs ================================================ use hex; use ripemd::{Digest, Ripemd160}; pub fn ripemd(msg: &[u8]) -> String { // create a RIPEMD-160 hasher instance let mut hasher = Ripemd160::new(); // process input message //hasher.update(b"Hello world!"); hasher.update(msg); // acquire hash digest in the form of GenericArray, // which in this case is equivalent to [u8; 20] let result = hasher.finalize(); hex::encode(&result[..]) } ================================================ FILE: crates/anychain-kms/src/error.rs ================================================ #[derive(Debug, thiserror::Error)] pub enum Error { #[error("secp256k1 error")] Secp256k1Error(#[from] libsecp256k1::Error), } ================================================ FILE: crates/anychain-kms/src/lib.rs ================================================ #[cfg(feature = "alloc")] extern crate alloc; #[cfg(feature = "std")] extern crate std; pub mod bip32; pub mod bip39; pub mod crypto; pub mod error; use anychain_core::crypto::sha256; use anyhow::{anyhow, Result}; use bip32::PrivateKey; use curve25519_dalek::Scalar; use ed25519_dalek::{hazmat::ExpandedSecretKey, Signature}; use sha2::Sha512; pub fn secp256k1_sign(sk: &[u8], msg: &[u8]) -> Result<(Vec, u8)> { let sk = libsecp256k1::SecretKey::parse_slice(sk)?; let msg = libsecp256k1::Message::parse_slice(msg)?; let (sig, recid) = libsecp256k1::sign(&msg, &sk); Ok((sig.serialize().to_vec(), recid.into())) } pub fn ed25519_sign(sk: &[u8], msg: &[u8]) -> Result> { // tests can inject nonce bytes via ed25519_sign_inner let nonce = sha256(sk); ed25519_sign_inner(sk, msg, &nonce) } fn ed25519_sign_inner(sk: &[u8], msg: &[u8], nonce_bytes: &[u8]) -> Result> { let sk: [u8; 32] = sk .try_into() .map_err(|_| anyhow!("Invalid private key length".to_string()))?; /* * NOTE: We intentionally bypass the standard Ed25519 "clamping" process * (clearing the lowest 3 bits and specific MSB bits). * * In standard RFC 8032, clamping is required to prevent small-subgroup attacks. * However, clamping breaks the additivity of scalars, which is essential for * Hierarchical Deterministic (HD) wallets. By using raw scalars without clamping, * we enable "non-hardened derivation," allowing sub-public keys and addresses * to be derived directly from a parent public key without exposing the private key. * * Warning: This makes the implementation non-compliant with standard Ed25519 * and should only be used within protocols that handle the co-factor 8 issue * (e.g., via Ristretto or ensuring all points are in the prime-order subgroup). */ let scalar = Scalar::from_bytes_mod_order(sk); let nonce: [u8; 32] = nonce_bytes .try_into() .map_err(|_| anyhow!("Invalid nonce length".to_string()))?; let xsk = ExpandedSecretKey { scalar, hash_prefix: nonce, }; let pk = PrivateKey::public_key(&scalar); let sig: Signature = ed25519_dalek::hazmat::raw_sign::(&xsk, msg, &pk); let sig_vec = sig.to_bytes().to_vec(); Ok(sig_vec) } #[cfg(test)] mod tests { use super::{ed25519_sign, ed25519_sign_inner}; use crate::bip32::{ChildNumber, DerivationPath, Prefix, XprvSecp256k1, XpubSecp256k1}; use crate::bip39::{Language, Mnemonic, Seed}; use ed25519_dalek::{ hazmat::{self, ExpandedSecretKey}, Signature, Signer, SigningKey, VerifyingKey, }; use sha2::Sha512; #[test] fn test_mnemonic() { let phrase = "heavy face learn track claw jaguar pigeon uncle seven enough glow where"; // let mnemonic = Mnemonic::new(MnemonicType::Words12,Language::English); let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); //let phrase = mnemonic.phrase(); assert_eq!(phrase, mnemonic.phrase()); println!("phrase:{:#?}", phrase); let seed = Seed::new(&mnemonic, ""); println!("seed:{:X}", seed); let path: DerivationPath = "m/44'/196'/300049'/0".parse().unwrap(); let xprv = XprvSecp256k1::new_from_path(seed, &path).unwrap(); let _ek = xprv.to_extended_key(Prefix::XPRV); println!("xprv:{:?}", xprv); let cp: ChildNumber = 1u32.into(); let cx = xprv.derive_child(cp).unwrap(); let mut hex = String::new(); for b in cx.to_bytes() { hex.push_str(format!("{:X}", b).as_str()); } println!("{}", hex) } #[test] fn test_master_xprv() { let phrase = "heavy face learn track claw jaguar pigeon uncle seven enough glow where"; // let mnemonic = Mnemonic::new(MnemonicType::Words12,Language::English); let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); //let phrase = mnemonic.phrase(); let seed = Seed::new(&mnemonic, ""); // let path: DerivationPath = "m".parse().unwrap(); let xprv = XprvSecp256k1::new(seed).unwrap(); let _secret = xprv.private_key(); //let ek = xprv.to_extended_key(Prefix::XPRV); println!("xprv:{:}", xprv.to_string(Prefix::XPRV).as_str()); } #[test] fn test_xpub() { let phrase = "deal pretty baby midnight federal capital suggest cheese creek mutual boil shine"; let mnemonic = Mnemonic::from_phrase(phrase, Language::English).unwrap(); //let phrase = mnemonic.phrase(); let seed = Seed::new(&mnemonic, ""); let path: DerivationPath = "m/44'/60".parse().unwrap(); let xprv = XprvSecp256k1::new_from_path(seed, &path).unwrap(); let xpub: XpubSecp256k1 = xprv.public_key(); println!("{}", xpub.to_string(Prefix::XPUB)); } #[test] fn test_stand_ed25519_sign() { // ed25519-dalek v2.2.0 let secret_key_bytes: [u8; 32] = [ 224, 90, 166, 77, 51, 213, 200, 177, 62, 18, 172, 127, 11, 124, 215, 1, 150, 165, 56, 139, 192, 234, 139, 72, 131, 7, 67, 224, 44, 17, 79, 101, ]; let secret_key = ed25519_dalek::SecretKey::from(secret_key_bytes); let expanded_secret_key: ExpandedSecretKey = ExpandedSecretKey::from(&secret_key); let verifying_key = VerifyingKey::from(&expanded_secret_key); let message = b"helloworld"; let raw_signature: Signature = hazmat::raw_sign::(&expanded_secret_key, message, &verifying_key); let signing_key = SigningKey::from_bytes(&secret_key_bytes); let standard_signature = signing_key.sign(message); assert_eq!(raw_signature, standard_signature); let custom_signature_result = ed25519_sign(&expanded_secret_key.scalar.to_bytes(), message); assert!(custom_signature_result.is_ok()); let custom_signature_bytes = custom_signature_result.unwrap(); // custom_signature_bytes does not equal raw_signature assert_ne!(custom_signature_bytes.as_slice(), raw_signature.to_bytes()); } #[test] fn test_ed25519_sign() { let sk = [1u8; 32]; let msg = b"hello world"; let sig = super::ed25519_sign(&sk, msg); assert!(sig.is_ok()); let sig = sig.unwrap(); let expected_sig = [ 5, 0, 237, 32, 228, 86, 144, 1, 231, 127, 241, 133, 219, 99, 108, 67, 2, 122, 193, 83, 79, 26, 253, 179, 22, 235, 248, 218, 171, 222, 240, 37, 141, 35, 38, 109, 86, 242, 219, 149, 203, 118, 228, 214, 173, 156, 71, 238, 246, 140, 200, 129, 33, 217, 203, 199, 44, 91, 144, 161, 185, 213, 14, 6, ]; assert_eq!(expected_sig.as_slice(), sig); } #[test] fn test_ed25519_exception() { let msg = b"hello world"; let short_sk = [1u8; 31]; let sk_err = ed25519_sign(&short_sk, msg).unwrap_err(); assert!(sk_err.to_string().contains("Invalid private key length")); let sk = [1u8; 32]; let short_nonce = [2u8; 31]; let nonce_err = ed25519_sign_inner(&sk, msg, &short_nonce).unwrap_err(); assert!(nonce_err.to_string().contains("Invalid nonce length")); } } ================================================ FILE: crates/anychain-neo/Cargo.toml ================================================ [package] name = "anychain-neo" version = "0.1.1" authors.workspace = true edition.workspace = true homepage.workspace = true license.workspace = true repository.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } p256 = { workspace = true } base58 = { workspace = true } base64 = { workspace = true } [dev-dependencies] rand = { workspace = true } [lints] workspace = true ================================================ FILE: crates/anychain-neo/src/address.rs ================================================ use crate::{NeoFormat, NeoPublicKey}; use anychain_core::{ crypto::{checksum, hash160}, Address, AddressError, PublicKey, }; use base58::{FromBase58, ToBase58}; use std::{fmt::Display, str::FromStr}; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct NeoAddress(pub String); impl Address for NeoAddress { type Format = NeoFormat; type SecretKey = p256::SecretKey; type PublicKey = NeoPublicKey; fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::PublicKey::from_secret_key(secret_key).to_address(format) } fn from_public_key( public_key: &Self::PublicKey, _format: &Self::Format, ) -> Result { let bytes = public_key.serialize_compressed(); let bytes = [ vec![ 0x0c, /* PushData1 */ 0x21, /* compressed key length */ ], bytes, /* compressed public key bytes */ vec![ 0x41, /* Opcode.Syscall */ 0x56, 0xe7, 0xb3, 0x27, /* System.Crypto.CheckSig */ ], ] .concat(); let hash = hash160(&bytes); let payload = [vec![0x35u8 /* version byte */], hash].concat(); let checksum = checksum(&payload)[..4].to_vec(); let res = [payload, checksum].concat(); Ok(Self(res.to_base58())) } } impl NeoAddress { pub fn to_script_hash(&self) -> Vec { let bytes = self.0.as_str().from_base58().unwrap(); // strip the version byte and the checksum bytes[1..21].to_vec() } } impl FromStr for NeoAddress { type Err = AddressError; fn from_str(s: &str) -> Result { let bytes = s.from_base58()?; let checksum_provided = bytes[21..].to_vec(); let checksum_gen = checksum(&bytes[..21])[..4].to_vec(); if checksum_gen != checksum_provided { return Err(AddressError::Message(format!("Invalid address {}", s))); } Ok(Self(s.to_string())) } } impl Display for NeoAddress { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } } #[allow(unused_imports)] #[cfg(test)] mod tests { // use anychain_core::{Address, PublicKey}; // use super::{NeoFormat, NeoAddress, NeoPublicKey}; use super::*; use rand::rngs::OsRng; #[test] fn test_address_from_secret_key() { // Create a secret key for testing let mut rng = OsRng; let secret_key = p256::SecretKey::random(&mut rng); // Define the desired format let format = NeoFormat::Standard; let result = NeoAddress::from_secret_key(&secret_key, &format); assert!(result.is_ok()); let address = result.unwrap(); assert_eq!(address.to_script_hash().len(), 20); } #[test] fn test_address_from_public_key() { // Create a public key for testing let mut rng = OsRng; let secret_key = p256::SecretKey::random(&mut rng); let public_key = NeoPublicKey::from_secret_key(&secret_key); let format = NeoFormat::Standard; let result = NeoAddress::from_public_key(&public_key, &format); assert!(result.is_ok()); let address = result.unwrap(); assert_eq!(address.to_script_hash().len(), 20); } #[test] fn test_address_from_str() { let address_str = "NVEqR4e73afGKpVBzBXLEnY5F5uZSmSKZZ"; let address = NeoAddress::from_str(address_str); assert!(address.is_ok()); let parsed_address = address.unwrap(); assert_eq!(parsed_address.to_string(), address_str); } #[test] fn tesa_addresses_from_sk() { let mut sk = [ 1u8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; let format = NeoFormat::Standard; let addresses = [ "NKvAasuNZqDc8dQDXd6Wm2XccTh6Dt3nr4", "NUz6PKTAM7NbPJzkKJFNay3VckQtcDkgWo", "NgZs1i1hZSWh9Lpj9mVRZyNLT3gvydn5Y7", "NVKhps7L2souj2xUSw9dWuyGn5Sdgv8g6J", "NcBrH4zAwCf3XhywpxgWPcTv3y67y8C1C2", "NdvNCaDAt4gn4cWz1Ua8AUp6RQ3u5uABpK", "NMkKsN8SrmSTDB4j6EsbELxnJ5UmcUZLVS", "NYQLdcRTgLcnsZ3fWjnobBxZkzc4rRnbtb", "NbnMx2Bt6b6AWgZzuK7c3iuNFySoGhyg5S", "NWUTErT9hs9QiphzhkxbFzhpfKQXX5xvqf", ]; for i in 0..10 { sk[3] = i; let sk = p256::SecretKey::from_slice(&sk).unwrap(); let addr = NeoPublicKey::from_secret_key(&sk) .to_address(&format) .unwrap(); assert_eq!(format!("{}", addr), addresses[i as usize]); } } } ================================================ FILE: crates/anychain-neo/src/format.rs ================================================ use anychain_core::Format; use core::fmt; /// Represents the format of a Ethereum address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum NeoFormat { Standard, } impl Format for NeoFormat {} impl fmt::Display for NeoFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Standard") } } ================================================ FILE: crates/anychain-neo/src/lib.rs ================================================ mod address; pub use address::*; mod format; pub use format::*; mod public_key; pub use public_key::*; mod transaction; pub use transaction::*; ================================================ FILE: crates/anychain-neo/src/public_key.rs ================================================ use crate::{NeoAddress, NeoFormat}; use anychain_core::{hex, Address, AddressError, PublicKey, PublicKeyError}; use std::{fmt::Display, str::FromStr}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct NeoPublicKey(pub p256::PublicKey); impl PublicKey for NeoPublicKey { type SecretKey = p256::SecretKey; type Address = NeoAddress; type Format = NeoFormat; fn from_secret_key(secret_key: &Self::SecretKey) -> Self { let scalar = secret_key.to_nonzero_scalar(); Self(p256::PublicKey::from_secret_scalar(&scalar)) } fn to_address(&self, format: &Self::Format) -> Result { Self::Address::from_public_key(self, format) } } impl NeoPublicKey { #[allow(deprecated)] pub fn serialize_compressed(&self) -> Vec { p256::CompressedPoint::from(self.0).as_slice().to_vec() } } impl FromStr for NeoPublicKey { type Err = PublicKeyError; fn from_str(s: &str) -> Result { let bin = hex::decode(s)?; let public_key = p256::PublicKey::from_sec1_bytes(&bin).unwrap(); Ok(NeoPublicKey(public_key)) } } impl Display for NeoPublicKey { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let bytes = self.0.to_sec1_bytes().to_vec(); let s = hex::encode(bytes); write!(f, "pk = {}, len = {}", s, s.len()) } } #[cfg(test)] mod test { use super::*; use crate::NeoPublicKey; use anychain_core::PublicKey; #[test] fn test_public_key_from_str() { let sk = [ 1u8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; let sk = p256::SecretKey::from_slice(&sk).unwrap(); let _public_key = NeoPublicKey::from_secret_key(&sk); let public_key = "046ff03b949241ce1dadd43519e6960e0a85b41a69a05c328103aa2bce1594ca163c4f753a55bf01dc53f6c0b0c7eee78b40c6ff7d25a96e2282b989cef71c144a"; let pb = NeoPublicKey::from_str(public_key); assert!(pb.is_ok()); } } ================================================ FILE: crates/anychain-neo/src/transaction.rs ================================================ use crate::{NeoAddress, NeoFormat, NeoPublicKey}; use anychain_core::{crypto::sha256, hex, Transaction, TransactionError, TransactionId}; use std::fmt::{Display, Error}; #[derive(Clone)] pub struct TxIn { prev_hash: Vec, index: u16, } #[derive(Clone)] pub struct TxOut { asset_id: Vec, address: String, value: u64, } impl TxIn { fn serialize(&self) -> Vec { if self.prev_hash.len() != 32 { panic!("Invalid prev_hash length"); } let prevhash = self.prev_hash.clone(); let index = self.index.to_le_bytes().to_vec(); [prevhash, index].concat() } } impl TxOut { fn serialize(&self) -> Vec { if self.asset_id.len() != 32 { panic!("Invalid prev_hash length"); } let mut asset_id = self.asset_id.clone(); asset_id.reverse(); let value = self.value.to_le_bytes().to_vec(); let address = NeoAddress(self.address.clone()); let address = address.to_script_hash(); [asset_id, value, address].concat() } } #[derive(Clone)] pub struct NeoTransactionParameters { txins: Vec, txouts: Vec, } impl NeoTransactionParameters { fn serialize(&self) -> Vec { let mut ret = vec![0u8; 0]; ret.push(0x80); // contract type byte ret.push(0x00); // version byte ret.push(0u8); // attribute length, which is 0 ret.push(self.txins.len() as u8); for txin in &self.txins { ret.extend(txin.serialize()); } ret.push(self.txouts.len() as u8); for txout in &self.txouts { ret.extend(txout.serialize()); } ret } } #[derive(Clone)] pub struct NeoSignature { rs: Vec, public_key: Vec, } impl NeoSignature { fn serialize(&self) -> Vec { let mut stream = vec![]; let rs = self.rs.clone(); let pk = self.public_key.clone(); let rs_script = [vec![rs.len() as u8], rs].concat(); let pk_script = [vec![pk.len() as u8], pk, vec![172 /* Opcode::CheckSig */]].concat(); stream.push(rs_script.len() as u8); stream.extend(rs_script); stream.push(pk_script.len() as u8); stream.extend(pk_script); stream } } #[derive(Clone)] pub struct NeoTransaction { params: NeoTransactionParameters, signatures: Option>, } #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct NeoTransactionId { txid: Vec, } impl Display for NeoTransactionId { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } impl TransactionId for NeoTransactionId {} impl Transaction for NeoTransaction { type TransactionId = NeoTransactionId; type Format = NeoFormat; type TransactionParameters = NeoTransactionParameters; type Address = NeoAddress; type PublicKey = NeoPublicKey; fn new(params: &Self::TransactionParameters) -> Result { Ok(Self { params: params.clone(), signatures: None, }) } fn sign(&mut self, rs_pk_s: Vec, _recid: u8) -> Result, TransactionError> { if !rs_pk_s.len().is_multiple_of(97) { return Err(TransactionError::Message(format!( "Invalid signauture-public-key tuple length {}", rs_pk_s.len() ))); } let sigs_cnt = rs_pk_s.len() / 97; let txins_cnt = self.params.txins.len(); if sigs_cnt != txins_cnt { return Err(TransactionError::Message(format!( "Amount of signatures {} differs with that of tx inputs {}", sigs_cnt, txins_cnt, ))); } let mut sigs = vec![]; for i in 0..sigs_cnt { let start = 97 * i; let divide = start + 64; let end = divide + 33; let sig = NeoSignature { rs: rs_pk_s[start..divide].to_vec(), public_key: rs_pk_s[divide..end].to_vec(), }; sigs.push(sig); } self.signatures = Some(sigs); self.to_bytes() } fn to_bytes(&self) -> Result, TransactionError> { let mut stream = self.params.serialize(); if let Some(sigs) = &self.signatures { stream.push(sigs.len() as u8); for sig in sigs { stream.extend(sig.serialize()); } } Ok(stream) } fn from_bytes(_tx: &[u8]) -> Result { todo!() } fn to_transaction_id(&self) -> Result { let stream = self.to_bytes()?; Ok(NeoTransactionId { txid: sha256(&stream).to_vec(), }) } } impl Display for NeoTransaction { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( f, "{}", &hex::encode(match self.to_bytes() { Ok(transaction) => transaction, _ => return Err(Error), }) ) } } #[cfg(test)] mod tests { use crate::{TxIn, TxOut}; use super::{NeoFormat, NeoPublicKey, NeoTransaction, NeoTransactionParameters}; use p256::ecdsa::{signature::Signer, Signature, SigningKey}; use anychain_core::{hex, PublicKey, Transaction}; use base64::{engine::general_purpose::STANDARD_NO_PAD, Engine}; #[allow(deprecated)] #[test] fn test_tx_gen() { let sk = [ 1u8, 1, 1, 23, 1, 1, 1, 59, 1, 1, 1, 16, 87, 1, 1, 1, 1, 99, 1, 1, 1, 1, 79, 1, 1, 1, 1, 1, 121, 1, 1, 1, ]; let sk = p256::SecretKey::from_slice(&sk).unwrap(); let pk = NeoPublicKey::from_secret_key(&sk); let format = &NeoFormat::Standard; let _from = pk.to_address(format).unwrap(); let sk_to = [ 2u8, 7, 0, 5, 0, 0, 1, 1, 111, 23, 34, 39, 109, 20, 1, 2, 7, 0, 5, 0, 0, 1, 1, 111, 23, 34, 39, 109, 203, 1, 5, 55, ]; let sk_to = p256::SecretKey::from_slice(&sk_to).unwrap(); let pk_to = NeoPublicKey::from_secret_key(&sk_to); let to = pk_to.to_address(format).unwrap(); let prev_hash = "b3ad3320f8230a8358a4c056ead57182d787ec8607870f70d70a844dc4d049a3"; let index = 0; let asset_id = "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"; let mut prev_hash = hex::decode(prev_hash).unwrap(); prev_hash.reverse(); let asset_id = hex::decode(asset_id).unwrap(); let input = TxIn { prev_hash, index }; let output = TxOut { asset_id, address: to.0, value: 1000000000, }; let params = NeoTransactionParameters { txins: vec![input], txouts: vec![output], }; let mut tx = NeoTransaction::new(¶ms).unwrap(); let hash = tx.to_transaction_id().unwrap().txid; let signing_key = SigningKey::from(sk); // the signature differs with bipay signature, possible cause being that // bipay use a random r as opposed to a fixed r used by this signer let sig: Signature = signing_key.sign(&hash); let mut sig = sig.to_bytes().as_slice().to_vec(); sig.extend(pk.serialize_compressed()); let tx = tx.sign(sig, 0).unwrap(); let tx_hex = hex::encode(&tx); let tx_64 = STANDARD_NO_PAD.encode(&tx); println!("tx hex = {}\ntx 64 = {}", tx_hex, tx_64); } } ================================================ FILE: crates/anychain-polkadot/Cargo.toml ================================================ [package] name = "anychain-polkadot" description = "A Rust library for Polkadot cryptocurrency wallets, enabling seamless transactions on the Polkadot blockchain" version = "0.1.7" keywords = ["polkadot", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } sp-core = "38.1.0" base58 = { workspace = true } parity-scale-codec = { version = "3.6.5" } ed25519-dalek = { workspace = true } serde_json = { workspace = true } libsecp256k1 = { workspace = true } blake2b_simd = { workspace = true } sha2 = {workspace = true} [dev-dependencies] curve25519-dalek = {workspace = true} anychain-kms = { path = "../anychain-kms", version = "0.1.20" } [lints] workspace = true ================================================ FILE: crates/anychain-polkadot/README.md ================================================ # anychain-polkadot anychain-polkadot is a Rust library for Polkadot cryptocurrency wallets. It enables seamless transactions on the Polkadot blockchain. ## Features - Address generation and validation - Transaction building, signing, and broadcasting - Querying blockchain data (blocks, transactions, balances, etc.) ## Installation Add the following to your `Cargo.toml` file: ```toml [dependencies] anychain-polkadot = "0.1.4" ``` Then run `cargo build` to download and compile the library. ## Usage ## Contributing We welcome contributions from the community! If you'd like to contribute, please follow these steps: 1. Fork the repository 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Create a pull request and describe your changes Please make sure to follow the Rust coding guidelines and add tests for any new features or bug fixes. ## License anychain-polkadot is released under the MIT License. See the [LICENSE](LICENSE) file for more information. ================================================ FILE: crates/anychain-polkadot/src/address.rs ================================================ use std::{fmt::Display, marker::PhantomData, str::FromStr}; use anychain_core::{hex, Address, AddressError, PublicKey, TransactionError}; use crate::{PolkadotFormat, PolkadotNetwork, PolkadotPublicKey, PolkadotSecretKey}; use base58::{FromBase58, ToBase58}; use sp_core::hashing::blake2_512; #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub struct PolkadotAddress { addr: String, _network: PhantomData, } impl Address for PolkadotAddress { type SecretKey = PolkadotSecretKey; type PublicKey = PolkadotPublicKey; type Format = PolkadotFormat; fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::PublicKey::from_secret_key(secret_key).to_address(format) } fn from_public_key( public_key: &Self::PublicKey, _format: &Self::Format, ) -> Result { Self::from_payload(&hex::encode(public_key.address_payload())) } } impl PolkadotAddress { pub fn from_payload(payload: &str) -> Result { let payload = hex::decode(payload).unwrap(); let payload = [vec![N::VERSION], payload].concat(); let ss_prefix = vec![0x53u8, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45]; let checksum = blake2_512(&[ss_prefix, payload.clone()].concat()).to_vec(); let addr = [payload, checksum[..2].to_vec()].concat().to_base58(); Ok(PolkadotAddress { addr, _network: PhantomData::, }) } pub fn to_payload(&self) -> Result, AddressError> { let bin = self.addr.as_str().from_base58()?; Ok(bin[1..33].to_vec()) } } impl FromStr for PolkadotAddress { type Err = TransactionError; fn from_str(s: &str) -> Result { let bytes = s.from_base58()?; if N::VERSION != bytes[0] { return Err(TransactionError::Message(format!( "Invalid version byte {} for polkadot network {}", bytes[0], N::NAME, ))); } let checksum_provided = bytes[33..].to_vec(); let ss_prefix = vec![0x53u8, 0x53, 0x35, 0x38, 0x50, 0x52, 0x45]; let checksum_expected = blake2_512(&[ss_prefix, bytes[..33].to_vec()].concat())[..2].to_vec(); if checksum_expected != checksum_provided { return Err(TransactionError::Message(format!( "Invalid {} address", N::NAME ))); } Ok(PolkadotAddress { addr: s.to_string(), _network: PhantomData, }) } } impl Display for PolkadotAddress { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.addr) } } #[cfg(test)] mod tests { use crate::{PolkadotAddress, PolkadotFormat, PolkadotSecretKey, Westend}; use anychain_core::{hex, Address}; use std::str::FromStr; #[test] fn test_address() { let sk = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, ]; let h = hex::encode(sk); println!("{}", h); // let sk = SecretKey::from_bytes(sk.as_slice()).unwrap(); let signing_key: ed25519_dalek::SigningKey = ed25519_dalek::SigningKey::from_bytes(&sk); let sk = PolkadotSecretKey::Ed25519(signing_key.to_bytes()); let address = PolkadotAddress::::from_secret_key(&sk, &PolkadotFormat::Standard).unwrap(); assert_eq!( "5EpHX5foDtnhZngj4GsKq5eKGpUvuMqbpUG48ZfCCCs7EzKR", address.addr ); } #[test] fn test_address_2() { let hash = "8ee504148e75c34e8f051899b3c6e4241ff18dc1c9211260b6a6a434bedb485f"; let address = PolkadotAddress::::from_payload(hash).unwrap(); assert_eq!( "5FJ4gu9eVX6DG4qYi1hxkUgu1yaTm1CnQ4MiiZPjPVaXiATo", address.addr ); } #[test] fn test_address_3() { let addr = "5DoW9HHuqSfpf55Ux5pLdJbHFWvbngeg8Ynhub9DrdtxmZeV"; let addr = PolkadotAddress::::from_str(addr).unwrap(); let payload = addr.to_payload().unwrap(); let payload = hex::encode(payload); assert_eq!( "4ce05abd387b560855a3d486eba6237b9a08c6e9dfe351302a5ceda90be801fe", payload ); } } ================================================ FILE: crates/anychain-polkadot/src/format.rs ================================================ use anychain_core::Format; use std::fmt::Display; #[derive(Hash, Clone, PartialEq, PartialOrd, Eq, Ord, Debug)] pub enum PolkadotFormat { Standard, } impl Format for PolkadotFormat {} impl Display for PolkadotFormat { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/lib.rs ================================================ mod public_key; pub use public_key::*; mod address; pub use address::*; mod format; pub use format::*; mod transaction; pub use transaction::*; mod network; pub use network::*; mod utilities; ================================================ FILE: crates/anychain-polkadot/src/network/kusama.rs ================================================ use std::{fmt::Display, str::FromStr}; use crate::PolkadotNetwork; use anychain_core::{Network, NetworkError}; #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] pub struct Kusama; impl Network for Kusama { const NAME: &'static str = "kusama"; } impl PolkadotNetwork for Kusama { const VERSION: u8 = 0x02; const PALLET_ASSET: u8 = 4; const TRANSFER_ALLOW_DEATH: u8 = 0; const TRANSFER_KEEP_ALIVE: u8 = 3; } impl FromStr for Kusama { type Err = NetworkError; fn from_str(_s: &str) -> Result { todo!() } } impl Display for Kusama { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/network/mod.rs ================================================ mod polkadot; pub use polkadot::*; mod kusama; pub use kusama::*; mod westend; pub use westend::*; mod rococo; pub use rococo::*; use anychain_core::Network; pub trait PolkadotNetwork: Network { const VERSION: u8; const PALLET_ASSET: u8; const TRANSFER_ALLOW_DEATH: u8; const TRANSFER_KEEP_ALIVE: u8; } ================================================ FILE: crates/anychain-polkadot/src/network/polkadot.rs ================================================ use std::{fmt::Display, str::FromStr}; use crate::PolkadotNetwork; use anychain_core::{Network, NetworkError}; #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] pub struct Polkadot; impl Network for Polkadot { const NAME: &'static str = "polkadot"; } impl PolkadotNetwork for Polkadot { const VERSION: u8 = 0x00; const PALLET_ASSET: u8 = 5; const TRANSFER_ALLOW_DEATH: u8 = 0; const TRANSFER_KEEP_ALIVE: u8 = 3; } impl FromStr for Polkadot { type Err = NetworkError; fn from_str(_s: &str) -> Result { todo!() } } impl Display for Polkadot { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/network/rococo.rs ================================================ use std::{fmt::Display, str::FromStr}; use crate::PolkadotNetwork; use anychain_core::{Network, NetworkError}; #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] pub struct Rococo; impl Network for Rococo { const NAME: &'static str = "rococo"; } impl PolkadotNetwork for Rococo { const VERSION: u8 = 0x2a; const PALLET_ASSET: u8 = 4; const TRANSFER_ALLOW_DEATH: u8 = 0; const TRANSFER_KEEP_ALIVE: u8 = 3; } impl FromStr for Rococo { type Err = NetworkError; fn from_str(_s: &str) -> Result { todo!() } } impl Display for Rococo { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/network/westend.rs ================================================ use std::{fmt::Display, str::FromStr}; use crate::PolkadotNetwork; use anychain_core::{Network, NetworkError}; #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] pub struct Westend; impl Network for Westend { const NAME: &'static str = "westend"; } impl PolkadotNetwork for Westend { const VERSION: u8 = 0x2a; const PALLET_ASSET: u8 = 4; const TRANSFER_ALLOW_DEATH: u8 = 0; const TRANSFER_KEEP_ALIVE: u8 = 3; } impl FromStr for Westend { type Err = NetworkError; fn from_str(_s: &str) -> Result { todo!() } } impl Display for Westend { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/public_key.rs ================================================ use crate::{PolkadotAddress, PolkadotFormat, PolkadotNetwork}; use anychain_core::{Address, PublicKey, PublicKeyError}; use sp_core::blake2_256; use std::{fmt::Display, marker::PhantomData, str::FromStr}; pub enum PolkadotSecretKey { Secp256k1(libsecp256k1::SecretKey), Ed25519(ed25519_dalek::SecretKey), } #[derive(Debug, Clone)] pub enum PublicKeyContent { Secp256k1(libsecp256k1::PublicKey), Ed25519(ed25519_dalek::VerifyingKey), } #[derive(Debug, Clone)] pub struct PolkadotPublicKey { pub key: PublicKeyContent, _network: PhantomData, } impl PublicKey for PolkadotPublicKey { type SecretKey = PolkadotSecretKey; type Address = PolkadotAddress; type Format = PolkadotFormat; fn from_secret_key(secret_key: &Self::SecretKey) -> Self { match secret_key { Self::SecretKey::Secp256k1(sk) => { let pk = libsecp256k1::PublicKey::from_secret_key(sk); let pk = PublicKeyContent::Secp256k1(pk); Self { key: pk, _network: PhantomData, } } Self::SecretKey::Ed25519(sk) => { let signing_key: ed25519_dalek::SigningKey = ed25519_dalek::SigningKey::from_bytes(sk); let pk: ed25519_dalek::VerifyingKey = signing_key.verifying_key(); let pk = PublicKeyContent::Ed25519(pk); Self { key: pk, _network: PhantomData, } } } } fn to_address( &self, format: &Self::Format, ) -> Result { Self::Address::from_public_key(self, format) } } impl PolkadotPublicKey { pub fn serialize(&self) -> Vec { match self.key { PublicKeyContent::Secp256k1(pk) => pk.serialize_compressed().to_vec(), PublicKeyContent::Ed25519(pk) => pk.to_bytes().to_vec(), } } pub fn address_payload(&self) -> Vec { match self.key { PublicKeyContent::Secp256k1(_) => blake2_256(&self.serialize()).to_vec(), PublicKeyContent::Ed25519(_) => self.serialize(), } } } impl FromStr for PolkadotPublicKey { type Err = PublicKeyError; fn from_str(_s: &str) -> Result { todo!() } } impl Display for PolkadotPublicKey { fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } ================================================ FILE: crates/anychain-polkadot/src/transaction.rs ================================================ use crate::utilities::crypto::blake2b_256; use crate::{PolkadotAddress, PolkadotFormat, PolkadotNetwork, PolkadotPublicKey}; use anychain_core::{hex, Transaction, TransactionError, TransactionId}; use parity_scale_codec::{Decode, Encode, HasCompact}; use std::fmt::Display; #[derive(Clone)] pub struct PolkadotTransactionParameters { pub from: PolkadotAddress, pub to: PolkadotAddress, pub amount: u64, pub nonce: u64, pub tip: u64, pub block_hash: String, pub genesis_hash: String, pub spec_version: u32, pub tx_version: u32, } struct TxInterim { method: Vec, era: Vec, nonce: Vec, tip: Vec, spec_version: Vec, genesis_hash: Vec, block_hash: Vec, tx_version: Vec, } #[derive(Clone)] pub struct PolkadotTransaction { pub params: PolkadotTransactionParameters, pub signature: Option>, } #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub struct PolkadotTransactionId { txid: Vec, } impl TransactionId for PolkadotTransactionId {} impl Display for PolkadotTransactionId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "0x{}", hex::encode(&self.txid)) } } #[derive(Debug, PartialEq, Encode, Decode)] struct CompactWrapper { #[codec(encoded_as = "::Type")] val: T, } fn encode(val: u64) -> Vec { if val == 0 { vec![0] } else { CompactWrapper { val }.encode() } } impl Transaction for PolkadotTransaction { type Address = PolkadotAddress; type Format = PolkadotFormat; type PublicKey = PolkadotPublicKey; type TransactionId = PolkadotTransactionId; type TransactionParameters = PolkadotTransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(PolkadotTransaction { params: params.clone(), signature: None, }) } // Only used for secp256k1 signing scheme fn sign(&mut self, rs: Vec, recid: u8) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length {}", rs.len(), ))); } self.signature = Some([rs, vec![recid]].concat()); self.to_bytes() } fn from_bytes(_tx: &[u8]) -> Result { todo!() } // Only used for secp256k1 signing scheme fn to_bytes(&self) -> Result, TransactionError> { match &self.signature { Some(sig) => { let interim = self.to_interim()?; let from = self.params.from.to_payload()?; let stream = [ vec![0x84], // version = 0x84 vec![0], from, vec![2], // ed25519 = 0, sr25519 = 1, secp256k1 = 2 sig.clone(), interim.era, interim.nonce, interim.tip, interim.method, ] .concat(); let len = stream.len() as u64; let len = encode(len); Ok([len, stream].concat()) } None => { let interim = self.to_interim()?; Ok([ interim.method, interim.era, interim.nonce, interim.tip, interim.spec_version, interim.tx_version, interim.genesis_hash, interim.block_hash, ] .concat()) } } } fn to_transaction_id(&self) -> Result { Ok(PolkadotTransactionId { txid: blake2b_256(&self.to_bytes()?).to_vec(), }) } } impl PolkadotTransaction { fn to_interim(&self) -> Result { let params = &self.params; let to = params.to.to_payload()?; let amount = encode(params.amount); let era = vec![0]; let nonce = encode(params.nonce); let tip = encode(params.tip); let spec_version = params.spec_version.to_le_bytes().to_vec(); let tx_version = params.tx_version.to_le_bytes().to_vec(); let genesis_hash = hex::decode(¶ms.genesis_hash)?; let block_hash = hex::decode(¶ms.block_hash)?; let interim = TxInterim { method: [ vec![N::PALLET_ASSET, N::TRANSFER_ALLOW_DEATH], vec![0], to, amount, ] .concat(), era, nonce, tip, spec_version, tx_version, genesis_hash, block_hash, }; Ok(interim) } // Alternative to to_bytes() when using ed25519 signing scheme fn to_bytes_ed25519(&self) -> Result, TransactionError> { match &self.signature { Some(sig) => { let interim = self.to_interim()?; let from = self.params.from.to_payload()?; let stream = [ vec![0x84], // version = 0x84 vec![0], from, vec![0], // ed25519 = 0, sr25519 = 1, secp256k1 = 2 sig.clone(), interim.era, interim.nonce, interim.tip, interim.method, ] .concat(); let len = stream.len() as u64; let len = encode(len); Ok([len, stream].concat()) } None => { let interim = self.to_interim()?; Ok([ interim.method, interim.era, interim.nonce, interim.tip, interim.spec_version, interim.tx_version, interim.genesis_hash, interim.block_hash, ] .concat()) } } } // Alternative to sign() when using ed25519 signing scheme pub fn sign_ed25519(&mut self, rs: Vec) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length {}", rs.len(), ))); } self.signature = Some(rs); self.to_bytes_ed25519() } } impl Display for PolkadotTransaction { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", hex::encode(self.to_bytes().unwrap())) } } #[cfg(test)] mod tests { use crate::{ PolkadotAddress, PolkadotFormat, PolkadotNetwork, PolkadotSecretKey, PolkadotTransaction, PolkadotTransactionParameters, Westend, }; use anychain_core::Address; use anychain_core::{hex, Transaction}; use ed25519_dalek::{ hazmat::{self, ExpandedSecretKey}, Signature, VerifyingKey, }; use serde_json::Value; use sha2::Sha512; use std::str::FromStr; fn tx_from_str(json: &str) -> PolkadotTransaction { let json = serde_json::from_str::(json).unwrap(); let from = PolkadotAddress::::from_str(json["from"].as_str().unwrap()).unwrap(); let to = PolkadotAddress::::from_str(json["to"].as_str().unwrap()).unwrap(); let amount = json["amount"].as_u64().unwrap(); let nonce = json["nonce"].as_u64().unwrap(); let tip = json["tip"].as_u64().unwrap(); let block_hash = json["block_hash"].as_str().unwrap().to_string(); let genesis_hash = json["genesis_hash"].as_str().unwrap().to_string(); let spec_version = json["spec_version"].as_u64().unwrap() as u32; let tx_version = json["tx_version"].as_u64().unwrap() as u32; let params = PolkadotTransactionParameters:: { from, to, amount, nonce, tip, block_hash, genesis_hash, spec_version, tx_version, }; PolkadotTransaction::::new(¶ms).unwrap() } #[test] fn test_address_gen() { let format = &PolkadotFormat::Standard; let sk_from = [ 228u8, 121, 108, 167, 244, 6, 57, 61, 104, 68, 229, 88, 23, 16, 212, 157, 110, 171, 36, 26, 232, 171, 144, 41, 109, 182, 148, 243, 20, 23, 29, 61, ]; let sk_to = [ 3, 1, 2, 5, 8, 1, 118, 203, 0, 1, 2, 1, 1, 2, 1, 1, 1, 103, 0, 0, 2, 2, 2, 2, 2, 2, 3, 5, 8, 13, 17, 29, ]; let sk_from = libsecp256k1::SecretKey::parse_slice(&sk_from).unwrap(); let sk_to = libsecp256k1::SecretKey::parse_slice(&sk_to).unwrap(); let sk_from = PolkadotSecretKey::Secp256k1(sk_from); let sk_to = PolkadotSecretKey::Secp256k1(sk_to); let from = PolkadotAddress::::from_secret_key(&sk_from, format).unwrap(); let to = PolkadotAddress::::from_secret_key(&sk_to, format).unwrap(); assert_eq!( "5FnS6tYbCTAtK3QCfNnddwVR61ypLLM7APRrs98paFs7yMSY", from.to_string() ); assert_eq!( "5DoW9HHuqSfpf55Ux5pLdJbHFWvbngeg8Ynhub9DrdtxmZeV", to.to_string() ); } #[test] fn test_address_gen_2() { let format = &PolkadotFormat::Standard; let sk_from = [ 228u8, 121, 108, 167, 244, 6, 57, 61, 104, 68, 229, 88, 23, 16, 212, 157, 110, 171, 36, 26, 232, 171, 144, 41, 109, 182, 148, 243, 20, 23, 29, 61, ]; let sk_to = [ 3, 1, 2, 5, 8, 1, 118, 203, 0, 1, 2, 1, 1, 2, 1, 1, 1, 103, 0, 0, 2, 2, 2, 2, 2, 2, 3, 5, 8, 13, 17, 29, ]; // let sk_from = ed25519_dalek::SecretKey::from_bytes(sk_from.as_slice()).unwrap(); // let sk_to = ed25519_dalek::SecretKey::from_bytes(sk_to.as_slice()).unwrap(); let sk_from = ed25519_dalek::SecretKey::from(sk_from); let sk_to = ed25519_dalek::SecretKey::from(sk_to); let sk_from = PolkadotSecretKey::Ed25519(sk_from); let sk_to = PolkadotSecretKey::Ed25519(sk_to); let from = PolkadotAddress::::from_secret_key(&sk_from, format).unwrap(); let to = PolkadotAddress::::from_secret_key(&sk_to, format).unwrap(); assert_eq!( "5DPaKszR7KpCbvNNtGCGTfrGdeDTUNRt1UdxwXp9G6iWvdk7", from.to_string() ); assert_eq!( "5D1NKGqfc2Q8hw53icrX74YQryjb3MMySWwFBhM71afKbdad", to.to_string() ); } #[test] fn test_tx_gen() { let tx = r#"{ "from": "5FnS6tYbCTAtK3QCfNnddwVR61ypLLM7APRrs98paFs7yMSY", "to": "5DoW9HHuqSfpf55Ux5pLdJbHFWvbngeg8Ynhub9DrdtxmZeV", "amount": 1000000000000, "nonce": 3, "tip": 0, "block_hash": "e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "genesis_hash": "e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "spec_version": 1005000, "tx_version": 24 }"#; let mut tx = tx_from_str::(tx); let hash = tx.to_transaction_id().unwrap().txid; let msg = libsecp256k1::Message::parse_slice(&hash).unwrap(); let sk = [ 228u8, 121, 108, 167, 244, 6, 57, 61, 104, 68, 229, 88, 23, 16, 212, 157, 110, 171, 36, 26, 232, 171, 144, 41, 109, 182, 148, 243, 20, 23, 29, 61, ]; let sk = libsecp256k1::SecretKey::parse_slice(&sk).unwrap(); let (sig, rec) = libsecp256k1::sign(&msg, &sk); let sig = sig.serialize().to_vec(); let rec = rec.serialize(); let signed_tx = tx.sign(sig, rec).unwrap(); let signed_tx = hex::encode(signed_tx); assert_eq!( "41028400a487f8cf0c11fd48eae13f819dbb06e5cb97b7103d2434897bd7cb3ea80963e502ba136449919abc037e45cb36fbeae2b1d5dde212f7cd6f9eef604833811a6ac07eba271bdbb4bfb940f6f0ab810e0afea3d0bcdce0b2a51270a2235d42d3816300000c000400004ce05abd387b560855a3d486eba6237b9a08c6e9dfe351302a5ceda90be801fe070010a5d4e8", signed_tx ); } #[test] fn test_tx_gen_2() { let tx = r#"{ "from": "5DPaKszR7KpCbvNNtGCGTfrGdeDTUNRt1UdxwXp9G6iWvdk7", "to": "5D1NKGqfc2Q8hw53icrX74YQryjb3MMySWwFBhM71afKbdad", "amount": 1000000000000, "nonce": 5, "tip": 0, "block_hash": "e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "genesis_hash": "e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e", "spec_version": 1005000, "tx_version": 24 }"#; let mut tx = tx_from_str::(tx); let msg = tx.to_bytes_ed25519().unwrap(); let sk = [ 228u8, 121, 108, 167, 244, 6, 57, 61, 104, 68, 229, 88, 23, 16, 212, 157, 110, 171, 36, 26, 232, 171, 144, 41, 109, 182, 148, 243, 20, 23, 29, 61, ]; let secret = ed25519_dalek::SecretKey::from(sk); let xsk: ed25519_dalek::hazmat::ExpandedSecretKey = ExpandedSecretKey::from(&secret); let pk = VerifyingKey::from(&xsk); let signature: Signature = hazmat::raw_sign::(&xsk, &msg, &pk); // let sk = SecretKey::from_bytes(sk.as_slice()).unwrap(); // let pk = PublicKey::from(&sk); // let xsk = ExpandedSecretKey::from_slice(&sk).unwrap(); // let sig = xsk.sign(&msg, &pk); let signed_tx = tx.sign_ed25519(signature.to_bytes().to_vec()).unwrap(); let signed_tx = hex::encode(signed_tx); assert_eq!( "3d0284003aa08b895131d34e7c1364ca80067f282fc6b2417b4eefcf7e2ecf7c19d7f81900aff4f335398d8584150fae80adc6dcaea686b2a5a2c9cb28a82a5a59314b7fd3ceaac142b91c949e482aec06f16202c9ea8dcd1c82a4b250cc72dfae03a6360400140004000029b0b723f2e8b89f1bcdc0cf2b3d0e624454a0cb898a46b5b59368964c5544f5070010a5d4e8", signed_tx ); } } ================================================ FILE: crates/anychain-polkadot/src/utilities/crypto.rs ================================================ /// Returns a 32-byte hash for given data #[inline] pub fn blake2b_256(ingest: &[u8]) -> [u8; 32] { let digest = blake2b_simd::Params::new() .hash_length(32) .to_state() .update(ingest) .finalize(); let mut hash = [0u8; 32]; hash.clone_from_slice(digest.as_bytes()); hash } ================================================ FILE: crates/anychain-polkadot/src/utilities/mod.rs ================================================ pub mod crypto; ================================================ FILE: crates/anychain-ripple/Cargo.toml ================================================ [package] name = "anychain-ripple" description = "A Rust library for interacting with the Ripple blockchain. It provides core functionalities such as transaction signing and serialization, address generation, and network communication." version = "0.1.12" keywords = ["ripple", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } base58 = { workspace = true } libsecp256k1 = { workspace = true } [lints] workspace = true ================================================ FILE: crates/anychain-ripple/README.md ================================================ anychain-ripple anychain-ripple is a Rust library that provides a unified interface for interacting with the Ripple blockchain. It is part of the anychain project, which aims to provide a consistent API for interacting with different blockchains. Installation Features - Get balance of a Ripple address - Send XRP to a Ripple address - Get transaction history of a Ripple address - More features coming soon! ## Installation Add the following to your Cargo.toml file: ```toml [dependencies] anychain-ripple = "0.1.10" ``` Then run cargo build to download and compile the anychain-ripple library. ## Usage Here is a basic example of how to use anychain-ripple: ```rust ``` For more examples and detailed usage instructions, please refer to the [documentation](https://docs.rs/anychain-ripple). ## Contributing We welcome contributions from the community! If you'd like to contribute, please follow these steps: 1. Fork the repository 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Create a pull request and describe your changes Please make sure to follow the Rust coding guidelines and add tests for any new features or bug fixes. ## License anychain-ripple is released under the MIT License. See the [LICENSE](LICENSE) file for more information. ================================================ FILE: crates/anychain-ripple/src/address.rs ================================================ use base58::{FromBase58, ToBase58}; use std::{fmt::Display, str::FromStr}; use crate::{RippleFormat, RipplePublicKey}; use anychain_core::{ crypto::{checksum, hash160}, Address, AddressError, PublicKey, }; // fn map_gen(from: &str, to: &str) { // let from = from.as_bytes(); // let to = to.as_bytes(); // let mut table = [-1i8; 128]; // for i in 0..58 { // table[from[i] as usize] = to[i] as i8; // } // println!("{:?}", table); // } // /// You can run this test function to generate the 2 maps below // #[test] // fn gen_map() { // let ripple_alphabet: &str = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"; // let bitcoin_alphabet: &str ="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; // map_gen(bitcoin_alphabet, ripple_alphabet); // map_gen(ripple_alphabet, bitcoin_alphabet); // } const RIPPLE_ALPHABET: &str = "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"; /// Utility for mapping the bitcoin base58 alphabet to ripple base58 alphabet static BTC_2_XRP_BS58_MAP: [i8; 128] = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, 112, 115, 104, 110, 97, 102, 51, 57, -1, -1, -1, -1, -1, -1, -1, 119, 66, 85, 68, 78, 69, 71, 72, -1, 74, 75, 76, 77, 52, -1, 80, 81, 82, 83, 84, 55, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, 50, 98, 99, 100, 101, 67, 103, 54, 53, 106, 107, -1, 109, 56, 111, 70, 113, 105, 49, 116, 117, 118, 65, 120, 121, 122, -1, -1, -1, -1, -1, ]; /// Utility for mapping the ripple base58 alphabet to bitcoin base58 alphabet static XRP_2_BTC_BS58_MAP: [i8; 128] = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, 97, 56, 78, 105, 104, 85, 110, 57, -1, -1, -1, -1, -1, -1, -1, 119, 66, 102, 68, 70, 112, 71, 72, -1, 74, 75, 76, 77, 69, -1, 80, 81, 82, 83, 84, 67, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, 54, 98, 99, 100, 101, 55, 103, 52, 114, 106, 107, -1, 109, 53, 111, 50, 113, 49, 51, 116, 117, 118, 65, 120, 121, 122, -1, -1, -1, -1, -1, ]; /// Map the string in bitcoin base58 format to ripple base58 format fn to_xrp_bs58(s: &str) -> Result { let to: Vec = s .as_bytes() .iter() .map(|b| BTC_2_XRP_BS58_MAP[*b as usize] as u8) .collect(); Ok(String::from_utf8(to)?) } /// Map the string in ripple base58 format to bitcoin base58 format fn to_btc_bs58(s: &str) -> Result { let to: Vec = s .as_bytes() .iter() .map(|b| XRP_2_BTC_BS58_MAP[*b as usize] as u8) .collect(); Ok(String::from_utf8(to)?) } /// Represents a Ripple address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct RippleAddress(String); impl Address for RippleAddress { type SecretKey = libsecp256k1::SecretKey; type PublicKey = RipplePublicKey; type Format = RippleFormat; fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::PublicKey::from_secret_key(secret_key).to_address(format) } fn from_public_key( public_key: &Self::PublicKey, _: &Self::Format, ) -> Result { let hash = hash160(&public_key.serialize()); Self::from_hash160(&hash) } } impl FromStr for RippleAddress { type Err = AddressError; fn from_str(addr: &str) -> Result { for c in addr.chars() { if !RIPPLE_ALPHABET.contains(c) { return Err(AddressError::InvalidAddress( "illegal ripple address".to_string(), )); } } let s = to_btc_bs58(addr)?; let data = s.from_base58()?; if data.len() != 25 { return Err(AddressError::InvalidByteLength(s.len())); } if data[0] != 0 { return Err(AddressError::Message(format!( "Invalid version byte {}", data[0] ))); } // Check if the payload produces the provided checksum let expected_checksum = &checksum(&data[..21])[..4]; let provided_checksum = &data[21..]; if *expected_checksum != *provided_checksum { return Err(AddressError::InvalidChecksum( to_xrp_bs58( &[data[..21].to_vec(), expected_checksum.to_vec()] .concat() .to_base58(), )?, addr.to_string(), )); } Ok(RippleAddress(addr.to_string())) } } impl Display for RippleAddress { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } } impl RippleAddress { pub fn to_hash160(&self) -> Result<[u8; 20], AddressError> { let _ = Self::from_str(&self.0)?; let btc_bs58 = to_btc_bs58(&self.0)?; let bytes = btc_bs58.from_base58()?; let mut ret = [0u8; 20]; // strip version bytes and checksum ret.copy_from_slice(&bytes[1..21]); Ok(ret) } pub fn from_hash160(hash: &[u8]) -> Result { if hash.len() != 20 { return Err(AddressError::Message("Illegal hash160 length".to_string())); } let mut data = [0u8; 25]; data[1..21].copy_from_slice(hash); let checksum = &checksum(&data[..21])[..4]; data[21..].copy_from_slice(checksum); Ok(RippleAddress(to_xrp_bs58(&data.to_base58())?)) } } #[cfg(test)] mod tests { use std::str::FromStr; use super::{Address, RippleAddress, RippleFormat}; #[test] fn test_from_secret_key() { let sk = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; let sk = libsecp256k1::SecretKey::parse_slice(&sk).unwrap(); let addr = RippleAddress::from_secret_key(&sk, &RippleFormat::Standard).unwrap(); println!("addr = {}", addr); } #[test] fn test_from_str() { let addrs = [ "rJ6HEKFe8T2mkZQqzuGbFEmE8SKtadxd8n", "rBbvWBK4pmibqtwNMWhPMTgJUGfaNh71Yk", ]; addrs.iter().for_each(|&addr| { let addr = RippleAddress::from_str(addr); assert!(addr.is_ok()); dbg!("address = {}", addr.unwrap()); }); } #[test] fn test_from_str_invalid_address() { let addr_str = "HanzōFe8T2mkZQqzuGbFEmE8SKtadxd8n"; let addr = RippleAddress::from_str(addr_str); assert!(addr.is_err()); matches!(addr.unwrap_err(), super::AddressError::InvalidAddress(_)); } } ================================================ FILE: crates/anychain-ripple/src/format.rs ================================================ use anychain_core::Format; use core::fmt; /// Represents the format of a Ripple address #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum RippleFormat { Standard, } impl Format for RippleFormat {} impl fmt::Display for RippleFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Standard") } } ================================================ FILE: crates/anychain-ripple/src/lib.rs ================================================ pub mod address; pub use self::address::*; pub mod format; pub use self::format::*; pub mod public_key; pub use self::public_key::*; pub mod transaction; pub use self::transaction::*; ================================================ FILE: crates/anychain-ripple/src/public_key.rs ================================================ use crate::{RippleAddress, RippleFormat}; use anychain_core::{hex, Address, AddressError, PublicKey, PublicKeyError}; use core::{fmt, str::FromStr}; /// Represents a Ripple public key #[derive(Debug, Clone, PartialEq, Eq)] pub struct RipplePublicKey { /// The secp256k1 public key public_key: libsecp256k1::PublicKey, /// If true, the public key is serialized in compressed form compressed: bool, } impl PublicKey for RipplePublicKey { type SecretKey = libsecp256k1::SecretKey; type Address = RippleAddress; type Format = RippleFormat; /// Returns a Ripple public key given an secp256k1 secret key. fn from_secret_key(secret_key: &Self::SecretKey) -> Self { Self { public_key: libsecp256k1::PublicKey::from_secret_key(secret_key), compressed: true, } } /// Returns a Ripple address corresponding to this Ripple public key. fn to_address(&self, format: &Self::Format) -> Result { Self::Address::from_public_key(self, format) } } impl RipplePublicKey { /// Returns a Ripple public key given an secp256k1 public key. pub fn from_secp256k1_public_key( public_key: libsecp256k1::PublicKey, compressed: bool, ) -> Self { Self { public_key, compressed, } } /// Returns the secp256k1 public key of this Ripple public key. pub fn to_secp256k1_public_key(&self) -> libsecp256k1::PublicKey { self.public_key } /// Serialize the Ripple public key as a vector of u8 pub fn serialize(&self) -> Vec { match self.compressed { true => self.public_key.serialize_compressed().to_vec(), false => self.public_key.serialize().to_vec(), } } /// Returns `true` if the public key is in compressed form. pub fn is_compressed(&self) -> bool { self.compressed } } impl FromStr for RipplePublicKey { type Err = PublicKeyError; fn from_str(public_key: &str) -> Result { let compressed = public_key.len() == 66; let p = hex::decode(public_key) .map_err(|error| PublicKeyError::Crate("hex", format!("{:?}", error)))?; let public_key = libsecp256k1::PublicKey::parse_slice(&p, None) .map_err(|error| PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)))?; Ok(Self { public_key, compressed, }) } } impl fmt::Display for RipplePublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.compressed { for s in &self.public_key.serialize_compressed()[..] { write!(f, "{:02x}", s)?; } } else { for s in &self.public_key.serialize()[..] { write!(f, "{:02x}", s)?; } } Ok(()) } } ================================================ FILE: crates/anychain-ripple/src/transaction.rs ================================================ use std::cmp::{Ord, Ordering}; use std::{fmt, str::FromStr}; use crate::{RippleAddress, RippleFormat, RipplePublicKey}; use anychain_core::{ crypto::{hash160, sha512}, hex, no_std::io::Read, Transaction, TransactionError, TransactionId, }; use libsecp256k1::Signature; #[derive(Clone, Debug, Hash, Eq, PartialEq)] pub struct RippleTransactionParameters { pub destination: [u8; 20], pub fee: u32, pub sequence: u32, pub destination_tag: u32, pub amount: u64, pub memos: Vec, pub public_key: [u8; 33], } #[derive(Clone, Debug, Hash, Eq, PartialEq)] pub struct RippleTransaction { pub params: RippleTransactionParameters, pub signature: Option>, } impl Transaction for RippleTransaction { type Address = RippleAddress; type Format = RippleFormat; type PublicKey = RipplePublicKey; type TransactionParameters = RippleTransactionParameters; type TransactionId = RippleTransactionId; fn new(parameters: &Self::TransactionParameters) -> Result { Ok(Self { params: parameters.clone(), signature: None, }) } fn sign(&mut self, rs: Vec, _recid: u8) -> Result, TransactionError> { if rs.len() != 64 { return Err(TransactionError::Message(format!( "Invalid signature length {}", rs.len(), ))); } self.signature = Some(rs); self.to_bytes() } fn from_bytes(stream: &[u8]) -> Result { // Before we deserialize the stream, we should postfix the // stream with a mark of ending for object type let mut stream = stream.to_vec(); stream.extend(serialize_type(SerializedTypeID::Object, 1)?); // Deserialize the stream to a SerializedType object, which // is then converted to a Ripple Transaction Self::from_st(&SerializedType::deserialize( &mut stream.as_slice(), SerializedTypeID::Object, 0, )?) } fn to_bytes(&self) -> Result, TransactionError> { self.to_st()?.serialize() } fn to_transaction_id(&self) -> Result { match &self.signature { // compute the txid of the signed tx Some(_) => { // prefix the tx stream with "TXN\0" let mut stream = vec![b'T', b'X', b'N', 0]; stream.extend(self.to_bytes()?); // we take the first half of the sha512 hash as txid let txid = sha512(&stream)[..32].to_vec(); Ok(RippleTransactionId { txid }) } // compute the raw tx's digest for signing None => { // preifx the tx stream with "STX\0" let mut stream = vec![b'S', b'T', b'X', 0]; stream.extend(self.to_bytes()?); // we take the first half of the sha512 hash as digest for signing let digest = sha512(&stream)[..32].to_vec(); Ok(RippleTransactionId { txid: digest }) } } } } impl FromStr for RippleTransaction { type Err = TransactionError; fn from_str(tx: &str) -> Result { Self::from_bytes(&hex::decode(tx)?) } } impl fmt::Display for RippleTransaction { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", hex::encode(self.to_bytes().unwrap())) } } impl RippleTransaction { fn to_st(&self) -> Result { let mut account_id = [0u8; 20]; account_id.copy_from_slice(&hash160(&self.params.public_key)); // It is a transaction of type 'payment' let tx_type = SerializedType::Uint16 { field_value: 2, value: 0, }; let account = SerializedType::Account { field_value: 1, account_id, }; let dest = SerializedType::Account { field_value: 3, account_id: self.params.destination, }; let fee = SerializedType::Amount { field_value: 8, value: self.params.fee as u64 | 0x4000000000000000, }; let sequence = SerializedType::Uint32 { field_value: 4, value: self.params.sequence, }; let dest_tag = SerializedType::Uint32 { field_value: 14, value: self.params.destination_tag, }; let amount = SerializedType::Amount { field_value: 1, value: self.params.amount | 0x4000000000000000, }; let public_key = SerializedType::Blob { field_value: 3, buffer: self.params.public_key.to_vec(), }; let mut st = SerializedType::Object { field_value: 0, members: vec![ tx_type, account, dest, fee, sequence, dest_tag, amount, public_key, ], }; let memos: Vec = self .params .memos .iter() .map(|memo| { let memo_type = SerializedType::Blob { field_value: 12, buffer: "payment".as_bytes().to_vec(), }; let memo = SerializedType::Blob { field_value: 13, buffer: memo.as_bytes().to_vec(), }; SerializedType::Object { field_value: 10, members: vec![memo_type, memo], } }) .collect(); if !memos.is_empty() { st.add(SerializedType::Array { field_value: 9, elems: memos, })? } if let Some(sig) = &self.signature { let sig = Signature::parse_standard_slice(sig) .map_err(|error| TransactionError::Crate("libsecp256k1", format!("{:?}", error)))? .serialize_der() .as_ref() .to_vec(); let sig = SerializedType::Blob { field_value: 4, buffer: sig, }; st.add(sig)?; } // Ascendingly sort the object's members by SerializedTypeID. If SerializedTypeIDs // are equal, ascendingly sort them by field value st.sort()?; Ok(st) } fn from_st(st: &SerializedType) -> Result { if let SerializedType::Object { members, .. } = st { let mut source = [0u8; 20]; let mut destination = [0u8; 20]; let mut fee = 0; let mut sequence = 0; let mut destination_tag = 0; let mut amount = 0; let mut memos = vec![]; let mut public_key = [0u8; 33]; let mut signature: Option> = None; for mem in members { match mem { SerializedType::Account { field_value, account_id, .. } => { if *field_value == 3 { destination = *account_id; } else if *field_value == 1 { // Store source account (field 1) for later hash160(public_key) verification. source = *account_id; } else { return Err(TransactionError::Message(format!( "Invalid field value {} for field serialized type 'account'", *field_value, ))); } } SerializedType::Amount { field_value, value, .. } => { if *field_value == 1 { amount = *value & !0x4000000000000000; } else if *field_value == 8 { fee = *value as u32; } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type 'amount'", *field_value, ))); } } SerializedType::Array { field_value, elems } => { if *field_value == 9 { for elem in elems { if let SerializedType::Object { field_value, members, } = elem { if *field_value == 10 { for mem in members { if let SerializedType::Blob { field_value, buffer, } = mem { if *field_value == 12 { // we skip the deserialization of memo_type } else if *field_value == 13 { match String::from_utf8(buffer.clone()) { Ok(memo) => memos.push(memo), Err(_) => { return Err(TransactionError::Message( "Invalid memo".to_string(), )) } } } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type", *field_value, ))); } } } } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type 'object'", *field_value, ))); } } else { return Err(TransactionError::Message( "None object array elements not allowed".to_string(), )); } } } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type 'array'", *field_value, ))); } } SerializedType::Blob { field_value, buffer, } => { if *field_value == 3 { if buffer.len() != 33 { return Err(TransactionError::Message(format!( "Invalid public key length {}", buffer.len(), ))); } public_key.copy_from_slice(buffer); } else if *field_value == 4 { if !(70..=72).contains(&buffer.len()) { return Err(TransactionError::Message(format!( "Invalid signature length {}", buffer.len(), ))); } let sig = Signature::parse_der(buffer) .map_err(|error| { TransactionError::Crate("libsecp256k1", format!("{:?}", error)) })? .serialize() .to_vec(); signature = Some(sig); } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type 'blob'", *field_value, ))); } } SerializedType::Uint32 { field_value, value } => { if *field_value == 4 { sequence = *value; } else if *field_value == 14 { destination_tag = *value; } else { return Err(TransactionError::Message(format!( "Invalid field value {} for serialized type 'integer'", *field_value, ))); } } SerializedType::Uint16 { .. } => {} SerializedType::Object { .. } => { return Err(TransactionError::Message( "Serialized type 'object' not allowd in first layer deserialization" .to_string(), )) } } } // Enforce that Account(source) matches the signer public key hash. let derived_source = hash160(&public_key); if source != derived_source.as_slice() { return Err(TransactionError::Message(format!( "Invalid source account: expected {}, got {}", hex::encode(derived_source), hex::encode(source), ))); } let mut tx = RippleTransaction::new(&RippleTransactionParameters { destination, fee, sequence, destination_tag, amount, memos, public_key, })?; if signature.is_some() { tx.signature = signature; } Ok(tx) } else { Err(TransactionError::Message( "Deserialization of none object serialized type not allowed for Ripple transaction" .to_string(), )) } } pub fn set_public_key(&mut self, pk: Vec) -> Result<(), TransactionError> { self.params.public_key = pk.try_into().unwrap(); Ok(()) } } #[derive(Eq, PartialEq, Hash, Debug, Clone)] pub struct RippleTransactionId { pub txid: Vec, } impl TransactionId for RippleTransactionId {} impl fmt::Display for RippleTransactionId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", hex::encode(&self.txid).to_uppercase()) } } #[derive(PartialEq)] enum SerializedTypeID { Uint16 = 1, Uint32 = 2, Amount = 6, VL = 7, Account = 8, // 9-13 are reserved Object = 14, Array = 15, } impl SerializedTypeID { fn from_u8(b: u8) -> Result { match b { 1 => Ok(Self::Uint16), 2 => Ok(Self::Uint32), 6 => Ok(Self::Amount), 7 => Ok(Self::VL), 8 => Ok(Self::Account), 14 => Ok(Self::Object), 15 => Ok(Self::Array), _ => Err(TransactionError::Message(format!( "Unsupported serialized type id {}", b, ))), } } } impl fmt::Display for SerializedTypeID { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Uint16 => write!(f, "Uint16"), Self::Uint32 => write!(f, "Uint32"), Self::Amount => write!(f, "Amount"), Self::VL => write!(f, "Blob"), Self::Account => write!(f, "Account"), Self::Object => write!(f, "Object"), Self::Array => write!(f, "Array"), } } } #[derive(Clone, Debug, Eq)] enum SerializedType { Account { field_value: u32, account_id: [u8; 20], }, Amount { field_value: u32, value: u64, }, Uint16 { field_value: u32, value: u16, }, Uint32 { field_value: u32, value: u32, }, Blob { field_value: u32, buffer: Vec, }, Array { field_value: u32, elems: Vec, }, Object { field_value: u32, members: Vec, }, } impl PartialEq for SerializedType { fn eq(&self, other: &Self) -> bool { let typ0 = self.typ() as u32; let val0 = self.val(); let typ1 = other.typ() as u32; let val1 = other.val(); typ0 == typ1 && val0 == val1 } } impl Ord for SerializedType { fn cmp(&self, other: &Self) -> Ordering { let typ0 = self.typ() as u32; let val0 = self.val(); let typ1 = other.typ() as u32; let val1 = other.val(); if typ0 < typ1 { Ordering::Less } else if typ0 > typ1 { Ordering::Greater } else if val0 < val1 { Ordering::Less } else if val0 > val1 { Ordering::Greater } else { Ordering::Equal } } } impl PartialOrd for SerializedType { fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } fn serialize_len(mut len: u32) -> Result, TransactionError> { if len <= 192 { Ok(vec![len as u8]) } else if len <= 12480 { len -= 193; let b0 = 193 + (len >> 8) as u8; let b1 = (len & 0xff) as u8; Ok(vec![b0, b1]) } else if len <= 918744 { len -= 12481; let b0 = 241 + (len >> 16) as u8; let b1 = ((len >> 8) & 0xff) as u8; let b2 = (len & 0xff) as u8; Ok(vec![b0, b1, b2]) } else { Err(TransactionError::Message( "Maximum length exceeded".to_string(), )) } } fn deserialize_len(stream: &mut &[u8]) -> Result { let mut b = [0u8; 1]; let _ = stream.read(&mut b)?; match b[0] { (..=192) => Ok(b[0] as u32), (193..=240) => { let mut buf = [0u8; 1]; let _ = stream.read(&mut buf)?; let mut len = [0u8; 4]; len[2] = b[0] - 193; len[3] = buf[0]; Ok(u32::from_be_bytes(len)) } (241..) => { let mut buf = [0u8; 2]; let _ = stream.read(&mut buf)?; let mut len = [0u8; 4]; len[1] = b[0] - 241; len[2] = buf[0]; len[3] = buf[1]; Ok(u32::from_be_bytes(len)) } } } fn serialize_type(typ: SerializedTypeID, val: u32) -> Result, TransactionError> { let typ = typ as u32; if !(..256).contains(&typ) || !(..256).contains(&val) { return Err(TransactionError::Message("Number out of range".to_string())); } if typ < 16 { if val < 16 { // common type, common val Ok(vec![((typ << 4) | val) as u8]) } else { // common type, uncommon val let b0 = (typ << 4) as u8; let b1 = val as u8; Ok(vec![b0, b1]) } } else if val < 16 { // uncommon type, common val let b0 = val as u8; let b1 = typ as u8; Ok(vec![b0, b1]) } else { // uncommon type, uncommon val let b0 = 0; let b1 = typ as u8; let b2 = val as u8; Ok(vec![b0, b1, b2]) } } fn deserialize_type(stream: &mut &[u8]) -> Result<(u8, u8), TransactionError> { let mut b = [0u8; 1]; let _ = stream.read(&mut b)?; match (b[0] & 0xf0 == 0, b[0] & 0x0f == 0) { // both higher and lower 4 bits are zero (true, true) => { let mut buf = [0u8; 2]; let _ = stream.read(&mut buf)?; Ok((buf[0], buf[1])) } // only higher 4 bits are zero (true, false) => { let mut buf = [0u8; 1]; let _ = stream.read(&mut buf)?; Ok((buf[0], b[0])) } // only lower 4 bits are zero (false, true) => { let mut buf = [0u8; 1]; let _ = stream.read(&mut buf)?; Ok((b[0] >> 4, buf[0])) } // neither higher 4 bits nor lower 4 bits are zero (false, false) => Ok(((b[0] & 0xf0) >> 4, b[0] & 0x0f)), } } impl SerializedType { fn typ(&self) -> SerializedTypeID { match self { Self::Account { .. } => SerializedTypeID::Account, Self::Amount { .. } => SerializedTypeID::Amount, Self::Uint16 { .. } => SerializedTypeID::Uint16, Self::Uint32 { .. } => SerializedTypeID::Uint32, Self::Blob { .. } => SerializedTypeID::VL, Self::Array { .. } => SerializedTypeID::Array, Self::Object { .. } => SerializedTypeID::Object, } } fn val(&self) -> u32 { match self { Self::Account { field_value, .. } => *field_value, Self::Amount { field_value, .. } => *field_value, Self::Uint16 { field_value, .. } => *field_value, Self::Uint32 { field_value, .. } => *field_value, Self::Blob { field_value, .. } => *field_value, Self::Array { field_value, .. } => *field_value, Self::Object { field_value, .. } => *field_value, } } fn serialize_type(&self) -> Result, TransactionError> { serialize_type(self.typ(), self.val()) } fn serialize(&self) -> Result, TransactionError> { match self { Self::Amount { value, .. } => Ok(value.to_be_bytes().to_vec()), Self::Uint16 { value, .. } => Ok(value.to_be_bytes().to_vec()), Self::Uint32 { value, .. } => Ok(value.to_be_bytes().to_vec()), Self::Account { account_id, .. } => { let mut stream = serialize_len(account_id.len() as u32)?; stream.extend(account_id.to_vec()); Ok(stream) } Self::Blob { buffer, .. } => { let mut stream = serialize_len(buffer.len() as u32)?; stream.extend(buffer); Ok(stream) } Self::Array { elems, .. } => { let mut stream = vec![]; for elem in elems { stream.extend(elem.serialize_type()?); stream.extend(elem.serialize()?); stream.extend(serialize_type(SerializedTypeID::Object, 1)?); } Ok(stream) } Self::Object { members, .. } => { let mut stream = vec![]; for mem in members { stream.extend(mem.serialize_type()?); stream.extend(mem.serialize()?); match mem.typ() { SerializedTypeID::Array | SerializedTypeID::Object => { stream.extend(serialize_type(mem.typ(), 1)?) } _ => {} } } Ok(stream) } } } fn deserialize( stream: &mut &[u8], typ: SerializedTypeID, field_value: u32, ) -> Result { match typ { SerializedTypeID::Account => { // Firstly we extract the length of the account id let len = deserialize_len(stream)?; if len != 20 { return Err(TransactionError::Message(format!( "Invalid account length {}", len, ))); } // Then we extract the account id let mut account_id = [0u8; 20]; let _ = stream.read(&mut account_id)?; // Return the ST Ok(SerializedType::Account { field_value, account_id, }) } SerializedTypeID::Amount => { let mut value = [0u8; 8]; let _ = stream.read(&mut value)?; let value = u64::from_be_bytes(value); // Return the ST Ok(SerializedType::Amount { field_value, value }) } SerializedTypeID::Uint16 => { let mut value = [0u8; 2]; let _ = stream.read(&mut value)?; let value = u16::from_be_bytes(value); // Return the ST Ok(SerializedType::Uint16 { field_value, value }) } SerializedTypeID::Uint32 => { let mut value = [0u8; 4]; let _ = stream.read(&mut value)?; let value = u32::from_be_bytes(value); // Return the ST Ok(SerializedType::Uint32 { field_value, value }) } SerializedTypeID::VL => { // Firstly we extract the length of the blob let len = deserialize_len(stream)?; // Then we extract the blob according to its length let mut buffer = vec![0u8; len as usize]; let _ = stream.read(&mut buffer)?; // Return the ST Ok(SerializedType::Blob { field_value, buffer, }) } SerializedTypeID::Array => { let mut array = SerializedType::Array { field_value, elems: vec![], }; loop { let (typ, fv) = deserialize_type(stream)?; let typ = SerializedTypeID::from_u8(typ)?; // we have reached the end of the array if typ == SerializedTypeID::Array && fv == 1 { break; } let st = Self::deserialize(stream, typ, fv as u32)?; array.add(st)?; } Ok(array) } SerializedTypeID::Object => { let mut obj = SerializedType::Object { field_value, members: vec![], }; loop { let (typ, fv) = deserialize_type(stream)?; let typ = SerializedTypeID::from_u8(typ)?; // we have reached the end of the object if typ == SerializedTypeID::Object && fv == 1 { break; } let st = Self::deserialize(stream, typ, fv as u32)?; obj.add(st)?; } Ok(obj) } } } fn add(&mut self, st: SerializedType) -> Result<(), TransactionError> { match self { SerializedType::Object { members, .. } => { members.push(st); Ok(()) } SerializedType::Array { elems, .. } => { elems.push(st); Ok(()) } _ => Err(TransactionError::Message( "Adding fields to neither an object or an array".to_string(), )), } } fn sort(&mut self) -> Result<(), TransactionError> { match self { SerializedType::Object { members, .. } => { members.sort(); Ok(()) } _ => Err(TransactionError::Message( "Sorting non-object ST".to_string(), )), } } } #[cfg(test)] mod tests { use crate::{RippleFormat, RipplePublicKey}; use super::{RippleTransaction, RippleTransactionParameters}; use anychain_core::{PublicKey, Transaction, TransactionError}; use libsecp256k1::{self, Message, SecretKey}; use std::str::FromStr; #[test] fn test_tx_gen() { let sk_from = [ 1u8, 1, 1, 1, 1, 117, 1, 1, 1, 1, 1, 1, 118, 1, 1, 92, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]; let sk_to = [ 1u8, 1, 8, 1, 33, 17, 1, 1, 1, 99, 1, 1, 18, 1, 1, 2, 1, 1, 1, 1, 1, 37, 1, 1, 101, 7, 1, 1, 1, 0, 1, 2, ]; let sk_from = SecretKey::parse(&sk_from).unwrap(); let sk_to = SecretKey::parse(&sk_to).unwrap(); let pk_from = RipplePublicKey::from_secret_key(&sk_from); let pk_to = RipplePublicKey::from_secret_key(&sk_to); let from = pk_from.to_address(&RippleFormat::Standard).unwrap(); let to = pk_to.to_address(&RippleFormat::Standard).unwrap(); assert_eq!(from.to_string(), "rDZr8KX1A5Ws1DyT7jZd8TPonchDzDGfX2"); assert_eq!(to.to_string(), "rpnZmX9CW1QoP2uPRgB5mupp9exFyZmuKM"); let pk_from = pk_from.serialize(); let params = RippleTransactionParameters { destination: to.to_hash160().unwrap(), fee: 500000, sequence: 39998031, destination_tag: 50, amount: 100000000, memos: vec!["guai".to_string()], public_key: pk_from.try_into().unwrap(), }; let mut tx = RippleTransaction::new(¶ms).unwrap(); let txid = tx.to_transaction_id().unwrap().txid; let msg = Message::parse_slice(&txid).unwrap(); let sig = libsecp256k1::sign(&msg, &sk_from).0.serialize().to_vec(); let tx = tx.sign(sig, 0).unwrap(); let tx = RippleTransaction::from_bytes(&tx).unwrap(); assert_eq!("120000240262524f2e00000032614000000005f5e10068400000000007a120732102b722a70170451981d269bb52db986c46cd5e46d82628f7770fbc2962a60c5e997446304402200adf9912caaf33ef357031cd46a49c026e5780ca198b1d32dfd252f38fdde572022056b953c08d31b0d68ed6e9ffb810fd8deeefbad21d08f82527bbfa3ec6de0330811489af78f1b802fca6dfaa06c9b6807d2288a9c3be83140bd52483842334109d52935847c4bc188a04998ff9ea7c077061796d656e747d0467756169e1f1", tx.to_string()); // println!("tx = {:?}", tx); // println!("tx = {}", tx); } #[test] fn test_tx_from_str() { let tx = "120000240262524f2e00000032614000000005f5e10068400000000007a120732102b722a70170451981d269bb52db986c46cd5e46d82628f7770fbc2962a60c5e997446304402200adf9912caaf33ef357031cd46a49c026e5780ca198b1d32dfd252f38fdde572022056b953c08d31b0d68ed6e9ffb810fd8deeefbad21d08f82527bbfa3ec6de0330811489af78f1b802fca6dfaa06c9b6807d2288a9c3be83140bd52483842334109d52935847c4bc188a04998ff9ea7c077061796d656e747d0467756169e1f1"; let tx = RippleTransaction::from_str(tx).unwrap(); assert_eq!( tx.params.destination, [ 11, 213, 36, 131, 132, 35, 52, 16, 157, 82, 147, 88, 71, 196, 188, 24, 138, 4, 153, 143 ] ); assert_eq!(tx.params.fee, 500000); assert_eq!(tx.params.sequence, 39998031); assert_eq!(tx.params.destination_tag, 50); assert_eq!(tx.params.amount, 100000000); assert_eq!(tx.params.memos.len(), 1); assert_eq!( tx.params.public_key, [ 2, 183, 34, 167, 1, 112, 69, 25, 129, 210, 105, 187, 82, 219, 152, 108, 70, 205, 94, 70, 216, 38, 40, 247, 119, 15, 188, 41, 98, 166, 12, 94, 153 ] ); let expected_signagure: Vec = [ 10, 223, 153, 18, 202, 175, 51, 239, 53, 112, 49, 205, 70, 164, 156, 2, 110, 87, 128, 202, 25, 139, 29, 50, 223, 210, 82, 243, 143, 221, 229, 114, 86, 185, 83, 192, 141, 49, 176, 214, 142, 214, 233, 255, 184, 16, 253, 141, 238, 239, 186, 210, 29, 8, 248, 37, 39, 187, 250, 62, 198, 222, 3, 48, ] .into(); assert_eq!(tx.signature, Some(expected_signagure)); } #[test] fn test_tx_from_str_rejects_tampered_source_account() { let tx = "120000240262524f2e00000032614000000005f5e10068400000000007a120732102b722a70170451981d269bb52db986c46cd5e46d82628f7770fbc2962a60c5e997446304402200adf9912caaf33ef357031cd46a49c026e5780ca198b1d32dfd252f38fdde572022056b953c08d31b0d68ed6e9ffb810fd8deeefbad21d08f82527bbfa3ec6de0330811489af78f1b802fca6dfaa06c9b6807d2288a9c3be83140bd52483842334109d52935847c4bc188a04998ff9ea7c077061796d656e747d0467756169e1f1"; // Tamper source account (field 0x81 + len 0x14 + 20-byte payload) but keep SigningPubKey unchanged. let tampered = tx.replacen( "811489af78f1b802fca6dfaa06c9b6807d2288a9c3b", "811400af78f1b802fca6dfaa06c9b6807d2288a9c3b", 1, ); let err = RippleTransaction::from_str(&tampered).unwrap_err(); assert!(matches!( err, TransactionError::Message(msg) if msg.contains("Invalid source account") )); } } ================================================ FILE: crates/anychain-tron/Cargo.toml ================================================ [package] name = "anychain-tron" description = "A Rust library for Tron-focused cryptocurrency wallets, enabling seamless transactions on the Tron blockchain" version = "0.2.14" keywords = ["tron", "blockchain", "wallet", "transactions"] categories = ["cryptography::cryptocurrencies"] # Workspace inherited keys authors = { workspace = true } edition = { workspace = true } homepage = { workspace = true } license = { workspace = true } repository = { workspace = true } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../anychain-core", version = "0.1.8" } serde = { workspace = true } sha3 = { workspace = true } sha2 = { workspace = true } hex = { workspace = true } base58 = { workspace = true } protobuf = { workspace = true } chrono = { workspace = true } ethabi = { workspace = true } libsecp256k1 = { workspace = true } ethereum-types = { workspace = true } [lints] workspace = true ================================================ FILE: crates/anychain-tron/README.md ================================================ # anychain-tron anychain-tron is a Rust library that provides a simple and unified interface for interacting with the Tron blockchain. It is designed to be easy to use and integrate into your Rust projects, while maintaining compatibility with the anychain-bitcoin library. ## Features - Unified API for Tron blockchain operations - Support for mainnet and testnet networks - Account management (create, import, export) - Transaction building and signing - Querying blockchain data (balances, transactions, etc.) - Support for smart contracts and TRC10/TRC20 tokens ## Installation Add the following to your Cargo.toml file: ```toml [dependencies] anychain-tron = "0.2.8" ``` Then, run cargo build to download and compile the library. ## Usage Here's a simple example of how to create a new Tron account and query its balance: ```rust ``` For more examples and detailed usage instructions, please refer to the [documentation](https://docs.rs/anychain-tron). ## Contributing We welcome contributions from the community! If you'd like to contribute, please follow these steps: 1. Fork the repository 2. Create a new branch for your changes 3. Make your changes and commit them to your branch 4. Submit a pull request with a description of your changes Please make sure to write tests for your changes and follow the Rust coding style. ## License anychain-tron is released under the MIT License. See the [LICENSE](LICENSE) file for more information. ================================================ FILE: crates/anychain-tron/src/abi.rs ================================================ use crate::TronAddress; use anychain_core::utilities::crypto::keccak256; use ethabi::{encode, Token}; use ethereum_types::U256; use std::str::FromStr; /// Represents a parameter that's fed to a /// function of an on-chain contract pub struct Param { pub type_: String, pub value: Token, } impl From<&TronAddress> for Param { fn from(address: &TronAddress) -> Self { Param { type_: "address".to_string(), value: address.to_token(), } } } impl From for Param { fn from(amount: U256) -> Self { Param { type_: "uint256".to_string(), value: Token::Uint(amount), } } } pub fn contract_function_call(function_name: &str, params: &[Param]) -> Vec { let mut data = Vec::::new(); let param_types = params .iter() .map(|param| param.type_.as_str()) .collect::>() .join(","); let function_selector = format!("{}({})", function_name, param_types); data.extend_from_slice(&keccak256(function_selector.as_bytes())[..4]); let tokens = params .iter() .map(|param| param.value.clone()) .collect::>(); data.extend_from_slice(&encode(&tokens)); data } pub fn trc20_transfer(address: &str, amount: &str) -> Vec { let address = TronAddress::from_str(address).unwrap(); let amount = U256::from_dec_str(amount).unwrap(); contract_function_call("transfer", &[Param::from(&address), Param::from(amount)]) } pub fn trc20_approve(address: &str, amount: &str) -> Vec { let address = TronAddress::from_str(address).unwrap(); let amount = U256::from_dec_str(amount).unwrap(); contract_function_call("approve", &[Param::from(&address), Param::from(amount)]) } #[cfg(test)] mod test_mod { use std::str::FromStr; use super::{contract_function_call, Param}; use crate::TronAddress; use ethabi::ethereum_types::U256; #[test] fn test_contract_function_call() { let address = TronAddress::from_str("TG7jQ7eGsns6nmQNfcKNgZKyKBFkx7CvXr").unwrap(); let amount = U256::from_dec_str("20000000000000000000").unwrap(); let call_data = contract_function_call("transfer", &[Param::from(&address), Param::from(amount)]); assert_eq!( "a9059cbb000000000000000000000041436d74fc1577266b7\ 290b85801145d9c5287e19400000000000000000000000000\ 0000000000000000000001158e460913d00000", hex::encode(call_data) ) } } ================================================ FILE: crates/anychain-tron/src/address.rs ================================================ use crate::{TronFormat, TronPublicKey}; use anychain_core::{Address, AddressError, PublicKey}; use base58::{FromBase58, ToBase58}; use ethabi::Token; use hex::FromHex; use serde::Serialize; use sha2::{Digest, Sha256}; use sha3::Keccak256; use std::fmt; use std::str::FromStr; const ADDRESS_TYPE_PREFIX: u8 = 0x41; #[derive(Clone, PartialEq, Eq, Serialize, Hash)] pub struct TronAddress([u8; 21]); impl Address for TronAddress { type SecretKey = libsecp256k1::SecretKey; type Format = TronFormat; type PublicKey = TronPublicKey; fn from_secret_key( secret_key: &Self::SecretKey, format: &Self::Format, ) -> Result { Self::from_public_key(&TronPublicKey::from_secret_key(secret_key), format) } fn from_public_key( public_key: &Self::PublicKey, _format: &Self::Format, ) -> Result { let mut hasher = Keccak256::new(); hasher.update(&public_key.to_secp256k1_public_key().serialize()[1..]); let digest = hasher.finalize(); let mut raw = [ADDRESS_TYPE_PREFIX; 21]; raw[1..21].copy_from_slice(&digest[digest.len() - 20..]); Ok(TronAddress(raw)) } } impl TronAddress { pub fn to_hex(&self) -> String { hex::encode_upper(self.0) } pub fn as_bytes(&self) -> &[u8] { &self.0 } pub fn from_bytes(raw: &[u8]) -> Result { if raw.len() != 21 { return Err(AddressError::InvalidAddress("Invalid length".to_string())); } let mut address = [0u8; 21]; address.copy_from_slice(raw); Ok(TronAddress(address)) // assert!(raw.len() == 21); // unsafe { std::mem::transmute(&raw[0]) } } pub fn to_base58(&self) -> String { self.to_string() } pub fn to_token(&self) -> Token { let mut bytes = [0u8; 11].to_vec(); bytes.extend_from_slice(self.as_bytes()); Token::FixedBytes(bytes) } } impl Default for TronAddress { fn default() -> Self { TronAddress([ 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]) } } impl fmt::Display for TronAddress { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { b58encode_check(self.0).fmt(f) } } impl ::std::fmt::Debug for TronAddress { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { f.debug_tuple("Address").field(&self.to_string()).finish() } } impl TryFrom<&[u8]> for TronAddress { type Error = AddressError; fn try_from(value: &[u8]) -> Result { if value.len() != 21 { Err(AddressError::InvalidAddress("Invalid length".to_string())) } else if value[0] != ADDRESS_TYPE_PREFIX { Err(AddressError::Message(format!( "Invalid version byte {}", value[0] ))) } else { let mut raw = [0u8; 21]; raw[..21].copy_from_slice(value); Ok(TronAddress(raw)) } } } impl TryFrom> for TronAddress { type Error = AddressError; fn try_from(value: Vec) -> Result { Self::try_from(&value[..]) } } impl TryFrom<&Vec> for TronAddress { type Error = AddressError; fn try_from(value: &Vec) -> Result { Self::try_from(&value[..]) } } impl TryFrom<&str> for TronAddress { type Error = AddressError; fn try_from(value: &str) -> Result { TronAddress::from_str(value) } } impl FromHex for TronAddress { type Error = AddressError; fn from_hex>(hex: T) -> Result { TronAddress::try_from(hex.as_ref()) } } impl FromStr for TronAddress { type Err = AddressError; fn from_str(s: &str) -> Result where Self: Sized, { if s.len() == 34 { b58decode_check(s).and_then(TronAddress::try_from) } else if s.len() == 42 && s[..2] == hex::encode([ADDRESS_TYPE_PREFIX]) { Vec::from_hex(s) .map_err(|_| AddressError::InvalidAddress("InvalidAddress".to_string())) .and_then(TronAddress::try_from) } else if s.len() == 44 && (s.starts_with("0x") || s.starts_with("0X")) { Vec::from_hex(&s.as_bytes()[2..]) .map_err(|_| AddressError::InvalidAddress("InvalidAddress".to_string())) .and_then(TronAddress::try_from) } else if s == "_" || s == "0x0" || s == "/0" { "410000000000000000000000000000000000000000".parse() } else { // eprintln!("len={} prefix={:x}", s.len(), s.as_bytes()[0]); Err(AddressError::InvalidAddress("Invalid length".to_string())) } } } // NOTE: AsRef<[u8]> implies ToHex impl AsRef<[u8]> for TronAddress { fn as_ref(&self) -> &[u8] { &self.0 } } /// Base58check encode. pub fn b58encode_check>(raw: T) -> String { let mut hasher = Sha256::new(); hasher.update(raw.as_ref()); let digest1 = hasher.finalize(); let mut hasher = Sha256::new(); hasher.update(digest1); let digest = hasher.finalize(); let mut raw = raw.as_ref().to_owned(); raw.extend(&digest[..4]); raw.to_base58() } /// Base58check decode. pub fn b58decode_check(s: &str) -> Result, AddressError> { let mut result = s .from_base58() .map_err(|_| AddressError::InvalidAddress("".to_string()))?; let check = result.split_off(result.len() - 4); let mut hasher = Sha256::new(); hasher.update(&result); let digest1 = hasher.finalize(); let mut hasher = Sha256::new(); hasher.update(digest1); let digest = hasher.finalize(); if check != digest[..4] { Err(AddressError::InvalidAddress("".to_string())) } else { Ok(result) } } #[cfg(test)] mod tests { use super::*; use hex::ToHex; #[test] fn test_address() { let addr = TronAddress([ 65, 150, 163, 186, 206, 90, 218, 207, 99, 126, 183, 204, 121, 213, 120, 127, 66, 71, 218, 75, 190, ]); assert_eq!("TPhiVyQZ5xyvVK2KS2LTke8YvXJU5wxnbN", format!("{:}", addr)); assert_eq!( addr, "TPhiVyQZ5xyvVK2KS2LTke8YvXJU5wxnbN" .parse() .expect("parse error") ); assert_eq!( addr, "4196a3bace5adacf637eb7cc79d5787f4247da4bbe" .parse() .expect("parse error") ); assert_eq!( addr.as_bytes().encode_hex::(), "4196a3bace5adacf637eb7cc79d5787f4247da4bbe" ) } #[test] fn test_address_from_public() { let public = TronPublicKey::from_str("56f19ba7de92264d94f9b6600ec05c16c0b25a064e2ee1cf5bf0dd9661d04515c99c3a6b42b2c574232a5b951bf57cf706bbfd36377b406f9313772f65612cd0").unwrap(); let addr = TronAddress::from_public_key(&public, &TronFormat::Standard).unwrap(); assert_eq!(addr.to_string(), "TQHAvs2ZFTbsd93ycTfw1Wuf1e4WsPZWCp"); } #[test] fn test_address_from_bytes() { let bytes = [ 65, 150, 163, 186, 206, 90, 218, 207, 99, 126, 183, 204, 121, 213, 120, 127, 66, 71, 218, 75, 190, ]; let addr = TronAddress::from_bytes(&bytes); assert!(addr.is_ok()); let malicious_bytes: [u8; 22] = [ 0xde, 0xad, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; let addr = TronAddress::from_bytes(&malicious_bytes); assert!(addr.is_err()); } } ================================================ FILE: crates/anychain-tron/src/format.rs ================================================ use anychain_core::Format; use core::fmt; use serde::Serialize; /// Represents the format of a Ethereum address #[derive(Serialize, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum TronFormat { Standard, } impl Format for TronFormat {} impl fmt::Display for TronFormat { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "TronFormat") } } ================================================ FILE: crates/anychain-tron/src/lib.rs ================================================ pub mod address; pub use address::*; pub mod format; pub use format::*; pub mod public_key; pub use public_key::*; pub mod protocol; pub mod transaction; pub use transaction::*; pub mod abi; pub mod trx; ================================================ FILE: crates/anychain-tron/src/protocol/Discover.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/Discover.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.Endpoint) #[derive(PartialEq,Clone,Default,Debug)] pub struct Endpoint { // message fields // @@protoc_insertion_point(field:protocol.Endpoint.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Endpoint.port) pub port: i32, // @@protoc_insertion_point(field:protocol.Endpoint.nodeId) pub nodeId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Endpoint.addressIpv6) pub addressIpv6: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Endpoint.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Endpoint { fn default() -> &'a Endpoint { ::default_instance() } } impl Endpoint { pub fn new() -> Endpoint { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Endpoint| { &m.address }, |m: &mut Endpoint| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "port", |m: &Endpoint| { &m.port }, |m: &mut Endpoint| { &mut m.port }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nodeId", |m: &Endpoint| { &m.nodeId }, |m: &mut Endpoint| { &mut m.nodeId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "addressIpv6", |m: &Endpoint| { &m.addressIpv6 }, |m: &mut Endpoint| { &mut m.addressIpv6 }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Endpoint", fields, oneofs, ) } } impl ::protobuf::Message for Endpoint { const NAME: &'static str = "Endpoint"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, 16 => { self.port = is.read_int32()?; }, 26 => { self.nodeId = is.read_bytes()?; }, 34 => { self.addressIpv6 = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } if self.port != 0 { my_size += ::protobuf::rt::int32_size(2, self.port); } if !self.nodeId.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.nodeId); } if !self.addressIpv6.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.addressIpv6); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } if self.port != 0 { os.write_int32(2, self.port)?; } if !self.nodeId.is_empty() { os.write_bytes(3, &self.nodeId)?; } if !self.addressIpv6.is_empty() { os.write_bytes(4, &self.addressIpv6)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Endpoint { Endpoint::new() } fn clear(&mut self) { self.address.clear(); self.port = 0; self.nodeId.clear(); self.addressIpv6.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Endpoint { static instance: Endpoint = Endpoint { address: ::std::vec::Vec::new(), port: 0, nodeId: ::std::vec::Vec::new(), addressIpv6: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Endpoint { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Endpoint").unwrap()).clone() } } impl ::std::fmt::Display for Endpoint { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Endpoint { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.PingMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct PingMessage { // message fields // @@protoc_insertion_point(field:protocol.PingMessage.from) pub from: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.PingMessage.to) pub to: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.PingMessage.version) pub version: i32, // @@protoc_insertion_point(field:protocol.PingMessage.timestamp) pub timestamp: i64, // special fields // @@protoc_insertion_point(special_field:protocol.PingMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PingMessage { fn default() -> &'a PingMessage { ::default_instance() } } impl PingMessage { pub fn new() -> PingMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Endpoint>( "from", |m: &PingMessage| { &m.from }, |m: &mut PingMessage| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Endpoint>( "to", |m: &PingMessage| { &m.to }, |m: &mut PingMessage| { &mut m.to }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &PingMessage| { &m.version }, |m: &mut PingMessage| { &mut m.version }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &PingMessage| { &m.timestamp }, |m: &mut PingMessage| { &mut m.timestamp }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PingMessage", fields, oneofs, ) } } impl ::protobuf::Message for PingMessage { const NAME: &'static str = "PingMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.from)?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.to)?; }, 24 => { self.version = is.read_int32()?; }, 32 => { self.timestamp = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.from.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.to.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.version != 0 { my_size += ::protobuf::rt::int32_size(3, self.version); } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(4, self.timestamp); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.from.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if let Some(v) = self.to.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if self.version != 0 { os.write_int32(3, self.version)?; } if self.timestamp != 0 { os.write_int64(4, self.timestamp)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PingMessage { PingMessage::new() } fn clear(&mut self) { self.from.clear(); self.to.clear(); self.version = 0; self.timestamp = 0; self.special_fields.clear(); } fn default_instance() -> &'static PingMessage { static instance: PingMessage = PingMessage { from: ::protobuf::MessageField::none(), to: ::protobuf::MessageField::none(), version: 0, timestamp: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PingMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("PingMessage").unwrap()).clone() } } impl ::std::fmt::Display for PingMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PingMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.PongMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct PongMessage { // message fields // @@protoc_insertion_point(field:protocol.PongMessage.from) pub from: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.PongMessage.echo) pub echo: i32, // @@protoc_insertion_point(field:protocol.PongMessage.timestamp) pub timestamp: i64, // special fields // @@protoc_insertion_point(special_field:protocol.PongMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PongMessage { fn default() -> &'a PongMessage { ::default_instance() } } impl PongMessage { pub fn new() -> PongMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Endpoint>( "from", |m: &PongMessage| { &m.from }, |m: &mut PongMessage| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "echo", |m: &PongMessage| { &m.echo }, |m: &mut PongMessage| { &mut m.echo }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &PongMessage| { &m.timestamp }, |m: &mut PongMessage| { &mut m.timestamp }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PongMessage", fields, oneofs, ) } } impl ::protobuf::Message for PongMessage { const NAME: &'static str = "PongMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.from)?; }, 16 => { self.echo = is.read_int32()?; }, 24 => { self.timestamp = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.from.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.echo != 0 { my_size += ::protobuf::rt::int32_size(2, self.echo); } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(3, self.timestamp); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.from.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if self.echo != 0 { os.write_int32(2, self.echo)?; } if self.timestamp != 0 { os.write_int64(3, self.timestamp)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PongMessage { PongMessage::new() } fn clear(&mut self) { self.from.clear(); self.echo = 0; self.timestamp = 0; self.special_fields.clear(); } fn default_instance() -> &'static PongMessage { static instance: PongMessage = PongMessage { from: ::protobuf::MessageField::none(), echo: 0, timestamp: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PongMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("PongMessage").unwrap()).clone() } } impl ::std::fmt::Display for PongMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PongMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.FindNeighbours) #[derive(PartialEq,Clone,Default,Debug)] pub struct FindNeighbours { // message fields // @@protoc_insertion_point(field:protocol.FindNeighbours.from) pub from: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.FindNeighbours.targetId) pub targetId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.FindNeighbours.timestamp) pub timestamp: i64, // special fields // @@protoc_insertion_point(special_field:protocol.FindNeighbours.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a FindNeighbours { fn default() -> &'a FindNeighbours { ::default_instance() } } impl FindNeighbours { pub fn new() -> FindNeighbours { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Endpoint>( "from", |m: &FindNeighbours| { &m.from }, |m: &mut FindNeighbours| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "targetId", |m: &FindNeighbours| { &m.targetId }, |m: &mut FindNeighbours| { &mut m.targetId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &FindNeighbours| { &m.timestamp }, |m: &mut FindNeighbours| { &mut m.timestamp }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "FindNeighbours", fields, oneofs, ) } } impl ::protobuf::Message for FindNeighbours { const NAME: &'static str = "FindNeighbours"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.from)?; }, 18 => { self.targetId = is.read_bytes()?; }, 24 => { self.timestamp = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.from.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.targetId.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.targetId); } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(3, self.timestamp); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.from.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.targetId.is_empty() { os.write_bytes(2, &self.targetId)?; } if self.timestamp != 0 { os.write_int64(3, self.timestamp)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> FindNeighbours { FindNeighbours::new() } fn clear(&mut self) { self.from.clear(); self.targetId.clear(); self.timestamp = 0; self.special_fields.clear(); } fn default_instance() -> &'static FindNeighbours { static instance: FindNeighbours = FindNeighbours { from: ::protobuf::MessageField::none(), targetId: ::std::vec::Vec::new(), timestamp: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for FindNeighbours { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("FindNeighbours").unwrap()).clone() } } impl ::std::fmt::Display for FindNeighbours { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for FindNeighbours { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Neighbours) #[derive(PartialEq,Clone,Default,Debug)] pub struct Neighbours { // message fields // @@protoc_insertion_point(field:protocol.Neighbours.from) pub from: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Neighbours.neighbours) pub neighbours: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Neighbours.timestamp) pub timestamp: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Neighbours.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Neighbours { fn default() -> &'a Neighbours { ::default_instance() } } impl Neighbours { pub fn new() -> Neighbours { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Endpoint>( "from", |m: &Neighbours| { &m.from }, |m: &mut Neighbours| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "neighbours", |m: &Neighbours| { &m.neighbours }, |m: &mut Neighbours| { &mut m.neighbours }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &Neighbours| { &m.timestamp }, |m: &mut Neighbours| { &mut m.timestamp }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Neighbours", fields, oneofs, ) } } impl ::protobuf::Message for Neighbours { const NAME: &'static str = "Neighbours"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.from)?; }, 18 => { self.neighbours.push(is.read_message()?); }, 24 => { self.timestamp = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.from.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.neighbours { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(3, self.timestamp); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.from.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } for v in &self.neighbours { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; if self.timestamp != 0 { os.write_int64(3, self.timestamp)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Neighbours { Neighbours::new() } fn clear(&mut self) { self.from.clear(); self.neighbours.clear(); self.timestamp = 0; self.special_fields.clear(); } fn default_instance() -> &'static Neighbours { static instance: Neighbours = Neighbours { from: ::protobuf::MessageField::none(), neighbours: ::std::vec::Vec::new(), timestamp: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Neighbours { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Neighbours").unwrap()).clone() } } impl ::std::fmt::Display for Neighbours { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Neighbours { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.BackupMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct BackupMessage { // message fields // @@protoc_insertion_point(field:protocol.BackupMessage.flag) pub flag: bool, // @@protoc_insertion_point(field:protocol.BackupMessage.priority) pub priority: i32, // special fields // @@protoc_insertion_point(special_field:protocol.BackupMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BackupMessage { fn default() -> &'a BackupMessage { ::default_instance() } } impl BackupMessage { pub fn new() -> BackupMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "flag", |m: &BackupMessage| { &m.flag }, |m: &mut BackupMessage| { &mut m.flag }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "priority", |m: &BackupMessage| { &m.priority }, |m: &mut BackupMessage| { &mut m.priority }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BackupMessage", fields, oneofs, ) } } impl ::protobuf::Message for BackupMessage { const NAME: &'static str = "BackupMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.flag = is.read_bool()?; }, 16 => { self.priority = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.flag != false { my_size += 1 + 1; } if self.priority != 0 { my_size += ::protobuf::rt::int32_size(2, self.priority); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.flag != false { os.write_bool(1, self.flag)?; } if self.priority != 0 { os.write_int32(2, self.priority)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BackupMessage { BackupMessage::new() } fn clear(&mut self) { self.flag = false; self.priority = 0; self.special_fields.clear(); } fn default_instance() -> &'static BackupMessage { static instance: BackupMessage = BackupMessage { flag: false, priority: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BackupMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BackupMessage").unwrap()).clone() } } impl ::std::fmt::Display for BackupMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BackupMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n\x13core/Discover.proto\x12\x08protocol\"r\n\x08Endpoint\x12\x18\n\x07\ address\x18\x01\x20\x01(\x0cR\x07address\x12\x12\n\x04port\x18\x02\x20\ \x01(\x05R\x04port\x12\x16\n\x06nodeId\x18\x03\x20\x01(\x0cR\x06nodeId\ \x12\x20\n\x0baddressIpv6\x18\x04\x20\x01(\x0cR\x0baddressIpv6\"\x91\x01\ \n\x0bPingMessage\x12&\n\x04from\x18\x01\x20\x01(\x0b2\x12.protocol.Endp\ ointR\x04from\x12\"\n\x02to\x18\x02\x20\x01(\x0b2\x12.protocol.EndpointR\ \x02to\x12\x18\n\x07version\x18\x03\x20\x01(\x05R\x07version\x12\x1c\n\t\ timestamp\x18\x04\x20\x01(\x03R\ttimestamp\"g\n\x0bPongMessage\x12&\n\ \x04from\x18\x01\x20\x01(\x0b2\x12.protocol.EndpointR\x04from\x12\x12\n\ \x04echo\x18\x02\x20\x01(\x05R\x04echo\x12\x1c\n\ttimestamp\x18\x03\x20\ \x01(\x03R\ttimestamp\"r\n\x0eFindNeighbours\x12&\n\x04from\x18\x01\x20\ \x01(\x0b2\x12.protocol.EndpointR\x04from\x12\x1a\n\x08targetId\x18\x02\ \x20\x01(\x0cR\x08targetId\x12\x1c\n\ttimestamp\x18\x03\x20\x01(\x03R\tt\ imestamp\"\x86\x01\n\nNeighbours\x12&\n\x04from\x18\x01\x20\x01(\x0b2\ \x12.protocol.EndpointR\x04from\x122\n\nneighbours\x18\x02\x20\x03(\x0b2\ \x12.protocol.EndpointR\nneighbours\x12\x1c\n\ttimestamp\x18\x03\x20\x01\ (\x03R\ttimestamp\"?\n\rBackupMessage\x12\x12\n\x04flag\x18\x01\x20\x01(\ \x08R\x04flag\x12\x1a\n\x08priority\x18\x02\x20\x01(\x05R\x08priorityBF\ \n\x0forg.tron.protosB\x08DiscoverZ)github.com/tronprotocol/grpc-gateway\ /coreJ\x81\x0b\n\x06\x12\x04\0\0,\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\ \x08\n\x01\x02\x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x05\0(\nH\n\x02\ \x08\x01\x12\x03\x05\0(\"=Specify\x20the\x20name\x20of\x20the\x20package\ \x20that\x20generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\ \x06\0)\n=\n\x02\x08\x08\x12\x03\x06\0)\"2Specify\x20the\x20class\x20nam\ e\x20of\x20the\x20generated\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\ \x07\0@\n\t\n\x02\x08\x0b\x12\x03\x07\0@\n\n\n\x02\x04\0\x12\x04\t\0\x0e\ \x01\n\n\n\x03\x04\0\x01\x12\x03\t\x08\x10\n\x0b\n\x04\x04\0\x02\0\x12\ \x03\n\x02\x14\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\n\x02\x07\n\x0c\n\x05\ \x04\0\x02\0\x01\x12\x03\n\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\n\ \x12\x13\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0b\x02\x11\n\x0c\n\x05\x04\0\ \x02\x01\x05\x12\x03\x0b\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ \x0b\x08\x0c\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0b\x0f\x10\n\x0b\n\ \x04\x04\0\x02\x02\x12\x03\x0c\x02\x13\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ \x03\x0c\x02\x07\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0c\x08\x0e\n\x0c\ \n\x05\x04\0\x02\x02\x03\x12\x03\x0c\x11\x12\n\x0b\n\x04\x04\0\x02\x03\ \x12\x03\r\x02\x18\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\r\x02\x07\n\x0c\ \n\x05\x04\0\x02\x03\x01\x12\x03\r\x08\x13\n\x0c\n\x05\x04\0\x02\x03\x03\ \x12\x03\r\x16\x17\n\n\n\x02\x04\x01\x12\x04\x10\0\x15\x01\n\n\n\x03\x04\ \x01\x01\x12\x03\x10\x08\x13\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x11\x02\ \x14\n\x0c\n\x05\x04\x01\x02\0\x06\x12\x03\x11\x02\n\n\x0c\n\x05\x04\x01\ \x02\0\x01\x12\x03\x11\x0b\x0f\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x11\ \x12\x13\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x12\x02\x12\n\x0c\n\x05\x04\ \x01\x02\x01\x06\x12\x03\x12\x02\n\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\ \x03\x12\x0b\r\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x12\x10\x11\n\x0b\ \n\x04\x04\x01\x02\x02\x12\x03\x13\x02\x14\n\x0c\n\x05\x04\x01\x02\x02\ \x05\x12\x03\x13\x02\x07\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x13\x08\ \x0f\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x13\x12\x13\n\x0b\n\x04\x04\ \x01\x02\x03\x12\x03\x14\x02\x16\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\ \x14\x02\x07\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\x14\x08\x11\n\x0c\n\ \x05\x04\x01\x02\x03\x03\x12\x03\x14\x14\x15\n\n\n\x02\x04\x02\x12\x04\ \x17\0\x1b\x01\n\n\n\x03\x04\x02\x01\x12\x03\x17\x08\x13\n\x0b\n\x04\x04\ \x02\x02\0\x12\x03\x18\x02\x14\n\x0c\n\x05\x04\x02\x02\0\x06\x12\x03\x18\ \x02\n\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x18\x0b\x0f\n\x0c\n\x05\x04\ \x02\x02\0\x03\x12\x03\x18\x12\x13\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\ \x19\x02\x11\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x19\x02\x07\n\x0c\n\ \x05\x04\x02\x02\x01\x01\x12\x03\x19\x08\x0c\n\x0c\n\x05\x04\x02\x02\x01\ \x03\x12\x03\x19\x0f\x10\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1a\x02\x16\ \n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x1a\x02\x07\n\x0c\n\x05\x04\x02\ \x02\x02\x01\x12\x03\x1a\x08\x11\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\ \x1a\x14\x15\n\n\n\x02\x04\x03\x12\x04\x1d\0!\x01\n\n\n\x03\x04\x03\x01\ \x12\x03\x1d\x08\x16\n\x0b\n\x04\x04\x03\x02\0\x12\x03\x1e\x02\x14\n\x0c\ \n\x05\x04\x03\x02\0\x06\x12\x03\x1e\x02\n\n\x0c\n\x05\x04\x03\x02\0\x01\ \x12\x03\x1e\x0b\x0f\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x1e\x12\x13\n\ \x0b\n\x04\x04\x03\x02\x01\x12\x03\x1f\x02\x15\n\x0c\n\x05\x04\x03\x02\ \x01\x05\x12\x03\x1f\x02\x07\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x1f\ \x08\x10\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x1f\x13\x14\n\x0b\n\x04\ \x04\x03\x02\x02\x12\x03\x20\x02\x16\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\ \x03\x20\x02\x07\n\x0c\n\x05\x04\x03\x02\x02\x01\x12\x03\x20\x08\x11\n\ \x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\x20\x14\x15\n\n\n\x02\x04\x04\x12\ \x04#\0'\x01\n\n\n\x03\x04\x04\x01\x12\x03#\x08\x12\n\x0b\n\x04\x04\x04\ \x02\0\x12\x03$\x02\x14\n\x0c\n\x05\x04\x04\x02\0\x06\x12\x03$\x02\n\n\ \x0c\n\x05\x04\x04\x02\0\x01\x12\x03$\x0b\x0f\n\x0c\n\x05\x04\x04\x02\0\ \x03\x12\x03$\x12\x13\n\x0b\n\x04\x04\x04\x02\x01\x12\x03%\x02#\n\x0c\n\ \x05\x04\x04\x02\x01\x04\x12\x03%\x02\n\n\x0c\n\x05\x04\x04\x02\x01\x06\ \x12\x03%\x0b\x13\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03%\x14\x1e\n\x0c\ \n\x05\x04\x04\x02\x01\x03\x12\x03%!\"\n\x0b\n\x04\x04\x04\x02\x02\x12\ \x03&\x02\x16\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x03&\x02\x07\n\x0c\n\ \x05\x04\x04\x02\x02\x01\x12\x03&\x08\x11\n\x0c\n\x05\x04\x04\x02\x02\ \x03\x12\x03&\x14\x15\n\n\n\x02\x04\x05\x12\x04)\0,\x01\n\n\n\x03\x04\ \x05\x01\x12\x03)\x08\x15\n\x0b\n\x04\x04\x05\x02\0\x12\x03*\x02\x10\n\ \x0c\n\x05\x04\x05\x02\0\x05\x12\x03*\x02\x06\n\x0c\n\x05\x04\x05\x02\0\ \x01\x12\x03*\x07\x0b\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03*\x0e\x0f\n\ \x0b\n\x04\x04\x05\x02\x01\x12\x03+\x02\x15\n\x0c\n\x05\x04\x05\x02\x01\ \x05\x12\x03+\x02\x07\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03+\x08\x10\n\ \x0c\n\x05\x04\x05\x02\x01\x03\x12\x03+\x13\x14b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(6); messages.push(Endpoint::generated_message_descriptor_data()); messages.push(PingMessage::generated_message_descriptor_data()); messages.push(PongMessage::generated_message_descriptor_data()); messages.push(FindNeighbours::generated_message_descriptor_data()); messages.push(Neighbours::generated_message_descriptor_data()); messages.push(BackupMessage::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/Tron.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/Tron.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; /// AccountId, (name, address) use name, (null, address) use address, (name, null) use name, // @@protoc_insertion_point(message:protocol.AccountId) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountId { // message fields // @@protoc_insertion_point(field:protocol.AccountId.name) pub name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AccountId.address) pub address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.AccountId.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountId { fn default() -> &'a AccountId { ::default_instance() } } impl AccountId { pub fn new() -> AccountId { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &AccountId| { &m.name }, |m: &mut AccountId| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &AccountId| { &m.address }, |m: &mut AccountId| { &mut m.address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountId", fields, oneofs, ) } } impl ::protobuf::Message for AccountId { const NAME: &'static str = "AccountId"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.name = is.read_bytes()?; }, 18 => { self.address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.name.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.name); } if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.name.is_empty() { os.write_bytes(1, &self.name)?; } if !self.address.is_empty() { os.write_bytes(2, &self.address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountId { AccountId::new() } fn clear(&mut self) { self.name.clear(); self.address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountId { static instance: AccountId = AccountId { name: ::std::vec::Vec::new(), address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountId { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountId").unwrap()).clone() } } impl ::std::fmt::Display for AccountId { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountId { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// vote message // @@protoc_insertion_point(message:protocol.Vote) #[derive(PartialEq,Clone,Default,Debug)] pub struct Vote { // message fields /// the super rep address // @@protoc_insertion_point(field:protocol.Vote.vote_address) pub vote_address: ::std::vec::Vec, /// the vote num to this super rep. // @@protoc_insertion_point(field:protocol.Vote.vote_count) pub vote_count: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Vote.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Vote { fn default() -> &'a Vote { ::default_instance() } } impl Vote { pub fn new() -> Vote { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vote_address", |m: &Vote| { &m.vote_address }, |m: &mut Vote| { &mut m.vote_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vote_count", |m: &Vote| { &m.vote_count }, |m: &mut Vote| { &mut m.vote_count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Vote", fields, oneofs, ) } } impl ::protobuf::Message for Vote { const NAME: &'static str = "Vote"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.vote_address = is.read_bytes()?; }, 16 => { self.vote_count = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.vote_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.vote_address); } if self.vote_count != 0 { my_size += ::protobuf::rt::int64_size(2, self.vote_count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.vote_address.is_empty() { os.write_bytes(1, &self.vote_address)?; } if self.vote_count != 0 { os.write_int64(2, self.vote_count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Vote { Vote::new() } fn clear(&mut self) { self.vote_address.clear(); self.vote_count = 0; self.special_fields.clear(); } fn default_instance() -> &'static Vote { static instance: Vote = Vote { vote_address: ::std::vec::Vec::new(), vote_count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Vote { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Vote").unwrap()).clone() } } impl ::std::fmt::Display for Vote { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Vote { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Proposal // @@protoc_insertion_point(message:protocol.Proposal) #[derive(PartialEq,Clone,Default,Debug)] pub struct Proposal { // message fields // @@protoc_insertion_point(field:protocol.Proposal.proposal_id) pub proposal_id: i64, // @@protoc_insertion_point(field:protocol.Proposal.proposer_address) pub proposer_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Proposal.parameters) pub parameters: ::std::collections::HashMap, // @@protoc_insertion_point(field:protocol.Proposal.expiration_time) pub expiration_time: i64, // @@protoc_insertion_point(field:protocol.Proposal.create_time) pub create_time: i64, // @@protoc_insertion_point(field:protocol.Proposal.approvals) pub approvals: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.Proposal.state) pub state: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.Proposal.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Proposal { fn default() -> &'a Proposal { ::default_instance() } } impl Proposal { pub fn new() -> Proposal { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "proposal_id", |m: &Proposal| { &m.proposal_id }, |m: &mut Proposal| { &mut m.proposal_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "proposer_address", |m: &Proposal| { &m.proposer_address }, |m: &mut Proposal| { &mut m.proposer_address }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "parameters", |m: &Proposal| { &m.parameters }, |m: &mut Proposal| { &mut m.parameters }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expiration_time", |m: &Proposal| { &m.expiration_time }, |m: &mut Proposal| { &mut m.expiration_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "create_time", |m: &Proposal| { &m.create_time }, |m: &mut Proposal| { &mut m.create_time }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "approvals", |m: &Proposal| { &m.approvals }, |m: &mut Proposal| { &mut m.approvals }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "state", |m: &Proposal| { &m.state }, |m: &mut Proposal| { &mut m.state }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Proposal", fields, oneofs, ) } } impl ::protobuf::Message for Proposal { const NAME: &'static str = "Proposal"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.proposal_id = is.read_int64()?; }, 18 => { self.proposer_address = is.read_bytes()?; }, 26 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => key = is.read_int64()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.parameters.insert(key, value); }, 32 => { self.expiration_time = is.read_int64()?; }, 40 => { self.create_time = is.read_int64()?; }, 50 => { self.approvals.push(is.read_bytes()?); }, 56 => { self.state = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.proposal_id != 0 { my_size += ::protobuf::rt::int64_size(1, self.proposal_id); } if !self.proposer_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.proposer_address); } for (k, v) in &self.parameters { let mut entry_size = 0; entry_size += ::protobuf::rt::int64_size(1, *k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; if self.expiration_time != 0 { my_size += ::protobuf::rt::int64_size(4, self.expiration_time); } if self.create_time != 0 { my_size += ::protobuf::rt::int64_size(5, self.create_time); } for value in &self.approvals { my_size += ::protobuf::rt::bytes_size(6, &value); }; if self.state != ::protobuf::EnumOrUnknown::new(proposal::State::PENDING) { my_size += ::protobuf::rt::int32_size(7, self.state.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.proposal_id != 0 { os.write_int64(1, self.proposal_id)?; } if !self.proposer_address.is_empty() { os.write_bytes(2, &self.proposer_address)?; } for (k, v) in &self.parameters { let mut entry_size = 0; entry_size += ::protobuf::rt::int64_size(1, *k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(26)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_int64(1, *k)?; os.write_int64(2, *v)?; }; if self.expiration_time != 0 { os.write_int64(4, self.expiration_time)?; } if self.create_time != 0 { os.write_int64(5, self.create_time)?; } for v in &self.approvals { os.write_bytes(6, &v)?; }; if self.state != ::protobuf::EnumOrUnknown::new(proposal::State::PENDING) { os.write_enum(7, ::protobuf::EnumOrUnknown::value(&self.state))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Proposal { Proposal::new() } fn clear(&mut self) { self.proposal_id = 0; self.proposer_address.clear(); self.parameters.clear(); self.expiration_time = 0; self.create_time = 0; self.approvals.clear(); self.state = ::protobuf::EnumOrUnknown::new(proposal::State::PENDING); self.special_fields.clear(); } fn default_instance() -> &'static Proposal { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(Proposal::new) } } impl ::protobuf::MessageFull for Proposal { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Proposal").unwrap()).clone() } } impl ::std::fmt::Display for Proposal { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Proposal { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Proposal` pub mod proposal { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Proposal.State) pub enum State { // @@protoc_insertion_point(enum_value:protocol.Proposal.State.PENDING) PENDING = 0, // @@protoc_insertion_point(enum_value:protocol.Proposal.State.DISAPPROVED) DISAPPROVED = 1, // @@protoc_insertion_point(enum_value:protocol.Proposal.State.APPROVED) APPROVED = 2, // @@protoc_insertion_point(enum_value:protocol.Proposal.State.CANCELED) CANCELED = 3, } impl ::protobuf::Enum for State { const NAME: &'static str = "State"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(State::PENDING), 1 => ::std::option::Option::Some(State::DISAPPROVED), 2 => ::std::option::Option::Some(State::APPROVED), 3 => ::std::option::Option::Some(State::CANCELED), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "PENDING" => ::std::option::Option::Some(State::PENDING), "DISAPPROVED" => ::std::option::Option::Some(State::DISAPPROVED), "APPROVED" => ::std::option::Option::Some(State::APPROVED), "CANCELED" => ::std::option::Option::Some(State::CANCELED), _ => ::std::option::Option::None } } const VALUES: &'static [State] = &[ State::PENDING, State::DISAPPROVED, State::APPROVED, State::CANCELED, ]; } impl ::protobuf::EnumFull for State { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Proposal.State").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for State { fn default() -> Self { State::PENDING } } impl State { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Proposal.State") } } } /// Exchange // @@protoc_insertion_point(message:protocol.Exchange) #[derive(PartialEq,Clone,Default,Debug)] pub struct Exchange { // message fields // @@protoc_insertion_point(field:protocol.Exchange.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.Exchange.creator_address) pub creator_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Exchange.create_time) pub create_time: i64, // @@protoc_insertion_point(field:protocol.Exchange.first_token_id) pub first_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Exchange.first_token_balance) pub first_token_balance: i64, // @@protoc_insertion_point(field:protocol.Exchange.second_token_id) pub second_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Exchange.second_token_balance) pub second_token_balance: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Exchange.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Exchange { fn default() -> &'a Exchange { ::default_instance() } } impl Exchange { pub fn new() -> Exchange { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &Exchange| { &m.exchange_id }, |m: &mut Exchange| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "creator_address", |m: &Exchange| { &m.creator_address }, |m: &mut Exchange| { &mut m.creator_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "create_time", |m: &Exchange| { &m.create_time }, |m: &mut Exchange| { &mut m.create_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "first_token_id", |m: &Exchange| { &m.first_token_id }, |m: &mut Exchange| { &mut m.first_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "first_token_balance", |m: &Exchange| { &m.first_token_balance }, |m: &mut Exchange| { &mut m.first_token_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "second_token_id", |m: &Exchange| { &m.second_token_id }, |m: &mut Exchange| { &mut m.second_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "second_token_balance", |m: &Exchange| { &m.second_token_balance }, |m: &mut Exchange| { &mut m.second_token_balance }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Exchange", fields, oneofs, ) } } impl ::protobuf::Message for Exchange { const NAME: &'static str = "Exchange"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.exchange_id = is.read_int64()?; }, 18 => { self.creator_address = is.read_bytes()?; }, 24 => { self.create_time = is.read_int64()?; }, 50 => { self.first_token_id = is.read_bytes()?; }, 56 => { self.first_token_balance = is.read_int64()?; }, 66 => { self.second_token_id = is.read_bytes()?; }, 72 => { self.second_token_balance = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(1, self.exchange_id); } if !self.creator_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.creator_address); } if self.create_time != 0 { my_size += ::protobuf::rt::int64_size(3, self.create_time); } if !self.first_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.first_token_id); } if self.first_token_balance != 0 { my_size += ::protobuf::rt::int64_size(7, self.first_token_balance); } if !self.second_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(8, &self.second_token_id); } if self.second_token_balance != 0 { my_size += ::protobuf::rt::int64_size(9, self.second_token_balance); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.exchange_id != 0 { os.write_int64(1, self.exchange_id)?; } if !self.creator_address.is_empty() { os.write_bytes(2, &self.creator_address)?; } if self.create_time != 0 { os.write_int64(3, self.create_time)?; } if !self.first_token_id.is_empty() { os.write_bytes(6, &self.first_token_id)?; } if self.first_token_balance != 0 { os.write_int64(7, self.first_token_balance)?; } if !self.second_token_id.is_empty() { os.write_bytes(8, &self.second_token_id)?; } if self.second_token_balance != 0 { os.write_int64(9, self.second_token_balance)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Exchange { Exchange::new() } fn clear(&mut self) { self.exchange_id = 0; self.creator_address.clear(); self.create_time = 0; self.first_token_id.clear(); self.first_token_balance = 0; self.second_token_id.clear(); self.second_token_balance = 0; self.special_fields.clear(); } fn default_instance() -> &'static Exchange { static instance: Exchange = Exchange { exchange_id: 0, creator_address: ::std::vec::Vec::new(), create_time: 0, first_token_id: ::std::vec::Vec::new(), first_token_balance: 0, second_token_id: ::std::vec::Vec::new(), second_token_balance: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Exchange { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Exchange").unwrap()).clone() } } impl ::std::fmt::Display for Exchange { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Exchange { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// market // @@protoc_insertion_point(message:protocol.MarketOrder) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrder { // message fields // @@protoc_insertion_point(field:protocol.MarketOrder.order_id) pub order_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrder.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrder.create_time) pub create_time: i64, // @@protoc_insertion_point(field:protocol.MarketOrder.sell_token_id) pub sell_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrder.sell_token_quantity) pub sell_token_quantity: i64, // @@protoc_insertion_point(field:protocol.MarketOrder.buy_token_id) pub buy_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrder.buy_token_quantity) pub buy_token_quantity: i64, // @@protoc_insertion_point(field:protocol.MarketOrder.sell_token_quantity_remain) pub sell_token_quantity_remain: i64, /// When state != ACTIVE and sell_token_quantity_return !=0, /// it means that some sell tokens are returned to the account due to insufficient remaining amount // @@protoc_insertion_point(field:protocol.MarketOrder.sell_token_quantity_return) pub sell_token_quantity_return: i64, // @@protoc_insertion_point(field:protocol.MarketOrder.state) pub state: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.MarketOrder.prev) pub prev: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrder.next) pub next: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrder.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrder { fn default() -> &'a MarketOrder { ::default_instance() } } impl MarketOrder { pub fn new() -> MarketOrder { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(12); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "order_id", |m: &MarketOrder| { &m.order_id }, |m: &mut MarketOrder| { &mut m.order_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &MarketOrder| { &m.owner_address }, |m: &mut MarketOrder| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "create_time", |m: &MarketOrder| { &m.create_time }, |m: &mut MarketOrder| { &mut m.create_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_id", |m: &MarketOrder| { &m.sell_token_id }, |m: &mut MarketOrder| { &mut m.sell_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_quantity", |m: &MarketOrder| { &m.sell_token_quantity }, |m: &mut MarketOrder| { &mut m.sell_token_quantity }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_id", |m: &MarketOrder| { &m.buy_token_id }, |m: &mut MarketOrder| { &mut m.buy_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_quantity", |m: &MarketOrder| { &m.buy_token_quantity }, |m: &mut MarketOrder| { &mut m.buy_token_quantity }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_quantity_remain", |m: &MarketOrder| { &m.sell_token_quantity_remain }, |m: &mut MarketOrder| { &mut m.sell_token_quantity_remain }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_quantity_return", |m: &MarketOrder| { &m.sell_token_quantity_return }, |m: &mut MarketOrder| { &mut m.sell_token_quantity_return }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "state", |m: &MarketOrder| { &m.state }, |m: &mut MarketOrder| { &mut m.state }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "prev", |m: &MarketOrder| { &m.prev }, |m: &mut MarketOrder| { &mut m.prev }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "next", |m: &MarketOrder| { &m.next }, |m: &mut MarketOrder| { &mut m.next }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrder", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrder { const NAME: &'static str = "MarketOrder"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.order_id = is.read_bytes()?; }, 18 => { self.owner_address = is.read_bytes()?; }, 24 => { self.create_time = is.read_int64()?; }, 34 => { self.sell_token_id = is.read_bytes()?; }, 40 => { self.sell_token_quantity = is.read_int64()?; }, 50 => { self.buy_token_id = is.read_bytes()?; }, 56 => { self.buy_token_quantity = is.read_int64()?; }, 72 => { self.sell_token_quantity_remain = is.read_int64()?; }, 80 => { self.sell_token_quantity_return = is.read_int64()?; }, 88 => { self.state = is.read_enum_or_unknown()?; }, 98 => { self.prev = is.read_bytes()?; }, 106 => { self.next = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.order_id.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.order_id); } if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.owner_address); } if self.create_time != 0 { my_size += ::protobuf::rt::int64_size(3, self.create_time); } if !self.sell_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.sell_token_id); } if self.sell_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(5, self.sell_token_quantity); } if !self.buy_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.buy_token_id); } if self.buy_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(7, self.buy_token_quantity); } if self.sell_token_quantity_remain != 0 { my_size += ::protobuf::rt::int64_size(9, self.sell_token_quantity_remain); } if self.sell_token_quantity_return != 0 { my_size += ::protobuf::rt::int64_size(10, self.sell_token_quantity_return); } if self.state != ::protobuf::EnumOrUnknown::new(market_order::State::ACTIVE) { my_size += ::protobuf::rt::int32_size(11, self.state.value()); } if !self.prev.is_empty() { my_size += ::protobuf::rt::bytes_size(12, &self.prev); } if !self.next.is_empty() { my_size += ::protobuf::rt::bytes_size(13, &self.next); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.order_id.is_empty() { os.write_bytes(1, &self.order_id)?; } if !self.owner_address.is_empty() { os.write_bytes(2, &self.owner_address)?; } if self.create_time != 0 { os.write_int64(3, self.create_time)?; } if !self.sell_token_id.is_empty() { os.write_bytes(4, &self.sell_token_id)?; } if self.sell_token_quantity != 0 { os.write_int64(5, self.sell_token_quantity)?; } if !self.buy_token_id.is_empty() { os.write_bytes(6, &self.buy_token_id)?; } if self.buy_token_quantity != 0 { os.write_int64(7, self.buy_token_quantity)?; } if self.sell_token_quantity_remain != 0 { os.write_int64(9, self.sell_token_quantity_remain)?; } if self.sell_token_quantity_return != 0 { os.write_int64(10, self.sell_token_quantity_return)?; } if self.state != ::protobuf::EnumOrUnknown::new(market_order::State::ACTIVE) { os.write_enum(11, ::protobuf::EnumOrUnknown::value(&self.state))?; } if !self.prev.is_empty() { os.write_bytes(12, &self.prev)?; } if !self.next.is_empty() { os.write_bytes(13, &self.next)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrder { MarketOrder::new() } fn clear(&mut self) { self.order_id.clear(); self.owner_address.clear(); self.create_time = 0; self.sell_token_id.clear(); self.sell_token_quantity = 0; self.buy_token_id.clear(); self.buy_token_quantity = 0; self.sell_token_quantity_remain = 0; self.sell_token_quantity_return = 0; self.state = ::protobuf::EnumOrUnknown::new(market_order::State::ACTIVE); self.prev.clear(); self.next.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketOrder { static instance: MarketOrder = MarketOrder { order_id: ::std::vec::Vec::new(), owner_address: ::std::vec::Vec::new(), create_time: 0, sell_token_id: ::std::vec::Vec::new(), sell_token_quantity: 0, buy_token_id: ::std::vec::Vec::new(), buy_token_quantity: 0, sell_token_quantity_remain: 0, sell_token_quantity_return: 0, state: ::protobuf::EnumOrUnknown::from_i32(0), prev: ::std::vec::Vec::new(), next: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrder { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrder").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrder { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrder { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `MarketOrder` pub mod market_order { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.MarketOrder.State) pub enum State { // @@protoc_insertion_point(enum_value:protocol.MarketOrder.State.ACTIVE) ACTIVE = 0, // @@protoc_insertion_point(enum_value:protocol.MarketOrder.State.INACTIVE) INACTIVE = 1, // @@protoc_insertion_point(enum_value:protocol.MarketOrder.State.CANCELED) CANCELED = 2, } impl ::protobuf::Enum for State { const NAME: &'static str = "State"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(State::ACTIVE), 1 => ::std::option::Option::Some(State::INACTIVE), 2 => ::std::option::Option::Some(State::CANCELED), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "ACTIVE" => ::std::option::Option::Some(State::ACTIVE), "INACTIVE" => ::std::option::Option::Some(State::INACTIVE), "CANCELED" => ::std::option::Option::Some(State::CANCELED), _ => ::std::option::Option::None } } const VALUES: &'static [State] = &[ State::ACTIVE, State::INACTIVE, State::CANCELED, ]; } impl ::protobuf::EnumFull for State { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("MarketOrder.State").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for State { fn default() -> Self { State::ACTIVE } } impl State { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("MarketOrder.State") } } } // @@protoc_insertion_point(message:protocol.MarketOrderList) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrderList { // message fields // @@protoc_insertion_point(field:protocol.MarketOrderList.orders) pub orders: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrderList.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrderList { fn default() -> &'a MarketOrderList { ::default_instance() } } impl MarketOrderList { pub fn new() -> MarketOrderList { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "orders", |m: &MarketOrderList| { &m.orders }, |m: &mut MarketOrderList| { &mut m.orders }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrderList", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrderList { const NAME: &'static str = "MarketOrderList"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.orders.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.orders { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.orders { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrderList { MarketOrderList::new() } fn clear(&mut self) { self.orders.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketOrderList { static instance: MarketOrderList = MarketOrderList { orders: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrderList { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrderList").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrderList { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrderList { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketOrderPairList) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrderPairList { // message fields // @@protoc_insertion_point(field:protocol.MarketOrderPairList.orderPair) pub orderPair: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrderPairList.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrderPairList { fn default() -> &'a MarketOrderPairList { ::default_instance() } } impl MarketOrderPairList { pub fn new() -> MarketOrderPairList { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "orderPair", |m: &MarketOrderPairList| { &m.orderPair }, |m: &mut MarketOrderPairList| { &mut m.orderPair }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrderPairList", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrderPairList { const NAME: &'static str = "MarketOrderPairList"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.orderPair.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.orderPair { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.orderPair { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrderPairList { MarketOrderPairList::new() } fn clear(&mut self) { self.orderPair.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketOrderPairList { static instance: MarketOrderPairList = MarketOrderPairList { orderPair: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrderPairList { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrderPairList").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrderPairList { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrderPairList { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketOrderPair) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrderPair { // message fields // @@protoc_insertion_point(field:protocol.MarketOrderPair.sell_token_id) pub sell_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrderPair.buy_token_id) pub buy_token_id: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrderPair.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrderPair { fn default() -> &'a MarketOrderPair { ::default_instance() } } impl MarketOrderPair { pub fn new() -> MarketOrderPair { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_id", |m: &MarketOrderPair| { &m.sell_token_id }, |m: &mut MarketOrderPair| { &mut m.sell_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_id", |m: &MarketOrderPair| { &m.buy_token_id }, |m: &mut MarketOrderPair| { &mut m.buy_token_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrderPair", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrderPair { const NAME: &'static str = "MarketOrderPair"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.sell_token_id = is.read_bytes()?; }, 18 => { self.buy_token_id = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.sell_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.sell_token_id); } if !self.buy_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.buy_token_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.sell_token_id.is_empty() { os.write_bytes(1, &self.sell_token_id)?; } if !self.buy_token_id.is_empty() { os.write_bytes(2, &self.buy_token_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrderPair { MarketOrderPair::new() } fn clear(&mut self) { self.sell_token_id.clear(); self.buy_token_id.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketOrderPair { static instance: MarketOrderPair = MarketOrderPair { sell_token_id: ::std::vec::Vec::new(), buy_token_id: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrderPair { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrderPair").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrderPair { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrderPair { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketAccountOrder) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketAccountOrder { // message fields // @@protoc_insertion_point(field:protocol.MarketAccountOrder.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketAccountOrder.orders) pub orders: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.MarketAccountOrder.count) pub count: i64, // @@protoc_insertion_point(field:protocol.MarketAccountOrder.total_count) pub total_count: i64, // special fields // @@protoc_insertion_point(special_field:protocol.MarketAccountOrder.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketAccountOrder { fn default() -> &'a MarketAccountOrder { ::default_instance() } } impl MarketAccountOrder { pub fn new() -> MarketAccountOrder { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &MarketAccountOrder| { &m.owner_address }, |m: &mut MarketAccountOrder| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "orders", |m: &MarketAccountOrder| { &m.orders }, |m: &mut MarketAccountOrder| { &mut m.orders }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &MarketAccountOrder| { &m.count }, |m: &mut MarketAccountOrder| { &mut m.count }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "total_count", |m: &MarketAccountOrder| { &m.total_count }, |m: &mut MarketAccountOrder| { &mut m.total_count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketAccountOrder", fields, oneofs, ) } } impl ::protobuf::Message for MarketAccountOrder { const NAME: &'static str = "MarketAccountOrder"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.orders.push(is.read_bytes()?); }, 24 => { self.count = is.read_int64()?; }, 32 => { self.total_count = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } for value in &self.orders { my_size += ::protobuf::rt::bytes_size(2, &value); }; if self.count != 0 { my_size += ::protobuf::rt::int64_size(3, self.count); } if self.total_count != 0 { my_size += ::protobuf::rt::int64_size(4, self.total_count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } for v in &self.orders { os.write_bytes(2, &v)?; }; if self.count != 0 { os.write_int64(3, self.count)?; } if self.total_count != 0 { os.write_int64(4, self.total_count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketAccountOrder { MarketAccountOrder::new() } fn clear(&mut self) { self.owner_address.clear(); self.orders.clear(); self.count = 0; self.total_count = 0; self.special_fields.clear(); } fn default_instance() -> &'static MarketAccountOrder { static instance: MarketAccountOrder = MarketAccountOrder { owner_address: ::std::vec::Vec::new(), orders: ::std::vec::Vec::new(), count: 0, total_count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketAccountOrder { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketAccountOrder").unwrap()).clone() } } impl ::std::fmt::Display for MarketAccountOrder { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketAccountOrder { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketPrice) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketPrice { // message fields // @@protoc_insertion_point(field:protocol.MarketPrice.sell_token_quantity) pub sell_token_quantity: i64, // @@protoc_insertion_point(field:protocol.MarketPrice.buy_token_quantity) pub buy_token_quantity: i64, // special fields // @@protoc_insertion_point(special_field:protocol.MarketPrice.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketPrice { fn default() -> &'a MarketPrice { ::default_instance() } } impl MarketPrice { pub fn new() -> MarketPrice { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_quantity", |m: &MarketPrice| { &m.sell_token_quantity }, |m: &mut MarketPrice| { &mut m.sell_token_quantity }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_quantity", |m: &MarketPrice| { &m.buy_token_quantity }, |m: &mut MarketPrice| { &mut m.buy_token_quantity }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketPrice", fields, oneofs, ) } } impl ::protobuf::Message for MarketPrice { const NAME: &'static str = "MarketPrice"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.sell_token_quantity = is.read_int64()?; }, 16 => { self.buy_token_quantity = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.sell_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(1, self.sell_token_quantity); } if self.buy_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(2, self.buy_token_quantity); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.sell_token_quantity != 0 { os.write_int64(1, self.sell_token_quantity)?; } if self.buy_token_quantity != 0 { os.write_int64(2, self.buy_token_quantity)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketPrice { MarketPrice::new() } fn clear(&mut self) { self.sell_token_quantity = 0; self.buy_token_quantity = 0; self.special_fields.clear(); } fn default_instance() -> &'static MarketPrice { static instance: MarketPrice = MarketPrice { sell_token_quantity: 0, buy_token_quantity: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketPrice { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketPrice").unwrap()).clone() } } impl ::std::fmt::Display for MarketPrice { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketPrice { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketPriceList) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketPriceList { // message fields // @@protoc_insertion_point(field:protocol.MarketPriceList.sell_token_id) pub sell_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketPriceList.buy_token_id) pub buy_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketPriceList.prices) pub prices: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketPriceList.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketPriceList { fn default() -> &'a MarketPriceList { ::default_instance() } } impl MarketPriceList { pub fn new() -> MarketPriceList { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_id", |m: &MarketPriceList| { &m.sell_token_id }, |m: &mut MarketPriceList| { &mut m.sell_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_id", |m: &MarketPriceList| { &m.buy_token_id }, |m: &mut MarketPriceList| { &mut m.buy_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "prices", |m: &MarketPriceList| { &m.prices }, |m: &mut MarketPriceList| { &mut m.prices }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketPriceList", fields, oneofs, ) } } impl ::protobuf::Message for MarketPriceList { const NAME: &'static str = "MarketPriceList"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.sell_token_id = is.read_bytes()?; }, 18 => { self.buy_token_id = is.read_bytes()?; }, 26 => { self.prices.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.sell_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.sell_token_id); } if !self.buy_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.buy_token_id); } for value in &self.prices { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.sell_token_id.is_empty() { os.write_bytes(1, &self.sell_token_id)?; } if !self.buy_token_id.is_empty() { os.write_bytes(2, &self.buy_token_id)?; } for v in &self.prices { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketPriceList { MarketPriceList::new() } fn clear(&mut self) { self.sell_token_id.clear(); self.buy_token_id.clear(); self.prices.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketPriceList { static instance: MarketPriceList = MarketPriceList { sell_token_id: ::std::vec::Vec::new(), buy_token_id: ::std::vec::Vec::new(), prices: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketPriceList { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketPriceList").unwrap()).clone() } } impl ::std::fmt::Display for MarketPriceList { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketPriceList { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketOrderIdList) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrderIdList { // message fields // @@protoc_insertion_point(field:protocol.MarketOrderIdList.head) pub head: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrderIdList.tail) pub tail: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrderIdList.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrderIdList { fn default() -> &'a MarketOrderIdList { ::default_instance() } } impl MarketOrderIdList { pub fn new() -> MarketOrderIdList { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "head", |m: &MarketOrderIdList| { &m.head }, |m: &mut MarketOrderIdList| { &mut m.head }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "tail", |m: &MarketOrderIdList| { &m.tail }, |m: &mut MarketOrderIdList| { &mut m.tail }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrderIdList", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrderIdList { const NAME: &'static str = "MarketOrderIdList"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.head = is.read_bytes()?; }, 18 => { self.tail = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.head.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.head); } if !self.tail.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.tail); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.head.is_empty() { os.write_bytes(1, &self.head)?; } if !self.tail.is_empty() { os.write_bytes(2, &self.tail)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrderIdList { MarketOrderIdList::new() } fn clear(&mut self) { self.head.clear(); self.tail.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketOrderIdList { static instance: MarketOrderIdList = MarketOrderIdList { head: ::std::vec::Vec::new(), tail: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrderIdList { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrderIdList").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrderIdList { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrderIdList { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ChainParameters) #[derive(PartialEq,Clone,Default,Debug)] pub struct ChainParameters { // message fields // @@protoc_insertion_point(field:protocol.ChainParameters.chainParameter) pub chainParameter: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.ChainParameters.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ChainParameters { fn default() -> &'a ChainParameters { ::default_instance() } } impl ChainParameters { pub fn new() -> ChainParameters { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "chainParameter", |m: &ChainParameters| { &m.chainParameter }, |m: &mut ChainParameters| { &mut m.chainParameter }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ChainParameters", fields, oneofs, ) } } impl ::protobuf::Message for ChainParameters { const NAME: &'static str = "ChainParameters"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.chainParameter.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.chainParameter { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.chainParameter { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ChainParameters { ChainParameters::new() } fn clear(&mut self) { self.chainParameter.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ChainParameters { static instance: ChainParameters = ChainParameters { chainParameter: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ChainParameters { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ChainParameters").unwrap()).clone() } } impl ::std::fmt::Display for ChainParameters { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ChainParameters { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `ChainParameters` pub mod chain_parameters { // @@protoc_insertion_point(message:protocol.ChainParameters.ChainParameter) #[derive(PartialEq,Clone,Default,Debug)] pub struct ChainParameter { // message fields // @@protoc_insertion_point(field:protocol.ChainParameters.ChainParameter.key) pub key: ::std::string::String, // @@protoc_insertion_point(field:protocol.ChainParameters.ChainParameter.value) pub value: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ChainParameters.ChainParameter.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ChainParameter { fn default() -> &'a ChainParameter { ::default_instance() } } impl ChainParameter { pub fn new() -> ChainParameter { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "key", |m: &ChainParameter| { &m.key }, |m: &mut ChainParameter| { &mut m.key }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "value", |m: &ChainParameter| { &m.value }, |m: &mut ChainParameter| { &mut m.value }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ChainParameters.ChainParameter", fields, oneofs, ) } } impl ::protobuf::Message for ChainParameter { const NAME: &'static str = "ChainParameter"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.key = is.read_string()?; }, 16 => { self.value = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.key.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.key); } if self.value != 0 { my_size += ::protobuf::rt::int64_size(2, self.value); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.key.is_empty() { os.write_string(1, &self.key)?; } if self.value != 0 { os.write_int64(2, self.value)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ChainParameter { ChainParameter::new() } fn clear(&mut self) { self.key.clear(); self.value = 0; self.special_fields.clear(); } fn default_instance() -> &'static ChainParameter { static instance: ChainParameter = ChainParameter { key: ::std::string::String::new(), value: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ChainParameter { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("ChainParameters.ChainParameter").unwrap()).clone() } } impl ::std::fmt::Display for ChainParameter { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ChainParameter { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } /// Account // @@protoc_insertion_point(message:protocol.Account) #[derive(PartialEq,Clone,Default,Debug)] pub struct Account { // message fields /// account nick name // @@protoc_insertion_point(field:protocol.Account.account_name) pub account_name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.type) pub type_: ::protobuf::EnumOrUnknown, /// the create address // @@protoc_insertion_point(field:protocol.Account.address) pub address: ::std::vec::Vec, /// the trx balance // @@protoc_insertion_point(field:protocol.Account.balance) pub balance: i64, /// the votes // @@protoc_insertion_point(field:protocol.Account.votes) pub votes: ::std::vec::Vec, /// the other asset owned by this account // @@protoc_insertion_point(field:protocol.Account.asset) pub asset: ::std::collections::HashMap<::std::string::String, i64>, /// the other asset owned by this account,key is assetId // @@protoc_insertion_point(field:protocol.Account.assetV2) pub assetV2: ::std::collections::HashMap<::std::string::String, i64>, /// the frozen balance for bandwidth // @@protoc_insertion_point(field:protocol.Account.frozen) pub frozen: ::std::vec::Vec, /// bandwidth, get from frozen // @@protoc_insertion_point(field:protocol.Account.net_usage) pub net_usage: i64, /// Frozen balance provided by other accounts to this account // @@protoc_insertion_point(field:protocol.Account.acquired_delegated_frozen_balance_for_bandwidth) pub acquired_delegated_frozen_balance_for_bandwidth: i64, /// Freeze and provide balances to other accounts // @@protoc_insertion_point(field:protocol.Account.delegated_frozen_balance_for_bandwidth) pub delegated_frozen_balance_for_bandwidth: i64, // @@protoc_insertion_point(field:protocol.Account.old_tron_power) pub old_tron_power: i64, // @@protoc_insertion_point(field:protocol.Account.tron_power) pub tron_power: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Account.asset_optimized) pub asset_optimized: bool, /// this account create time // @@protoc_insertion_point(field:protocol.Account.create_time) pub create_time: i64, /// this last operation time, including transfer, voting and so on. //FIXME fix grammar // @@protoc_insertion_point(field:protocol.Account.latest_opration_time) pub latest_opration_time: i64, /// witness block producing allowance // @@protoc_insertion_point(field:protocol.Account.allowance) pub allowance: i64, /// last withdraw time // @@protoc_insertion_point(field:protocol.Account.latest_withdraw_time) pub latest_withdraw_time: i64, /// not used so far // @@protoc_insertion_point(field:protocol.Account.code) pub code: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.is_witness) pub is_witness: bool, // @@protoc_insertion_point(field:protocol.Account.is_committee) pub is_committee: bool, /// frozen asset(for asset issuer) // @@protoc_insertion_point(field:protocol.Account.frozen_supply) pub frozen_supply: ::std::vec::Vec, /// asset_issued_name // @@protoc_insertion_point(field:protocol.Account.asset_issued_name) pub asset_issued_name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.asset_issued_ID) pub asset_issued_ID: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.latest_asset_operation_time) pub latest_asset_operation_time: ::std::collections::HashMap<::std::string::String, i64>, // @@protoc_insertion_point(field:protocol.Account.latest_asset_operation_timeV2) pub latest_asset_operation_timeV2: ::std::collections::HashMap<::std::string::String, i64>, // @@protoc_insertion_point(field:protocol.Account.free_net_usage) pub free_net_usage: i64, // @@protoc_insertion_point(field:protocol.Account.free_asset_net_usage) pub free_asset_net_usage: ::std::collections::HashMap<::std::string::String, i64>, // @@protoc_insertion_point(field:protocol.Account.free_asset_net_usageV2) pub free_asset_net_usageV2: ::std::collections::HashMap<::std::string::String, i64>, // @@protoc_insertion_point(field:protocol.Account.latest_consume_time) pub latest_consume_time: i64, // @@protoc_insertion_point(field:protocol.Account.latest_consume_free_time) pub latest_consume_free_time: i64, /// the identity of this account, case insensitive // @@protoc_insertion_point(field:protocol.Account.account_id) pub account_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.net_window_size) pub net_window_size: i64, // @@protoc_insertion_point(field:protocol.Account.net_window_optimized) pub net_window_optimized: bool, // @@protoc_insertion_point(field:protocol.Account.account_resource) pub account_resource: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Account.codeHash) pub codeHash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.owner_permission) pub owner_permission: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Account.witness_permission) pub witness_permission: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Account.active_permission) pub active_permission: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.frozenV2) pub frozenV2: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.unfrozenV2) pub unfrozenV2: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Account.delegated_frozenV2_balance_for_bandwidth) pub delegated_frozenV2_balance_for_bandwidth: i64, // @@protoc_insertion_point(field:protocol.Account.acquired_delegated_frozenV2_balance_for_bandwidth) pub acquired_delegated_frozenV2_balance_for_bandwidth: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Account.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Account { fn default() -> &'a Account { ::default_instance() } } impl Account { pub fn new() -> Account { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(43); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account_name", |m: &Account| { &m.account_name }, |m: &mut Account| { &mut m.account_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Account| { &m.type_ }, |m: &mut Account| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Account| { &m.address }, |m: &mut Account| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "balance", |m: &Account| { &m.balance }, |m: &mut Account| { &mut m.balance }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "votes", |m: &Account| { &m.votes }, |m: &mut Account| { &mut m.votes }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "asset", |m: &Account| { &m.asset }, |m: &mut Account| { &mut m.asset }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "assetV2", |m: &Account| { &m.assetV2 }, |m: &mut Account| { &mut m.assetV2 }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "frozen", |m: &Account| { &m.frozen }, |m: &mut Account| { &mut m.frozen }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "net_usage", |m: &Account| { &m.net_usage }, |m: &mut Account| { &mut m.net_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "acquired_delegated_frozen_balance_for_bandwidth", |m: &Account| { &m.acquired_delegated_frozen_balance_for_bandwidth }, |m: &mut Account| { &mut m.acquired_delegated_frozen_balance_for_bandwidth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delegated_frozen_balance_for_bandwidth", |m: &Account| { &m.delegated_frozen_balance_for_bandwidth }, |m: &mut Account| { &mut m.delegated_frozen_balance_for_bandwidth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "old_tron_power", |m: &Account| { &m.old_tron_power }, |m: &mut Account| { &mut m.old_tron_power }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, account::Frozen>( "tron_power", |m: &Account| { &m.tron_power }, |m: &mut Account| { &mut m.tron_power }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "asset_optimized", |m: &Account| { &m.asset_optimized }, |m: &mut Account| { &mut m.asset_optimized }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "create_time", |m: &Account| { &m.create_time }, |m: &mut Account| { &mut m.create_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_opration_time", |m: &Account| { &m.latest_opration_time }, |m: &mut Account| { &mut m.latest_opration_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "allowance", |m: &Account| { &m.allowance }, |m: &mut Account| { &mut m.allowance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_withdraw_time", |m: &Account| { &m.latest_withdraw_time }, |m: &mut Account| { &mut m.latest_withdraw_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "code", |m: &Account| { &m.code }, |m: &mut Account| { &mut m.code }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "is_witness", |m: &Account| { &m.is_witness }, |m: &mut Account| { &mut m.is_witness }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "is_committee", |m: &Account| { &m.is_committee }, |m: &mut Account| { &mut m.is_committee }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "frozen_supply", |m: &Account| { &m.frozen_supply }, |m: &mut Account| { &mut m.frozen_supply }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "asset_issued_name", |m: &Account| { &m.asset_issued_name }, |m: &mut Account| { &mut m.asset_issued_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "asset_issued_ID", |m: &Account| { &m.asset_issued_ID }, |m: &mut Account| { &mut m.asset_issued_ID }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "latest_asset_operation_time", |m: &Account| { &m.latest_asset_operation_time }, |m: &mut Account| { &mut m.latest_asset_operation_time }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "latest_asset_operation_timeV2", |m: &Account| { &m.latest_asset_operation_timeV2 }, |m: &mut Account| { &mut m.latest_asset_operation_timeV2 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "free_net_usage", |m: &Account| { &m.free_net_usage }, |m: &mut Account| { &mut m.free_net_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "free_asset_net_usage", |m: &Account| { &m.free_asset_net_usage }, |m: &mut Account| { &mut m.free_asset_net_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "free_asset_net_usageV2", |m: &Account| { &m.free_asset_net_usageV2 }, |m: &mut Account| { &mut m.free_asset_net_usageV2 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_consume_time", |m: &Account| { &m.latest_consume_time }, |m: &mut Account| { &mut m.latest_consume_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_consume_free_time", |m: &Account| { &m.latest_consume_free_time }, |m: &mut Account| { &mut m.latest_consume_free_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account_id", |m: &Account| { &m.account_id }, |m: &mut Account| { &mut m.account_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "net_window_size", |m: &Account| { &m.net_window_size }, |m: &mut Account| { &mut m.net_window_size }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "net_window_optimized", |m: &Account| { &m.net_window_optimized }, |m: &mut Account| { &mut m.net_window_optimized }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, account::AccountResource>( "account_resource", |m: &Account| { &m.account_resource }, |m: &mut Account| { &mut m.account_resource }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "codeHash", |m: &Account| { &m.codeHash }, |m: &mut Account| { &mut m.codeHash }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Permission>( "owner_permission", |m: &Account| { &m.owner_permission }, |m: &mut Account| { &mut m.owner_permission }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Permission>( "witness_permission", |m: &Account| { &m.witness_permission }, |m: &mut Account| { &mut m.witness_permission }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "active_permission", |m: &Account| { &m.active_permission }, |m: &mut Account| { &mut m.active_permission }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "frozenV2", |m: &Account| { &m.frozenV2 }, |m: &mut Account| { &mut m.frozenV2 }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "unfrozenV2", |m: &Account| { &m.unfrozenV2 }, |m: &mut Account| { &mut m.unfrozenV2 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delegated_frozenV2_balance_for_bandwidth", |m: &Account| { &m.delegated_frozenV2_balance_for_bandwidth }, |m: &mut Account| { &mut m.delegated_frozenV2_balance_for_bandwidth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "acquired_delegated_frozenV2_balance_for_bandwidth", |m: &Account| { &m.acquired_delegated_frozenV2_balance_for_bandwidth }, |m: &mut Account| { &mut m.acquired_delegated_frozenV2_balance_for_bandwidth }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Account", fields, oneofs, ) } } impl ::protobuf::Message for Account { const NAME: &'static str = "Account"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.account_name = is.read_bytes()?; }, 16 => { self.type_ = is.read_enum_or_unknown()?; }, 26 => { self.address = is.read_bytes()?; }, 32 => { self.balance = is.read_int64()?; }, 42 => { self.votes.push(is.read_message()?); }, 50 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.asset.insert(key, value); }, 450 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.assetV2.insert(key, value); }, 58 => { self.frozen.push(is.read_message()?); }, 64 => { self.net_usage = is.read_int64()?; }, 328 => { self.acquired_delegated_frozen_balance_for_bandwidth = is.read_int64()?; }, 336 => { self.delegated_frozen_balance_for_bandwidth = is.read_int64()?; }, 368 => { self.old_tron_power = is.read_int64()?; }, 378 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.tron_power)?; }, 480 => { self.asset_optimized = is.read_bool()?; }, 72 => { self.create_time = is.read_int64()?; }, 80 => { self.latest_opration_time = is.read_int64()?; }, 88 => { self.allowance = is.read_int64()?; }, 96 => { self.latest_withdraw_time = is.read_int64()?; }, 106 => { self.code = is.read_bytes()?; }, 112 => { self.is_witness = is.read_bool()?; }, 120 => { self.is_committee = is.read_bool()?; }, 130 => { self.frozen_supply.push(is.read_message()?); }, 138 => { self.asset_issued_name = is.read_bytes()?; }, 458 => { self.asset_issued_ID = is.read_bytes()?; }, 146 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.latest_asset_operation_time.insert(key, value); }, 466 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.latest_asset_operation_timeV2.insert(key, value); }, 152 => { self.free_net_usage = is.read_int64()?; }, 162 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.free_asset_net_usage.insert(key, value); }, 474 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.free_asset_net_usageV2.insert(key, value); }, 168 => { self.latest_consume_time = is.read_int64()?; }, 176 => { self.latest_consume_free_time = is.read_int64()?; }, 186 => { self.account_id = is.read_bytes()?; }, 192 => { self.net_window_size = is.read_int64()?; }, 200 => { self.net_window_optimized = is.read_bool()?; }, 210 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.account_resource)?; }, 242 => { self.codeHash = is.read_bytes()?; }, 250 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.owner_permission)?; }, 258 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.witness_permission)?; }, 266 => { self.active_permission.push(is.read_message()?); }, 274 => { self.frozenV2.push(is.read_message()?); }, 282 => { self.unfrozenV2.push(is.read_message()?); }, 288 => { self.delegated_frozenV2_balance_for_bandwidth = is.read_int64()?; }, 296 => { self.acquired_delegated_frozenV2_balance_for_bandwidth = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.account_name.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.account_name); } if self.type_ != ::protobuf::EnumOrUnknown::new(AccountType::Normal) { my_size += ::protobuf::rt::int32_size(2, self.type_.value()); } if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.address); } if self.balance != 0 { my_size += ::protobuf::rt::int64_size(4, self.balance); } for value in &self.votes { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for (k, v) in &self.asset { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; for (k, v) in &self.assetV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; for value in &self.frozen { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.net_usage != 0 { my_size += ::protobuf::rt::int64_size(8, self.net_usage); } if self.acquired_delegated_frozen_balance_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(41, self.acquired_delegated_frozen_balance_for_bandwidth); } if self.delegated_frozen_balance_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(42, self.delegated_frozen_balance_for_bandwidth); } if self.old_tron_power != 0 { my_size += ::protobuf::rt::int64_size(46, self.old_tron_power); } if let Some(v) = self.tron_power.as_ref() { let len = v.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.asset_optimized != false { my_size += 2 + 1; } if self.create_time != 0 { my_size += ::protobuf::rt::int64_size(9, self.create_time); } if self.latest_opration_time != 0 { my_size += ::protobuf::rt::int64_size(10, self.latest_opration_time); } if self.allowance != 0 { my_size += ::protobuf::rt::int64_size(11, self.allowance); } if self.latest_withdraw_time != 0 { my_size += ::protobuf::rt::int64_size(12, self.latest_withdraw_time); } if !self.code.is_empty() { my_size += ::protobuf::rt::bytes_size(13, &self.code); } if self.is_witness != false { my_size += 1 + 1; } if self.is_committee != false { my_size += 1 + 1; } for value in &self.frozen_supply { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.asset_issued_name.is_empty() { my_size += ::protobuf::rt::bytes_size(17, &self.asset_issued_name); } if !self.asset_issued_ID.is_empty() { my_size += ::protobuf::rt::bytes_size(57, &self.asset_issued_ID); } for (k, v) in &self.latest_asset_operation_time { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; for (k, v) in &self.latest_asset_operation_timeV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; if self.free_net_usage != 0 { my_size += ::protobuf::rt::int64_size(19, self.free_net_usage); } for (k, v) in &self.free_asset_net_usage { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; for (k, v) in &self.free_asset_net_usageV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; if self.latest_consume_time != 0 { my_size += ::protobuf::rt::int64_size(21, self.latest_consume_time); } if self.latest_consume_free_time != 0 { my_size += ::protobuf::rt::int64_size(22, self.latest_consume_free_time); } if !self.account_id.is_empty() { my_size += ::protobuf::rt::bytes_size(23, &self.account_id); } if self.net_window_size != 0 { my_size += ::protobuf::rt::int64_size(24, self.net_window_size); } if self.net_window_optimized != false { my_size += 2 + 1; } if let Some(v) = self.account_resource.as_ref() { let len = v.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.codeHash.is_empty() { my_size += ::protobuf::rt::bytes_size(30, &self.codeHash); } if let Some(v) = self.owner_permission.as_ref() { let len = v.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.witness_permission.as_ref() { let len = v.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.active_permission { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.frozenV2 { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.unfrozenV2 { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.delegated_frozenV2_balance_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(36, self.delegated_frozenV2_balance_for_bandwidth); } if self.acquired_delegated_frozenV2_balance_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(37, self.acquired_delegated_frozenV2_balance_for_bandwidth); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.account_name.is_empty() { os.write_bytes(1, &self.account_name)?; } if self.type_ != ::protobuf::EnumOrUnknown::new(AccountType::Normal) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if !self.address.is_empty() { os.write_bytes(3, &self.address)?; } if self.balance != 0 { os.write_int64(4, self.balance)?; } for v in &self.votes { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; }; for (k, v) in &self.asset { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(50)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; for (k, v) in &self.assetV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(450)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; for v in &self.frozen { ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; }; if self.net_usage != 0 { os.write_int64(8, self.net_usage)?; } if self.acquired_delegated_frozen_balance_for_bandwidth != 0 { os.write_int64(41, self.acquired_delegated_frozen_balance_for_bandwidth)?; } if self.delegated_frozen_balance_for_bandwidth != 0 { os.write_int64(42, self.delegated_frozen_balance_for_bandwidth)?; } if self.old_tron_power != 0 { os.write_int64(46, self.old_tron_power)?; } if let Some(v) = self.tron_power.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(47, v, os)?; } if self.asset_optimized != false { os.write_bool(60, self.asset_optimized)?; } if self.create_time != 0 { os.write_int64(9, self.create_time)?; } if self.latest_opration_time != 0 { os.write_int64(10, self.latest_opration_time)?; } if self.allowance != 0 { os.write_int64(11, self.allowance)?; } if self.latest_withdraw_time != 0 { os.write_int64(12, self.latest_withdraw_time)?; } if !self.code.is_empty() { os.write_bytes(13, &self.code)?; } if self.is_witness != false { os.write_bool(14, self.is_witness)?; } if self.is_committee != false { os.write_bool(15, self.is_committee)?; } for v in &self.frozen_supply { ::protobuf::rt::write_message_field_with_cached_size(16, v, os)?; }; if !self.asset_issued_name.is_empty() { os.write_bytes(17, &self.asset_issued_name)?; } if !self.asset_issued_ID.is_empty() { os.write_bytes(57, &self.asset_issued_ID)?; } for (k, v) in &self.latest_asset_operation_time { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(146)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; for (k, v) in &self.latest_asset_operation_timeV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(466)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; if self.free_net_usage != 0 { os.write_int64(19, self.free_net_usage)?; } for (k, v) in &self.free_asset_net_usage { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(162)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; for (k, v) in &self.free_asset_net_usageV2 { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(474)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; if self.latest_consume_time != 0 { os.write_int64(21, self.latest_consume_time)?; } if self.latest_consume_free_time != 0 { os.write_int64(22, self.latest_consume_free_time)?; } if !self.account_id.is_empty() { os.write_bytes(23, &self.account_id)?; } if self.net_window_size != 0 { os.write_int64(24, self.net_window_size)?; } if self.net_window_optimized != false { os.write_bool(25, self.net_window_optimized)?; } if let Some(v) = self.account_resource.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(26, v, os)?; } if !self.codeHash.is_empty() { os.write_bytes(30, &self.codeHash)?; } if let Some(v) = self.owner_permission.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(31, v, os)?; } if let Some(v) = self.witness_permission.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(32, v, os)?; } for v in &self.active_permission { ::protobuf::rt::write_message_field_with_cached_size(33, v, os)?; }; for v in &self.frozenV2 { ::protobuf::rt::write_message_field_with_cached_size(34, v, os)?; }; for v in &self.unfrozenV2 { ::protobuf::rt::write_message_field_with_cached_size(35, v, os)?; }; if self.delegated_frozenV2_balance_for_bandwidth != 0 { os.write_int64(36, self.delegated_frozenV2_balance_for_bandwidth)?; } if self.acquired_delegated_frozenV2_balance_for_bandwidth != 0 { os.write_int64(37, self.acquired_delegated_frozenV2_balance_for_bandwidth)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Account { Account::new() } fn clear(&mut self) { self.account_name.clear(); self.type_ = ::protobuf::EnumOrUnknown::new(AccountType::Normal); self.address.clear(); self.balance = 0; self.votes.clear(); self.asset.clear(); self.assetV2.clear(); self.frozen.clear(); self.net_usage = 0; self.acquired_delegated_frozen_balance_for_bandwidth = 0; self.delegated_frozen_balance_for_bandwidth = 0; self.old_tron_power = 0; self.tron_power.clear(); self.asset_optimized = false; self.create_time = 0; self.latest_opration_time = 0; self.allowance = 0; self.latest_withdraw_time = 0; self.code.clear(); self.is_witness = false; self.is_committee = false; self.frozen_supply.clear(); self.asset_issued_name.clear(); self.asset_issued_ID.clear(); self.latest_asset_operation_time.clear(); self.latest_asset_operation_timeV2.clear(); self.free_net_usage = 0; self.free_asset_net_usage.clear(); self.free_asset_net_usageV2.clear(); self.latest_consume_time = 0; self.latest_consume_free_time = 0; self.account_id.clear(); self.net_window_size = 0; self.net_window_optimized = false; self.account_resource.clear(); self.codeHash.clear(); self.owner_permission.clear(); self.witness_permission.clear(); self.active_permission.clear(); self.frozenV2.clear(); self.unfrozenV2.clear(); self.delegated_frozenV2_balance_for_bandwidth = 0; self.acquired_delegated_frozenV2_balance_for_bandwidth = 0; self.special_fields.clear(); } fn default_instance() -> &'static Account { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(Account::new) } } impl ::protobuf::MessageFull for Account { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Account").unwrap()).clone() } } impl ::std::fmt::Display for Account { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Account { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Account` pub mod account { /// frozen balance // @@protoc_insertion_point(message:protocol.Account.Frozen) #[derive(PartialEq,Clone,Default,Debug)] pub struct Frozen { // message fields // @@protoc_insertion_point(field:protocol.Account.Frozen.frozen_balance) pub frozen_balance: i64, // @@protoc_insertion_point(field:protocol.Account.Frozen.expire_time) pub expire_time: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Account.Frozen.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Frozen { fn default() -> &'a Frozen { ::default_instance() } } impl Frozen { pub fn new() -> Frozen { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_balance", |m: &Frozen| { &m.frozen_balance }, |m: &mut Frozen| { &mut m.frozen_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expire_time", |m: &Frozen| { &m.expire_time }, |m: &mut Frozen| { &mut m.expire_time }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Account.Frozen", fields, oneofs, ) } } impl ::protobuf::Message for Frozen { const NAME: &'static str = "Frozen"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.frozen_balance = is.read_int64()?; }, 16 => { self.expire_time = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.frozen_balance != 0 { my_size += ::protobuf::rt::int64_size(1, self.frozen_balance); } if self.expire_time != 0 { my_size += ::protobuf::rt::int64_size(2, self.expire_time); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.frozen_balance != 0 { os.write_int64(1, self.frozen_balance)?; } if self.expire_time != 0 { os.write_int64(2, self.expire_time)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Frozen { Frozen::new() } fn clear(&mut self) { self.frozen_balance = 0; self.expire_time = 0; self.special_fields.clear(); } fn default_instance() -> &'static Frozen { static instance: Frozen = Frozen { frozen_balance: 0, expire_time: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Frozen { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Account.Frozen").unwrap()).clone() } } impl ::std::fmt::Display for Frozen { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Frozen { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Account.AccountResource) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountResource { // message fields // @@protoc_insertion_point(field:protocol.Account.AccountResource.energy_usage) pub energy_usage: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.frozen_balance_for_energy) pub frozen_balance_for_energy: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.Account.AccountResource.latest_consume_time_for_energy) pub latest_consume_time_for_energy: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.acquired_delegated_frozen_balance_for_energy) pub acquired_delegated_frozen_balance_for_energy: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.delegated_frozen_balance_for_energy) pub delegated_frozen_balance_for_energy: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.storage_limit) pub storage_limit: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.storage_usage) pub storage_usage: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.latest_exchange_storage_time) pub latest_exchange_storage_time: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.energy_window_size) pub energy_window_size: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.delegated_frozenV2_balance_for_energy) pub delegated_frozenV2_balance_for_energy: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.acquired_delegated_frozenV2_balance_for_energy) pub acquired_delegated_frozenV2_balance_for_energy: i64, // @@protoc_insertion_point(field:protocol.Account.AccountResource.energy_window_optimized) pub energy_window_optimized: bool, // special fields // @@protoc_insertion_point(special_field:protocol.Account.AccountResource.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountResource { fn default() -> &'a AccountResource { ::default_instance() } } impl AccountResource { pub fn new() -> AccountResource { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(12); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_usage", |m: &AccountResource| { &m.energy_usage }, |m: &mut AccountResource| { &mut m.energy_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, Frozen>( "frozen_balance_for_energy", |m: &AccountResource| { &m.frozen_balance_for_energy }, |m: &mut AccountResource| { &mut m.frozen_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_consume_time_for_energy", |m: &AccountResource| { &m.latest_consume_time_for_energy }, |m: &mut AccountResource| { &mut m.latest_consume_time_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "acquired_delegated_frozen_balance_for_energy", |m: &AccountResource| { &m.acquired_delegated_frozen_balance_for_energy }, |m: &mut AccountResource| { &mut m.acquired_delegated_frozen_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delegated_frozen_balance_for_energy", |m: &AccountResource| { &m.delegated_frozen_balance_for_energy }, |m: &mut AccountResource| { &mut m.delegated_frozen_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "storage_limit", |m: &AccountResource| { &m.storage_limit }, |m: &mut AccountResource| { &mut m.storage_limit }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "storage_usage", |m: &AccountResource| { &m.storage_usage }, |m: &mut AccountResource| { &mut m.storage_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latest_exchange_storage_time", |m: &AccountResource| { &m.latest_exchange_storage_time }, |m: &mut AccountResource| { &mut m.latest_exchange_storage_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_window_size", |m: &AccountResource| { &m.energy_window_size }, |m: &mut AccountResource| { &mut m.energy_window_size }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delegated_frozenV2_balance_for_energy", |m: &AccountResource| { &m.delegated_frozenV2_balance_for_energy }, |m: &mut AccountResource| { &mut m.delegated_frozenV2_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "acquired_delegated_frozenV2_balance_for_energy", |m: &AccountResource| { &m.acquired_delegated_frozenV2_balance_for_energy }, |m: &mut AccountResource| { &mut m.acquired_delegated_frozenV2_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_window_optimized", |m: &AccountResource| { &m.energy_window_optimized }, |m: &mut AccountResource| { &mut m.energy_window_optimized }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Account.AccountResource", fields, oneofs, ) } } impl ::protobuf::Message for AccountResource { const NAME: &'static str = "AccountResource"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.energy_usage = is.read_int64()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.frozen_balance_for_energy)?; }, 24 => { self.latest_consume_time_for_energy = is.read_int64()?; }, 32 => { self.acquired_delegated_frozen_balance_for_energy = is.read_int64()?; }, 40 => { self.delegated_frozen_balance_for_energy = is.read_int64()?; }, 48 => { self.storage_limit = is.read_int64()?; }, 56 => { self.storage_usage = is.read_int64()?; }, 64 => { self.latest_exchange_storage_time = is.read_int64()?; }, 72 => { self.energy_window_size = is.read_int64()?; }, 80 => { self.delegated_frozenV2_balance_for_energy = is.read_int64()?; }, 88 => { self.acquired_delegated_frozenV2_balance_for_energy = is.read_int64()?; }, 96 => { self.energy_window_optimized = is.read_bool()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.energy_usage != 0 { my_size += ::protobuf::rt::int64_size(1, self.energy_usage); } if let Some(v) = self.frozen_balance_for_energy.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.latest_consume_time_for_energy != 0 { my_size += ::protobuf::rt::int64_size(3, self.latest_consume_time_for_energy); } if self.acquired_delegated_frozen_balance_for_energy != 0 { my_size += ::protobuf::rt::int64_size(4, self.acquired_delegated_frozen_balance_for_energy); } if self.delegated_frozen_balance_for_energy != 0 { my_size += ::protobuf::rt::int64_size(5, self.delegated_frozen_balance_for_energy); } if self.storage_limit != 0 { my_size += ::protobuf::rt::int64_size(6, self.storage_limit); } if self.storage_usage != 0 { my_size += ::protobuf::rt::int64_size(7, self.storage_usage); } if self.latest_exchange_storage_time != 0 { my_size += ::protobuf::rt::int64_size(8, self.latest_exchange_storage_time); } if self.energy_window_size != 0 { my_size += ::protobuf::rt::int64_size(9, self.energy_window_size); } if self.delegated_frozenV2_balance_for_energy != 0 { my_size += ::protobuf::rt::int64_size(10, self.delegated_frozenV2_balance_for_energy); } if self.acquired_delegated_frozenV2_balance_for_energy != 0 { my_size += ::protobuf::rt::int64_size(11, self.acquired_delegated_frozenV2_balance_for_energy); } if self.energy_window_optimized != false { my_size += 1 + 1; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.energy_usage != 0 { os.write_int64(1, self.energy_usage)?; } if let Some(v) = self.frozen_balance_for_energy.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if self.latest_consume_time_for_energy != 0 { os.write_int64(3, self.latest_consume_time_for_energy)?; } if self.acquired_delegated_frozen_balance_for_energy != 0 { os.write_int64(4, self.acquired_delegated_frozen_balance_for_energy)?; } if self.delegated_frozen_balance_for_energy != 0 { os.write_int64(5, self.delegated_frozen_balance_for_energy)?; } if self.storage_limit != 0 { os.write_int64(6, self.storage_limit)?; } if self.storage_usage != 0 { os.write_int64(7, self.storage_usage)?; } if self.latest_exchange_storage_time != 0 { os.write_int64(8, self.latest_exchange_storage_time)?; } if self.energy_window_size != 0 { os.write_int64(9, self.energy_window_size)?; } if self.delegated_frozenV2_balance_for_energy != 0 { os.write_int64(10, self.delegated_frozenV2_balance_for_energy)?; } if self.acquired_delegated_frozenV2_balance_for_energy != 0 { os.write_int64(11, self.acquired_delegated_frozenV2_balance_for_energy)?; } if self.energy_window_optimized != false { os.write_bool(12, self.energy_window_optimized)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountResource { AccountResource::new() } fn clear(&mut self) { self.energy_usage = 0; self.frozen_balance_for_energy.clear(); self.latest_consume_time_for_energy = 0; self.acquired_delegated_frozen_balance_for_energy = 0; self.delegated_frozen_balance_for_energy = 0; self.storage_limit = 0; self.storage_usage = 0; self.latest_exchange_storage_time = 0; self.energy_window_size = 0; self.delegated_frozenV2_balance_for_energy = 0; self.acquired_delegated_frozenV2_balance_for_energy = 0; self.energy_window_optimized = false; self.special_fields.clear(); } fn default_instance() -> &'static AccountResource { static instance: AccountResource = AccountResource { energy_usage: 0, frozen_balance_for_energy: ::protobuf::MessageField::none(), latest_consume_time_for_energy: 0, acquired_delegated_frozen_balance_for_energy: 0, delegated_frozen_balance_for_energy: 0, storage_limit: 0, storage_usage: 0, latest_exchange_storage_time: 0, energy_window_size: 0, delegated_frozenV2_balance_for_energy: 0, acquired_delegated_frozenV2_balance_for_energy: 0, energy_window_optimized: false, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountResource { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Account.AccountResource").unwrap()).clone() } } impl ::std::fmt::Display for AccountResource { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountResource { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Account.FreezeV2) #[derive(PartialEq,Clone,Default,Debug)] pub struct FreezeV2 { // message fields // @@protoc_insertion_point(field:protocol.Account.FreezeV2.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Account.FreezeV2.amount) pub amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Account.FreezeV2.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a FreezeV2 { fn default() -> &'a FreezeV2 { ::default_instance() } } impl FreezeV2 { pub fn new() -> FreezeV2 { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &FreezeV2| { &m.type_ }, |m: &mut FreezeV2| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "amount", |m: &FreezeV2| { &m.amount }, |m: &mut FreezeV2| { &mut m.amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Account.FreezeV2", fields, oneofs, ) } } impl ::protobuf::Message for FreezeV2 { const NAME: &'static str = "FreezeV2"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 16 => { self.amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } if self.amount != 0 { my_size += ::protobuf::rt::int64_size(2, self.amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if self.amount != 0 { os.write_int64(2, self.amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> FreezeV2 { FreezeV2::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH); self.amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static FreezeV2 { static instance: FreezeV2 = FreezeV2 { type_: ::protobuf::EnumOrUnknown::from_i32(0), amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for FreezeV2 { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Account.FreezeV2").unwrap()).clone() } } impl ::std::fmt::Display for FreezeV2 { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for FreezeV2 { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Account.UnFreezeV2) #[derive(PartialEq,Clone,Default,Debug)] pub struct UnFreezeV2 { // message fields // @@protoc_insertion_point(field:protocol.Account.UnFreezeV2.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Account.UnFreezeV2.unfreeze_amount) pub unfreeze_amount: i64, // @@protoc_insertion_point(field:protocol.Account.UnFreezeV2.unfreeze_expire_time) pub unfreeze_expire_time: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Account.UnFreezeV2.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UnFreezeV2 { fn default() -> &'a UnFreezeV2 { ::default_instance() } } impl UnFreezeV2 { pub fn new() -> UnFreezeV2 { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &UnFreezeV2| { &m.type_ }, |m: &mut UnFreezeV2| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unfreeze_amount", |m: &UnFreezeV2| { &m.unfreeze_amount }, |m: &mut UnFreezeV2| { &mut m.unfreeze_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unfreeze_expire_time", |m: &UnFreezeV2| { &m.unfreeze_expire_time }, |m: &mut UnFreezeV2| { &mut m.unfreeze_expire_time }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Account.UnFreezeV2", fields, oneofs, ) } } impl ::protobuf::Message for UnFreezeV2 { const NAME: &'static str = "UnFreezeV2"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 24 => { self.unfreeze_amount = is.read_int64()?; }, 32 => { self.unfreeze_expire_time = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } if self.unfreeze_amount != 0 { my_size += ::protobuf::rt::int64_size(3, self.unfreeze_amount); } if self.unfreeze_expire_time != 0 { my_size += ::protobuf::rt::int64_size(4, self.unfreeze_expire_time); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if self.unfreeze_amount != 0 { os.write_int64(3, self.unfreeze_amount)?; } if self.unfreeze_expire_time != 0 { os.write_int64(4, self.unfreeze_expire_time)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UnFreezeV2 { UnFreezeV2::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(super::super::common::ResourceCode::BANDWIDTH); self.unfreeze_amount = 0; self.unfreeze_expire_time = 0; self.special_fields.clear(); } fn default_instance() -> &'static UnFreezeV2 { static instance: UnFreezeV2 = UnFreezeV2 { type_: ::protobuf::EnumOrUnknown::from_i32(0), unfreeze_amount: 0, unfreeze_expire_time: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UnFreezeV2 { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Account.UnFreezeV2").unwrap()).clone() } } impl ::std::fmt::Display for UnFreezeV2 { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UnFreezeV2 { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.Key) #[derive(PartialEq,Clone,Default,Debug)] pub struct Key { // message fields // @@protoc_insertion_point(field:protocol.Key.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Key.weight) pub weight: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Key.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Key { fn default() -> &'a Key { ::default_instance() } } impl Key { pub fn new() -> Key { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Key| { &m.address }, |m: &mut Key| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "weight", |m: &Key| { &m.weight }, |m: &mut Key| { &mut m.weight }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Key", fields, oneofs, ) } } impl ::protobuf::Message for Key { const NAME: &'static str = "Key"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, 16 => { self.weight = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } if self.weight != 0 { my_size += ::protobuf::rt::int64_size(2, self.weight); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } if self.weight != 0 { os.write_int64(2, self.weight)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Key { Key::new() } fn clear(&mut self) { self.address.clear(); self.weight = 0; self.special_fields.clear(); } fn default_instance() -> &'static Key { static instance: Key = Key { address: ::std::vec::Vec::new(), weight: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Key { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Key").unwrap()).clone() } } impl ::std::fmt::Display for Key { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Key { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.DelegatedResource) #[derive(PartialEq,Clone,Default,Debug)] pub struct DelegatedResource { // message fields // @@protoc_insertion_point(field:protocol.DelegatedResource.from) pub from: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.DelegatedResource.to) pub to: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.DelegatedResource.frozen_balance_for_bandwidth) pub frozen_balance_for_bandwidth: i64, // @@protoc_insertion_point(field:protocol.DelegatedResource.frozen_balance_for_energy) pub frozen_balance_for_energy: i64, // @@protoc_insertion_point(field:protocol.DelegatedResource.expire_time_for_bandwidth) pub expire_time_for_bandwidth: i64, // @@protoc_insertion_point(field:protocol.DelegatedResource.expire_time_for_energy) pub expire_time_for_energy: i64, // special fields // @@protoc_insertion_point(special_field:protocol.DelegatedResource.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DelegatedResource { fn default() -> &'a DelegatedResource { ::default_instance() } } impl DelegatedResource { pub fn new() -> DelegatedResource { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "from", |m: &DelegatedResource| { &m.from }, |m: &mut DelegatedResource| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "to", |m: &DelegatedResource| { &m.to }, |m: &mut DelegatedResource| { &mut m.to }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_balance_for_bandwidth", |m: &DelegatedResource| { &m.frozen_balance_for_bandwidth }, |m: &mut DelegatedResource| { &mut m.frozen_balance_for_bandwidth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_balance_for_energy", |m: &DelegatedResource| { &m.frozen_balance_for_energy }, |m: &mut DelegatedResource| { &mut m.frozen_balance_for_energy }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expire_time_for_bandwidth", |m: &DelegatedResource| { &m.expire_time_for_bandwidth }, |m: &mut DelegatedResource| { &mut m.expire_time_for_bandwidth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expire_time_for_energy", |m: &DelegatedResource| { &m.expire_time_for_energy }, |m: &mut DelegatedResource| { &mut m.expire_time_for_energy }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "DelegatedResource", fields, oneofs, ) } } impl ::protobuf::Message for DelegatedResource { const NAME: &'static str = "DelegatedResource"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.from = is.read_bytes()?; }, 18 => { self.to = is.read_bytes()?; }, 24 => { self.frozen_balance_for_bandwidth = is.read_int64()?; }, 32 => { self.frozen_balance_for_energy = is.read_int64()?; }, 40 => { self.expire_time_for_bandwidth = is.read_int64()?; }, 48 => { self.expire_time_for_energy = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.from.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.from); } if !self.to.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.to); } if self.frozen_balance_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(3, self.frozen_balance_for_bandwidth); } if self.frozen_balance_for_energy != 0 { my_size += ::protobuf::rt::int64_size(4, self.frozen_balance_for_energy); } if self.expire_time_for_bandwidth != 0 { my_size += ::protobuf::rt::int64_size(5, self.expire_time_for_bandwidth); } if self.expire_time_for_energy != 0 { my_size += ::protobuf::rt::int64_size(6, self.expire_time_for_energy); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.from.is_empty() { os.write_bytes(1, &self.from)?; } if !self.to.is_empty() { os.write_bytes(2, &self.to)?; } if self.frozen_balance_for_bandwidth != 0 { os.write_int64(3, self.frozen_balance_for_bandwidth)?; } if self.frozen_balance_for_energy != 0 { os.write_int64(4, self.frozen_balance_for_energy)?; } if self.expire_time_for_bandwidth != 0 { os.write_int64(5, self.expire_time_for_bandwidth)?; } if self.expire_time_for_energy != 0 { os.write_int64(6, self.expire_time_for_energy)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DelegatedResource { DelegatedResource::new() } fn clear(&mut self) { self.from.clear(); self.to.clear(); self.frozen_balance_for_bandwidth = 0; self.frozen_balance_for_energy = 0; self.expire_time_for_bandwidth = 0; self.expire_time_for_energy = 0; self.special_fields.clear(); } fn default_instance() -> &'static DelegatedResource { static instance: DelegatedResource = DelegatedResource { from: ::std::vec::Vec::new(), to: ::std::vec::Vec::new(), frozen_balance_for_bandwidth: 0, frozen_balance_for_energy: 0, expire_time_for_bandwidth: 0, expire_time_for_energy: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DelegatedResource { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("DelegatedResource").unwrap()).clone() } } impl ::std::fmt::Display for DelegatedResource { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DelegatedResource { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.authority) #[derive(PartialEq,Clone,Default,Debug)] pub struct Authority { // message fields // @@protoc_insertion_point(field:protocol.authority.account) pub account: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.authority.permission_name) pub permission_name: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.authority.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Authority { fn default() -> &'a Authority { ::default_instance() } } impl Authority { pub fn new() -> Authority { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, AccountId>( "account", |m: &Authority| { &m.account }, |m: &mut Authority| { &mut m.account }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "permission_name", |m: &Authority| { &m.permission_name }, |m: &mut Authority| { &mut m.permission_name }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "authority", fields, oneofs, ) } } impl ::protobuf::Message for Authority { const NAME: &'static str = "authority"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.account)?; }, 18 => { self.permission_name = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.account.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.permission_name.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.permission_name); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.account.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.permission_name.is_empty() { os.write_bytes(2, &self.permission_name)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Authority { Authority::new() } fn clear(&mut self) { self.account.clear(); self.permission_name.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Authority { static instance: Authority = Authority { account: ::protobuf::MessageField::none(), permission_name: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Authority { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("authority").unwrap()).clone() } } impl ::std::fmt::Display for Authority { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Authority { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Permission) #[derive(PartialEq,Clone,Default,Debug)] pub struct Permission { // message fields // @@protoc_insertion_point(field:protocol.Permission.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Permission.id) pub id: i32, // @@protoc_insertion_point(field:protocol.Permission.permission_name) pub permission_name: ::std::string::String, // @@protoc_insertion_point(field:protocol.Permission.threshold) pub threshold: i64, // @@protoc_insertion_point(field:protocol.Permission.parent_id) pub parent_id: i32, // @@protoc_insertion_point(field:protocol.Permission.operations) pub operations: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Permission.keys) pub keys: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Permission.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Permission { fn default() -> &'a Permission { ::default_instance() } } impl Permission { pub fn new() -> Permission { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Permission| { &m.type_ }, |m: &mut Permission| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "id", |m: &Permission| { &m.id }, |m: &mut Permission| { &mut m.id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "permission_name", |m: &Permission| { &m.permission_name }, |m: &mut Permission| { &mut m.permission_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "threshold", |m: &Permission| { &m.threshold }, |m: &mut Permission| { &mut m.threshold }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "parent_id", |m: &Permission| { &m.parent_id }, |m: &mut Permission| { &mut m.parent_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "operations", |m: &Permission| { &m.operations }, |m: &mut Permission| { &mut m.operations }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "keys", |m: &Permission| { &m.keys }, |m: &mut Permission| { &mut m.keys }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Permission", fields, oneofs, ) } } impl ::protobuf::Message for Permission { const NAME: &'static str = "Permission"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 16 => { self.id = is.read_int32()?; }, 26 => { self.permission_name = is.read_string()?; }, 32 => { self.threshold = is.read_int64()?; }, 40 => { self.parent_id = is.read_int32()?; }, 50 => { self.operations = is.read_bytes()?; }, 58 => { self.keys.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(permission::PermissionType::Owner) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } if self.id != 0 { my_size += ::protobuf::rt::int32_size(2, self.id); } if !self.permission_name.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.permission_name); } if self.threshold != 0 { my_size += ::protobuf::rt::int64_size(4, self.threshold); } if self.parent_id != 0 { my_size += ::protobuf::rt::int32_size(5, self.parent_id); } if !self.operations.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.operations); } for value in &self.keys { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(permission::PermissionType::Owner) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if self.id != 0 { os.write_int32(2, self.id)?; } if !self.permission_name.is_empty() { os.write_string(3, &self.permission_name)?; } if self.threshold != 0 { os.write_int64(4, self.threshold)?; } if self.parent_id != 0 { os.write_int32(5, self.parent_id)?; } if !self.operations.is_empty() { os.write_bytes(6, &self.operations)?; } for v in &self.keys { ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Permission { Permission::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(permission::PermissionType::Owner); self.id = 0; self.permission_name.clear(); self.threshold = 0; self.parent_id = 0; self.operations.clear(); self.keys.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Permission { static instance: Permission = Permission { type_: ::protobuf::EnumOrUnknown::from_i32(0), id: 0, permission_name: ::std::string::String::new(), threshold: 0, parent_id: 0, operations: ::std::vec::Vec::new(), keys: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Permission { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Permission").unwrap()).clone() } } impl ::std::fmt::Display for Permission { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Permission { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Permission` pub mod permission { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Permission.PermissionType) pub enum PermissionType { // @@protoc_insertion_point(enum_value:protocol.Permission.PermissionType.Owner) Owner = 0, // @@protoc_insertion_point(enum_value:protocol.Permission.PermissionType.Witness) Witness = 1, // @@protoc_insertion_point(enum_value:protocol.Permission.PermissionType.Active) Active = 2, } impl ::protobuf::Enum for PermissionType { const NAME: &'static str = "PermissionType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(PermissionType::Owner), 1 => ::std::option::Option::Some(PermissionType::Witness), 2 => ::std::option::Option::Some(PermissionType::Active), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "Owner" => ::std::option::Option::Some(PermissionType::Owner), "Witness" => ::std::option::Option::Some(PermissionType::Witness), "Active" => ::std::option::Option::Some(PermissionType::Active), _ => ::std::option::Option::None } } const VALUES: &'static [PermissionType] = &[ PermissionType::Owner, PermissionType::Witness, PermissionType::Active, ]; } impl ::protobuf::EnumFull for PermissionType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Permission.PermissionType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for PermissionType { fn default() -> Self { PermissionType::Owner } } impl PermissionType { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Permission.PermissionType") } } } /// Witness // @@protoc_insertion_point(message:protocol.Witness) #[derive(PartialEq,Clone,Default,Debug)] pub struct Witness { // message fields // @@protoc_insertion_point(field:protocol.Witness.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Witness.voteCount) pub voteCount: i64, // @@protoc_insertion_point(field:protocol.Witness.pubKey) pub pubKey: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Witness.url) pub url: ::std::string::String, // @@protoc_insertion_point(field:protocol.Witness.totalProduced) pub totalProduced: i64, // @@protoc_insertion_point(field:protocol.Witness.totalMissed) pub totalMissed: i64, // @@protoc_insertion_point(field:protocol.Witness.latestBlockNum) pub latestBlockNum: i64, // @@protoc_insertion_point(field:protocol.Witness.latestSlotNum) pub latestSlotNum: i64, // @@protoc_insertion_point(field:protocol.Witness.isJobs) pub isJobs: bool, // special fields // @@protoc_insertion_point(special_field:protocol.Witness.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Witness { fn default() -> &'a Witness { ::default_instance() } } impl Witness { pub fn new() -> Witness { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(9); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Witness| { &m.address }, |m: &mut Witness| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "voteCount", |m: &Witness| { &m.voteCount }, |m: &mut Witness| { &mut m.voteCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "pubKey", |m: &Witness| { &m.pubKey }, |m: &mut Witness| { &mut m.pubKey }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "url", |m: &Witness| { &m.url }, |m: &mut Witness| { &mut m.url }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "totalProduced", |m: &Witness| { &m.totalProduced }, |m: &mut Witness| { &mut m.totalProduced }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "totalMissed", |m: &Witness| { &m.totalMissed }, |m: &mut Witness| { &mut m.totalMissed }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latestBlockNum", |m: &Witness| { &m.latestBlockNum }, |m: &mut Witness| { &mut m.latestBlockNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "latestSlotNum", |m: &Witness| { &m.latestSlotNum }, |m: &mut Witness| { &mut m.latestSlotNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "isJobs", |m: &Witness| { &m.isJobs }, |m: &mut Witness| { &mut m.isJobs }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Witness", fields, oneofs, ) } } impl ::protobuf::Message for Witness { const NAME: &'static str = "Witness"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, 16 => { self.voteCount = is.read_int64()?; }, 26 => { self.pubKey = is.read_bytes()?; }, 34 => { self.url = is.read_string()?; }, 40 => { self.totalProduced = is.read_int64()?; }, 48 => { self.totalMissed = is.read_int64()?; }, 56 => { self.latestBlockNum = is.read_int64()?; }, 64 => { self.latestSlotNum = is.read_int64()?; }, 72 => { self.isJobs = is.read_bool()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } if self.voteCount != 0 { my_size += ::protobuf::rt::int64_size(2, self.voteCount); } if !self.pubKey.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.pubKey); } if !self.url.is_empty() { my_size += ::protobuf::rt::string_size(4, &self.url); } if self.totalProduced != 0 { my_size += ::protobuf::rt::int64_size(5, self.totalProduced); } if self.totalMissed != 0 { my_size += ::protobuf::rt::int64_size(6, self.totalMissed); } if self.latestBlockNum != 0 { my_size += ::protobuf::rt::int64_size(7, self.latestBlockNum); } if self.latestSlotNum != 0 { my_size += ::protobuf::rt::int64_size(8, self.latestSlotNum); } if self.isJobs != false { my_size += 1 + 1; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } if self.voteCount != 0 { os.write_int64(2, self.voteCount)?; } if !self.pubKey.is_empty() { os.write_bytes(3, &self.pubKey)?; } if !self.url.is_empty() { os.write_string(4, &self.url)?; } if self.totalProduced != 0 { os.write_int64(5, self.totalProduced)?; } if self.totalMissed != 0 { os.write_int64(6, self.totalMissed)?; } if self.latestBlockNum != 0 { os.write_int64(7, self.latestBlockNum)?; } if self.latestSlotNum != 0 { os.write_int64(8, self.latestSlotNum)?; } if self.isJobs != false { os.write_bool(9, self.isJobs)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Witness { Witness::new() } fn clear(&mut self) { self.address.clear(); self.voteCount = 0; self.pubKey.clear(); self.url.clear(); self.totalProduced = 0; self.totalMissed = 0; self.latestBlockNum = 0; self.latestSlotNum = 0; self.isJobs = false; self.special_fields.clear(); } fn default_instance() -> &'static Witness { static instance: Witness = Witness { address: ::std::vec::Vec::new(), voteCount: 0, pubKey: ::std::vec::Vec::new(), url: ::std::string::String::new(), totalProduced: 0, totalMissed: 0, latestBlockNum: 0, latestSlotNum: 0, isJobs: false, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Witness { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Witness").unwrap()).clone() } } impl ::std::fmt::Display for Witness { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Witness { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Vote Change // @@protoc_insertion_point(message:protocol.Votes) #[derive(PartialEq,Clone,Default,Debug)] pub struct Votes { // message fields // @@protoc_insertion_point(field:protocol.Votes.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Votes.old_votes) pub old_votes: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Votes.new_votes) pub new_votes: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Votes.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Votes { fn default() -> &'a Votes { ::default_instance() } } impl Votes { pub fn new() -> Votes { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Votes| { &m.address }, |m: &mut Votes| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "old_votes", |m: &Votes| { &m.old_votes }, |m: &mut Votes| { &mut m.old_votes }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "new_votes", |m: &Votes| { &m.new_votes }, |m: &mut Votes| { &mut m.new_votes }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Votes", fields, oneofs, ) } } impl ::protobuf::Message for Votes { const NAME: &'static str = "Votes"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, 18 => { self.old_votes.push(is.read_message()?); }, 26 => { self.new_votes.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } for value in &self.old_votes { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.new_votes { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } for v in &self.old_votes { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; for v in &self.new_votes { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Votes { Votes::new() } fn clear(&mut self) { self.address.clear(); self.old_votes.clear(); self.new_votes.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Votes { static instance: Votes = Votes { address: ::std::vec::Vec::new(), old_votes: ::std::vec::Vec::new(), new_votes: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Votes { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Votes").unwrap()).clone() } } impl ::std::fmt::Display for Votes { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Votes { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.TXOutput) #[derive(PartialEq,Clone,Default,Debug)] pub struct TXOutput { // message fields // @@protoc_insertion_point(field:protocol.TXOutput.value) pub value: i64, // @@protoc_insertion_point(field:protocol.TXOutput.pubKeyHash) pub pubKeyHash: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TXOutput.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TXOutput { fn default() -> &'a TXOutput { ::default_instance() } } impl TXOutput { pub fn new() -> TXOutput { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "value", |m: &TXOutput| { &m.value }, |m: &mut TXOutput| { &mut m.value }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "pubKeyHash", |m: &TXOutput| { &m.pubKeyHash }, |m: &mut TXOutput| { &mut m.pubKeyHash }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TXOutput", fields, oneofs, ) } } impl ::protobuf::Message for TXOutput { const NAME: &'static str = "TXOutput"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.value = is.read_int64()?; }, 18 => { self.pubKeyHash = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.value != 0 { my_size += ::protobuf::rt::int64_size(1, self.value); } if !self.pubKeyHash.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.pubKeyHash); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.value != 0 { os.write_int64(1, self.value)?; } if !self.pubKeyHash.is_empty() { os.write_bytes(2, &self.pubKeyHash)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TXOutput { TXOutput::new() } fn clear(&mut self) { self.value = 0; self.pubKeyHash.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TXOutput { static instance: TXOutput = TXOutput { value: 0, pubKeyHash: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TXOutput { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TXOutput").unwrap()).clone() } } impl ::std::fmt::Display for TXOutput { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TXOutput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.TXInput) #[derive(PartialEq,Clone,Default,Debug)] pub struct TXInput { // message fields // @@protoc_insertion_point(field:protocol.TXInput.raw_data) pub raw_data: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.TXInput.signature) pub signature: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TXInput.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TXInput { fn default() -> &'a TXInput { ::default_instance() } } impl TXInput { pub fn new() -> TXInput { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, txinput::Raw>( "raw_data", |m: &TXInput| { &m.raw_data }, |m: &mut TXInput| { &mut m.raw_data }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "signature", |m: &TXInput| { &m.signature }, |m: &mut TXInput| { &mut m.signature }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TXInput", fields, oneofs, ) } } impl ::protobuf::Message for TXInput { const NAME: &'static str = "TXInput"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.raw_data)?; }, 34 => { self.signature = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.raw_data.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.signature.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.signature); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.raw_data.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.signature.is_empty() { os.write_bytes(4, &self.signature)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TXInput { TXInput::new() } fn clear(&mut self) { self.raw_data.clear(); self.signature.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TXInput { static instance: TXInput = TXInput { raw_data: ::protobuf::MessageField::none(), signature: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TXInput { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TXInput").unwrap()).clone() } } impl ::std::fmt::Display for TXInput { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TXInput { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `TXInput` pub mod txinput { // @@protoc_insertion_point(message:protocol.TXInput.raw) #[derive(PartialEq,Clone,Default,Debug)] pub struct Raw { // message fields // @@protoc_insertion_point(field:protocol.TXInput.raw.txID) pub txID: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TXInput.raw.vout) pub vout: i64, // @@protoc_insertion_point(field:protocol.TXInput.raw.pubKey) pub pubKey: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TXInput.raw.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Raw { fn default() -> &'a Raw { ::default_instance() } } impl Raw { pub fn new() -> Raw { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "txID", |m: &Raw| { &m.txID }, |m: &mut Raw| { &mut m.txID }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vout", |m: &Raw| { &m.vout }, |m: &mut Raw| { &mut m.vout }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "pubKey", |m: &Raw| { &m.pubKey }, |m: &mut Raw| { &mut m.pubKey }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TXInput.raw", fields, oneofs, ) } } impl ::protobuf::Message for Raw { const NAME: &'static str = "raw"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.txID = is.read_bytes()?; }, 16 => { self.vout = is.read_int64()?; }, 26 => { self.pubKey = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.txID.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.txID); } if self.vout != 0 { my_size += ::protobuf::rt::int64_size(2, self.vout); } if !self.pubKey.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.pubKey); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.txID.is_empty() { os.write_bytes(1, &self.txID)?; } if self.vout != 0 { os.write_int64(2, self.vout)?; } if !self.pubKey.is_empty() { os.write_bytes(3, &self.pubKey)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Raw { Raw::new() } fn clear(&mut self) { self.txID.clear(); self.vout = 0; self.pubKey.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Raw { static instance: Raw = Raw { txID: ::std::vec::Vec::new(), vout: 0, pubKey: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Raw { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TXInput.raw").unwrap()).clone() } } impl ::std::fmt::Display for Raw { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Raw { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.TXOutputs) #[derive(PartialEq,Clone,Default,Debug)] pub struct TXOutputs { // message fields // @@protoc_insertion_point(field:protocol.TXOutputs.outputs) pub outputs: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TXOutputs.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TXOutputs { fn default() -> &'a TXOutputs { ::default_instance() } } impl TXOutputs { pub fn new() -> TXOutputs { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "outputs", |m: &TXOutputs| { &m.outputs }, |m: &mut TXOutputs| { &mut m.outputs }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TXOutputs", fields, oneofs, ) } } impl ::protobuf::Message for TXOutputs { const NAME: &'static str = "TXOutputs"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.outputs.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.outputs { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.outputs { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TXOutputs { TXOutputs::new() } fn clear(&mut self) { self.outputs.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TXOutputs { static instance: TXOutputs = TXOutputs { outputs: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TXOutputs { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TXOutputs").unwrap()).clone() } } impl ::std::fmt::Display for TXOutputs { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TXOutputs { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ResourceReceipt) #[derive(PartialEq,Clone,Default,Debug)] pub struct ResourceReceipt { // message fields // @@protoc_insertion_point(field:protocol.ResourceReceipt.energy_usage) pub energy_usage: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.energy_fee) pub energy_fee: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.origin_energy_usage) pub origin_energy_usage: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.energy_usage_total) pub energy_usage_total: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.net_usage) pub net_usage: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.net_fee) pub net_fee: i64, // @@protoc_insertion_point(field:protocol.ResourceReceipt.result) pub result: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.ResourceReceipt.energy_penalty_total) pub energy_penalty_total: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ResourceReceipt.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ResourceReceipt { fn default() -> &'a ResourceReceipt { ::default_instance() } } impl ResourceReceipt { pub fn new() -> ResourceReceipt { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(8); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_usage", |m: &ResourceReceipt| { &m.energy_usage }, |m: &mut ResourceReceipt| { &mut m.energy_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_fee", |m: &ResourceReceipt| { &m.energy_fee }, |m: &mut ResourceReceipt| { &mut m.energy_fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "origin_energy_usage", |m: &ResourceReceipt| { &m.origin_energy_usage }, |m: &mut ResourceReceipt| { &mut m.origin_energy_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_usage_total", |m: &ResourceReceipt| { &m.energy_usage_total }, |m: &mut ResourceReceipt| { &mut m.energy_usage_total }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "net_usage", |m: &ResourceReceipt| { &m.net_usage }, |m: &mut ResourceReceipt| { &mut m.net_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "net_fee", |m: &ResourceReceipt| { &m.net_fee }, |m: &mut ResourceReceipt| { &mut m.net_fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "result", |m: &ResourceReceipt| { &m.result }, |m: &mut ResourceReceipt| { &mut m.result }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_penalty_total", |m: &ResourceReceipt| { &m.energy_penalty_total }, |m: &mut ResourceReceipt| { &mut m.energy_penalty_total }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ResourceReceipt", fields, oneofs, ) } } impl ::protobuf::Message for ResourceReceipt { const NAME: &'static str = "ResourceReceipt"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.energy_usage = is.read_int64()?; }, 16 => { self.energy_fee = is.read_int64()?; }, 24 => { self.origin_energy_usage = is.read_int64()?; }, 32 => { self.energy_usage_total = is.read_int64()?; }, 40 => { self.net_usage = is.read_int64()?; }, 48 => { self.net_fee = is.read_int64()?; }, 56 => { self.result = is.read_enum_or_unknown()?; }, 64 => { self.energy_penalty_total = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.energy_usage != 0 { my_size += ::protobuf::rt::int64_size(1, self.energy_usage); } if self.energy_fee != 0 { my_size += ::protobuf::rt::int64_size(2, self.energy_fee); } if self.origin_energy_usage != 0 { my_size += ::protobuf::rt::int64_size(3, self.origin_energy_usage); } if self.energy_usage_total != 0 { my_size += ::protobuf::rt::int64_size(4, self.energy_usage_total); } if self.net_usage != 0 { my_size += ::protobuf::rt::int64_size(5, self.net_usage); } if self.net_fee != 0 { my_size += ::protobuf::rt::int64_size(6, self.net_fee); } if self.result != ::protobuf::EnumOrUnknown::new(transaction::result::ContractResult::DEFAULT) { my_size += ::protobuf::rt::int32_size(7, self.result.value()); } if self.energy_penalty_total != 0 { my_size += ::protobuf::rt::int64_size(8, self.energy_penalty_total); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.energy_usage != 0 { os.write_int64(1, self.energy_usage)?; } if self.energy_fee != 0 { os.write_int64(2, self.energy_fee)?; } if self.origin_energy_usage != 0 { os.write_int64(3, self.origin_energy_usage)?; } if self.energy_usage_total != 0 { os.write_int64(4, self.energy_usage_total)?; } if self.net_usage != 0 { os.write_int64(5, self.net_usage)?; } if self.net_fee != 0 { os.write_int64(6, self.net_fee)?; } if self.result != ::protobuf::EnumOrUnknown::new(transaction::result::ContractResult::DEFAULT) { os.write_enum(7, ::protobuf::EnumOrUnknown::value(&self.result))?; } if self.energy_penalty_total != 0 { os.write_int64(8, self.energy_penalty_total)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ResourceReceipt { ResourceReceipt::new() } fn clear(&mut self) { self.energy_usage = 0; self.energy_fee = 0; self.origin_energy_usage = 0; self.energy_usage_total = 0; self.net_usage = 0; self.net_fee = 0; self.result = ::protobuf::EnumOrUnknown::new(transaction::result::ContractResult::DEFAULT); self.energy_penalty_total = 0; self.special_fields.clear(); } fn default_instance() -> &'static ResourceReceipt { static instance: ResourceReceipt = ResourceReceipt { energy_usage: 0, energy_fee: 0, origin_energy_usage: 0, energy_usage_total: 0, net_usage: 0, net_fee: 0, result: ::protobuf::EnumOrUnknown::from_i32(0), energy_penalty_total: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ResourceReceipt { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ResourceReceipt").unwrap()).clone() } } impl ::std::fmt::Display for ResourceReceipt { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ResourceReceipt { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketOrderDetail) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketOrderDetail { // message fields // @@protoc_insertion_point(field:protocol.MarketOrderDetail.makerOrderId) pub makerOrderId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrderDetail.takerOrderId) pub takerOrderId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketOrderDetail.fillSellQuantity) pub fillSellQuantity: i64, // @@protoc_insertion_point(field:protocol.MarketOrderDetail.fillBuyQuantity) pub fillBuyQuantity: i64, // special fields // @@protoc_insertion_point(special_field:protocol.MarketOrderDetail.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketOrderDetail { fn default() -> &'a MarketOrderDetail { ::default_instance() } } impl MarketOrderDetail { pub fn new() -> MarketOrderDetail { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "makerOrderId", |m: &MarketOrderDetail| { &m.makerOrderId }, |m: &mut MarketOrderDetail| { &mut m.makerOrderId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "takerOrderId", |m: &MarketOrderDetail| { &m.takerOrderId }, |m: &mut MarketOrderDetail| { &mut m.takerOrderId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fillSellQuantity", |m: &MarketOrderDetail| { &m.fillSellQuantity }, |m: &mut MarketOrderDetail| { &mut m.fillSellQuantity }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fillBuyQuantity", |m: &MarketOrderDetail| { &m.fillBuyQuantity }, |m: &mut MarketOrderDetail| { &mut m.fillBuyQuantity }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketOrderDetail", fields, oneofs, ) } } impl ::protobuf::Message for MarketOrderDetail { const NAME: &'static str = "MarketOrderDetail"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.makerOrderId = is.read_bytes()?; }, 18 => { self.takerOrderId = is.read_bytes()?; }, 24 => { self.fillSellQuantity = is.read_int64()?; }, 32 => { self.fillBuyQuantity = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.makerOrderId.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.makerOrderId); } if !self.takerOrderId.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.takerOrderId); } if self.fillSellQuantity != 0 { my_size += ::protobuf::rt::int64_size(3, self.fillSellQuantity); } if self.fillBuyQuantity != 0 { my_size += ::protobuf::rt::int64_size(4, self.fillBuyQuantity); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.makerOrderId.is_empty() { os.write_bytes(1, &self.makerOrderId)?; } if !self.takerOrderId.is_empty() { os.write_bytes(2, &self.takerOrderId)?; } if self.fillSellQuantity != 0 { os.write_int64(3, self.fillSellQuantity)?; } if self.fillBuyQuantity != 0 { os.write_int64(4, self.fillBuyQuantity)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketOrderDetail { MarketOrderDetail::new() } fn clear(&mut self) { self.makerOrderId.clear(); self.takerOrderId.clear(); self.fillSellQuantity = 0; self.fillBuyQuantity = 0; self.special_fields.clear(); } fn default_instance() -> &'static MarketOrderDetail { static instance: MarketOrderDetail = MarketOrderDetail { makerOrderId: ::std::vec::Vec::new(), takerOrderId: ::std::vec::Vec::new(), fillSellQuantity: 0, fillBuyQuantity: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketOrderDetail { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketOrderDetail").unwrap()).clone() } } impl ::std::fmt::Display for MarketOrderDetail { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketOrderDetail { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Transaction) #[derive(PartialEq,Clone,Default,Debug)] pub struct Transaction { // message fields // @@protoc_insertion_point(field:protocol.Transaction.raw_data) pub raw_data: ::protobuf::MessageField, /// only support size = 1, repeated list here for muti-sig extension // @@protoc_insertion_point(field:protocol.Transaction.signature) pub signature: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.Transaction.ret) pub ret: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Transaction.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Transaction { fn default() -> &'a Transaction { ::default_instance() } } impl Transaction { pub fn new() -> Transaction { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, transaction::Raw>( "raw_data", |m: &Transaction| { &m.raw_data }, |m: &mut Transaction| { &mut m.raw_data }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "signature", |m: &Transaction| { &m.signature }, |m: &mut Transaction| { &mut m.signature }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "ret", |m: &Transaction| { &m.ret }, |m: &mut Transaction| { &mut m.ret }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Transaction", fields, oneofs, ) } } impl ::protobuf::Message for Transaction { const NAME: &'static str = "Transaction"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.raw_data)?; }, 18 => { self.signature.push(is.read_bytes()?); }, 42 => { self.ret.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.raw_data.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.signature { my_size += ::protobuf::rt::bytes_size(2, &value); }; for value in &self.ret { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.raw_data.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } for v in &self.signature { os.write_bytes(2, &v)?; }; for v in &self.ret { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Transaction { Transaction::new() } fn clear(&mut self) { self.raw_data.clear(); self.signature.clear(); self.ret.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Transaction { static instance: Transaction = Transaction { raw_data: ::protobuf::MessageField::none(), signature: ::std::vec::Vec::new(), ret: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Transaction { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Transaction").unwrap()).clone() } } impl ::std::fmt::Display for Transaction { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Transaction { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Transaction` pub mod transaction { // @@protoc_insertion_point(message:protocol.Transaction.Contract) #[derive(PartialEq,Clone,Default,Debug)] pub struct Contract { // message fields // @@protoc_insertion_point(field:protocol.Transaction.Contract.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Transaction.Contract.parameter) pub parameter: ::protobuf::MessageField<::protobuf::well_known_types::any::Any>, // @@protoc_insertion_point(field:protocol.Transaction.Contract.provider) pub provider: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.Contract.ContractName) pub ContractName: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.Contract.Permission_id) pub Permission_id: i32, // special fields // @@protoc_insertion_point(special_field:protocol.Transaction.Contract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Contract { fn default() -> &'a Contract { ::default_instance() } } impl Contract { pub fn new() -> Contract { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Contract| { &m.type_ }, |m: &mut Contract| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ::protobuf::well_known_types::any::Any>( "parameter", |m: &Contract| { &m.parameter }, |m: &mut Contract| { &mut m.parameter }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "provider", |m: &Contract| { &m.provider }, |m: &mut Contract| { &mut m.provider }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ContractName", |m: &Contract| { &m.ContractName }, |m: &mut Contract| { &mut m.ContractName }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "Permission_id", |m: &Contract| { &m.Permission_id }, |m: &mut Contract| { &mut m.Permission_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Transaction.Contract", fields, oneofs, ) } } impl ::protobuf::Message for Contract { const NAME: &'static str = "Contract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.parameter)?; }, 26 => { self.provider = is.read_bytes()?; }, 34 => { self.ContractName = is.read_bytes()?; }, 40 => { self.Permission_id = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(contract::ContractType::AccountCreateContract) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } if let Some(v) = self.parameter.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.provider.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.provider); } if !self.ContractName.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.ContractName); } if self.Permission_id != 0 { my_size += ::protobuf::rt::int32_size(5, self.Permission_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(contract::ContractType::AccountCreateContract) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if let Some(v) = self.parameter.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if !self.provider.is_empty() { os.write_bytes(3, &self.provider)?; } if !self.ContractName.is_empty() { os.write_bytes(4, &self.ContractName)?; } if self.Permission_id != 0 { os.write_int32(5, self.Permission_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Contract { Contract::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(contract::ContractType::AccountCreateContract); self.parameter.clear(); self.provider.clear(); self.ContractName.clear(); self.Permission_id = 0; self.special_fields.clear(); } fn default_instance() -> &'static Contract { static instance: Contract = Contract { type_: ::protobuf::EnumOrUnknown::from_i32(0), parameter: ::protobuf::MessageField::none(), provider: ::std::vec::Vec::new(), ContractName: ::std::vec::Vec::new(), Permission_id: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Contract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Transaction.Contract").unwrap()).clone() } } impl ::std::fmt::Display for Contract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Contract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Contract` pub mod contract { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Transaction.Contract.ContractType) pub enum ContractType { // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.AccountCreateContract) AccountCreateContract = 0, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.TransferContract) TransferContract = 1, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.TransferAssetContract) TransferAssetContract = 2, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.VoteAssetContract) VoteAssetContract = 3, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.VoteWitnessContract) VoteWitnessContract = 4, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.WitnessCreateContract) WitnessCreateContract = 5, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.AssetIssueContract) AssetIssueContract = 6, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.WitnessUpdateContract) WitnessUpdateContract = 8, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ParticipateAssetIssueContract) ParticipateAssetIssueContract = 9, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.AccountUpdateContract) AccountUpdateContract = 10, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.FreezeBalanceContract) FreezeBalanceContract = 11, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UnfreezeBalanceContract) UnfreezeBalanceContract = 12, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.WithdrawBalanceContract) WithdrawBalanceContract = 13, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UnfreezeAssetContract) UnfreezeAssetContract = 14, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UpdateAssetContract) UpdateAssetContract = 15, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ProposalCreateContract) ProposalCreateContract = 16, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ProposalApproveContract) ProposalApproveContract = 17, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ProposalDeleteContract) ProposalDeleteContract = 18, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.SetAccountIdContract) SetAccountIdContract = 19, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.CustomContract) CustomContract = 20, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.CreateSmartContract) CreateSmartContract = 30, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.TriggerSmartContract) TriggerSmartContract = 31, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.GetContract) GetContract = 32, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UpdateSettingContract) UpdateSettingContract = 33, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ExchangeCreateContract) ExchangeCreateContract = 41, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ExchangeInjectContract) ExchangeInjectContract = 42, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ExchangeWithdrawContract) ExchangeWithdrawContract = 43, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ExchangeTransactionContract) ExchangeTransactionContract = 44, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UpdateEnergyLimitContract) UpdateEnergyLimitContract = 45, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.AccountPermissionUpdateContract) AccountPermissionUpdateContract = 46, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ClearABIContract) ClearABIContract = 48, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UpdateBrokerageContract) UpdateBrokerageContract = 49, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.ShieldedTransferContract) ShieldedTransferContract = 51, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.MarketSellAssetContract) MarketSellAssetContract = 52, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.MarketCancelOrderContract) MarketCancelOrderContract = 53, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.FreezeBalanceV2Contract) FreezeBalanceV2Contract = 54, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UnfreezeBalanceV2Contract) UnfreezeBalanceV2Contract = 55, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.WithdrawExpireUnfreezeContract) WithdrawExpireUnfreezeContract = 56, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.DelegateResourceContract) DelegateResourceContract = 57, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.UnDelegateResourceContract) UnDelegateResourceContract = 58, // @@protoc_insertion_point(enum_value:protocol.Transaction.Contract.ContractType.CancelAllUnfreezeV2Contract) CancelAllUnfreezeV2Contract = 59, } impl ::protobuf::Enum for ContractType { const NAME: &'static str = "ContractType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(ContractType::AccountCreateContract), 1 => ::std::option::Option::Some(ContractType::TransferContract), 2 => ::std::option::Option::Some(ContractType::TransferAssetContract), 3 => ::std::option::Option::Some(ContractType::VoteAssetContract), 4 => ::std::option::Option::Some(ContractType::VoteWitnessContract), 5 => ::std::option::Option::Some(ContractType::WitnessCreateContract), 6 => ::std::option::Option::Some(ContractType::AssetIssueContract), 8 => ::std::option::Option::Some(ContractType::WitnessUpdateContract), 9 => ::std::option::Option::Some(ContractType::ParticipateAssetIssueContract), 10 => ::std::option::Option::Some(ContractType::AccountUpdateContract), 11 => ::std::option::Option::Some(ContractType::FreezeBalanceContract), 12 => ::std::option::Option::Some(ContractType::UnfreezeBalanceContract), 13 => ::std::option::Option::Some(ContractType::WithdrawBalanceContract), 14 => ::std::option::Option::Some(ContractType::UnfreezeAssetContract), 15 => ::std::option::Option::Some(ContractType::UpdateAssetContract), 16 => ::std::option::Option::Some(ContractType::ProposalCreateContract), 17 => ::std::option::Option::Some(ContractType::ProposalApproveContract), 18 => ::std::option::Option::Some(ContractType::ProposalDeleteContract), 19 => ::std::option::Option::Some(ContractType::SetAccountIdContract), 20 => ::std::option::Option::Some(ContractType::CustomContract), 30 => ::std::option::Option::Some(ContractType::CreateSmartContract), 31 => ::std::option::Option::Some(ContractType::TriggerSmartContract), 32 => ::std::option::Option::Some(ContractType::GetContract), 33 => ::std::option::Option::Some(ContractType::UpdateSettingContract), 41 => ::std::option::Option::Some(ContractType::ExchangeCreateContract), 42 => ::std::option::Option::Some(ContractType::ExchangeInjectContract), 43 => ::std::option::Option::Some(ContractType::ExchangeWithdrawContract), 44 => ::std::option::Option::Some(ContractType::ExchangeTransactionContract), 45 => ::std::option::Option::Some(ContractType::UpdateEnergyLimitContract), 46 => ::std::option::Option::Some(ContractType::AccountPermissionUpdateContract), 48 => ::std::option::Option::Some(ContractType::ClearABIContract), 49 => ::std::option::Option::Some(ContractType::UpdateBrokerageContract), 51 => ::std::option::Option::Some(ContractType::ShieldedTransferContract), 52 => ::std::option::Option::Some(ContractType::MarketSellAssetContract), 53 => ::std::option::Option::Some(ContractType::MarketCancelOrderContract), 54 => ::std::option::Option::Some(ContractType::FreezeBalanceV2Contract), 55 => ::std::option::Option::Some(ContractType::UnfreezeBalanceV2Contract), 56 => ::std::option::Option::Some(ContractType::WithdrawExpireUnfreezeContract), 57 => ::std::option::Option::Some(ContractType::DelegateResourceContract), 58 => ::std::option::Option::Some(ContractType::UnDelegateResourceContract), 59 => ::std::option::Option::Some(ContractType::CancelAllUnfreezeV2Contract), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "AccountCreateContract" => ::std::option::Option::Some(ContractType::AccountCreateContract), "TransferContract" => ::std::option::Option::Some(ContractType::TransferContract), "TransferAssetContract" => ::std::option::Option::Some(ContractType::TransferAssetContract), "VoteAssetContract" => ::std::option::Option::Some(ContractType::VoteAssetContract), "VoteWitnessContract" => ::std::option::Option::Some(ContractType::VoteWitnessContract), "WitnessCreateContract" => ::std::option::Option::Some(ContractType::WitnessCreateContract), "AssetIssueContract" => ::std::option::Option::Some(ContractType::AssetIssueContract), "WitnessUpdateContract" => ::std::option::Option::Some(ContractType::WitnessUpdateContract), "ParticipateAssetIssueContract" => ::std::option::Option::Some(ContractType::ParticipateAssetIssueContract), "AccountUpdateContract" => ::std::option::Option::Some(ContractType::AccountUpdateContract), "FreezeBalanceContract" => ::std::option::Option::Some(ContractType::FreezeBalanceContract), "UnfreezeBalanceContract" => ::std::option::Option::Some(ContractType::UnfreezeBalanceContract), "WithdrawBalanceContract" => ::std::option::Option::Some(ContractType::WithdrawBalanceContract), "UnfreezeAssetContract" => ::std::option::Option::Some(ContractType::UnfreezeAssetContract), "UpdateAssetContract" => ::std::option::Option::Some(ContractType::UpdateAssetContract), "ProposalCreateContract" => ::std::option::Option::Some(ContractType::ProposalCreateContract), "ProposalApproveContract" => ::std::option::Option::Some(ContractType::ProposalApproveContract), "ProposalDeleteContract" => ::std::option::Option::Some(ContractType::ProposalDeleteContract), "SetAccountIdContract" => ::std::option::Option::Some(ContractType::SetAccountIdContract), "CustomContract" => ::std::option::Option::Some(ContractType::CustomContract), "CreateSmartContract" => ::std::option::Option::Some(ContractType::CreateSmartContract), "TriggerSmartContract" => ::std::option::Option::Some(ContractType::TriggerSmartContract), "GetContract" => ::std::option::Option::Some(ContractType::GetContract), "UpdateSettingContract" => ::std::option::Option::Some(ContractType::UpdateSettingContract), "ExchangeCreateContract" => ::std::option::Option::Some(ContractType::ExchangeCreateContract), "ExchangeInjectContract" => ::std::option::Option::Some(ContractType::ExchangeInjectContract), "ExchangeWithdrawContract" => ::std::option::Option::Some(ContractType::ExchangeWithdrawContract), "ExchangeTransactionContract" => ::std::option::Option::Some(ContractType::ExchangeTransactionContract), "UpdateEnergyLimitContract" => ::std::option::Option::Some(ContractType::UpdateEnergyLimitContract), "AccountPermissionUpdateContract" => ::std::option::Option::Some(ContractType::AccountPermissionUpdateContract), "ClearABIContract" => ::std::option::Option::Some(ContractType::ClearABIContract), "UpdateBrokerageContract" => ::std::option::Option::Some(ContractType::UpdateBrokerageContract), "ShieldedTransferContract" => ::std::option::Option::Some(ContractType::ShieldedTransferContract), "MarketSellAssetContract" => ::std::option::Option::Some(ContractType::MarketSellAssetContract), "MarketCancelOrderContract" => ::std::option::Option::Some(ContractType::MarketCancelOrderContract), "FreezeBalanceV2Contract" => ::std::option::Option::Some(ContractType::FreezeBalanceV2Contract), "UnfreezeBalanceV2Contract" => ::std::option::Option::Some(ContractType::UnfreezeBalanceV2Contract), "WithdrawExpireUnfreezeContract" => ::std::option::Option::Some(ContractType::WithdrawExpireUnfreezeContract), "DelegateResourceContract" => ::std::option::Option::Some(ContractType::DelegateResourceContract), "UnDelegateResourceContract" => ::std::option::Option::Some(ContractType::UnDelegateResourceContract), "CancelAllUnfreezeV2Contract" => ::std::option::Option::Some(ContractType::CancelAllUnfreezeV2Contract), _ => ::std::option::Option::None } } const VALUES: &'static [ContractType] = &[ ContractType::AccountCreateContract, ContractType::TransferContract, ContractType::TransferAssetContract, ContractType::VoteAssetContract, ContractType::VoteWitnessContract, ContractType::WitnessCreateContract, ContractType::AssetIssueContract, ContractType::WitnessUpdateContract, ContractType::ParticipateAssetIssueContract, ContractType::AccountUpdateContract, ContractType::FreezeBalanceContract, ContractType::UnfreezeBalanceContract, ContractType::WithdrawBalanceContract, ContractType::UnfreezeAssetContract, ContractType::UpdateAssetContract, ContractType::ProposalCreateContract, ContractType::ProposalApproveContract, ContractType::ProposalDeleteContract, ContractType::SetAccountIdContract, ContractType::CustomContract, ContractType::CreateSmartContract, ContractType::TriggerSmartContract, ContractType::GetContract, ContractType::UpdateSettingContract, ContractType::ExchangeCreateContract, ContractType::ExchangeInjectContract, ContractType::ExchangeWithdrawContract, ContractType::ExchangeTransactionContract, ContractType::UpdateEnergyLimitContract, ContractType::AccountPermissionUpdateContract, ContractType::ClearABIContract, ContractType::UpdateBrokerageContract, ContractType::ShieldedTransferContract, ContractType::MarketSellAssetContract, ContractType::MarketCancelOrderContract, ContractType::FreezeBalanceV2Contract, ContractType::UnfreezeBalanceV2Contract, ContractType::WithdrawExpireUnfreezeContract, ContractType::DelegateResourceContract, ContractType::UnDelegateResourceContract, ContractType::CancelAllUnfreezeV2Contract, ]; } impl ::protobuf::EnumFull for ContractType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("Transaction.Contract.ContractType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = match self { ContractType::AccountCreateContract => 0, ContractType::TransferContract => 1, ContractType::TransferAssetContract => 2, ContractType::VoteAssetContract => 3, ContractType::VoteWitnessContract => 4, ContractType::WitnessCreateContract => 5, ContractType::AssetIssueContract => 6, ContractType::WitnessUpdateContract => 7, ContractType::ParticipateAssetIssueContract => 8, ContractType::AccountUpdateContract => 9, ContractType::FreezeBalanceContract => 10, ContractType::UnfreezeBalanceContract => 11, ContractType::WithdrawBalanceContract => 12, ContractType::UnfreezeAssetContract => 13, ContractType::UpdateAssetContract => 14, ContractType::ProposalCreateContract => 15, ContractType::ProposalApproveContract => 16, ContractType::ProposalDeleteContract => 17, ContractType::SetAccountIdContract => 18, ContractType::CustomContract => 19, ContractType::CreateSmartContract => 20, ContractType::TriggerSmartContract => 21, ContractType::GetContract => 22, ContractType::UpdateSettingContract => 23, ContractType::ExchangeCreateContract => 24, ContractType::ExchangeInjectContract => 25, ContractType::ExchangeWithdrawContract => 26, ContractType::ExchangeTransactionContract => 27, ContractType::UpdateEnergyLimitContract => 28, ContractType::AccountPermissionUpdateContract => 29, ContractType::ClearABIContract => 30, ContractType::UpdateBrokerageContract => 31, ContractType::ShieldedTransferContract => 32, ContractType::MarketSellAssetContract => 33, ContractType::MarketCancelOrderContract => 34, ContractType::FreezeBalanceV2Contract => 35, ContractType::UnfreezeBalanceV2Contract => 36, ContractType::WithdrawExpireUnfreezeContract => 37, ContractType::DelegateResourceContract => 38, ContractType::UnDelegateResourceContract => 39, ContractType::CancelAllUnfreezeV2Contract => 40, }; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for ContractType { fn default() -> Self { ContractType::AccountCreateContract } } impl ContractType { pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Transaction.Contract.ContractType") } } } // @@protoc_insertion_point(message:protocol.Transaction.Result) #[derive(PartialEq,Clone,Default,Debug)] pub struct Result { // message fields // @@protoc_insertion_point(field:protocol.Transaction.Result.fee) pub fee: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.ret) pub ret: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Transaction.Result.contractRet) pub contractRet: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Transaction.Result.assetIssueID) pub assetIssueID: ::std::string::String, // @@protoc_insertion_point(field:protocol.Transaction.Result.withdraw_amount) pub withdraw_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.unfreeze_amount) pub unfreeze_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.exchange_received_amount) pub exchange_received_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.exchange_inject_another_amount) pub exchange_inject_another_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.exchange_withdraw_another_amount) pub exchange_withdraw_another_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.shielded_transaction_fee) pub shielded_transaction_fee: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.orderId) pub orderId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.Result.orderDetails) pub orderDetails: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.Result.withdraw_expire_amount) pub withdraw_expire_amount: i64, // @@protoc_insertion_point(field:protocol.Transaction.Result.cancel_unfreezeV2_amount) pub cancel_unfreezeV2_amount: ::std::collections::HashMap<::std::string::String, i64>, // special fields // @@protoc_insertion_point(special_field:protocol.Transaction.Result.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Result { fn default() -> &'a Result { ::default_instance() } } impl Result { pub fn new() -> Result { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(15); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fee", |m: &Result| { &m.fee }, |m: &mut Result| { &mut m.fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ret", |m: &Result| { &m.ret }, |m: &mut Result| { &mut m.ret }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contractRet", |m: &Result| { &m.contractRet }, |m: &mut Result| { &mut m.contractRet }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "assetIssueID", |m: &Result| { &m.assetIssueID }, |m: &mut Result| { &mut m.assetIssueID }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "withdraw_amount", |m: &Result| { &m.withdraw_amount }, |m: &mut Result| { &mut m.withdraw_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unfreeze_amount", |m: &Result| { &m.unfreeze_amount }, |m: &mut Result| { &mut m.unfreeze_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_received_amount", |m: &Result| { &m.exchange_received_amount }, |m: &mut Result| { &mut m.exchange_received_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_inject_another_amount", |m: &Result| { &m.exchange_inject_another_amount }, |m: &mut Result| { &mut m.exchange_inject_another_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_withdraw_another_amount", |m: &Result| { &m.exchange_withdraw_another_amount }, |m: &mut Result| { &mut m.exchange_withdraw_another_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &Result| { &m.exchange_id }, |m: &mut Result| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "shielded_transaction_fee", |m: &Result| { &m.shielded_transaction_fee }, |m: &mut Result| { &mut m.shielded_transaction_fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "orderId", |m: &Result| { &m.orderId }, |m: &mut Result| { &mut m.orderId }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "orderDetails", |m: &Result| { &m.orderDetails }, |m: &mut Result| { &mut m.orderDetails }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "withdraw_expire_amount", |m: &Result| { &m.withdraw_expire_amount }, |m: &mut Result| { &mut m.withdraw_expire_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "cancel_unfreezeV2_amount", |m: &Result| { &m.cancel_unfreezeV2_amount }, |m: &mut Result| { &mut m.cancel_unfreezeV2_amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Transaction.Result", fields, oneofs, ) } } impl ::protobuf::Message for Result { const NAME: &'static str = "Result"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.fee = is.read_int64()?; }, 16 => { self.ret = is.read_enum_or_unknown()?; }, 24 => { self.contractRet = is.read_enum_or_unknown()?; }, 114 => { self.assetIssueID = is.read_string()?; }, 120 => { self.withdraw_amount = is.read_int64()?; }, 128 => { self.unfreeze_amount = is.read_int64()?; }, 144 => { self.exchange_received_amount = is.read_int64()?; }, 152 => { self.exchange_inject_another_amount = is.read_int64()?; }, 160 => { self.exchange_withdraw_another_amount = is.read_int64()?; }, 168 => { self.exchange_id = is.read_int64()?; }, 176 => { self.shielded_transaction_fee = is.read_int64()?; }, 202 => { self.orderId = is.read_bytes()?; }, 210 => { self.orderDetails.push(is.read_message()?); }, 216 => { self.withdraw_expire_amount = is.read_int64()?; }, 226 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.cancel_unfreezeV2_amount.insert(key, value); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.fee != 0 { my_size += ::protobuf::rt::int64_size(1, self.fee); } if self.ret != ::protobuf::EnumOrUnknown::new(result::Code::SUCESS) { my_size += ::protobuf::rt::int32_size(2, self.ret.value()); } if self.contractRet != ::protobuf::EnumOrUnknown::new(result::ContractResult::DEFAULT) { my_size += ::protobuf::rt::int32_size(3, self.contractRet.value()); } if !self.assetIssueID.is_empty() { my_size += ::protobuf::rt::string_size(14, &self.assetIssueID); } if self.withdraw_amount != 0 { my_size += ::protobuf::rt::int64_size(15, self.withdraw_amount); } if self.unfreeze_amount != 0 { my_size += ::protobuf::rt::int64_size(16, self.unfreeze_amount); } if self.exchange_received_amount != 0 { my_size += ::protobuf::rt::int64_size(18, self.exchange_received_amount); } if self.exchange_inject_another_amount != 0 { my_size += ::protobuf::rt::int64_size(19, self.exchange_inject_another_amount); } if self.exchange_withdraw_another_amount != 0 { my_size += ::protobuf::rt::int64_size(20, self.exchange_withdraw_another_amount); } if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(21, self.exchange_id); } if self.shielded_transaction_fee != 0 { my_size += ::protobuf::rt::int64_size(22, self.shielded_transaction_fee); } if !self.orderId.is_empty() { my_size += ::protobuf::rt::bytes_size(25, &self.orderId); } for value in &self.orderDetails { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.withdraw_expire_amount != 0 { my_size += ::protobuf::rt::int64_size(27, self.withdraw_expire_amount); } for (k, v) in &self.cancel_unfreezeV2_amount { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.fee != 0 { os.write_int64(1, self.fee)?; } if self.ret != ::protobuf::EnumOrUnknown::new(result::Code::SUCESS) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.ret))?; } if self.contractRet != ::protobuf::EnumOrUnknown::new(result::ContractResult::DEFAULT) { os.write_enum(3, ::protobuf::EnumOrUnknown::value(&self.contractRet))?; } if !self.assetIssueID.is_empty() { os.write_string(14, &self.assetIssueID)?; } if self.withdraw_amount != 0 { os.write_int64(15, self.withdraw_amount)?; } if self.unfreeze_amount != 0 { os.write_int64(16, self.unfreeze_amount)?; } if self.exchange_received_amount != 0 { os.write_int64(18, self.exchange_received_amount)?; } if self.exchange_inject_another_amount != 0 { os.write_int64(19, self.exchange_inject_another_amount)?; } if self.exchange_withdraw_another_amount != 0 { os.write_int64(20, self.exchange_withdraw_another_amount)?; } if self.exchange_id != 0 { os.write_int64(21, self.exchange_id)?; } if self.shielded_transaction_fee != 0 { os.write_int64(22, self.shielded_transaction_fee)?; } if !self.orderId.is_empty() { os.write_bytes(25, &self.orderId)?; } for v in &self.orderDetails { ::protobuf::rt::write_message_field_with_cached_size(26, v, os)?; }; if self.withdraw_expire_amount != 0 { os.write_int64(27, self.withdraw_expire_amount)?; } for (k, v) in &self.cancel_unfreezeV2_amount { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(226)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Result { Result::new() } fn clear(&mut self) { self.fee = 0; self.ret = ::protobuf::EnumOrUnknown::new(result::Code::SUCESS); self.contractRet = ::protobuf::EnumOrUnknown::new(result::ContractResult::DEFAULT); self.assetIssueID.clear(); self.withdraw_amount = 0; self.unfreeze_amount = 0; self.exchange_received_amount = 0; self.exchange_inject_another_amount = 0; self.exchange_withdraw_another_amount = 0; self.exchange_id = 0; self.shielded_transaction_fee = 0; self.orderId.clear(); self.orderDetails.clear(); self.withdraw_expire_amount = 0; self.cancel_unfreezeV2_amount.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Result { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(Result::new) } } impl ::protobuf::MessageFull for Result { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Transaction.Result").unwrap()).clone() } } impl ::std::fmt::Display for Result { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Result { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Result` pub mod result { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Transaction.Result.code) pub enum Code { // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.code.SUCESS) SUCESS = 0, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.code.FAILED) FAILED = 1, } impl ::protobuf::Enum for Code { const NAME: &'static str = "code"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(Code::SUCESS), 1 => ::std::option::Option::Some(Code::FAILED), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "SUCESS" => ::std::option::Option::Some(Code::SUCESS), "FAILED" => ::std::option::Option::Some(Code::FAILED), _ => ::std::option::Option::None } } const VALUES: &'static [Code] = &[ Code::SUCESS, Code::FAILED, ]; } impl ::protobuf::EnumFull for Code { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("Transaction.Result.code").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for Code { fn default() -> Self { Code::SUCESS } } impl Code { pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Transaction.Result.code") } } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Transaction.Result.contractResult) pub enum ContractResult { // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.DEFAULT) DEFAULT = 0, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.SUCCESS) SUCCESS = 1, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.REVERT) REVERT = 2, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.BAD_JUMP_DESTINATION) BAD_JUMP_DESTINATION = 3, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.OUT_OF_MEMORY) OUT_OF_MEMORY = 4, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.PRECOMPILED_CONTRACT) PRECOMPILED_CONTRACT = 5, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.STACK_TOO_SMALL) STACK_TOO_SMALL = 6, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.STACK_TOO_LARGE) STACK_TOO_LARGE = 7, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.ILLEGAL_OPERATION) ILLEGAL_OPERATION = 8, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.STACK_OVERFLOW) STACK_OVERFLOW = 9, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.OUT_OF_ENERGY) OUT_OF_ENERGY = 10, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.OUT_OF_TIME) OUT_OF_TIME = 11, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.JVM_STACK_OVER_FLOW) JVM_STACK_OVER_FLOW = 12, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.UNKNOWN) UNKNOWN = 13, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.TRANSFER_FAILED) TRANSFER_FAILED = 14, // @@protoc_insertion_point(enum_value:protocol.Transaction.Result.contractResult.INVALID_CODE) INVALID_CODE = 15, } impl ::protobuf::Enum for ContractResult { const NAME: &'static str = "contractResult"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(ContractResult::DEFAULT), 1 => ::std::option::Option::Some(ContractResult::SUCCESS), 2 => ::std::option::Option::Some(ContractResult::REVERT), 3 => ::std::option::Option::Some(ContractResult::BAD_JUMP_DESTINATION), 4 => ::std::option::Option::Some(ContractResult::OUT_OF_MEMORY), 5 => ::std::option::Option::Some(ContractResult::PRECOMPILED_CONTRACT), 6 => ::std::option::Option::Some(ContractResult::STACK_TOO_SMALL), 7 => ::std::option::Option::Some(ContractResult::STACK_TOO_LARGE), 8 => ::std::option::Option::Some(ContractResult::ILLEGAL_OPERATION), 9 => ::std::option::Option::Some(ContractResult::STACK_OVERFLOW), 10 => ::std::option::Option::Some(ContractResult::OUT_OF_ENERGY), 11 => ::std::option::Option::Some(ContractResult::OUT_OF_TIME), 12 => ::std::option::Option::Some(ContractResult::JVM_STACK_OVER_FLOW), 13 => ::std::option::Option::Some(ContractResult::UNKNOWN), 14 => ::std::option::Option::Some(ContractResult::TRANSFER_FAILED), 15 => ::std::option::Option::Some(ContractResult::INVALID_CODE), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "DEFAULT" => ::std::option::Option::Some(ContractResult::DEFAULT), "SUCCESS" => ::std::option::Option::Some(ContractResult::SUCCESS), "REVERT" => ::std::option::Option::Some(ContractResult::REVERT), "BAD_JUMP_DESTINATION" => ::std::option::Option::Some(ContractResult::BAD_JUMP_DESTINATION), "OUT_OF_MEMORY" => ::std::option::Option::Some(ContractResult::OUT_OF_MEMORY), "PRECOMPILED_CONTRACT" => ::std::option::Option::Some(ContractResult::PRECOMPILED_CONTRACT), "STACK_TOO_SMALL" => ::std::option::Option::Some(ContractResult::STACK_TOO_SMALL), "STACK_TOO_LARGE" => ::std::option::Option::Some(ContractResult::STACK_TOO_LARGE), "ILLEGAL_OPERATION" => ::std::option::Option::Some(ContractResult::ILLEGAL_OPERATION), "STACK_OVERFLOW" => ::std::option::Option::Some(ContractResult::STACK_OVERFLOW), "OUT_OF_ENERGY" => ::std::option::Option::Some(ContractResult::OUT_OF_ENERGY), "OUT_OF_TIME" => ::std::option::Option::Some(ContractResult::OUT_OF_TIME), "JVM_STACK_OVER_FLOW" => ::std::option::Option::Some(ContractResult::JVM_STACK_OVER_FLOW), "UNKNOWN" => ::std::option::Option::Some(ContractResult::UNKNOWN), "TRANSFER_FAILED" => ::std::option::Option::Some(ContractResult::TRANSFER_FAILED), "INVALID_CODE" => ::std::option::Option::Some(ContractResult::INVALID_CODE), _ => ::std::option::Option::None } } const VALUES: &'static [ContractResult] = &[ ContractResult::DEFAULT, ContractResult::SUCCESS, ContractResult::REVERT, ContractResult::BAD_JUMP_DESTINATION, ContractResult::OUT_OF_MEMORY, ContractResult::PRECOMPILED_CONTRACT, ContractResult::STACK_TOO_SMALL, ContractResult::STACK_TOO_LARGE, ContractResult::ILLEGAL_OPERATION, ContractResult::STACK_OVERFLOW, ContractResult::OUT_OF_ENERGY, ContractResult::OUT_OF_TIME, ContractResult::JVM_STACK_OVER_FLOW, ContractResult::UNKNOWN, ContractResult::TRANSFER_FAILED, ContractResult::INVALID_CODE, ]; } impl ::protobuf::EnumFull for ContractResult { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().enum_by_package_relative_name("Transaction.Result.contractResult").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for ContractResult { fn default() -> Self { ContractResult::DEFAULT } } impl ContractResult { pub(in super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Transaction.Result.contractResult") } } } // @@protoc_insertion_point(message:protocol.Transaction.raw) #[derive(PartialEq,Clone,Default,Debug)] pub struct Raw { // message fields // @@protoc_insertion_point(field:protocol.Transaction.raw.ref_block_bytes) pub ref_block_bytes: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.raw.ref_block_num) pub ref_block_num: i64, // @@protoc_insertion_point(field:protocol.Transaction.raw.ref_block_hash) pub ref_block_hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.raw.expiration) pub expiration: i64, // @@protoc_insertion_point(field:protocol.Transaction.raw.auths) pub auths: ::std::vec::Vec, /// data not used // @@protoc_insertion_point(field:protocol.Transaction.raw.data) pub data: ::std::vec::Vec, /// only support size = 1, repeated list here for extension // @@protoc_insertion_point(field:protocol.Transaction.raw.contract) pub contract: ::std::vec::Vec, /// scripts not used // @@protoc_insertion_point(field:protocol.Transaction.raw.scripts) pub scripts: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Transaction.raw.timestamp) pub timestamp: i64, // @@protoc_insertion_point(field:protocol.Transaction.raw.fee_limit) pub fee_limit: i64, // special fields // @@protoc_insertion_point(special_field:protocol.Transaction.raw.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Raw { fn default() -> &'a Raw { ::default_instance() } } impl Raw { pub fn new() -> Raw { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(10); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ref_block_bytes", |m: &Raw| { &m.ref_block_bytes }, |m: &mut Raw| { &mut m.ref_block_bytes }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ref_block_num", |m: &Raw| { &m.ref_block_num }, |m: &mut Raw| { &mut m.ref_block_num }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ref_block_hash", |m: &Raw| { &m.ref_block_hash }, |m: &mut Raw| { &mut m.ref_block_hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expiration", |m: &Raw| { &m.expiration }, |m: &mut Raw| { &mut m.expiration }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "auths", |m: &Raw| { &m.auths }, |m: &mut Raw| { &mut m.auths }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data", |m: &Raw| { &m.data }, |m: &mut Raw| { &mut m.data }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "contract", |m: &Raw| { &m.contract }, |m: &mut Raw| { &mut m.contract }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "scripts", |m: &Raw| { &m.scripts }, |m: &mut Raw| { &mut m.scripts }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &Raw| { &m.timestamp }, |m: &mut Raw| { &mut m.timestamp }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fee_limit", |m: &Raw| { &m.fee_limit }, |m: &mut Raw| { &mut m.fee_limit }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Transaction.raw", fields, oneofs, ) } } impl ::protobuf::Message for Raw { const NAME: &'static str = "raw"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.ref_block_bytes = is.read_bytes()?; }, 24 => { self.ref_block_num = is.read_int64()?; }, 34 => { self.ref_block_hash = is.read_bytes()?; }, 64 => { self.expiration = is.read_int64()?; }, 74 => { self.auths.push(is.read_message()?); }, 82 => { self.data = is.read_bytes()?; }, 90 => { self.contract.push(is.read_message()?); }, 98 => { self.scripts = is.read_bytes()?; }, 112 => { self.timestamp = is.read_int64()?; }, 144 => { self.fee_limit = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.ref_block_bytes.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.ref_block_bytes); } if self.ref_block_num != 0 { my_size += ::protobuf::rt::int64_size(3, self.ref_block_num); } if !self.ref_block_hash.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.ref_block_hash); } if self.expiration != 0 { my_size += ::protobuf::rt::int64_size(8, self.expiration); } for value in &self.auths { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(10, &self.data); } for value in &self.contract { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.scripts.is_empty() { my_size += ::protobuf::rt::bytes_size(12, &self.scripts); } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(14, self.timestamp); } if self.fee_limit != 0 { my_size += ::protobuf::rt::int64_size(18, self.fee_limit); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.ref_block_bytes.is_empty() { os.write_bytes(1, &self.ref_block_bytes)?; } if self.ref_block_num != 0 { os.write_int64(3, self.ref_block_num)?; } if !self.ref_block_hash.is_empty() { os.write_bytes(4, &self.ref_block_hash)?; } if self.expiration != 0 { os.write_int64(8, self.expiration)?; } for v in &self.auths { ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; }; if !self.data.is_empty() { os.write_bytes(10, &self.data)?; } for v in &self.contract { ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; }; if !self.scripts.is_empty() { os.write_bytes(12, &self.scripts)?; } if self.timestamp != 0 { os.write_int64(14, self.timestamp)?; } if self.fee_limit != 0 { os.write_int64(18, self.fee_limit)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Raw { Raw::new() } fn clear(&mut self) { self.ref_block_bytes.clear(); self.ref_block_num = 0; self.ref_block_hash.clear(); self.expiration = 0; self.auths.clear(); self.data.clear(); self.contract.clear(); self.scripts.clear(); self.timestamp = 0; self.fee_limit = 0; self.special_fields.clear(); } fn default_instance() -> &'static Raw { static instance: Raw = Raw { ref_block_bytes: ::std::vec::Vec::new(), ref_block_num: 0, ref_block_hash: ::std::vec::Vec::new(), expiration: 0, auths: ::std::vec::Vec::new(), data: ::std::vec::Vec::new(), contract: ::std::vec::Vec::new(), scripts: ::std::vec::Vec::new(), timestamp: 0, fee_limit: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Raw { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("Transaction.raw").unwrap()).clone() } } impl ::std::fmt::Display for Raw { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Raw { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.TransactionInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct TransactionInfo { // message fields // @@protoc_insertion_point(field:protocol.TransactionInfo.id) pub id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.fee) pub fee: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.blockNumber) pub blockNumber: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.blockTimeStamp) pub blockTimeStamp: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.contractResult) pub contractResult: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.TransactionInfo.contract_address) pub contract_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.receipt) pub receipt: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.TransactionInfo.log) pub log: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.result) pub result: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.TransactionInfo.resMessage) pub resMessage: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.assetIssueID) pub assetIssueID: ::std::string::String, // @@protoc_insertion_point(field:protocol.TransactionInfo.withdraw_amount) pub withdraw_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.unfreeze_amount) pub unfreeze_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.internal_transactions) pub internal_transactions: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.exchange_received_amount) pub exchange_received_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.exchange_inject_another_amount) pub exchange_inject_another_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.exchange_withdraw_another_amount) pub exchange_withdraw_another_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.shielded_transaction_fee) pub shielded_transaction_fee: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.orderId) pub orderId: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.orderDetails) pub orderDetails: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.packingFee) pub packingFee: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.withdraw_expire_amount) pub withdraw_expire_amount: i64, // @@protoc_insertion_point(field:protocol.TransactionInfo.cancel_unfreezeV2_amount) pub cancel_unfreezeV2_amount: ::std::collections::HashMap<::std::string::String, i64>, // special fields // @@protoc_insertion_point(special_field:protocol.TransactionInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TransactionInfo { fn default() -> &'a TransactionInfo { ::default_instance() } } impl TransactionInfo { pub fn new() -> TransactionInfo { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(24); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "id", |m: &TransactionInfo| { &m.id }, |m: &mut TransactionInfo| { &mut m.id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fee", |m: &TransactionInfo| { &m.fee }, |m: &mut TransactionInfo| { &mut m.fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockNumber", |m: &TransactionInfo| { &m.blockNumber }, |m: &mut TransactionInfo| { &mut m.blockNumber }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockTimeStamp", |m: &TransactionInfo| { &m.blockTimeStamp }, |m: &mut TransactionInfo| { &mut m.blockTimeStamp }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "contractResult", |m: &TransactionInfo| { &m.contractResult }, |m: &mut TransactionInfo| { &mut m.contractResult }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &TransactionInfo| { &m.contract_address }, |m: &mut TransactionInfo| { &mut m.contract_address }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ResourceReceipt>( "receipt", |m: &TransactionInfo| { &m.receipt }, |m: &mut TransactionInfo| { &mut m.receipt }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "log", |m: &TransactionInfo| { &m.log }, |m: &mut TransactionInfo| { &mut m.log }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "result", |m: &TransactionInfo| { &m.result }, |m: &mut TransactionInfo| { &mut m.result }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resMessage", |m: &TransactionInfo| { &m.resMessage }, |m: &mut TransactionInfo| { &mut m.resMessage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "assetIssueID", |m: &TransactionInfo| { &m.assetIssueID }, |m: &mut TransactionInfo| { &mut m.assetIssueID }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "withdraw_amount", |m: &TransactionInfo| { &m.withdraw_amount }, |m: &mut TransactionInfo| { &mut m.withdraw_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unfreeze_amount", |m: &TransactionInfo| { &m.unfreeze_amount }, |m: &mut TransactionInfo| { &mut m.unfreeze_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "internal_transactions", |m: &TransactionInfo| { &m.internal_transactions }, |m: &mut TransactionInfo| { &mut m.internal_transactions }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_received_amount", |m: &TransactionInfo| { &m.exchange_received_amount }, |m: &mut TransactionInfo| { &mut m.exchange_received_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_inject_another_amount", |m: &TransactionInfo| { &m.exchange_inject_another_amount }, |m: &mut TransactionInfo| { &mut m.exchange_inject_another_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_withdraw_another_amount", |m: &TransactionInfo| { &m.exchange_withdraw_another_amount }, |m: &mut TransactionInfo| { &mut m.exchange_withdraw_another_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &TransactionInfo| { &m.exchange_id }, |m: &mut TransactionInfo| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "shielded_transaction_fee", |m: &TransactionInfo| { &m.shielded_transaction_fee }, |m: &mut TransactionInfo| { &mut m.shielded_transaction_fee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "orderId", |m: &TransactionInfo| { &m.orderId }, |m: &mut TransactionInfo| { &mut m.orderId }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "orderDetails", |m: &TransactionInfo| { &m.orderDetails }, |m: &mut TransactionInfo| { &mut m.orderDetails }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "packingFee", |m: &TransactionInfo| { &m.packingFee }, |m: &mut TransactionInfo| { &mut m.packingFee }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "withdraw_expire_amount", |m: &TransactionInfo| { &m.withdraw_expire_amount }, |m: &mut TransactionInfo| { &mut m.withdraw_expire_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "cancel_unfreezeV2_amount", |m: &TransactionInfo| { &m.cancel_unfreezeV2_amount }, |m: &mut TransactionInfo| { &mut m.cancel_unfreezeV2_amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransactionInfo", fields, oneofs, ) } } impl ::protobuf::Message for TransactionInfo { const NAME: &'static str = "TransactionInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.id = is.read_bytes()?; }, 16 => { self.fee = is.read_int64()?; }, 24 => { self.blockNumber = is.read_int64()?; }, 32 => { self.blockTimeStamp = is.read_int64()?; }, 42 => { self.contractResult.push(is.read_bytes()?); }, 50 => { self.contract_address = is.read_bytes()?; }, 58 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.receipt)?; }, 66 => { self.log.push(is.read_message()?); }, 72 => { self.result = is.read_enum_or_unknown()?; }, 82 => { self.resMessage = is.read_bytes()?; }, 114 => { self.assetIssueID = is.read_string()?; }, 120 => { self.withdraw_amount = is.read_int64()?; }, 128 => { self.unfreeze_amount = is.read_int64()?; }, 138 => { self.internal_transactions.push(is.read_message()?); }, 144 => { self.exchange_received_amount = is.read_int64()?; }, 152 => { self.exchange_inject_another_amount = is.read_int64()?; }, 160 => { self.exchange_withdraw_another_amount = is.read_int64()?; }, 168 => { self.exchange_id = is.read_int64()?; }, 176 => { self.shielded_transaction_fee = is.read_int64()?; }, 202 => { self.orderId = is.read_bytes()?; }, 210 => { self.orderDetails.push(is.read_message()?); }, 216 => { self.packingFee = is.read_int64()?; }, 224 => { self.withdraw_expire_amount = is.read_int64()?; }, 234 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.cancel_unfreezeV2_amount.insert(key, value); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.id.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.id); } if self.fee != 0 { my_size += ::protobuf::rt::int64_size(2, self.fee); } if self.blockNumber != 0 { my_size += ::protobuf::rt::int64_size(3, self.blockNumber); } if self.blockTimeStamp != 0 { my_size += ::protobuf::rt::int64_size(4, self.blockTimeStamp); } for value in &self.contractResult { my_size += ::protobuf::rt::bytes_size(5, &value); }; if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.contract_address); } if let Some(v) = self.receipt.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.log { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.result != ::protobuf::EnumOrUnknown::new(transaction_info::Code::SUCESS) { my_size += ::protobuf::rt::int32_size(9, self.result.value()); } if !self.resMessage.is_empty() { my_size += ::protobuf::rt::bytes_size(10, &self.resMessage); } if !self.assetIssueID.is_empty() { my_size += ::protobuf::rt::string_size(14, &self.assetIssueID); } if self.withdraw_amount != 0 { my_size += ::protobuf::rt::int64_size(15, self.withdraw_amount); } if self.unfreeze_amount != 0 { my_size += ::protobuf::rt::int64_size(16, self.unfreeze_amount); } for value in &self.internal_transactions { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.exchange_received_amount != 0 { my_size += ::protobuf::rt::int64_size(18, self.exchange_received_amount); } if self.exchange_inject_another_amount != 0 { my_size += ::protobuf::rt::int64_size(19, self.exchange_inject_another_amount); } if self.exchange_withdraw_another_amount != 0 { my_size += ::protobuf::rt::int64_size(20, self.exchange_withdraw_another_amount); } if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(21, self.exchange_id); } if self.shielded_transaction_fee != 0 { my_size += ::protobuf::rt::int64_size(22, self.shielded_transaction_fee); } if !self.orderId.is_empty() { my_size += ::protobuf::rt::bytes_size(25, &self.orderId); } for value in &self.orderDetails { let len = value.compute_size(); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.packingFee != 0 { my_size += ::protobuf::rt::int64_size(27, self.packingFee); } if self.withdraw_expire_amount != 0 { my_size += ::protobuf::rt::int64_size(28, self.withdraw_expire_amount); } for (k, v) in &self.cancel_unfreezeV2_amount { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 2 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.id.is_empty() { os.write_bytes(1, &self.id)?; } if self.fee != 0 { os.write_int64(2, self.fee)?; } if self.blockNumber != 0 { os.write_int64(3, self.blockNumber)?; } if self.blockTimeStamp != 0 { os.write_int64(4, self.blockTimeStamp)?; } for v in &self.contractResult { os.write_bytes(5, &v)?; }; if !self.contract_address.is_empty() { os.write_bytes(6, &self.contract_address)?; } if let Some(v) = self.receipt.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; } for v in &self.log { ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; }; if self.result != ::protobuf::EnumOrUnknown::new(transaction_info::Code::SUCESS) { os.write_enum(9, ::protobuf::EnumOrUnknown::value(&self.result))?; } if !self.resMessage.is_empty() { os.write_bytes(10, &self.resMessage)?; } if !self.assetIssueID.is_empty() { os.write_string(14, &self.assetIssueID)?; } if self.withdraw_amount != 0 { os.write_int64(15, self.withdraw_amount)?; } if self.unfreeze_amount != 0 { os.write_int64(16, self.unfreeze_amount)?; } for v in &self.internal_transactions { ::protobuf::rt::write_message_field_with_cached_size(17, v, os)?; }; if self.exchange_received_amount != 0 { os.write_int64(18, self.exchange_received_amount)?; } if self.exchange_inject_another_amount != 0 { os.write_int64(19, self.exchange_inject_another_amount)?; } if self.exchange_withdraw_another_amount != 0 { os.write_int64(20, self.exchange_withdraw_another_amount)?; } if self.exchange_id != 0 { os.write_int64(21, self.exchange_id)?; } if self.shielded_transaction_fee != 0 { os.write_int64(22, self.shielded_transaction_fee)?; } if !self.orderId.is_empty() { os.write_bytes(25, &self.orderId)?; } for v in &self.orderDetails { ::protobuf::rt::write_message_field_with_cached_size(26, v, os)?; }; if self.packingFee != 0 { os.write_int64(27, self.packingFee)?; } if self.withdraw_expire_amount != 0 { os.write_int64(28, self.withdraw_expire_amount)?; } for (k, v) in &self.cancel_unfreezeV2_amount { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(234)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_int64(2, *v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TransactionInfo { TransactionInfo::new() } fn clear(&mut self) { self.id.clear(); self.fee = 0; self.blockNumber = 0; self.blockTimeStamp = 0; self.contractResult.clear(); self.contract_address.clear(); self.receipt.clear(); self.log.clear(); self.result = ::protobuf::EnumOrUnknown::new(transaction_info::Code::SUCESS); self.resMessage.clear(); self.assetIssueID.clear(); self.withdraw_amount = 0; self.unfreeze_amount = 0; self.internal_transactions.clear(); self.exchange_received_amount = 0; self.exchange_inject_another_amount = 0; self.exchange_withdraw_another_amount = 0; self.exchange_id = 0; self.shielded_transaction_fee = 0; self.orderId.clear(); self.orderDetails.clear(); self.packingFee = 0; self.withdraw_expire_amount = 0; self.cancel_unfreezeV2_amount.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TransactionInfo { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(TransactionInfo::new) } } impl ::protobuf::MessageFull for TransactionInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TransactionInfo").unwrap()).clone() } } impl ::std::fmt::Display for TransactionInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TransactionInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `TransactionInfo` pub mod transaction_info { // @@protoc_insertion_point(message:protocol.TransactionInfo.Log) #[derive(PartialEq,Clone,Default,Debug)] pub struct Log { // message fields // @@protoc_insertion_point(field:protocol.TransactionInfo.Log.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionInfo.Log.topics) pub topics: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.TransactionInfo.Log.data) pub data: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TransactionInfo.Log.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Log { fn default() -> &'a Log { ::default_instance() } } impl Log { pub fn new() -> Log { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Log| { &m.address }, |m: &mut Log| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "topics", |m: &Log| { &m.topics }, |m: &mut Log| { &mut m.topics }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data", |m: &Log| { &m.data }, |m: &mut Log| { &mut m.data }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransactionInfo.Log", fields, oneofs, ) } } impl ::protobuf::Message for Log { const NAME: &'static str = "Log"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, 18 => { self.topics.push(is.read_bytes()?); }, 26 => { self.data = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } for value in &self.topics { my_size += ::protobuf::rt::bytes_size(2, &value); }; if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.data); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } for v in &self.topics { os.write_bytes(2, &v)?; }; if !self.data.is_empty() { os.write_bytes(3, &self.data)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Log { Log::new() } fn clear(&mut self) { self.address.clear(); self.topics.clear(); self.data.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Log { static instance: Log = Log { address: ::std::vec::Vec::new(), topics: ::std::vec::Vec::new(), data: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Log { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TransactionInfo.Log").unwrap()).clone() } } impl ::std::fmt::Display for Log { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Log { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.TransactionInfo.code) pub enum Code { // @@protoc_insertion_point(enum_value:protocol.TransactionInfo.code.SUCESS) SUCESS = 0, // @@protoc_insertion_point(enum_value:protocol.TransactionInfo.code.FAILED) FAILED = 1, } impl ::protobuf::Enum for Code { const NAME: &'static str = "code"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(Code::SUCESS), 1 => ::std::option::Option::Some(Code::FAILED), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "SUCESS" => ::std::option::Option::Some(Code::SUCESS), "FAILED" => ::std::option::Option::Some(Code::FAILED), _ => ::std::option::Option::None } } const VALUES: &'static [Code] = &[ Code::SUCESS, Code::FAILED, ]; } impl ::protobuf::EnumFull for Code { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("TransactionInfo.code").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for Code { fn default() -> Self { Code::SUCESS } } impl Code { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("TransactionInfo.code") } } } // @@protoc_insertion_point(message:protocol.TransactionRet) #[derive(PartialEq,Clone,Default,Debug)] pub struct TransactionRet { // message fields // @@protoc_insertion_point(field:protocol.TransactionRet.blockNumber) pub blockNumber: i64, // @@protoc_insertion_point(field:protocol.TransactionRet.blockTimeStamp) pub blockTimeStamp: i64, // @@protoc_insertion_point(field:protocol.TransactionRet.transactioninfo) pub transactioninfo: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.TransactionRet.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TransactionRet { fn default() -> &'a TransactionRet { ::default_instance() } } impl TransactionRet { pub fn new() -> TransactionRet { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockNumber", |m: &TransactionRet| { &m.blockNumber }, |m: &mut TransactionRet| { &mut m.blockNumber }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockTimeStamp", |m: &TransactionRet| { &m.blockTimeStamp }, |m: &mut TransactionRet| { &mut m.blockTimeStamp }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "transactioninfo", |m: &TransactionRet| { &m.transactioninfo }, |m: &mut TransactionRet| { &mut m.transactioninfo }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransactionRet", fields, oneofs, ) } } impl ::protobuf::Message for TransactionRet { const NAME: &'static str = "TransactionRet"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.blockNumber = is.read_int64()?; }, 16 => { self.blockTimeStamp = is.read_int64()?; }, 26 => { self.transactioninfo.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.blockNumber != 0 { my_size += ::protobuf::rt::int64_size(1, self.blockNumber); } if self.blockTimeStamp != 0 { my_size += ::protobuf::rt::int64_size(2, self.blockTimeStamp); } for value in &self.transactioninfo { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.blockNumber != 0 { os.write_int64(1, self.blockNumber)?; } if self.blockTimeStamp != 0 { os.write_int64(2, self.blockTimeStamp)?; } for v in &self.transactioninfo { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TransactionRet { TransactionRet::new() } fn clear(&mut self) { self.blockNumber = 0; self.blockTimeStamp = 0; self.transactioninfo.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TransactionRet { static instance: TransactionRet = TransactionRet { blockNumber: 0, blockTimeStamp: 0, transactioninfo: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TransactionRet { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TransactionRet").unwrap()).clone() } } impl ::std::fmt::Display for TransactionRet { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TransactionRet { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.Transactions) #[derive(PartialEq,Clone,Default,Debug)] pub struct Transactions { // message fields // @@protoc_insertion_point(field:protocol.Transactions.transactions) pub transactions: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Transactions.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Transactions { fn default() -> &'a Transactions { ::default_instance() } } impl Transactions { pub fn new() -> Transactions { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "transactions", |m: &Transactions| { &m.transactions }, |m: &mut Transactions| { &mut m.transactions }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Transactions", fields, oneofs, ) } } impl ::protobuf::Message for Transactions { const NAME: &'static str = "Transactions"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.transactions.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.transactions { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.transactions { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Transactions { Transactions::new() } fn clear(&mut self) { self.transactions.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Transactions { static instance: Transactions = Transactions { transactions: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Transactions { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Transactions").unwrap()).clone() } } impl ::std::fmt::Display for Transactions { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Transactions { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.BlockHeader) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockHeader { // message fields // @@protoc_insertion_point(field:protocol.BlockHeader.raw_data) pub raw_data: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.BlockHeader.witness_signature) pub witness_signature: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.BlockHeader.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockHeader { fn default() -> &'a BlockHeader { ::default_instance() } } impl BlockHeader { pub fn new() -> BlockHeader { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, block_header::Raw>( "raw_data", |m: &BlockHeader| { &m.raw_data }, |m: &mut BlockHeader| { &mut m.raw_data }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "witness_signature", |m: &BlockHeader| { &m.witness_signature }, |m: &mut BlockHeader| { &mut m.witness_signature }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockHeader", fields, oneofs, ) } } impl ::protobuf::Message for BlockHeader { const NAME: &'static str = "BlockHeader"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.raw_data)?; }, 18 => { self.witness_signature = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.raw_data.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.witness_signature.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.witness_signature); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.raw_data.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.witness_signature.is_empty() { os.write_bytes(2, &self.witness_signature)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockHeader { BlockHeader::new() } fn clear(&mut self) { self.raw_data.clear(); self.witness_signature.clear(); self.special_fields.clear(); } fn default_instance() -> &'static BlockHeader { static instance: BlockHeader = BlockHeader { raw_data: ::protobuf::MessageField::none(), witness_signature: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockHeader { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BlockHeader").unwrap()).clone() } } impl ::std::fmt::Display for BlockHeader { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockHeader { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `BlockHeader` pub mod block_header { // @@protoc_insertion_point(message:protocol.BlockHeader.raw) #[derive(PartialEq,Clone,Default,Debug)] pub struct Raw { // message fields // @@protoc_insertion_point(field:protocol.BlockHeader.raw.timestamp) pub timestamp: i64, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.txTrieRoot) pub txTrieRoot: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.parentHash) pub parentHash: ::std::vec::Vec, /// bytes nonce = 5; /// bytes difficulty = 6; // @@protoc_insertion_point(field:protocol.BlockHeader.raw.number) pub number: i64, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.witness_id) pub witness_id: i64, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.witness_address) pub witness_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.version) pub version: i32, // @@protoc_insertion_point(field:protocol.BlockHeader.raw.accountStateRoot) pub accountStateRoot: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.BlockHeader.raw.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Raw { fn default() -> &'a Raw { ::default_instance() } } impl Raw { pub fn new() -> Raw { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(8); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &Raw| { &m.timestamp }, |m: &mut Raw| { &mut m.timestamp }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "txTrieRoot", |m: &Raw| { &m.txTrieRoot }, |m: &mut Raw| { &mut m.txTrieRoot }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "parentHash", |m: &Raw| { &m.parentHash }, |m: &mut Raw| { &mut m.parentHash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "number", |m: &Raw| { &m.number }, |m: &mut Raw| { &mut m.number }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "witness_id", |m: &Raw| { &m.witness_id }, |m: &mut Raw| { &mut m.witness_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "witness_address", |m: &Raw| { &m.witness_address }, |m: &mut Raw| { &mut m.witness_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &Raw| { &m.version }, |m: &mut Raw| { &mut m.version }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "accountStateRoot", |m: &Raw| { &m.accountStateRoot }, |m: &mut Raw| { &mut m.accountStateRoot }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockHeader.raw", fields, oneofs, ) } } impl ::protobuf::Message for Raw { const NAME: &'static str = "raw"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.timestamp = is.read_int64()?; }, 18 => { self.txTrieRoot = is.read_bytes()?; }, 26 => { self.parentHash = is.read_bytes()?; }, 56 => { self.number = is.read_int64()?; }, 64 => { self.witness_id = is.read_int64()?; }, 74 => { self.witness_address = is.read_bytes()?; }, 80 => { self.version = is.read_int32()?; }, 90 => { self.accountStateRoot = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(1, self.timestamp); } if !self.txTrieRoot.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.txTrieRoot); } if !self.parentHash.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.parentHash); } if self.number != 0 { my_size += ::protobuf::rt::int64_size(7, self.number); } if self.witness_id != 0 { my_size += ::protobuf::rt::int64_size(8, self.witness_id); } if !self.witness_address.is_empty() { my_size += ::protobuf::rt::bytes_size(9, &self.witness_address); } if self.version != 0 { my_size += ::protobuf::rt::int32_size(10, self.version); } if !self.accountStateRoot.is_empty() { my_size += ::protobuf::rt::bytes_size(11, &self.accountStateRoot); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.timestamp != 0 { os.write_int64(1, self.timestamp)?; } if !self.txTrieRoot.is_empty() { os.write_bytes(2, &self.txTrieRoot)?; } if !self.parentHash.is_empty() { os.write_bytes(3, &self.parentHash)?; } if self.number != 0 { os.write_int64(7, self.number)?; } if self.witness_id != 0 { os.write_int64(8, self.witness_id)?; } if !self.witness_address.is_empty() { os.write_bytes(9, &self.witness_address)?; } if self.version != 0 { os.write_int32(10, self.version)?; } if !self.accountStateRoot.is_empty() { os.write_bytes(11, &self.accountStateRoot)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Raw { Raw::new() } fn clear(&mut self) { self.timestamp = 0; self.txTrieRoot.clear(); self.parentHash.clear(); self.number = 0; self.witness_id = 0; self.witness_address.clear(); self.version = 0; self.accountStateRoot.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Raw { static instance: Raw = Raw { timestamp: 0, txTrieRoot: ::std::vec::Vec::new(), parentHash: ::std::vec::Vec::new(), number: 0, witness_id: 0, witness_address: ::std::vec::Vec::new(), version: 0, accountStateRoot: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Raw { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BlockHeader.raw").unwrap()).clone() } } impl ::std::fmt::Display for Raw { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Raw { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } /// block // @@protoc_insertion_point(message:protocol.Block) #[derive(PartialEq,Clone,Default,Debug)] pub struct Block { // message fields // @@protoc_insertion_point(field:protocol.Block.transactions) pub transactions: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Block.block_header) pub block_header: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.Block.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Block { fn default() -> &'a Block { ::default_instance() } } impl Block { pub fn new() -> Block { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "transactions", |m: &Block| { &m.transactions }, |m: &mut Block| { &mut m.transactions }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, BlockHeader>( "block_header", |m: &Block| { &m.block_header }, |m: &mut Block| { &mut m.block_header }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Block", fields, oneofs, ) } } impl ::protobuf::Message for Block { const NAME: &'static str = "Block"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.transactions.push(is.read_message()?); }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.block_header)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.transactions { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.block_header.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.transactions { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if let Some(v) = self.block_header.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Block { Block::new() } fn clear(&mut self) { self.transactions.clear(); self.block_header.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Block { static instance: Block = Block { transactions: ::std::vec::Vec::new(), block_header: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Block { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Block").unwrap()).clone() } } impl ::std::fmt::Display for Block { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Block { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ChainInventory) #[derive(PartialEq,Clone,Default,Debug)] pub struct ChainInventory { // message fields // @@protoc_insertion_point(field:protocol.ChainInventory.ids) pub ids: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ChainInventory.remain_num) pub remain_num: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ChainInventory.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ChainInventory { fn default() -> &'a ChainInventory { ::default_instance() } } impl ChainInventory { pub fn new() -> ChainInventory { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "ids", |m: &ChainInventory| { &m.ids }, |m: &mut ChainInventory| { &mut m.ids }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "remain_num", |m: &ChainInventory| { &m.remain_num }, |m: &mut ChainInventory| { &mut m.remain_num }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ChainInventory", fields, oneofs, ) } } impl ::protobuf::Message for ChainInventory { const NAME: &'static str = "ChainInventory"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.ids.push(is.read_message()?); }, 16 => { self.remain_num = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.ids { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.remain_num != 0 { my_size += ::protobuf::rt::int64_size(2, self.remain_num); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.ids { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if self.remain_num != 0 { os.write_int64(2, self.remain_num)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ChainInventory { ChainInventory::new() } fn clear(&mut self) { self.ids.clear(); self.remain_num = 0; self.special_fields.clear(); } fn default_instance() -> &'static ChainInventory { static instance: ChainInventory = ChainInventory { ids: ::std::vec::Vec::new(), remain_num: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ChainInventory { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ChainInventory").unwrap()).clone() } } impl ::std::fmt::Display for ChainInventory { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ChainInventory { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `ChainInventory` pub mod chain_inventory { // @@protoc_insertion_point(message:protocol.ChainInventory.BlockId) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockId { // message fields // @@protoc_insertion_point(field:protocol.ChainInventory.BlockId.hash) pub hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ChainInventory.BlockId.number) pub number: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ChainInventory.BlockId.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockId { fn default() -> &'a BlockId { ::default_instance() } } impl BlockId { pub fn new() -> BlockId { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &BlockId| { &m.hash }, |m: &mut BlockId| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "number", |m: &BlockId| { &m.number }, |m: &mut BlockId| { &mut m.number }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ChainInventory.BlockId", fields, oneofs, ) } } impl ::protobuf::Message for BlockId { const NAME: &'static str = "BlockId"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 16 => { self.number = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if self.number != 0 { my_size += ::protobuf::rt::int64_size(2, self.number); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if self.number != 0 { os.write_int64(2, self.number)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockId { BlockId::new() } fn clear(&mut self) { self.hash.clear(); self.number = 0; self.special_fields.clear(); } fn default_instance() -> &'static BlockId { static instance: BlockId = BlockId { hash: ::std::vec::Vec::new(), number: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockId { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("ChainInventory.BlockId").unwrap()).clone() } } impl ::std::fmt::Display for BlockId { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockId { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } /// Inventory // @@protoc_insertion_point(message:protocol.BlockInventory) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockInventory { // message fields // @@protoc_insertion_point(field:protocol.BlockInventory.ids) pub ids: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BlockInventory.type) pub type_: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.BlockInventory.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockInventory { fn default() -> &'a BlockInventory { ::default_instance() } } impl BlockInventory { pub fn new() -> BlockInventory { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "ids", |m: &BlockInventory| { &m.ids }, |m: &mut BlockInventory| { &mut m.ids }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &BlockInventory| { &m.type_ }, |m: &mut BlockInventory| { &mut m.type_ }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockInventory", fields, oneofs, ) } } impl ::protobuf::Message for BlockInventory { const NAME: &'static str = "BlockInventory"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.ids.push(is.read_message()?); }, 16 => { self.type_ = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.ids { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.type_ != ::protobuf::EnumOrUnknown::new(block_inventory::Type::SYNC) { my_size += ::protobuf::rt::int32_size(2, self.type_.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.ids { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if self.type_ != ::protobuf::EnumOrUnknown::new(block_inventory::Type::SYNC) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.type_))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockInventory { BlockInventory::new() } fn clear(&mut self) { self.ids.clear(); self.type_ = ::protobuf::EnumOrUnknown::new(block_inventory::Type::SYNC); self.special_fields.clear(); } fn default_instance() -> &'static BlockInventory { static instance: BlockInventory = BlockInventory { ids: ::std::vec::Vec::new(), type_: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockInventory { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BlockInventory").unwrap()).clone() } } impl ::std::fmt::Display for BlockInventory { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockInventory { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `BlockInventory` pub mod block_inventory { // @@protoc_insertion_point(message:protocol.BlockInventory.BlockId) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockId { // message fields // @@protoc_insertion_point(field:protocol.BlockInventory.BlockId.hash) pub hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BlockInventory.BlockId.number) pub number: i64, // special fields // @@protoc_insertion_point(special_field:protocol.BlockInventory.BlockId.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockId { fn default() -> &'a BlockId { ::default_instance() } } impl BlockId { pub fn new() -> BlockId { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &BlockId| { &m.hash }, |m: &mut BlockId| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "number", |m: &BlockId| { &m.number }, |m: &mut BlockId| { &mut m.number }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockInventory.BlockId", fields, oneofs, ) } } impl ::protobuf::Message for BlockId { const NAME: &'static str = "BlockId"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 16 => { self.number = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if self.number != 0 { my_size += ::protobuf::rt::int64_size(2, self.number); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if self.number != 0 { os.write_int64(2, self.number)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockId { BlockId::new() } fn clear(&mut self) { self.hash.clear(); self.number = 0; self.special_fields.clear(); } fn default_instance() -> &'static BlockId { static instance: BlockId = BlockId { hash: ::std::vec::Vec::new(), number: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockId { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BlockInventory.BlockId").unwrap()).clone() } } impl ::std::fmt::Display for BlockId { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockId { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.BlockInventory.Type) pub enum Type { // @@protoc_insertion_point(enum_value:protocol.BlockInventory.Type.SYNC) SYNC = 0, // @@protoc_insertion_point(enum_value:protocol.BlockInventory.Type.ADVTISE) ADVTISE = 1, // @@protoc_insertion_point(enum_value:protocol.BlockInventory.Type.FETCH) FETCH = 2, } impl ::protobuf::Enum for Type { const NAME: &'static str = "Type"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(Type::SYNC), 1 => ::std::option::Option::Some(Type::ADVTISE), 2 => ::std::option::Option::Some(Type::FETCH), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "SYNC" => ::std::option::Option::Some(Type::SYNC), "ADVTISE" => ::std::option::Option::Some(Type::ADVTISE), "FETCH" => ::std::option::Option::Some(Type::FETCH), _ => ::std::option::Option::None } } const VALUES: &'static [Type] = &[ Type::SYNC, Type::ADVTISE, Type::FETCH, ]; } impl ::protobuf::EnumFull for Type { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("BlockInventory.Type").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for Type { fn default() -> Self { Type::SYNC } } impl Type { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("BlockInventory.Type") } } } // @@protoc_insertion_point(message:protocol.Inventory) #[derive(PartialEq,Clone,Default,Debug)] pub struct Inventory { // message fields // @@protoc_insertion_point(field:protocol.Inventory.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Inventory.ids) pub ids: ::std::vec::Vec<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:protocol.Inventory.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Inventory { fn default() -> &'a Inventory { ::default_instance() } } impl Inventory { pub fn new() -> Inventory { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Inventory| { &m.type_ }, |m: &mut Inventory| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "ids", |m: &Inventory| { &m.ids }, |m: &mut Inventory| { &mut m.ids }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Inventory", fields, oneofs, ) } } impl ::protobuf::Message for Inventory { const NAME: &'static str = "Inventory"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 18 => { self.ids.push(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(inventory::InventoryType::TRX) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } for value in &self.ids { my_size += ::protobuf::rt::bytes_size(2, &value); }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(inventory::InventoryType::TRX) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } for v in &self.ids { os.write_bytes(2, &v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Inventory { Inventory::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(inventory::InventoryType::TRX); self.ids.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Inventory { static instance: Inventory = Inventory { type_: ::protobuf::EnumOrUnknown::from_i32(0), ids: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Inventory { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Inventory").unwrap()).clone() } } impl ::std::fmt::Display for Inventory { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Inventory { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Inventory` pub mod inventory { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Inventory.InventoryType) pub enum InventoryType { // @@protoc_insertion_point(enum_value:protocol.Inventory.InventoryType.TRX) TRX = 0, // @@protoc_insertion_point(enum_value:protocol.Inventory.InventoryType.BLOCK) BLOCK = 1, } impl ::protobuf::Enum for InventoryType { const NAME: &'static str = "InventoryType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(InventoryType::TRX), 1 => ::std::option::Option::Some(InventoryType::BLOCK), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "TRX" => ::std::option::Option::Some(InventoryType::TRX), "BLOCK" => ::std::option::Option::Some(InventoryType::BLOCK), _ => ::std::option::Option::None } } const VALUES: &'static [InventoryType] = &[ InventoryType::TRX, InventoryType::BLOCK, ]; } impl ::protobuf::EnumFull for InventoryType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Inventory.InventoryType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for InventoryType { fn default() -> Self { InventoryType::TRX } } impl InventoryType { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Inventory.InventoryType") } } } // @@protoc_insertion_point(message:protocol.Items) #[derive(PartialEq,Clone,Default,Debug)] pub struct Items { // message fields // @@protoc_insertion_point(field:protocol.Items.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.Items.blocks) pub blocks: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Items.block_headers) pub block_headers: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.Items.transactions) pub transactions: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.Items.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Items { fn default() -> &'a Items { ::default_instance() } } impl Items { pub fn new() -> Items { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Items| { &m.type_ }, |m: &mut Items| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "blocks", |m: &Items| { &m.blocks }, |m: &mut Items| { &mut m.blocks }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "block_headers", |m: &Items| { &m.block_headers }, |m: &mut Items| { &mut m.block_headers }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "transactions", |m: &Items| { &m.transactions }, |m: &mut Items| { &mut m.transactions }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "Items", fields, oneofs, ) } } impl ::protobuf::Message for Items { const NAME: &'static str = "Items"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.type_ = is.read_enum_or_unknown()?; }, 18 => { self.blocks.push(is.read_message()?); }, 26 => { self.block_headers.push(is.read_message()?); }, 34 => { self.transactions.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.type_ != ::protobuf::EnumOrUnknown::new(items::ItemType::ERR) { my_size += ::protobuf::rt::int32_size(1, self.type_.value()); } for value in &self.blocks { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.block_headers { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.transactions { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.type_ != ::protobuf::EnumOrUnknown::new(items::ItemType::ERR) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.type_))?; } for v in &self.blocks { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; for v in &self.block_headers { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; for v in &self.transactions { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Items { Items::new() } fn clear(&mut self) { self.type_ = ::protobuf::EnumOrUnknown::new(items::ItemType::ERR); self.blocks.clear(); self.block_headers.clear(); self.transactions.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Items { static instance: Items = Items { type_: ::protobuf::EnumOrUnknown::from_i32(0), blocks: ::std::vec::Vec::new(), block_headers: ::std::vec::Vec::new(), transactions: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Items { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("Items").unwrap()).clone() } } impl ::std::fmt::Display for Items { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Items { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Items` pub mod items { #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.Items.ItemType) pub enum ItemType { // @@protoc_insertion_point(enum_value:protocol.Items.ItemType.ERR) ERR = 0, // @@protoc_insertion_point(enum_value:protocol.Items.ItemType.TRX) TRX = 1, // @@protoc_insertion_point(enum_value:protocol.Items.ItemType.BLOCK) BLOCK = 2, // @@protoc_insertion_point(enum_value:protocol.Items.ItemType.BLOCKHEADER) BLOCKHEADER = 3, } impl ::protobuf::Enum for ItemType { const NAME: &'static str = "ItemType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(ItemType::ERR), 1 => ::std::option::Option::Some(ItemType::TRX), 2 => ::std::option::Option::Some(ItemType::BLOCK), 3 => ::std::option::Option::Some(ItemType::BLOCKHEADER), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "ERR" => ::std::option::Option::Some(ItemType::ERR), "TRX" => ::std::option::Option::Some(ItemType::TRX), "BLOCK" => ::std::option::Option::Some(ItemType::BLOCK), "BLOCKHEADER" => ::std::option::Option::Some(ItemType::BLOCKHEADER), _ => ::std::option::Option::None } } const VALUES: &'static [ItemType] = &[ ItemType::ERR, ItemType::TRX, ItemType::BLOCK, ItemType::BLOCKHEADER, ]; } impl ::protobuf::EnumFull for ItemType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("Items.ItemType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for ItemType { fn default() -> Self { ItemType::ERR } } impl ItemType { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("Items.ItemType") } } } /// DynamicProperties // @@protoc_insertion_point(message:protocol.DynamicProperties) #[derive(PartialEq,Clone,Default,Debug)] pub struct DynamicProperties { // message fields // @@protoc_insertion_point(field:protocol.DynamicProperties.last_solidity_block_num) pub last_solidity_block_num: i64, // special fields // @@protoc_insertion_point(special_field:protocol.DynamicProperties.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DynamicProperties { fn default() -> &'a DynamicProperties { ::default_instance() } } impl DynamicProperties { pub fn new() -> DynamicProperties { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "last_solidity_block_num", |m: &DynamicProperties| { &m.last_solidity_block_num }, |m: &mut DynamicProperties| { &mut m.last_solidity_block_num }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "DynamicProperties", fields, oneofs, ) } } impl ::protobuf::Message for DynamicProperties { const NAME: &'static str = "DynamicProperties"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.last_solidity_block_num = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.last_solidity_block_num != 0 { my_size += ::protobuf::rt::int64_size(1, self.last_solidity_block_num); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.last_solidity_block_num != 0 { os.write_int64(1, self.last_solidity_block_num)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DynamicProperties { DynamicProperties::new() } fn clear(&mut self) { self.last_solidity_block_num = 0; self.special_fields.clear(); } fn default_instance() -> &'static DynamicProperties { static instance: DynamicProperties = DynamicProperties { last_solidity_block_num: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DynamicProperties { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("DynamicProperties").unwrap()).clone() } } impl ::std::fmt::Display for DynamicProperties { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DynamicProperties { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.DisconnectMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct DisconnectMessage { // message fields // @@protoc_insertion_point(field:protocol.DisconnectMessage.reason) pub reason: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.DisconnectMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DisconnectMessage { fn default() -> &'a DisconnectMessage { ::default_instance() } } impl DisconnectMessage { pub fn new() -> DisconnectMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "reason", |m: &DisconnectMessage| { &m.reason }, |m: &mut DisconnectMessage| { &mut m.reason }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "DisconnectMessage", fields, oneofs, ) } } impl ::protobuf::Message for DisconnectMessage { const NAME: &'static str = "DisconnectMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.reason = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.reason != ::protobuf::EnumOrUnknown::new(ReasonCode::REQUESTED) { my_size += ::protobuf::rt::int32_size(1, self.reason.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.reason != ::protobuf::EnumOrUnknown::new(ReasonCode::REQUESTED) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.reason))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DisconnectMessage { DisconnectMessage::new() } fn clear(&mut self) { self.reason = ::protobuf::EnumOrUnknown::new(ReasonCode::REQUESTED); self.special_fields.clear(); } fn default_instance() -> &'static DisconnectMessage { static instance: DisconnectMessage = DisconnectMessage { reason: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DisconnectMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("DisconnectMessage").unwrap()).clone() } } impl ::std::fmt::Display for DisconnectMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DisconnectMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.HelloMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct HelloMessage { // message fields // @@protoc_insertion_point(field:protocol.HelloMessage.from) pub from: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.HelloMessage.version) pub version: i32, // @@protoc_insertion_point(field:protocol.HelloMessage.timestamp) pub timestamp: i64, // @@protoc_insertion_point(field:protocol.HelloMessage.genesisBlockId) pub genesisBlockId: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.HelloMessage.solidBlockId) pub solidBlockId: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.HelloMessage.headBlockId) pub headBlockId: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.HelloMessage.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.HelloMessage.signature) pub signature: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.HelloMessage.nodeType) pub nodeType: i32, // @@protoc_insertion_point(field:protocol.HelloMessage.lowestBlockNum) pub lowestBlockNum: i64, // special fields // @@protoc_insertion_point(special_field:protocol.HelloMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a HelloMessage { fn default() -> &'a HelloMessage { ::default_instance() } } impl HelloMessage { pub fn new() -> HelloMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(10); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::Discover::Endpoint>( "from", |m: &HelloMessage| { &m.from }, |m: &mut HelloMessage| { &mut m.from }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &HelloMessage| { &m.version }, |m: &mut HelloMessage| { &mut m.version }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &HelloMessage| { &m.timestamp }, |m: &mut HelloMessage| { &mut m.timestamp }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, hello_message::BlockId>( "genesisBlockId", |m: &HelloMessage| { &m.genesisBlockId }, |m: &mut HelloMessage| { &mut m.genesisBlockId }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, hello_message::BlockId>( "solidBlockId", |m: &HelloMessage| { &m.solidBlockId }, |m: &mut HelloMessage| { &mut m.solidBlockId }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, hello_message::BlockId>( "headBlockId", |m: &HelloMessage| { &m.headBlockId }, |m: &mut HelloMessage| { &mut m.headBlockId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &HelloMessage| { &m.address }, |m: &mut HelloMessage| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "signature", |m: &HelloMessage| { &m.signature }, |m: &mut HelloMessage| { &mut m.signature }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nodeType", |m: &HelloMessage| { &m.nodeType }, |m: &mut HelloMessage| { &mut m.nodeType }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lowestBlockNum", |m: &HelloMessage| { &m.lowestBlockNum }, |m: &mut HelloMessage| { &mut m.lowestBlockNum }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "HelloMessage", fields, oneofs, ) } } impl ::protobuf::Message for HelloMessage { const NAME: &'static str = "HelloMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.from)?; }, 16 => { self.version = is.read_int32()?; }, 24 => { self.timestamp = is.read_int64()?; }, 34 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.genesisBlockId)?; }, 42 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.solidBlockId)?; }, 50 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.headBlockId)?; }, 58 => { self.address = is.read_bytes()?; }, 66 => { self.signature = is.read_bytes()?; }, 72 => { self.nodeType = is.read_int32()?; }, 80 => { self.lowestBlockNum = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.from.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.version != 0 { my_size += ::protobuf::rt::int32_size(2, self.version); } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(3, self.timestamp); } if let Some(v) = self.genesisBlockId.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.solidBlockId.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.headBlockId.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(7, &self.address); } if !self.signature.is_empty() { my_size += ::protobuf::rt::bytes_size(8, &self.signature); } if self.nodeType != 0 { my_size += ::protobuf::rt::int32_size(9, self.nodeType); } if self.lowestBlockNum != 0 { my_size += ::protobuf::rt::int64_size(10, self.lowestBlockNum); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.from.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if self.version != 0 { os.write_int32(2, self.version)?; } if self.timestamp != 0 { os.write_int64(3, self.timestamp)?; } if let Some(v) = self.genesisBlockId.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; } if let Some(v) = self.solidBlockId.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; } if let Some(v) = self.headBlockId.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; } if !self.address.is_empty() { os.write_bytes(7, &self.address)?; } if !self.signature.is_empty() { os.write_bytes(8, &self.signature)?; } if self.nodeType != 0 { os.write_int32(9, self.nodeType)?; } if self.lowestBlockNum != 0 { os.write_int64(10, self.lowestBlockNum)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> HelloMessage { HelloMessage::new() } fn clear(&mut self) { self.from.clear(); self.version = 0; self.timestamp = 0; self.genesisBlockId.clear(); self.solidBlockId.clear(); self.headBlockId.clear(); self.address.clear(); self.signature.clear(); self.nodeType = 0; self.lowestBlockNum = 0; self.special_fields.clear(); } fn default_instance() -> &'static HelloMessage { static instance: HelloMessage = HelloMessage { from: ::protobuf::MessageField::none(), version: 0, timestamp: 0, genesisBlockId: ::protobuf::MessageField::none(), solidBlockId: ::protobuf::MessageField::none(), headBlockId: ::protobuf::MessageField::none(), address: ::std::vec::Vec::new(), signature: ::std::vec::Vec::new(), nodeType: 0, lowestBlockNum: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for HelloMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("HelloMessage").unwrap()).clone() } } impl ::std::fmt::Display for HelloMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for HelloMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `HelloMessage` pub mod hello_message { // @@protoc_insertion_point(message:protocol.HelloMessage.BlockId) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockId { // message fields // @@protoc_insertion_point(field:protocol.HelloMessage.BlockId.hash) pub hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.HelloMessage.BlockId.number) pub number: i64, // special fields // @@protoc_insertion_point(special_field:protocol.HelloMessage.BlockId.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockId { fn default() -> &'a BlockId { ::default_instance() } } impl BlockId { pub fn new() -> BlockId { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &BlockId| { &m.hash }, |m: &mut BlockId| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "number", |m: &BlockId| { &m.number }, |m: &mut BlockId| { &mut m.number }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "HelloMessage.BlockId", fields, oneofs, ) } } impl ::protobuf::Message for BlockId { const NAME: &'static str = "BlockId"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 16 => { self.number = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if self.number != 0 { my_size += ::protobuf::rt::int64_size(2, self.number); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if self.number != 0 { os.write_int64(2, self.number)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockId { BlockId::new() } fn clear(&mut self) { self.hash.clear(); self.number = 0; self.special_fields.clear(); } fn default_instance() -> &'static BlockId { static instance: BlockId = BlockId { hash: ::std::vec::Vec::new(), number: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockId { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("HelloMessage.BlockId").unwrap()).clone() } } impl ::std::fmt::Display for BlockId { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockId { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.InternalTransaction) #[derive(PartialEq,Clone,Default,Debug)] pub struct InternalTransaction { // message fields /// internalTransaction identity, the root InternalTransaction hash /// should equals to root transaction id. // @@protoc_insertion_point(field:protocol.InternalTransaction.hash) pub hash: ::std::vec::Vec, /// the one send trx (TBD: or token) via function // @@protoc_insertion_point(field:protocol.InternalTransaction.caller_address) pub caller_address: ::std::vec::Vec, /// the one recieve trx (TBD: or token) via function // @@protoc_insertion_point(field:protocol.InternalTransaction.transferTo_address) pub transferTo_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.InternalTransaction.callValueInfo) pub callValueInfo: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.InternalTransaction.note) pub note: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.InternalTransaction.rejected) pub rejected: bool, // @@protoc_insertion_point(field:protocol.InternalTransaction.extra) pub extra: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.InternalTransaction.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a InternalTransaction { fn default() -> &'a InternalTransaction { ::default_instance() } } impl InternalTransaction { pub fn new() -> InternalTransaction { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &InternalTransaction| { &m.hash }, |m: &mut InternalTransaction| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "caller_address", |m: &InternalTransaction| { &m.caller_address }, |m: &mut InternalTransaction| { &mut m.caller_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "transferTo_address", |m: &InternalTransaction| { &m.transferTo_address }, |m: &mut InternalTransaction| { &mut m.transferTo_address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "callValueInfo", |m: &InternalTransaction| { &m.callValueInfo }, |m: &mut InternalTransaction| { &mut m.callValueInfo }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "note", |m: &InternalTransaction| { &m.note }, |m: &mut InternalTransaction| { &mut m.note }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "rejected", |m: &InternalTransaction| { &m.rejected }, |m: &mut InternalTransaction| { &mut m.rejected }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "extra", |m: &InternalTransaction| { &m.extra }, |m: &mut InternalTransaction| { &mut m.extra }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "InternalTransaction", fields, oneofs, ) } } impl ::protobuf::Message for InternalTransaction { const NAME: &'static str = "InternalTransaction"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 18 => { self.caller_address = is.read_bytes()?; }, 26 => { self.transferTo_address = is.read_bytes()?; }, 34 => { self.callValueInfo.push(is.read_message()?); }, 42 => { self.note = is.read_bytes()?; }, 48 => { self.rejected = is.read_bool()?; }, 58 => { self.extra = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if !self.caller_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.caller_address); } if !self.transferTo_address.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.transferTo_address); } for value in &self.callValueInfo { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.note.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.note); } if self.rejected != false { my_size += 1 + 1; } if !self.extra.is_empty() { my_size += ::protobuf::rt::string_size(7, &self.extra); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if !self.caller_address.is_empty() { os.write_bytes(2, &self.caller_address)?; } if !self.transferTo_address.is_empty() { os.write_bytes(3, &self.transferTo_address)?; } for v in &self.callValueInfo { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; if !self.note.is_empty() { os.write_bytes(5, &self.note)?; } if self.rejected != false { os.write_bool(6, self.rejected)?; } if !self.extra.is_empty() { os.write_string(7, &self.extra)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> InternalTransaction { InternalTransaction::new() } fn clear(&mut self) { self.hash.clear(); self.caller_address.clear(); self.transferTo_address.clear(); self.callValueInfo.clear(); self.note.clear(); self.rejected = false; self.extra.clear(); self.special_fields.clear(); } fn default_instance() -> &'static InternalTransaction { static instance: InternalTransaction = InternalTransaction { hash: ::std::vec::Vec::new(), caller_address: ::std::vec::Vec::new(), transferTo_address: ::std::vec::Vec::new(), callValueInfo: ::std::vec::Vec::new(), note: ::std::vec::Vec::new(), rejected: false, extra: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for InternalTransaction { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("InternalTransaction").unwrap()).clone() } } impl ::std::fmt::Display for InternalTransaction { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for InternalTransaction { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `InternalTransaction` pub mod internal_transaction { // @@protoc_insertion_point(message:protocol.InternalTransaction.CallValueInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct CallValueInfo { // message fields /// trx (TBD: or token) value // @@protoc_insertion_point(field:protocol.InternalTransaction.CallValueInfo.callValue) pub callValue: i64, /// TBD: tokenName, trx should be empty // @@protoc_insertion_point(field:protocol.InternalTransaction.CallValueInfo.tokenId) pub tokenId: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.InternalTransaction.CallValueInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a CallValueInfo { fn default() -> &'a CallValueInfo { ::default_instance() } } impl CallValueInfo { pub fn new() -> CallValueInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "callValue", |m: &CallValueInfo| { &m.callValue }, |m: &mut CallValueInfo| { &mut m.callValue }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "tokenId", |m: &CallValueInfo| { &m.tokenId }, |m: &mut CallValueInfo| { &mut m.tokenId }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "InternalTransaction.CallValueInfo", fields, oneofs, ) } } impl ::protobuf::Message for CallValueInfo { const NAME: &'static str = "CallValueInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.callValue = is.read_int64()?; }, 18 => { self.tokenId = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.callValue != 0 { my_size += ::protobuf::rt::int64_size(1, self.callValue); } if !self.tokenId.is_empty() { my_size += ::protobuf::rt::string_size(2, &self.tokenId); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.callValue != 0 { os.write_int64(1, self.callValue)?; } if !self.tokenId.is_empty() { os.write_string(2, &self.tokenId)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> CallValueInfo { CallValueInfo::new() } fn clear(&mut self) { self.callValue = 0; self.tokenId.clear(); self.special_fields.clear(); } fn default_instance() -> &'static CallValueInfo { static instance: CallValueInfo = CallValueInfo { callValue: 0, tokenId: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for CallValueInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("InternalTransaction.CallValueInfo").unwrap()).clone() } } impl ::std::fmt::Display for CallValueInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for CallValueInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.DelegatedResourceAccountIndex) #[derive(PartialEq,Clone,Default,Debug)] pub struct DelegatedResourceAccountIndex { // message fields // @@protoc_insertion_point(field:protocol.DelegatedResourceAccountIndex.account) pub account: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.DelegatedResourceAccountIndex.fromAccounts) pub fromAccounts: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.DelegatedResourceAccountIndex.toAccounts) pub toAccounts: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.DelegatedResourceAccountIndex.timestamp) pub timestamp: i64, // special fields // @@protoc_insertion_point(special_field:protocol.DelegatedResourceAccountIndex.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DelegatedResourceAccountIndex { fn default() -> &'a DelegatedResourceAccountIndex { ::default_instance() } } impl DelegatedResourceAccountIndex { pub fn new() -> DelegatedResourceAccountIndex { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account", |m: &DelegatedResourceAccountIndex| { &m.account }, |m: &mut DelegatedResourceAccountIndex| { &mut m.account }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "fromAccounts", |m: &DelegatedResourceAccountIndex| { &m.fromAccounts }, |m: &mut DelegatedResourceAccountIndex| { &mut m.fromAccounts }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "toAccounts", |m: &DelegatedResourceAccountIndex| { &m.toAccounts }, |m: &mut DelegatedResourceAccountIndex| { &mut m.toAccounts }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &DelegatedResourceAccountIndex| { &m.timestamp }, |m: &mut DelegatedResourceAccountIndex| { &mut m.timestamp }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "DelegatedResourceAccountIndex", fields, oneofs, ) } } impl ::protobuf::Message for DelegatedResourceAccountIndex { const NAME: &'static str = "DelegatedResourceAccountIndex"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.account = is.read_bytes()?; }, 18 => { self.fromAccounts.push(is.read_bytes()?); }, 26 => { self.toAccounts.push(is.read_bytes()?); }, 32 => { self.timestamp = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.account.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.account); } for value in &self.fromAccounts { my_size += ::protobuf::rt::bytes_size(2, &value); }; for value in &self.toAccounts { my_size += ::protobuf::rt::bytes_size(3, &value); }; if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(4, self.timestamp); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.account.is_empty() { os.write_bytes(1, &self.account)?; } for v in &self.fromAccounts { os.write_bytes(2, &v)?; }; for v in &self.toAccounts { os.write_bytes(3, &v)?; }; if self.timestamp != 0 { os.write_int64(4, self.timestamp)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DelegatedResourceAccountIndex { DelegatedResourceAccountIndex::new() } fn clear(&mut self) { self.account.clear(); self.fromAccounts.clear(); self.toAccounts.clear(); self.timestamp = 0; self.special_fields.clear(); } fn default_instance() -> &'static DelegatedResourceAccountIndex { static instance: DelegatedResourceAccountIndex = DelegatedResourceAccountIndex { account: ::std::vec::Vec::new(), fromAccounts: ::std::vec::Vec::new(), toAccounts: ::std::vec::Vec::new(), timestamp: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DelegatedResourceAccountIndex { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("DelegatedResourceAccountIndex").unwrap()).clone() } } impl ::std::fmt::Display for DelegatedResourceAccountIndex { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DelegatedResourceAccountIndex { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.NodeInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct NodeInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.beginSyncNum) pub beginSyncNum: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.block) pub block: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.solidityBlock) pub solidityBlock: ::std::string::String, /// connect information // @@protoc_insertion_point(field:protocol.NodeInfo.currentConnectCount) pub currentConnectCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.activeConnectCount) pub activeConnectCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.passiveConnectCount) pub passiveConnectCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.totalFlow) pub totalFlow: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.peerInfoList) pub peerInfoList: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.NodeInfo.configNodeInfo) pub configNodeInfo: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.NodeInfo.machineInfo) pub machineInfo: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.NodeInfo.cheatWitnessInfoMap) pub cheatWitnessInfoMap: ::std::collections::HashMap<::std::string::String, ::std::string::String>, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a NodeInfo { fn default() -> &'a NodeInfo { ::default_instance() } } impl NodeInfo { pub fn new() -> NodeInfo { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(11); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "beginSyncNum", |m: &NodeInfo| { &m.beginSyncNum }, |m: &mut NodeInfo| { &mut m.beginSyncNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "block", |m: &NodeInfo| { &m.block }, |m: &mut NodeInfo| { &mut m.block }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "solidityBlock", |m: &NodeInfo| { &m.solidityBlock }, |m: &mut NodeInfo| { &mut m.solidityBlock }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "currentConnectCount", |m: &NodeInfo| { &m.currentConnectCount }, |m: &mut NodeInfo| { &mut m.currentConnectCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "activeConnectCount", |m: &NodeInfo| { &m.activeConnectCount }, |m: &mut NodeInfo| { &mut m.activeConnectCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "passiveConnectCount", |m: &NodeInfo| { &m.passiveConnectCount }, |m: &mut NodeInfo| { &mut m.passiveConnectCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "totalFlow", |m: &NodeInfo| { &m.totalFlow }, |m: &mut NodeInfo| { &mut m.totalFlow }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "peerInfoList", |m: &NodeInfo| { &m.peerInfoList }, |m: &mut NodeInfo| { &mut m.peerInfoList }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, node_info::ConfigNodeInfo>( "configNodeInfo", |m: &NodeInfo| { &m.configNodeInfo }, |m: &mut NodeInfo| { &mut m.configNodeInfo }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, node_info::MachineInfo>( "machineInfo", |m: &NodeInfo| { &m.machineInfo }, |m: &mut NodeInfo| { &mut m.machineInfo }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "cheatWitnessInfoMap", |m: &NodeInfo| { &m.cheatWitnessInfoMap }, |m: &mut NodeInfo| { &mut m.cheatWitnessInfoMap }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo", fields, oneofs, ) } } impl ::protobuf::Message for NodeInfo { const NAME: &'static str = "NodeInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.beginSyncNum = is.read_int64()?; }, 18 => { self.block = is.read_string()?; }, 26 => { self.solidityBlock = is.read_string()?; }, 32 => { self.currentConnectCount = is.read_int32()?; }, 40 => { self.activeConnectCount = is.read_int32()?; }, 48 => { self.passiveConnectCount = is.read_int32()?; }, 56 => { self.totalFlow = is.read_int64()?; }, 66 => { self.peerInfoList.push(is.read_message()?); }, 74 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.configNodeInfo)?; }, 82 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.machineInfo)?; }, 90 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => key = is.read_string()?, 18 => value = is.read_string()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.cheatWitnessInfoMap.insert(key, value); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.beginSyncNum != 0 { my_size += ::protobuf::rt::int64_size(1, self.beginSyncNum); } if !self.block.is_empty() { my_size += ::protobuf::rt::string_size(2, &self.block); } if !self.solidityBlock.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.solidityBlock); } if self.currentConnectCount != 0 { my_size += ::protobuf::rt::int32_size(4, self.currentConnectCount); } if self.activeConnectCount != 0 { my_size += ::protobuf::rt::int32_size(5, self.activeConnectCount); } if self.passiveConnectCount != 0 { my_size += ::protobuf::rt::int32_size(6, self.passiveConnectCount); } if self.totalFlow != 0 { my_size += ::protobuf::rt::int64_size(7, self.totalFlow); } for value in &self.peerInfoList { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.configNodeInfo.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.machineInfo.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for (k, v) in &self.cheatWitnessInfoMap { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::string_size(2, &v); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.beginSyncNum != 0 { os.write_int64(1, self.beginSyncNum)?; } if !self.block.is_empty() { os.write_string(2, &self.block)?; } if !self.solidityBlock.is_empty() { os.write_string(3, &self.solidityBlock)?; } if self.currentConnectCount != 0 { os.write_int32(4, self.currentConnectCount)?; } if self.activeConnectCount != 0 { os.write_int32(5, self.activeConnectCount)?; } if self.passiveConnectCount != 0 { os.write_int32(6, self.passiveConnectCount)?; } if self.totalFlow != 0 { os.write_int64(7, self.totalFlow)?; } for v in &self.peerInfoList { ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; }; if let Some(v) = self.configNodeInfo.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; } if let Some(v) = self.machineInfo.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; } for (k, v) in &self.cheatWitnessInfoMap { let mut entry_size = 0; entry_size += ::protobuf::rt::string_size(1, &k); entry_size += ::protobuf::rt::string_size(2, &v); os.write_raw_varint32(90)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_string(1, &k)?; os.write_string(2, &v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> NodeInfo { NodeInfo::new() } fn clear(&mut self) { self.beginSyncNum = 0; self.block.clear(); self.solidityBlock.clear(); self.currentConnectCount = 0; self.activeConnectCount = 0; self.passiveConnectCount = 0; self.totalFlow = 0; self.peerInfoList.clear(); self.configNodeInfo.clear(); self.machineInfo.clear(); self.cheatWitnessInfoMap.clear(); self.special_fields.clear(); } fn default_instance() -> &'static NodeInfo { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(NodeInfo::new) } } impl ::protobuf::MessageFull for NodeInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("NodeInfo").unwrap()).clone() } } impl ::std::fmt::Display for NodeInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for NodeInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `NodeInfo` pub mod node_info { // @@protoc_insertion_point(message:protocol.NodeInfo.PeerInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct PeerInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.lastSyncBlock) pub lastSyncBlock: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.remainNum) pub remainNum: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.lastBlockUpdateTime) pub lastBlockUpdateTime: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.syncFlag) pub syncFlag: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.headBlockTimeWeBothHave) pub headBlockTimeWeBothHave: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.needSyncFromPeer) pub needSyncFromPeer: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.needSyncFromUs) pub needSyncFromUs: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.host) pub host: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.port) pub port: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.nodeId) pub nodeId: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.connectTime) pub connectTime: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.avgLatency) pub avgLatency: f64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.syncToFetchSize) pub syncToFetchSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.syncToFetchSizePeekNum) pub syncToFetchSizePeekNum: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.syncBlockRequestedSize) pub syncBlockRequestedSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.unFetchSynNum) pub unFetchSynNum: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.blockInPorcSize) pub blockInPorcSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.headBlockWeBothHave) pub headBlockWeBothHave: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.isActive) pub isActive: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.score) pub score: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.nodeCount) pub nodeCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.inFlow) pub inFlow: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.disconnectTimes) pub disconnectTimes: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.localDisconnectReason) pub localDisconnectReason: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.PeerInfo.remoteDisconnectReason) pub remoteDisconnectReason: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.PeerInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PeerInfo { fn default() -> &'a PeerInfo { ::default_instance() } } impl PeerInfo { pub fn new() -> PeerInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(25); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lastSyncBlock", |m: &PeerInfo| { &m.lastSyncBlock }, |m: &mut PeerInfo| { &mut m.lastSyncBlock }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "remainNum", |m: &PeerInfo| { &m.remainNum }, |m: &mut PeerInfo| { &mut m.remainNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lastBlockUpdateTime", |m: &PeerInfo| { &m.lastBlockUpdateTime }, |m: &mut PeerInfo| { &mut m.lastBlockUpdateTime }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "syncFlag", |m: &PeerInfo| { &m.syncFlag }, |m: &mut PeerInfo| { &mut m.syncFlag }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "headBlockTimeWeBothHave", |m: &PeerInfo| { &m.headBlockTimeWeBothHave }, |m: &mut PeerInfo| { &mut m.headBlockTimeWeBothHave }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "needSyncFromPeer", |m: &PeerInfo| { &m.needSyncFromPeer }, |m: &mut PeerInfo| { &mut m.needSyncFromPeer }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "needSyncFromUs", |m: &PeerInfo| { &m.needSyncFromUs }, |m: &mut PeerInfo| { &mut m.needSyncFromUs }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "host", |m: &PeerInfo| { &m.host }, |m: &mut PeerInfo| { &mut m.host }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "port", |m: &PeerInfo| { &m.port }, |m: &mut PeerInfo| { &mut m.port }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nodeId", |m: &PeerInfo| { &m.nodeId }, |m: &mut PeerInfo| { &mut m.nodeId }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "connectTime", |m: &PeerInfo| { &m.connectTime }, |m: &mut PeerInfo| { &mut m.connectTime }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "avgLatency", |m: &PeerInfo| { &m.avgLatency }, |m: &mut PeerInfo| { &mut m.avgLatency }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "syncToFetchSize", |m: &PeerInfo| { &m.syncToFetchSize }, |m: &mut PeerInfo| { &mut m.syncToFetchSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "syncToFetchSizePeekNum", |m: &PeerInfo| { &m.syncToFetchSizePeekNum }, |m: &mut PeerInfo| { &mut m.syncToFetchSizePeekNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "syncBlockRequestedSize", |m: &PeerInfo| { &m.syncBlockRequestedSize }, |m: &mut PeerInfo| { &mut m.syncBlockRequestedSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unFetchSynNum", |m: &PeerInfo| { &m.unFetchSynNum }, |m: &mut PeerInfo| { &mut m.unFetchSynNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockInPorcSize", |m: &PeerInfo| { &m.blockInPorcSize }, |m: &mut PeerInfo| { &mut m.blockInPorcSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "headBlockWeBothHave", |m: &PeerInfo| { &m.headBlockWeBothHave }, |m: &mut PeerInfo| { &mut m.headBlockWeBothHave }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "isActive", |m: &PeerInfo| { &m.isActive }, |m: &mut PeerInfo| { &mut m.isActive }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "score", |m: &PeerInfo| { &m.score }, |m: &mut PeerInfo| { &mut m.score }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nodeCount", |m: &PeerInfo| { &m.nodeCount }, |m: &mut PeerInfo| { &mut m.nodeCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "inFlow", |m: &PeerInfo| { &m.inFlow }, |m: &mut PeerInfo| { &mut m.inFlow }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "disconnectTimes", |m: &PeerInfo| { &m.disconnectTimes }, |m: &mut PeerInfo| { &mut m.disconnectTimes }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "localDisconnectReason", |m: &PeerInfo| { &m.localDisconnectReason }, |m: &mut PeerInfo| { &mut m.localDisconnectReason }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "remoteDisconnectReason", |m: &PeerInfo| { &m.remoteDisconnectReason }, |m: &mut PeerInfo| { &mut m.remoteDisconnectReason }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo.PeerInfo", fields, oneofs, ) } } impl ::protobuf::Message for PeerInfo { const NAME: &'static str = "PeerInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.lastSyncBlock = is.read_string()?; }, 16 => { self.remainNum = is.read_int64()?; }, 24 => { self.lastBlockUpdateTime = is.read_int64()?; }, 32 => { self.syncFlag = is.read_bool()?; }, 40 => { self.headBlockTimeWeBothHave = is.read_int64()?; }, 48 => { self.needSyncFromPeer = is.read_bool()?; }, 56 => { self.needSyncFromUs = is.read_bool()?; }, 66 => { self.host = is.read_string()?; }, 72 => { self.port = is.read_int32()?; }, 82 => { self.nodeId = is.read_string()?; }, 88 => { self.connectTime = is.read_int64()?; }, 97 => { self.avgLatency = is.read_double()?; }, 104 => { self.syncToFetchSize = is.read_int32()?; }, 112 => { self.syncToFetchSizePeekNum = is.read_int64()?; }, 120 => { self.syncBlockRequestedSize = is.read_int32()?; }, 128 => { self.unFetchSynNum = is.read_int64()?; }, 136 => { self.blockInPorcSize = is.read_int32()?; }, 146 => { self.headBlockWeBothHave = is.read_string()?; }, 152 => { self.isActive = is.read_bool()?; }, 160 => { self.score = is.read_int32()?; }, 168 => { self.nodeCount = is.read_int32()?; }, 176 => { self.inFlow = is.read_int64()?; }, 184 => { self.disconnectTimes = is.read_int32()?; }, 194 => { self.localDisconnectReason = is.read_string()?; }, 202 => { self.remoteDisconnectReason = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.lastSyncBlock.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.lastSyncBlock); } if self.remainNum != 0 { my_size += ::protobuf::rt::int64_size(2, self.remainNum); } if self.lastBlockUpdateTime != 0 { my_size += ::protobuf::rt::int64_size(3, self.lastBlockUpdateTime); } if self.syncFlag != false { my_size += 1 + 1; } if self.headBlockTimeWeBothHave != 0 { my_size += ::protobuf::rt::int64_size(5, self.headBlockTimeWeBothHave); } if self.needSyncFromPeer != false { my_size += 1 + 1; } if self.needSyncFromUs != false { my_size += 1 + 1; } if !self.host.is_empty() { my_size += ::protobuf::rt::string_size(8, &self.host); } if self.port != 0 { my_size += ::protobuf::rt::int32_size(9, self.port); } if !self.nodeId.is_empty() { my_size += ::protobuf::rt::string_size(10, &self.nodeId); } if self.connectTime != 0 { my_size += ::protobuf::rt::int64_size(11, self.connectTime); } if self.avgLatency != 0. { my_size += 1 + 8; } if self.syncToFetchSize != 0 { my_size += ::protobuf::rt::int32_size(13, self.syncToFetchSize); } if self.syncToFetchSizePeekNum != 0 { my_size += ::protobuf::rt::int64_size(14, self.syncToFetchSizePeekNum); } if self.syncBlockRequestedSize != 0 { my_size += ::protobuf::rt::int32_size(15, self.syncBlockRequestedSize); } if self.unFetchSynNum != 0 { my_size += ::protobuf::rt::int64_size(16, self.unFetchSynNum); } if self.blockInPorcSize != 0 { my_size += ::protobuf::rt::int32_size(17, self.blockInPorcSize); } if !self.headBlockWeBothHave.is_empty() { my_size += ::protobuf::rt::string_size(18, &self.headBlockWeBothHave); } if self.isActive != false { my_size += 2 + 1; } if self.score != 0 { my_size += ::protobuf::rt::int32_size(20, self.score); } if self.nodeCount != 0 { my_size += ::protobuf::rt::int32_size(21, self.nodeCount); } if self.inFlow != 0 { my_size += ::protobuf::rt::int64_size(22, self.inFlow); } if self.disconnectTimes != 0 { my_size += ::protobuf::rt::int32_size(23, self.disconnectTimes); } if !self.localDisconnectReason.is_empty() { my_size += ::protobuf::rt::string_size(24, &self.localDisconnectReason); } if !self.remoteDisconnectReason.is_empty() { my_size += ::protobuf::rt::string_size(25, &self.remoteDisconnectReason); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.lastSyncBlock.is_empty() { os.write_string(1, &self.lastSyncBlock)?; } if self.remainNum != 0 { os.write_int64(2, self.remainNum)?; } if self.lastBlockUpdateTime != 0 { os.write_int64(3, self.lastBlockUpdateTime)?; } if self.syncFlag != false { os.write_bool(4, self.syncFlag)?; } if self.headBlockTimeWeBothHave != 0 { os.write_int64(5, self.headBlockTimeWeBothHave)?; } if self.needSyncFromPeer != false { os.write_bool(6, self.needSyncFromPeer)?; } if self.needSyncFromUs != false { os.write_bool(7, self.needSyncFromUs)?; } if !self.host.is_empty() { os.write_string(8, &self.host)?; } if self.port != 0 { os.write_int32(9, self.port)?; } if !self.nodeId.is_empty() { os.write_string(10, &self.nodeId)?; } if self.connectTime != 0 { os.write_int64(11, self.connectTime)?; } if self.avgLatency != 0. { os.write_double(12, self.avgLatency)?; } if self.syncToFetchSize != 0 { os.write_int32(13, self.syncToFetchSize)?; } if self.syncToFetchSizePeekNum != 0 { os.write_int64(14, self.syncToFetchSizePeekNum)?; } if self.syncBlockRequestedSize != 0 { os.write_int32(15, self.syncBlockRequestedSize)?; } if self.unFetchSynNum != 0 { os.write_int64(16, self.unFetchSynNum)?; } if self.blockInPorcSize != 0 { os.write_int32(17, self.blockInPorcSize)?; } if !self.headBlockWeBothHave.is_empty() { os.write_string(18, &self.headBlockWeBothHave)?; } if self.isActive != false { os.write_bool(19, self.isActive)?; } if self.score != 0 { os.write_int32(20, self.score)?; } if self.nodeCount != 0 { os.write_int32(21, self.nodeCount)?; } if self.inFlow != 0 { os.write_int64(22, self.inFlow)?; } if self.disconnectTimes != 0 { os.write_int32(23, self.disconnectTimes)?; } if !self.localDisconnectReason.is_empty() { os.write_string(24, &self.localDisconnectReason)?; } if !self.remoteDisconnectReason.is_empty() { os.write_string(25, &self.remoteDisconnectReason)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PeerInfo { PeerInfo::new() } fn clear(&mut self) { self.lastSyncBlock.clear(); self.remainNum = 0; self.lastBlockUpdateTime = 0; self.syncFlag = false; self.headBlockTimeWeBothHave = 0; self.needSyncFromPeer = false; self.needSyncFromUs = false; self.host.clear(); self.port = 0; self.nodeId.clear(); self.connectTime = 0; self.avgLatency = 0.; self.syncToFetchSize = 0; self.syncToFetchSizePeekNum = 0; self.syncBlockRequestedSize = 0; self.unFetchSynNum = 0; self.blockInPorcSize = 0; self.headBlockWeBothHave.clear(); self.isActive = false; self.score = 0; self.nodeCount = 0; self.inFlow = 0; self.disconnectTimes = 0; self.localDisconnectReason.clear(); self.remoteDisconnectReason.clear(); self.special_fields.clear(); } fn default_instance() -> &'static PeerInfo { static instance: PeerInfo = PeerInfo { lastSyncBlock: ::std::string::String::new(), remainNum: 0, lastBlockUpdateTime: 0, syncFlag: false, headBlockTimeWeBothHave: 0, needSyncFromPeer: false, needSyncFromUs: false, host: ::std::string::String::new(), port: 0, nodeId: ::std::string::String::new(), connectTime: 0, avgLatency: 0., syncToFetchSize: 0, syncToFetchSizePeekNum: 0, syncBlockRequestedSize: 0, unFetchSynNum: 0, blockInPorcSize: 0, headBlockWeBothHave: ::std::string::String::new(), isActive: false, score: 0, nodeCount: 0, inFlow: 0, disconnectTimes: 0, localDisconnectReason: ::std::string::String::new(), remoteDisconnectReason: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PeerInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NodeInfo.PeerInfo").unwrap()).clone() } } impl ::std::fmt::Display for PeerInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PeerInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.NodeInfo.ConfigNodeInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct ConfigNodeInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.codeVersion) pub codeVersion: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.p2pVersion) pub p2pVersion: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.listenPort) pub listenPort: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.discoverEnable) pub discoverEnable: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.activeNodeSize) pub activeNodeSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.passiveNodeSize) pub passiveNodeSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.sendNodeSize) pub sendNodeSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.maxConnectCount) pub maxConnectCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.sameIpMaxConnectCount) pub sameIpMaxConnectCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.backupListenPort) pub backupListenPort: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.backupMemberSize) pub backupMemberSize: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.backupPriority) pub backupPriority: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.dbVersion) pub dbVersion: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.minParticipationRate) pub minParticipationRate: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.supportConstant) pub supportConstant: bool, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.minTimeRatio) pub minTimeRatio: f64, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.maxTimeRatio) pub maxTimeRatio: f64, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.allowCreationOfContracts) pub allowCreationOfContracts: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.ConfigNodeInfo.allowAdaptiveEnergy) pub allowAdaptiveEnergy: i64, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.ConfigNodeInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ConfigNodeInfo { fn default() -> &'a ConfigNodeInfo { ::default_instance() } } impl ConfigNodeInfo { pub fn new() -> ConfigNodeInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(19); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "codeVersion", |m: &ConfigNodeInfo| { &m.codeVersion }, |m: &mut ConfigNodeInfo| { &mut m.codeVersion }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "p2pVersion", |m: &ConfigNodeInfo| { &m.p2pVersion }, |m: &mut ConfigNodeInfo| { &mut m.p2pVersion }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "listenPort", |m: &ConfigNodeInfo| { &m.listenPort }, |m: &mut ConfigNodeInfo| { &mut m.listenPort }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "discoverEnable", |m: &ConfigNodeInfo| { &m.discoverEnable }, |m: &mut ConfigNodeInfo| { &mut m.discoverEnable }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "activeNodeSize", |m: &ConfigNodeInfo| { &m.activeNodeSize }, |m: &mut ConfigNodeInfo| { &mut m.activeNodeSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "passiveNodeSize", |m: &ConfigNodeInfo| { &m.passiveNodeSize }, |m: &mut ConfigNodeInfo| { &mut m.passiveNodeSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sendNodeSize", |m: &ConfigNodeInfo| { &m.sendNodeSize }, |m: &mut ConfigNodeInfo| { &mut m.sendNodeSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "maxConnectCount", |m: &ConfigNodeInfo| { &m.maxConnectCount }, |m: &mut ConfigNodeInfo| { &mut m.maxConnectCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sameIpMaxConnectCount", |m: &ConfigNodeInfo| { &m.sameIpMaxConnectCount }, |m: &mut ConfigNodeInfo| { &mut m.sameIpMaxConnectCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "backupListenPort", |m: &ConfigNodeInfo| { &m.backupListenPort }, |m: &mut ConfigNodeInfo| { &mut m.backupListenPort }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "backupMemberSize", |m: &ConfigNodeInfo| { &m.backupMemberSize }, |m: &mut ConfigNodeInfo| { &mut m.backupMemberSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "backupPriority", |m: &ConfigNodeInfo| { &m.backupPriority }, |m: &mut ConfigNodeInfo| { &mut m.backupPriority }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "dbVersion", |m: &ConfigNodeInfo| { &m.dbVersion }, |m: &mut ConfigNodeInfo| { &mut m.dbVersion }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "minParticipationRate", |m: &ConfigNodeInfo| { &m.minParticipationRate }, |m: &mut ConfigNodeInfo| { &mut m.minParticipationRate }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "supportConstant", |m: &ConfigNodeInfo| { &m.supportConstant }, |m: &mut ConfigNodeInfo| { &mut m.supportConstant }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "minTimeRatio", |m: &ConfigNodeInfo| { &m.minTimeRatio }, |m: &mut ConfigNodeInfo| { &mut m.minTimeRatio }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "maxTimeRatio", |m: &ConfigNodeInfo| { &m.maxTimeRatio }, |m: &mut ConfigNodeInfo| { &mut m.maxTimeRatio }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "allowCreationOfContracts", |m: &ConfigNodeInfo| { &m.allowCreationOfContracts }, |m: &mut ConfigNodeInfo| { &mut m.allowCreationOfContracts }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "allowAdaptiveEnergy", |m: &ConfigNodeInfo| { &m.allowAdaptiveEnergy }, |m: &mut ConfigNodeInfo| { &mut m.allowAdaptiveEnergy }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo.ConfigNodeInfo", fields, oneofs, ) } } impl ::protobuf::Message for ConfigNodeInfo { const NAME: &'static str = "ConfigNodeInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.codeVersion = is.read_string()?; }, 18 => { self.p2pVersion = is.read_string()?; }, 24 => { self.listenPort = is.read_int32()?; }, 32 => { self.discoverEnable = is.read_bool()?; }, 40 => { self.activeNodeSize = is.read_int32()?; }, 48 => { self.passiveNodeSize = is.read_int32()?; }, 56 => { self.sendNodeSize = is.read_int32()?; }, 64 => { self.maxConnectCount = is.read_int32()?; }, 72 => { self.sameIpMaxConnectCount = is.read_int32()?; }, 80 => { self.backupListenPort = is.read_int32()?; }, 88 => { self.backupMemberSize = is.read_int32()?; }, 96 => { self.backupPriority = is.read_int32()?; }, 104 => { self.dbVersion = is.read_int32()?; }, 112 => { self.minParticipationRate = is.read_int32()?; }, 120 => { self.supportConstant = is.read_bool()?; }, 129 => { self.minTimeRatio = is.read_double()?; }, 137 => { self.maxTimeRatio = is.read_double()?; }, 144 => { self.allowCreationOfContracts = is.read_int64()?; }, 152 => { self.allowAdaptiveEnergy = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.codeVersion.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.codeVersion); } if !self.p2pVersion.is_empty() { my_size += ::protobuf::rt::string_size(2, &self.p2pVersion); } if self.listenPort != 0 { my_size += ::protobuf::rt::int32_size(3, self.listenPort); } if self.discoverEnable != false { my_size += 1 + 1; } if self.activeNodeSize != 0 { my_size += ::protobuf::rt::int32_size(5, self.activeNodeSize); } if self.passiveNodeSize != 0 { my_size += ::protobuf::rt::int32_size(6, self.passiveNodeSize); } if self.sendNodeSize != 0 { my_size += ::protobuf::rt::int32_size(7, self.sendNodeSize); } if self.maxConnectCount != 0 { my_size += ::protobuf::rt::int32_size(8, self.maxConnectCount); } if self.sameIpMaxConnectCount != 0 { my_size += ::protobuf::rt::int32_size(9, self.sameIpMaxConnectCount); } if self.backupListenPort != 0 { my_size += ::protobuf::rt::int32_size(10, self.backupListenPort); } if self.backupMemberSize != 0 { my_size += ::protobuf::rt::int32_size(11, self.backupMemberSize); } if self.backupPriority != 0 { my_size += ::protobuf::rt::int32_size(12, self.backupPriority); } if self.dbVersion != 0 { my_size += ::protobuf::rt::int32_size(13, self.dbVersion); } if self.minParticipationRate != 0 { my_size += ::protobuf::rt::int32_size(14, self.minParticipationRate); } if self.supportConstant != false { my_size += 1 + 1; } if self.minTimeRatio != 0. { my_size += 2 + 8; } if self.maxTimeRatio != 0. { my_size += 2 + 8; } if self.allowCreationOfContracts != 0 { my_size += ::protobuf::rt::int64_size(18, self.allowCreationOfContracts); } if self.allowAdaptiveEnergy != 0 { my_size += ::protobuf::rt::int64_size(19, self.allowAdaptiveEnergy); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.codeVersion.is_empty() { os.write_string(1, &self.codeVersion)?; } if !self.p2pVersion.is_empty() { os.write_string(2, &self.p2pVersion)?; } if self.listenPort != 0 { os.write_int32(3, self.listenPort)?; } if self.discoverEnable != false { os.write_bool(4, self.discoverEnable)?; } if self.activeNodeSize != 0 { os.write_int32(5, self.activeNodeSize)?; } if self.passiveNodeSize != 0 { os.write_int32(6, self.passiveNodeSize)?; } if self.sendNodeSize != 0 { os.write_int32(7, self.sendNodeSize)?; } if self.maxConnectCount != 0 { os.write_int32(8, self.maxConnectCount)?; } if self.sameIpMaxConnectCount != 0 { os.write_int32(9, self.sameIpMaxConnectCount)?; } if self.backupListenPort != 0 { os.write_int32(10, self.backupListenPort)?; } if self.backupMemberSize != 0 { os.write_int32(11, self.backupMemberSize)?; } if self.backupPriority != 0 { os.write_int32(12, self.backupPriority)?; } if self.dbVersion != 0 { os.write_int32(13, self.dbVersion)?; } if self.minParticipationRate != 0 { os.write_int32(14, self.minParticipationRate)?; } if self.supportConstant != false { os.write_bool(15, self.supportConstant)?; } if self.minTimeRatio != 0. { os.write_double(16, self.minTimeRatio)?; } if self.maxTimeRatio != 0. { os.write_double(17, self.maxTimeRatio)?; } if self.allowCreationOfContracts != 0 { os.write_int64(18, self.allowCreationOfContracts)?; } if self.allowAdaptiveEnergy != 0 { os.write_int64(19, self.allowAdaptiveEnergy)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ConfigNodeInfo { ConfigNodeInfo::new() } fn clear(&mut self) { self.codeVersion.clear(); self.p2pVersion.clear(); self.listenPort = 0; self.discoverEnable = false; self.activeNodeSize = 0; self.passiveNodeSize = 0; self.sendNodeSize = 0; self.maxConnectCount = 0; self.sameIpMaxConnectCount = 0; self.backupListenPort = 0; self.backupMemberSize = 0; self.backupPriority = 0; self.dbVersion = 0; self.minParticipationRate = 0; self.supportConstant = false; self.minTimeRatio = 0.; self.maxTimeRatio = 0.; self.allowCreationOfContracts = 0; self.allowAdaptiveEnergy = 0; self.special_fields.clear(); } fn default_instance() -> &'static ConfigNodeInfo { static instance: ConfigNodeInfo = ConfigNodeInfo { codeVersion: ::std::string::String::new(), p2pVersion: ::std::string::String::new(), listenPort: 0, discoverEnable: false, activeNodeSize: 0, passiveNodeSize: 0, sendNodeSize: 0, maxConnectCount: 0, sameIpMaxConnectCount: 0, backupListenPort: 0, backupMemberSize: 0, backupPriority: 0, dbVersion: 0, minParticipationRate: 0, supportConstant: false, minTimeRatio: 0., maxTimeRatio: 0., allowCreationOfContracts: 0, allowAdaptiveEnergy: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ConfigNodeInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NodeInfo.ConfigNodeInfo").unwrap()).clone() } } impl ::std::fmt::Display for ConfigNodeInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ConfigNodeInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.NodeInfo.MachineInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct MachineInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.threadCount) pub threadCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.deadLockThreadCount) pub deadLockThreadCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.cpuCount) pub cpuCount: i32, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.totalMemory) pub totalMemory: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.freeMemory) pub freeMemory: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.cpuRate) pub cpuRate: f64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.javaVersion) pub javaVersion: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.osName) pub osName: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.jvmTotalMemory) pub jvmTotalMemory: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.jvmFreeMemory) pub jvmFreeMemory: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.processCpuRate) pub processCpuRate: f64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.memoryDescInfoList) pub memoryDescInfoList: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.deadLockThreadInfoList) pub deadLockThreadInfoList: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.MachineInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MachineInfo { fn default() -> &'a MachineInfo { ::default_instance() } } impl MachineInfo { pub fn new() -> MachineInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(13); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "threadCount", |m: &MachineInfo| { &m.threadCount }, |m: &mut MachineInfo| { &mut m.threadCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "deadLockThreadCount", |m: &MachineInfo| { &m.deadLockThreadCount }, |m: &mut MachineInfo| { &mut m.deadLockThreadCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "cpuCount", |m: &MachineInfo| { &m.cpuCount }, |m: &mut MachineInfo| { &mut m.cpuCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "totalMemory", |m: &MachineInfo| { &m.totalMemory }, |m: &mut MachineInfo| { &mut m.totalMemory }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "freeMemory", |m: &MachineInfo| { &m.freeMemory }, |m: &mut MachineInfo| { &mut m.freeMemory }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "cpuRate", |m: &MachineInfo| { &m.cpuRate }, |m: &mut MachineInfo| { &mut m.cpuRate }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "javaVersion", |m: &MachineInfo| { &m.javaVersion }, |m: &mut MachineInfo| { &mut m.javaVersion }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "osName", |m: &MachineInfo| { &m.osName }, |m: &mut MachineInfo| { &mut m.osName }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "jvmTotalMemory", |m: &MachineInfo| { &m.jvmTotalMemory }, |m: &mut MachineInfo| { &mut m.jvmTotalMemory }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "jvmFreeMemory", |m: &MachineInfo| { &m.jvmFreeMemory }, |m: &mut MachineInfo| { &mut m.jvmFreeMemory }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "processCpuRate", |m: &MachineInfo| { &m.processCpuRate }, |m: &mut MachineInfo| { &mut m.processCpuRate }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "memoryDescInfoList", |m: &MachineInfo| { &m.memoryDescInfoList }, |m: &mut MachineInfo| { &mut m.memoryDescInfoList }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "deadLockThreadInfoList", |m: &MachineInfo| { &m.deadLockThreadInfoList }, |m: &mut MachineInfo| { &mut m.deadLockThreadInfoList }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo.MachineInfo", fields, oneofs, ) } } impl ::protobuf::Message for MachineInfo { const NAME: &'static str = "MachineInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.threadCount = is.read_int32()?; }, 16 => { self.deadLockThreadCount = is.read_int32()?; }, 24 => { self.cpuCount = is.read_int32()?; }, 32 => { self.totalMemory = is.read_int64()?; }, 40 => { self.freeMemory = is.read_int64()?; }, 49 => { self.cpuRate = is.read_double()?; }, 58 => { self.javaVersion = is.read_string()?; }, 66 => { self.osName = is.read_string()?; }, 72 => { self.jvmTotalMemory = is.read_int64()?; }, 80 => { self.jvmFreeMemory = is.read_int64()?; }, 89 => { self.processCpuRate = is.read_double()?; }, 98 => { self.memoryDescInfoList.push(is.read_message()?); }, 106 => { self.deadLockThreadInfoList.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.threadCount != 0 { my_size += ::protobuf::rt::int32_size(1, self.threadCount); } if self.deadLockThreadCount != 0 { my_size += ::protobuf::rt::int32_size(2, self.deadLockThreadCount); } if self.cpuCount != 0 { my_size += ::protobuf::rt::int32_size(3, self.cpuCount); } if self.totalMemory != 0 { my_size += ::protobuf::rt::int64_size(4, self.totalMemory); } if self.freeMemory != 0 { my_size += ::protobuf::rt::int64_size(5, self.freeMemory); } if self.cpuRate != 0. { my_size += 1 + 8; } if !self.javaVersion.is_empty() { my_size += ::protobuf::rt::string_size(7, &self.javaVersion); } if !self.osName.is_empty() { my_size += ::protobuf::rt::string_size(8, &self.osName); } if self.jvmTotalMemory != 0 { my_size += ::protobuf::rt::int64_size(9, self.jvmTotalMemory); } if self.jvmFreeMemory != 0 { my_size += ::protobuf::rt::int64_size(10, self.jvmFreeMemory); } if self.processCpuRate != 0. { my_size += 1 + 8; } for value in &self.memoryDescInfoList { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.deadLockThreadInfoList { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.threadCount != 0 { os.write_int32(1, self.threadCount)?; } if self.deadLockThreadCount != 0 { os.write_int32(2, self.deadLockThreadCount)?; } if self.cpuCount != 0 { os.write_int32(3, self.cpuCount)?; } if self.totalMemory != 0 { os.write_int64(4, self.totalMemory)?; } if self.freeMemory != 0 { os.write_int64(5, self.freeMemory)?; } if self.cpuRate != 0. { os.write_double(6, self.cpuRate)?; } if !self.javaVersion.is_empty() { os.write_string(7, &self.javaVersion)?; } if !self.osName.is_empty() { os.write_string(8, &self.osName)?; } if self.jvmTotalMemory != 0 { os.write_int64(9, self.jvmTotalMemory)?; } if self.jvmFreeMemory != 0 { os.write_int64(10, self.jvmFreeMemory)?; } if self.processCpuRate != 0. { os.write_double(11, self.processCpuRate)?; } for v in &self.memoryDescInfoList { ::protobuf::rt::write_message_field_with_cached_size(12, v, os)?; }; for v in &self.deadLockThreadInfoList { ::protobuf::rt::write_message_field_with_cached_size(13, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MachineInfo { MachineInfo::new() } fn clear(&mut self) { self.threadCount = 0; self.deadLockThreadCount = 0; self.cpuCount = 0; self.totalMemory = 0; self.freeMemory = 0; self.cpuRate = 0.; self.javaVersion.clear(); self.osName.clear(); self.jvmTotalMemory = 0; self.jvmFreeMemory = 0; self.processCpuRate = 0.; self.memoryDescInfoList.clear(); self.deadLockThreadInfoList.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MachineInfo { static instance: MachineInfo = MachineInfo { threadCount: 0, deadLockThreadCount: 0, cpuCount: 0, totalMemory: 0, freeMemory: 0, cpuRate: 0., javaVersion: ::std::string::String::new(), osName: ::std::string::String::new(), jvmTotalMemory: 0, jvmFreeMemory: 0, processCpuRate: 0., memoryDescInfoList: ::std::vec::Vec::new(), deadLockThreadInfoList: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MachineInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("NodeInfo.MachineInfo").unwrap()).clone() } } impl ::std::fmt::Display for MachineInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MachineInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `MachineInfo` pub mod machine_info { // @@protoc_insertion_point(message:protocol.NodeInfo.MachineInfo.MemoryDescInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct MemoryDescInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.initSize) pub initSize: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.useSize) pub useSize: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.maxSize) pub maxSize: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.useRate) pub useRate: f64, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.MachineInfo.MemoryDescInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MemoryDescInfo { fn default() -> &'a MemoryDescInfo { ::default_instance() } } impl MemoryDescInfo { pub fn new() -> MemoryDescInfo { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &MemoryDescInfo| { &m.name }, |m: &mut MemoryDescInfo| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "initSize", |m: &MemoryDescInfo| { &m.initSize }, |m: &mut MemoryDescInfo| { &mut m.initSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "useSize", |m: &MemoryDescInfo| { &m.useSize }, |m: &mut MemoryDescInfo| { &mut m.useSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "maxSize", |m: &MemoryDescInfo| { &m.maxSize }, |m: &mut MemoryDescInfo| { &mut m.maxSize }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "useRate", |m: &MemoryDescInfo| { &m.useRate }, |m: &mut MemoryDescInfo| { &mut m.useRate }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo.MachineInfo.MemoryDescInfo", fields, oneofs, ) } } impl ::protobuf::Message for MemoryDescInfo { const NAME: &'static str = "MemoryDescInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.name = is.read_string()?; }, 16 => { self.initSize = is.read_int64()?; }, 24 => { self.useSize = is.read_int64()?; }, 32 => { self.maxSize = is.read_int64()?; }, 41 => { self.useRate = is.read_double()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.name); } if self.initSize != 0 { my_size += ::protobuf::rt::int64_size(2, self.initSize); } if self.useSize != 0 { my_size += ::protobuf::rt::int64_size(3, self.useSize); } if self.maxSize != 0 { my_size += ::protobuf::rt::int64_size(4, self.maxSize); } if self.useRate != 0. { my_size += 1 + 8; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.name.is_empty() { os.write_string(1, &self.name)?; } if self.initSize != 0 { os.write_int64(2, self.initSize)?; } if self.useSize != 0 { os.write_int64(3, self.useSize)?; } if self.maxSize != 0 { os.write_int64(4, self.maxSize)?; } if self.useRate != 0. { os.write_double(5, self.useRate)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MemoryDescInfo { MemoryDescInfo::new() } fn clear(&mut self) { self.name.clear(); self.initSize = 0; self.useSize = 0; self.maxSize = 0; self.useRate = 0.; self.special_fields.clear(); } fn default_instance() -> &'static MemoryDescInfo { static instance: MemoryDescInfo = MemoryDescInfo { name: ::std::string::String::new(), initSize: 0, useSize: 0, maxSize: 0, useRate: 0., special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MemoryDescInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NodeInfo.MachineInfo.MemoryDescInfo").unwrap()).clone() } } impl ::std::fmt::Display for MemoryDescInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MemoryDescInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct DeadLockThreadInfo { // message fields // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.lockName) pub lockName: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.lockOwner) pub lockOwner: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.state) pub state: ::std::string::String, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.blockTime) pub blockTime: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.waitTime) pub waitTime: i64, // @@protoc_insertion_point(field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.stackTrace) pub stackTrace: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.NodeInfo.MachineInfo.DeadLockThreadInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DeadLockThreadInfo { fn default() -> &'a DeadLockThreadInfo { ::default_instance() } } impl DeadLockThreadInfo { pub fn new() -> DeadLockThreadInfo { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &DeadLockThreadInfo| { &m.name }, |m: &mut DeadLockThreadInfo| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lockName", |m: &DeadLockThreadInfo| { &m.lockName }, |m: &mut DeadLockThreadInfo| { &mut m.lockName }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lockOwner", |m: &DeadLockThreadInfo| { &m.lockOwner }, |m: &mut DeadLockThreadInfo| { &mut m.lockOwner }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "state", |m: &DeadLockThreadInfo| { &m.state }, |m: &mut DeadLockThreadInfo| { &mut m.state }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockTime", |m: &DeadLockThreadInfo| { &m.blockTime }, |m: &mut DeadLockThreadInfo| { &mut m.blockTime }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "waitTime", |m: &DeadLockThreadInfo| { &m.waitTime }, |m: &mut DeadLockThreadInfo| { &mut m.waitTime }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "stackTrace", |m: &DeadLockThreadInfo| { &m.stackTrace }, |m: &mut DeadLockThreadInfo| { &mut m.stackTrace }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "NodeInfo.MachineInfo.DeadLockThreadInfo", fields, oneofs, ) } } impl ::protobuf::Message for DeadLockThreadInfo { const NAME: &'static str = "DeadLockThreadInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.name = is.read_string()?; }, 18 => { self.lockName = is.read_string()?; }, 26 => { self.lockOwner = is.read_string()?; }, 34 => { self.state = is.read_string()?; }, 40 => { self.blockTime = is.read_int64()?; }, 48 => { self.waitTime = is.read_int64()?; }, 58 => { self.stackTrace = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.name); } if !self.lockName.is_empty() { my_size += ::protobuf::rt::string_size(2, &self.lockName); } if !self.lockOwner.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.lockOwner); } if !self.state.is_empty() { my_size += ::protobuf::rt::string_size(4, &self.state); } if self.blockTime != 0 { my_size += ::protobuf::rt::int64_size(5, self.blockTime); } if self.waitTime != 0 { my_size += ::protobuf::rt::int64_size(6, self.waitTime); } if !self.stackTrace.is_empty() { my_size += ::protobuf::rt::string_size(7, &self.stackTrace); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.name.is_empty() { os.write_string(1, &self.name)?; } if !self.lockName.is_empty() { os.write_string(2, &self.lockName)?; } if !self.lockOwner.is_empty() { os.write_string(3, &self.lockOwner)?; } if !self.state.is_empty() { os.write_string(4, &self.state)?; } if self.blockTime != 0 { os.write_int64(5, self.blockTime)?; } if self.waitTime != 0 { os.write_int64(6, self.waitTime)?; } if !self.stackTrace.is_empty() { os.write_string(7, &self.stackTrace)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DeadLockThreadInfo { DeadLockThreadInfo::new() } fn clear(&mut self) { self.name.clear(); self.lockName.clear(); self.lockOwner.clear(); self.state.clear(); self.blockTime = 0; self.waitTime = 0; self.stackTrace.clear(); self.special_fields.clear(); } fn default_instance() -> &'static DeadLockThreadInfo { static instance: DeadLockThreadInfo = DeadLockThreadInfo { name: ::std::string::String::new(), lockName: ::std::string::String::new(), lockOwner: ::std::string::String::new(), state: ::std::string::String::new(), blockTime: 0, waitTime: 0, stackTrace: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DeadLockThreadInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("NodeInfo.MachineInfo.DeadLockThreadInfo").unwrap()).clone() } } impl ::std::fmt::Display for DeadLockThreadInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DeadLockThreadInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } } // @@protoc_insertion_point(message:protocol.MetricsInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct MetricsInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.interval) pub interval: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.node) pub node: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.blockchain) pub blockchain: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.net) pub net: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MetricsInfo { fn default() -> &'a MetricsInfo { ::default_instance() } } impl MetricsInfo { pub fn new() -> MetricsInfo { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "interval", |m: &MetricsInfo| { &m.interval }, |m: &mut MetricsInfo| { &mut m.interval }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, metrics_info::NodeInfo>( "node", |m: &MetricsInfo| { &m.node }, |m: &mut MetricsInfo| { &mut m.node }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, metrics_info::BlockChainInfo>( "blockchain", |m: &MetricsInfo| { &m.blockchain }, |m: &mut MetricsInfo| { &mut m.blockchain }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, metrics_info::NetInfo>( "net", |m: &MetricsInfo| { &m.net }, |m: &mut MetricsInfo| { &mut m.net }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo", fields, oneofs, ) } } impl ::protobuf::Message for MetricsInfo { const NAME: &'static str = "MetricsInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.interval = is.read_int64()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.node)?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.blockchain)?; }, 34 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.net)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.interval != 0 { my_size += ::protobuf::rt::int64_size(1, self.interval); } if let Some(v) = self.node.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.blockchain.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.net.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.interval != 0 { os.write_int64(1, self.interval)?; } if let Some(v) = self.node.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if let Some(v) = self.blockchain.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } if let Some(v) = self.net.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MetricsInfo { MetricsInfo::new() } fn clear(&mut self) { self.interval = 0; self.node.clear(); self.blockchain.clear(); self.net.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MetricsInfo { static instance: MetricsInfo = MetricsInfo { interval: 0, node: ::protobuf::MessageField::none(), blockchain: ::protobuf::MessageField::none(), net: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MetricsInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MetricsInfo").unwrap()).clone() } } impl ::std::fmt::Display for MetricsInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MetricsInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `MetricsInfo` pub mod metrics_info { // @@protoc_insertion_point(message:protocol.MetricsInfo.NodeInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct NodeInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NodeInfo.ip) pub ip: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.NodeInfo.nodeType) pub nodeType: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NodeInfo.version) pub version: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.NodeInfo.backupStatus) pub backupStatus: i32, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NodeInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a NodeInfo { fn default() -> &'a NodeInfo { ::default_instance() } } impl NodeInfo { pub fn new() -> NodeInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "ip", |m: &NodeInfo| { &m.ip }, |m: &mut NodeInfo| { &mut m.ip }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nodeType", |m: &NodeInfo| { &m.nodeType }, |m: &mut NodeInfo| { &mut m.nodeType }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &NodeInfo| { &m.version }, |m: &mut NodeInfo| { &mut m.version }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "backupStatus", |m: &NodeInfo| { &m.backupStatus }, |m: &mut NodeInfo| { &mut m.backupStatus }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NodeInfo", fields, oneofs, ) } } impl ::protobuf::Message for NodeInfo { const NAME: &'static str = "NodeInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.ip = is.read_string()?; }, 16 => { self.nodeType = is.read_int32()?; }, 26 => { self.version = is.read_string()?; }, 32 => { self.backupStatus = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.ip.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.ip); } if self.nodeType != 0 { my_size += ::protobuf::rt::int32_size(2, self.nodeType); } if !self.version.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.version); } if self.backupStatus != 0 { my_size += ::protobuf::rt::int32_size(4, self.backupStatus); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.ip.is_empty() { os.write_string(1, &self.ip)?; } if self.nodeType != 0 { os.write_int32(2, self.nodeType)?; } if !self.version.is_empty() { os.write_string(3, &self.version)?; } if self.backupStatus != 0 { os.write_int32(4, self.backupStatus)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> NodeInfo { NodeInfo::new() } fn clear(&mut self) { self.ip.clear(); self.nodeType = 0; self.version.clear(); self.backupStatus = 0; self.special_fields.clear(); } fn default_instance() -> &'static NodeInfo { static instance: NodeInfo = NodeInfo { ip: ::std::string::String::new(), nodeType: 0, version: ::std::string::String::new(), backupStatus: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for NodeInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MetricsInfo.NodeInfo").unwrap()).clone() } } impl ::std::fmt::Display for NodeInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for NodeInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MetricsInfo.BlockChainInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockChainInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.headBlockNum) pub headBlockNum: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.headBlockTimestamp) pub headBlockTimestamp: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.headBlockHash) pub headBlockHash: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.forkCount) pub forkCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.failForkCount) pub failForkCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.blockProcessTime) pub blockProcessTime: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.tps) pub tps: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.transactionCacheSize) pub transactionCacheSize: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.missedTransaction) pub missedTransaction: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.witnesses) pub witnesses: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.failProcessBlockNum) pub failProcessBlockNum: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.failProcessBlockReason) pub failProcessBlockReason: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.dupWitness) pub dupWitness: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.BlockChainInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockChainInfo { fn default() -> &'a BlockChainInfo { ::default_instance() } } impl BlockChainInfo { pub fn new() -> BlockChainInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(13); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "headBlockNum", |m: &BlockChainInfo| { &m.headBlockNum }, |m: &mut BlockChainInfo| { &mut m.headBlockNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "headBlockTimestamp", |m: &BlockChainInfo| { &m.headBlockTimestamp }, |m: &mut BlockChainInfo| { &mut m.headBlockTimestamp }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "headBlockHash", |m: &BlockChainInfo| { &m.headBlockHash }, |m: &mut BlockChainInfo| { &mut m.headBlockHash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "forkCount", |m: &BlockChainInfo| { &m.forkCount }, |m: &mut BlockChainInfo| { &mut m.forkCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "failForkCount", |m: &BlockChainInfo| { &m.failForkCount }, |m: &mut BlockChainInfo| { &mut m.failForkCount }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "blockProcessTime", |m: &BlockChainInfo| { &m.blockProcessTime }, |m: &mut BlockChainInfo| { &mut m.blockProcessTime }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "tps", |m: &BlockChainInfo| { &m.tps }, |m: &mut BlockChainInfo| { &mut m.tps }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "transactionCacheSize", |m: &BlockChainInfo| { &m.transactionCacheSize }, |m: &mut BlockChainInfo| { &mut m.transactionCacheSize }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "missedTransaction", |m: &BlockChainInfo| { &m.missedTransaction }, |m: &mut BlockChainInfo| { &mut m.missedTransaction }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "witnesses", |m: &BlockChainInfo| { &m.witnesses }, |m: &mut BlockChainInfo| { &mut m.witnesses }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "failProcessBlockNum", |m: &BlockChainInfo| { &m.failProcessBlockNum }, |m: &mut BlockChainInfo| { &mut m.failProcessBlockNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "failProcessBlockReason", |m: &BlockChainInfo| { &m.failProcessBlockReason }, |m: &mut BlockChainInfo| { &mut m.failProcessBlockReason }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "dupWitness", |m: &BlockChainInfo| { &m.dupWitness }, |m: &mut BlockChainInfo| { &mut m.dupWitness }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.BlockChainInfo", fields, oneofs, ) } } impl ::protobuf::Message for BlockChainInfo { const NAME: &'static str = "BlockChainInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.headBlockNum = is.read_int64()?; }, 16 => { self.headBlockTimestamp = is.read_int64()?; }, 26 => { self.headBlockHash = is.read_string()?; }, 32 => { self.forkCount = is.read_int32()?; }, 40 => { self.failForkCount = is.read_int32()?; }, 50 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.blockProcessTime)?; }, 58 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.tps)?; }, 64 => { self.transactionCacheSize = is.read_int32()?; }, 74 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.missedTransaction)?; }, 82 => { self.witnesses.push(is.read_message()?); }, 88 => { self.failProcessBlockNum = is.read_int64()?; }, 98 => { self.failProcessBlockReason = is.read_string()?; }, 106 => { self.dupWitness.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.headBlockNum != 0 { my_size += ::protobuf::rt::int64_size(1, self.headBlockNum); } if self.headBlockTimestamp != 0 { my_size += ::protobuf::rt::int64_size(2, self.headBlockTimestamp); } if !self.headBlockHash.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.headBlockHash); } if self.forkCount != 0 { my_size += ::protobuf::rt::int32_size(4, self.forkCount); } if self.failForkCount != 0 { my_size += ::protobuf::rt::int32_size(5, self.failForkCount); } if let Some(v) = self.blockProcessTime.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.tps.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.transactionCacheSize != 0 { my_size += ::protobuf::rt::int32_size(8, self.transactionCacheSize); } if let Some(v) = self.missedTransaction.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.witnesses { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.failProcessBlockNum != 0 { my_size += ::protobuf::rt::int64_size(11, self.failProcessBlockNum); } if !self.failProcessBlockReason.is_empty() { my_size += ::protobuf::rt::string_size(12, &self.failProcessBlockReason); } for value in &self.dupWitness { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.headBlockNum != 0 { os.write_int64(1, self.headBlockNum)?; } if self.headBlockTimestamp != 0 { os.write_int64(2, self.headBlockTimestamp)?; } if !self.headBlockHash.is_empty() { os.write_string(3, &self.headBlockHash)?; } if self.forkCount != 0 { os.write_int32(4, self.forkCount)?; } if self.failForkCount != 0 { os.write_int32(5, self.failForkCount)?; } if let Some(v) = self.blockProcessTime.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; } if let Some(v) = self.tps.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(7, v, os)?; } if self.transactionCacheSize != 0 { os.write_int32(8, self.transactionCacheSize)?; } if let Some(v) = self.missedTransaction.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; } for v in &self.witnesses { ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; }; if self.failProcessBlockNum != 0 { os.write_int64(11, self.failProcessBlockNum)?; } if !self.failProcessBlockReason.is_empty() { os.write_string(12, &self.failProcessBlockReason)?; } for v in &self.dupWitness { ::protobuf::rt::write_message_field_with_cached_size(13, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockChainInfo { BlockChainInfo::new() } fn clear(&mut self) { self.headBlockNum = 0; self.headBlockTimestamp = 0; self.headBlockHash.clear(); self.forkCount = 0; self.failForkCount = 0; self.blockProcessTime.clear(); self.tps.clear(); self.transactionCacheSize = 0; self.missedTransaction.clear(); self.witnesses.clear(); self.failProcessBlockNum = 0; self.failProcessBlockReason.clear(); self.dupWitness.clear(); self.special_fields.clear(); } fn default_instance() -> &'static BlockChainInfo { static instance: BlockChainInfo = BlockChainInfo { headBlockNum: 0, headBlockTimestamp: 0, headBlockHash: ::std::string::String::new(), forkCount: 0, failForkCount: 0, blockProcessTime: ::protobuf::MessageField::none(), tps: ::protobuf::MessageField::none(), transactionCacheSize: 0, missedTransaction: ::protobuf::MessageField::none(), witnesses: ::std::vec::Vec::new(), failProcessBlockNum: 0, failProcessBlockReason: ::std::string::String::new(), dupWitness: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockChainInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MetricsInfo.BlockChainInfo").unwrap()).clone() } } impl ::std::fmt::Display for BlockChainInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockChainInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `BlockChainInfo` pub mod block_chain_info { // @@protoc_insertion_point(message:protocol.MetricsInfo.BlockChainInfo.Witness) #[derive(PartialEq,Clone,Default,Debug)] pub struct Witness { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.Witness.address) pub address: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.Witness.version) pub version: i32, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.BlockChainInfo.Witness.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Witness { fn default() -> &'a Witness { ::default_instance() } } impl Witness { pub fn new() -> Witness { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Witness| { &m.address }, |m: &mut Witness| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &Witness| { &m.version }, |m: &mut Witness| { &mut m.version }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.BlockChainInfo.Witness", fields, oneofs, ) } } impl ::protobuf::Message for Witness { const NAME: &'static str = "Witness"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_string()?; }, 16 => { self.version = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.address); } if self.version != 0 { my_size += ::protobuf::rt::int32_size(2, self.version); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_string(1, &self.address)?; } if self.version != 0 { os.write_int32(2, self.version)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Witness { Witness::new() } fn clear(&mut self) { self.address.clear(); self.version = 0; self.special_fields.clear(); } fn default_instance() -> &'static Witness { static instance: Witness = Witness { address: ::std::string::String::new(), version: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Witness { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.BlockChainInfo.Witness").unwrap()).clone() } } impl ::std::fmt::Display for Witness { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Witness { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MetricsInfo.BlockChainInfo.DupWitness) #[derive(PartialEq,Clone,Default,Debug)] pub struct DupWitness { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.DupWitness.address) pub address: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.DupWitness.blockNum) pub blockNum: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.BlockChainInfo.DupWitness.count) pub count: i32, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.BlockChainInfo.DupWitness.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DupWitness { fn default() -> &'a DupWitness { ::default_instance() } } impl DupWitness { pub fn new() -> DupWitness { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &DupWitness| { &m.address }, |m: &mut DupWitness| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "blockNum", |m: &DupWitness| { &m.blockNum }, |m: &mut DupWitness| { &mut m.blockNum }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &DupWitness| { &m.count }, |m: &mut DupWitness| { &mut m.count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.BlockChainInfo.DupWitness", fields, oneofs, ) } } impl ::protobuf::Message for DupWitness { const NAME: &'static str = "DupWitness"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_string()?; }, 16 => { self.blockNum = is.read_int64()?; }, 24 => { self.count = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.address); } if self.blockNum != 0 { my_size += ::protobuf::rt::int64_size(2, self.blockNum); } if self.count != 0 { my_size += ::protobuf::rt::int32_size(3, self.count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_string(1, &self.address)?; } if self.blockNum != 0 { os.write_int64(2, self.blockNum)?; } if self.count != 0 { os.write_int32(3, self.count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DupWitness { DupWitness::new() } fn clear(&mut self) { self.address.clear(); self.blockNum = 0; self.count = 0; self.special_fields.clear(); } fn default_instance() -> &'static DupWitness { static instance: DupWitness = DupWitness { address: ::std::string::String::new(), blockNum: 0, count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DupWitness { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.BlockChainInfo.DupWitness").unwrap()).clone() } } impl ::std::fmt::Display for DupWitness { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DupWitness { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.MetricsInfo.RateInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct RateInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.RateInfo.count) pub count: i64, // @@protoc_insertion_point(field:protocol.MetricsInfo.RateInfo.meanRate) pub meanRate: f64, // @@protoc_insertion_point(field:protocol.MetricsInfo.RateInfo.oneMinuteRate) pub oneMinuteRate: f64, // @@protoc_insertion_point(field:protocol.MetricsInfo.RateInfo.fiveMinuteRate) pub fiveMinuteRate: f64, // @@protoc_insertion_point(field:protocol.MetricsInfo.RateInfo.fifteenMinuteRate) pub fifteenMinuteRate: f64, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.RateInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a RateInfo { fn default() -> &'a RateInfo { ::default_instance() } } impl RateInfo { pub fn new() -> RateInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &RateInfo| { &m.count }, |m: &mut RateInfo| { &mut m.count }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "meanRate", |m: &RateInfo| { &m.meanRate }, |m: &mut RateInfo| { &mut m.meanRate }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "oneMinuteRate", |m: &RateInfo| { &m.oneMinuteRate }, |m: &mut RateInfo| { &mut m.oneMinuteRate }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fiveMinuteRate", |m: &RateInfo| { &m.fiveMinuteRate }, |m: &mut RateInfo| { &mut m.fiveMinuteRate }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "fifteenMinuteRate", |m: &RateInfo| { &m.fifteenMinuteRate }, |m: &mut RateInfo| { &mut m.fifteenMinuteRate }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.RateInfo", fields, oneofs, ) } } impl ::protobuf::Message for RateInfo { const NAME: &'static str = "RateInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.count = is.read_int64()?; }, 17 => { self.meanRate = is.read_double()?; }, 25 => { self.oneMinuteRate = is.read_double()?; }, 33 => { self.fiveMinuteRate = is.read_double()?; }, 41 => { self.fifteenMinuteRate = is.read_double()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.count != 0 { my_size += ::protobuf::rt::int64_size(1, self.count); } if self.meanRate != 0. { my_size += 1 + 8; } if self.oneMinuteRate != 0. { my_size += 1 + 8; } if self.fiveMinuteRate != 0. { my_size += 1 + 8; } if self.fifteenMinuteRate != 0. { my_size += 1 + 8; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.count != 0 { os.write_int64(1, self.count)?; } if self.meanRate != 0. { os.write_double(2, self.meanRate)?; } if self.oneMinuteRate != 0. { os.write_double(3, self.oneMinuteRate)?; } if self.fiveMinuteRate != 0. { os.write_double(4, self.fiveMinuteRate)?; } if self.fifteenMinuteRate != 0. { os.write_double(5, self.fifteenMinuteRate)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> RateInfo { RateInfo::new() } fn clear(&mut self) { self.count = 0; self.meanRate = 0.; self.oneMinuteRate = 0.; self.fiveMinuteRate = 0.; self.fifteenMinuteRate = 0.; self.special_fields.clear(); } fn default_instance() -> &'static RateInfo { static instance: RateInfo = RateInfo { count: 0, meanRate: 0., oneMinuteRate: 0., fiveMinuteRate: 0., fifteenMinuteRate: 0., special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for RateInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MetricsInfo.RateInfo").unwrap()).clone() } } impl ::std::fmt::Display for RateInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for RateInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct NetInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.errorProtoCount) pub errorProtoCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.api) pub api: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.connectionCount) pub connectionCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.validConnectionCount) pub validConnectionCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.tcpInTraffic) pub tcpInTraffic: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.tcpOutTraffic) pub tcpOutTraffic: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.disconnectionCount) pub disconnectionCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.disconnectionDetail) pub disconnectionDetail: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.udpInTraffic) pub udpInTraffic: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.udpOutTraffic) pub udpOutTraffic: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.latency) pub latency: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a NetInfo { fn default() -> &'a NetInfo { ::default_instance() } } impl NetInfo { pub fn new() -> NetInfo { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(11); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "errorProtoCount", |m: &NetInfo| { &m.errorProtoCount }, |m: &mut NetInfo| { &mut m.errorProtoCount }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, net_info::ApiInfo>( "api", |m: &NetInfo| { &m.api }, |m: &mut NetInfo| { &mut m.api }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "connectionCount", |m: &NetInfo| { &m.connectionCount }, |m: &mut NetInfo| { &mut m.connectionCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "validConnectionCount", |m: &NetInfo| { &m.validConnectionCount }, |m: &mut NetInfo| { &mut m.validConnectionCount }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "tcpInTraffic", |m: &NetInfo| { &m.tcpInTraffic }, |m: &mut NetInfo| { &mut m.tcpInTraffic }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "tcpOutTraffic", |m: &NetInfo| { &m.tcpOutTraffic }, |m: &mut NetInfo| { &mut m.tcpOutTraffic }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "disconnectionCount", |m: &NetInfo| { &m.disconnectionCount }, |m: &mut NetInfo| { &mut m.disconnectionCount }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "disconnectionDetail", |m: &NetInfo| { &m.disconnectionDetail }, |m: &mut NetInfo| { &mut m.disconnectionDetail }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "udpInTraffic", |m: &NetInfo| { &m.udpInTraffic }, |m: &mut NetInfo| { &mut m.udpInTraffic }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, RateInfo>( "udpOutTraffic", |m: &NetInfo| { &m.udpOutTraffic }, |m: &mut NetInfo| { &mut m.udpOutTraffic }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, net_info::LatencyInfo>( "latency", |m: &NetInfo| { &m.latency }, |m: &mut NetInfo| { &mut m.latency }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo", fields, oneofs, ) } } impl ::protobuf::Message for NetInfo { const NAME: &'static str = "NetInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.errorProtoCount = is.read_int32()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.api)?; }, 24 => { self.connectionCount = is.read_int32()?; }, 32 => { self.validConnectionCount = is.read_int32()?; }, 42 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.tcpInTraffic)?; }, 50 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.tcpOutTraffic)?; }, 56 => { self.disconnectionCount = is.read_int32()?; }, 66 => { self.disconnectionDetail.push(is.read_message()?); }, 74 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.udpInTraffic)?; }, 82 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.udpOutTraffic)?; }, 90 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.latency)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.errorProtoCount != 0 { my_size += ::protobuf::rt::int32_size(1, self.errorProtoCount); } if let Some(v) = self.api.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.connectionCount != 0 { my_size += ::protobuf::rt::int32_size(3, self.connectionCount); } if self.validConnectionCount != 0 { my_size += ::protobuf::rt::int32_size(4, self.validConnectionCount); } if let Some(v) = self.tcpInTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.tcpOutTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.disconnectionCount != 0 { my_size += ::protobuf::rt::int32_size(7, self.disconnectionCount); } for value in &self.disconnectionDetail { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.udpInTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.udpOutTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.latency.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.errorProtoCount != 0 { os.write_int32(1, self.errorProtoCount)?; } if let Some(v) = self.api.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if self.connectionCount != 0 { os.write_int32(3, self.connectionCount)?; } if self.validConnectionCount != 0 { os.write_int32(4, self.validConnectionCount)?; } if let Some(v) = self.tcpInTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; } if let Some(v) = self.tcpOutTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(6, v, os)?; } if self.disconnectionCount != 0 { os.write_int32(7, self.disconnectionCount)?; } for v in &self.disconnectionDetail { ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; }; if let Some(v) = self.udpInTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(9, v, os)?; } if let Some(v) = self.udpOutTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; } if let Some(v) = self.latency.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(11, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> NetInfo { NetInfo::new() } fn clear(&mut self) { self.errorProtoCount = 0; self.api.clear(); self.connectionCount = 0; self.validConnectionCount = 0; self.tcpInTraffic.clear(); self.tcpOutTraffic.clear(); self.disconnectionCount = 0; self.disconnectionDetail.clear(); self.udpInTraffic.clear(); self.udpOutTraffic.clear(); self.latency.clear(); self.special_fields.clear(); } fn default_instance() -> &'static NetInfo { static instance: NetInfo = NetInfo { errorProtoCount: 0, api: ::protobuf::MessageField::none(), connectionCount: 0, validConnectionCount: 0, tcpInTraffic: ::protobuf::MessageField::none(), tcpOutTraffic: ::protobuf::MessageField::none(), disconnectionCount: 0, disconnectionDetail: ::std::vec::Vec::new(), udpInTraffic: ::protobuf::MessageField::none(), udpOutTraffic: ::protobuf::MessageField::none(), latency: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for NetInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo").unwrap()).clone() } } impl ::std::fmt::Display for NetInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for NetInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `NetInfo` pub mod net_info { // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo.ApiInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct ApiInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.qps) pub qps: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.failQps) pub failQps: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.outTraffic) pub outTraffic: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.detail) pub detail: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.ApiInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ApiInfo { fn default() -> &'a ApiInfo { ::default_instance() } } impl ApiInfo { pub fn new() -> ApiInfo { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::RateInfo>( "qps", |m: &ApiInfo| { &m.qps }, |m: &mut ApiInfo| { &mut m.qps }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::RateInfo>( "failQps", |m: &ApiInfo| { &m.failQps }, |m: &mut ApiInfo| { &mut m.failQps }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::RateInfo>( "outTraffic", |m: &ApiInfo| { &m.outTraffic }, |m: &mut ApiInfo| { &mut m.outTraffic }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "detail", |m: &ApiInfo| { &m.detail }, |m: &mut ApiInfo| { &mut m.detail }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo.ApiInfo", fields, oneofs, ) } } impl ::protobuf::Message for ApiInfo { const NAME: &'static str = "ApiInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.qps)?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.failQps)?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.outTraffic)?; }, 34 => { self.detail.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.qps.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.failQps.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.outTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.detail { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.qps.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if let Some(v) = self.failQps.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if let Some(v) = self.outTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } for v in &self.detail { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ApiInfo { ApiInfo::new() } fn clear(&mut self) { self.qps.clear(); self.failQps.clear(); self.outTraffic.clear(); self.detail.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ApiInfo { static instance: ApiInfo = ApiInfo { qps: ::protobuf::MessageField::none(), failQps: ::protobuf::MessageField::none(), outTraffic: ::protobuf::MessageField::none(), detail: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ApiInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo.ApiInfo").unwrap()).clone() } } impl ::std::fmt::Display for ApiInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ApiInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `ApiInfo` pub mod api_info { // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct ApiDetailInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo.qps) pub qps: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo.failQps) pub failQps: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo.outTraffic) pub outTraffic: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ApiDetailInfo { fn default() -> &'a ApiDetailInfo { ::default_instance() } } impl ApiDetailInfo { pub fn new() -> ApiDetailInfo { ::std::default::Default::default() } pub(in super::super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &ApiDetailInfo| { &m.name }, |m: &mut ApiDetailInfo| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::RateInfo>( "qps", |m: &ApiDetailInfo| { &m.qps }, |m: &mut ApiDetailInfo| { &mut m.qps }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::RateInfo>( "failQps", |m: &ApiDetailInfo| { &m.failQps }, |m: &mut ApiDetailInfo| { &mut m.failQps }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::super::RateInfo>( "outTraffic", |m: &ApiDetailInfo| { &m.outTraffic }, |m: &mut ApiDetailInfo| { &mut m.outTraffic }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo", fields, oneofs, ) } } impl ::protobuf::Message for ApiDetailInfo { const NAME: &'static str = "ApiDetailInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.name = is.read_string()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.qps)?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.failQps)?; }, 34 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.outTraffic)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.name); } if let Some(v) = self.qps.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.failQps.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.outTraffic.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.name.is_empty() { os.write_string(1, &self.name)?; } if let Some(v) = self.qps.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if let Some(v) = self.failQps.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } if let Some(v) = self.outTraffic.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ApiDetailInfo { ApiDetailInfo::new() } fn clear(&mut self) { self.name.clear(); self.qps.clear(); self.failQps.clear(); self.outTraffic.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ApiDetailInfo { static instance: ApiDetailInfo = ApiDetailInfo { name: ::std::string::String::new(), qps: ::protobuf::MessageField::none(), failQps: ::protobuf::MessageField::none(), outTraffic: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ApiDetailInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo.ApiInfo.ApiDetailInfo").unwrap()).clone() } } impl ::std::fmt::Display for ApiDetailInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ApiDetailInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo.DisconnectionDetailInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct DisconnectionDetailInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.DisconnectionDetailInfo.reason) pub reason: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.DisconnectionDetailInfo.count) pub count: i32, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.DisconnectionDetailInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DisconnectionDetailInfo { fn default() -> &'a DisconnectionDetailInfo { ::default_instance() } } impl DisconnectionDetailInfo { pub fn new() -> DisconnectionDetailInfo { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "reason", |m: &DisconnectionDetailInfo| { &m.reason }, |m: &mut DisconnectionDetailInfo| { &mut m.reason }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &DisconnectionDetailInfo| { &m.count }, |m: &mut DisconnectionDetailInfo| { &mut m.count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo.DisconnectionDetailInfo", fields, oneofs, ) } } impl ::protobuf::Message for DisconnectionDetailInfo { const NAME: &'static str = "DisconnectionDetailInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.reason = is.read_string()?; }, 16 => { self.count = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.reason.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.reason); } if self.count != 0 { my_size += ::protobuf::rt::int32_size(2, self.count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.reason.is_empty() { os.write_string(1, &self.reason)?; } if self.count != 0 { os.write_int32(2, self.count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DisconnectionDetailInfo { DisconnectionDetailInfo::new() } fn clear(&mut self) { self.reason.clear(); self.count = 0; self.special_fields.clear(); } fn default_instance() -> &'static DisconnectionDetailInfo { static instance: DisconnectionDetailInfo = DisconnectionDetailInfo { reason: ::std::string::String::new(), count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DisconnectionDetailInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo.DisconnectionDetailInfo").unwrap()).clone() } } impl ::std::fmt::Display for DisconnectionDetailInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DisconnectionDetailInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo.LatencyInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct LatencyInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.top99) pub top99: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.top95) pub top95: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.top75) pub top75: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.totalCount) pub totalCount: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.delay1S) pub delay1S: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.delay2S) pub delay2S: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.delay3S) pub delay3S: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.detail) pub detail: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.LatencyInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a LatencyInfo { fn default() -> &'a LatencyInfo { ::default_instance() } } impl LatencyInfo { pub fn new() -> LatencyInfo { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(8); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top99", |m: &LatencyInfo| { &m.top99 }, |m: &mut LatencyInfo| { &mut m.top99 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top95", |m: &LatencyInfo| { &m.top95 }, |m: &mut LatencyInfo| { &mut m.top95 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top75", |m: &LatencyInfo| { &m.top75 }, |m: &mut LatencyInfo| { &mut m.top75 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "totalCount", |m: &LatencyInfo| { &m.totalCount }, |m: &mut LatencyInfo| { &mut m.totalCount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay1S", |m: &LatencyInfo| { &m.delay1S }, |m: &mut LatencyInfo| { &mut m.delay1S }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay2S", |m: &LatencyInfo| { &m.delay2S }, |m: &mut LatencyInfo| { &mut m.delay2S }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay3S", |m: &LatencyInfo| { &m.delay3S }, |m: &mut LatencyInfo| { &mut m.delay3S }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "detail", |m: &LatencyInfo| { &m.detail }, |m: &mut LatencyInfo| { &mut m.detail }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo.LatencyInfo", fields, oneofs, ) } } impl ::protobuf::Message for LatencyInfo { const NAME: &'static str = "LatencyInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.top99 = is.read_int32()?; }, 16 => { self.top95 = is.read_int32()?; }, 24 => { self.top75 = is.read_int32()?; }, 32 => { self.totalCount = is.read_int32()?; }, 40 => { self.delay1S = is.read_int32()?; }, 48 => { self.delay2S = is.read_int32()?; }, 56 => { self.delay3S = is.read_int32()?; }, 66 => { self.detail.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.top99 != 0 { my_size += ::protobuf::rt::int32_size(1, self.top99); } if self.top95 != 0 { my_size += ::protobuf::rt::int32_size(2, self.top95); } if self.top75 != 0 { my_size += ::protobuf::rt::int32_size(3, self.top75); } if self.totalCount != 0 { my_size += ::protobuf::rt::int32_size(4, self.totalCount); } if self.delay1S != 0 { my_size += ::protobuf::rt::int32_size(5, self.delay1S); } if self.delay2S != 0 { my_size += ::protobuf::rt::int32_size(6, self.delay2S); } if self.delay3S != 0 { my_size += ::protobuf::rt::int32_size(7, self.delay3S); } for value in &self.detail { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.top99 != 0 { os.write_int32(1, self.top99)?; } if self.top95 != 0 { os.write_int32(2, self.top95)?; } if self.top75 != 0 { os.write_int32(3, self.top75)?; } if self.totalCount != 0 { os.write_int32(4, self.totalCount)?; } if self.delay1S != 0 { os.write_int32(5, self.delay1S)?; } if self.delay2S != 0 { os.write_int32(6, self.delay2S)?; } if self.delay3S != 0 { os.write_int32(7, self.delay3S)?; } for v in &self.detail { ::protobuf::rt::write_message_field_with_cached_size(8, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> LatencyInfo { LatencyInfo::new() } fn clear(&mut self) { self.top99 = 0; self.top95 = 0; self.top75 = 0; self.totalCount = 0; self.delay1S = 0; self.delay2S = 0; self.delay3S = 0; self.detail.clear(); self.special_fields.clear(); } fn default_instance() -> &'static LatencyInfo { static instance: LatencyInfo = LatencyInfo { top99: 0, top95: 0, top75: 0, totalCount: 0, delay1S: 0, delay2S: 0, delay3S: 0, detail: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for LatencyInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo.LatencyInfo").unwrap()).clone() } } impl ::std::fmt::Display for LatencyInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for LatencyInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `LatencyInfo` pub mod latency_info { // @@protoc_insertion_point(message:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct LatencyDetailInfo { // message fields // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.witness) pub witness: ::std::string::String, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.top99) pub top99: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.top95) pub top95: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.top75) pub top75: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.count) pub count: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.delay1S) pub delay1S: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.delay2S) pub delay2S: i32, // @@protoc_insertion_point(field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.delay3S) pub delay3S: i32, // special fields // @@protoc_insertion_point(special_field:protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a LatencyDetailInfo { fn default() -> &'a LatencyDetailInfo { ::default_instance() } } impl LatencyDetailInfo { pub fn new() -> LatencyDetailInfo { ::std::default::Default::default() } pub(in super::super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(8); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "witness", |m: &LatencyDetailInfo| { &m.witness }, |m: &mut LatencyDetailInfo| { &mut m.witness }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top99", |m: &LatencyDetailInfo| { &m.top99 }, |m: &mut LatencyDetailInfo| { &mut m.top99 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top95", |m: &LatencyDetailInfo| { &m.top95 }, |m: &mut LatencyDetailInfo| { &mut m.top95 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "top75", |m: &LatencyDetailInfo| { &m.top75 }, |m: &mut LatencyDetailInfo| { &mut m.top75 }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &LatencyDetailInfo| { &m.count }, |m: &mut LatencyDetailInfo| { &mut m.count }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay1S", |m: &LatencyDetailInfo| { &m.delay1S }, |m: &mut LatencyDetailInfo| { &mut m.delay1S }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay2S", |m: &LatencyDetailInfo| { &m.delay2S }, |m: &mut LatencyDetailInfo| { &mut m.delay2S }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "delay3S", |m: &LatencyDetailInfo| { &m.delay3S }, |m: &mut LatencyDetailInfo| { &mut m.delay3S }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo", fields, oneofs, ) } } impl ::protobuf::Message for LatencyDetailInfo { const NAME: &'static str = "LatencyDetailInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.witness = is.read_string()?; }, 16 => { self.top99 = is.read_int32()?; }, 24 => { self.top95 = is.read_int32()?; }, 32 => { self.top75 = is.read_int32()?; }, 40 => { self.count = is.read_int32()?; }, 48 => { self.delay1S = is.read_int32()?; }, 56 => { self.delay2S = is.read_int32()?; }, 64 => { self.delay3S = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.witness.is_empty() { my_size += ::protobuf::rt::string_size(1, &self.witness); } if self.top99 != 0 { my_size += ::protobuf::rt::int32_size(2, self.top99); } if self.top95 != 0 { my_size += ::protobuf::rt::int32_size(3, self.top95); } if self.top75 != 0 { my_size += ::protobuf::rt::int32_size(4, self.top75); } if self.count != 0 { my_size += ::protobuf::rt::int32_size(5, self.count); } if self.delay1S != 0 { my_size += ::protobuf::rt::int32_size(6, self.delay1S); } if self.delay2S != 0 { my_size += ::protobuf::rt::int32_size(7, self.delay2S); } if self.delay3S != 0 { my_size += ::protobuf::rt::int32_size(8, self.delay3S); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.witness.is_empty() { os.write_string(1, &self.witness)?; } if self.top99 != 0 { os.write_int32(2, self.top99)?; } if self.top95 != 0 { os.write_int32(3, self.top95)?; } if self.top75 != 0 { os.write_int32(4, self.top75)?; } if self.count != 0 { os.write_int32(5, self.count)?; } if self.delay1S != 0 { os.write_int32(6, self.delay1S)?; } if self.delay2S != 0 { os.write_int32(7, self.delay2S)?; } if self.delay3S != 0 { os.write_int32(8, self.delay3S)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> LatencyDetailInfo { LatencyDetailInfo::new() } fn clear(&mut self) { self.witness.clear(); self.top99 = 0; self.top95 = 0; self.top75 = 0; self.count = 0; self.delay1S = 0; self.delay2S = 0; self.delay3S = 0; self.special_fields.clear(); } fn default_instance() -> &'static LatencyDetailInfo { static instance: LatencyDetailInfo = LatencyDetailInfo { witness: ::std::string::String::new(), top99: 0, top95: 0, top75: 0, count: 0, delay1S: 0, delay2S: 0, delay3S: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for LatencyDetailInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::super::file_descriptor().message_by_package_relative_name("MetricsInfo.NetInfo.LatencyInfo.LatencyDetailInfo").unwrap()).clone() } } impl ::std::fmt::Display for LatencyDetailInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for LatencyDetailInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } } } // @@protoc_insertion_point(message:protocol.PBFTMessage) #[derive(PartialEq,Clone,Default,Debug)] pub struct PBFTMessage { // message fields // @@protoc_insertion_point(field:protocol.PBFTMessage.raw_data) pub raw_data: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.PBFTMessage.signature) pub signature: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.PBFTMessage.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PBFTMessage { fn default() -> &'a PBFTMessage { ::default_instance() } } impl PBFTMessage { pub fn new() -> PBFTMessage { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, pbftmessage::Raw>( "raw_data", |m: &PBFTMessage| { &m.raw_data }, |m: &mut PBFTMessage| { &mut m.raw_data }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "signature", |m: &PBFTMessage| { &m.signature }, |m: &mut PBFTMessage| { &mut m.signature }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PBFTMessage", fields, oneofs, ) } } impl ::protobuf::Message for PBFTMessage { const NAME: &'static str = "PBFTMessage"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.raw_data)?; }, 18 => { self.signature = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.raw_data.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.signature.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.signature); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.raw_data.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.signature.is_empty() { os.write_bytes(2, &self.signature)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PBFTMessage { PBFTMessage::new() } fn clear(&mut self) { self.raw_data.clear(); self.signature.clear(); self.special_fields.clear(); } fn default_instance() -> &'static PBFTMessage { static instance: PBFTMessage = PBFTMessage { raw_data: ::protobuf::MessageField::none(), signature: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PBFTMessage { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("PBFTMessage").unwrap()).clone() } } impl ::std::fmt::Display for PBFTMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PBFTMessage { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `PBFTMessage` pub mod pbftmessage { // @@protoc_insertion_point(message:protocol.PBFTMessage.Raw) #[derive(PartialEq,Clone,Default,Debug)] pub struct Raw { // message fields // @@protoc_insertion_point(field:protocol.PBFTMessage.Raw.msg_type) pub msg_type: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.PBFTMessage.Raw.data_type) pub data_type: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.PBFTMessage.Raw.view_n) pub view_n: i64, // @@protoc_insertion_point(field:protocol.PBFTMessage.Raw.epoch) pub epoch: i64, // @@protoc_insertion_point(field:protocol.PBFTMessage.Raw.data) pub data: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.PBFTMessage.Raw.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Raw { fn default() -> &'a Raw { ::default_instance() } } impl Raw { pub fn new() -> Raw { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "msg_type", |m: &Raw| { &m.msg_type }, |m: &mut Raw| { &mut m.msg_type }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data_type", |m: &Raw| { &m.data_type }, |m: &mut Raw| { &mut m.data_type }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "view_n", |m: &Raw| { &m.view_n }, |m: &mut Raw| { &mut m.view_n }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "epoch", |m: &Raw| { &m.epoch }, |m: &mut Raw| { &mut m.epoch }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data", |m: &Raw| { &m.data }, |m: &mut Raw| { &mut m.data }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PBFTMessage.Raw", fields, oneofs, ) } } impl ::protobuf::Message for Raw { const NAME: &'static str = "Raw"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.msg_type = is.read_enum_or_unknown()?; }, 16 => { self.data_type = is.read_enum_or_unknown()?; }, 24 => { self.view_n = is.read_int64()?; }, 32 => { self.epoch = is.read_int64()?; }, 42 => { self.data = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.msg_type != ::protobuf::EnumOrUnknown::new(MsgType::VIEW_CHANGE) { my_size += ::protobuf::rt::int32_size(1, self.msg_type.value()); } if self.data_type != ::protobuf::EnumOrUnknown::new(DataType::BLOCK) { my_size += ::protobuf::rt::int32_size(2, self.data_type.value()); } if self.view_n != 0 { my_size += ::protobuf::rt::int64_size(3, self.view_n); } if self.epoch != 0 { my_size += ::protobuf::rt::int64_size(4, self.epoch); } if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.data); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.msg_type != ::protobuf::EnumOrUnknown::new(MsgType::VIEW_CHANGE) { os.write_enum(1, ::protobuf::EnumOrUnknown::value(&self.msg_type))?; } if self.data_type != ::protobuf::EnumOrUnknown::new(DataType::BLOCK) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.data_type))?; } if self.view_n != 0 { os.write_int64(3, self.view_n)?; } if self.epoch != 0 { os.write_int64(4, self.epoch)?; } if !self.data.is_empty() { os.write_bytes(5, &self.data)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Raw { Raw::new() } fn clear(&mut self) { self.msg_type = ::protobuf::EnumOrUnknown::new(MsgType::VIEW_CHANGE); self.data_type = ::protobuf::EnumOrUnknown::new(DataType::BLOCK); self.view_n = 0; self.epoch = 0; self.data.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Raw { static instance: Raw = Raw { msg_type: ::protobuf::EnumOrUnknown::from_i32(0), data_type: ::protobuf::EnumOrUnknown::from_i32(0), view_n: 0, epoch: 0, data: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Raw { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("PBFTMessage.Raw").unwrap()).clone() } } impl ::std::fmt::Display for Raw { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Raw { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.PBFTMessage.MsgType) pub enum MsgType { // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.MsgType.VIEW_CHANGE) VIEW_CHANGE = 0, // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.MsgType.REQUEST) REQUEST = 1, // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.MsgType.PREPREPARE) PREPREPARE = 2, // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.MsgType.PREPARE) PREPARE = 3, // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.MsgType.COMMIT) COMMIT = 4, } impl ::protobuf::Enum for MsgType { const NAME: &'static str = "MsgType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(MsgType::VIEW_CHANGE), 1 => ::std::option::Option::Some(MsgType::REQUEST), 2 => ::std::option::Option::Some(MsgType::PREPREPARE), 3 => ::std::option::Option::Some(MsgType::PREPARE), 4 => ::std::option::Option::Some(MsgType::COMMIT), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "VIEW_CHANGE" => ::std::option::Option::Some(MsgType::VIEW_CHANGE), "REQUEST" => ::std::option::Option::Some(MsgType::REQUEST), "PREPREPARE" => ::std::option::Option::Some(MsgType::PREPREPARE), "PREPARE" => ::std::option::Option::Some(MsgType::PREPARE), "COMMIT" => ::std::option::Option::Some(MsgType::COMMIT), _ => ::std::option::Option::None } } const VALUES: &'static [MsgType] = &[ MsgType::VIEW_CHANGE, MsgType::REQUEST, MsgType::PREPREPARE, MsgType::PREPARE, MsgType::COMMIT, ]; } impl ::protobuf::EnumFull for MsgType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("PBFTMessage.MsgType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for MsgType { fn default() -> Self { MsgType::VIEW_CHANGE } } impl MsgType { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("PBFTMessage.MsgType") } } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.PBFTMessage.DataType) pub enum DataType { // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.DataType.BLOCK) BLOCK = 0, // @@protoc_insertion_point(enum_value:protocol.PBFTMessage.DataType.SRL) SRL = 1, } impl ::protobuf::Enum for DataType { const NAME: &'static str = "DataType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(DataType::BLOCK), 1 => ::std::option::Option::Some(DataType::SRL), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "BLOCK" => ::std::option::Option::Some(DataType::BLOCK), "SRL" => ::std::option::Option::Some(DataType::SRL), _ => ::std::option::Option::None } } const VALUES: &'static [DataType] = &[ DataType::BLOCK, DataType::SRL, ]; } impl ::protobuf::EnumFull for DataType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("PBFTMessage.DataType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for DataType { fn default() -> Self { DataType::BLOCK } } impl DataType { pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("PBFTMessage.DataType") } } } // @@protoc_insertion_point(message:protocol.PBFTCommitResult) #[derive(PartialEq,Clone,Default,Debug)] pub struct PBFTCommitResult { // message fields // @@protoc_insertion_point(field:protocol.PBFTCommitResult.data) pub data: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.PBFTCommitResult.signature) pub signature: ::std::vec::Vec<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:protocol.PBFTCommitResult.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PBFTCommitResult { fn default() -> &'a PBFTCommitResult { ::default_instance() } } impl PBFTCommitResult { pub fn new() -> PBFTCommitResult { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data", |m: &PBFTCommitResult| { &m.data }, |m: &mut PBFTCommitResult| { &mut m.data }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "signature", |m: &PBFTCommitResult| { &m.signature }, |m: &mut PBFTCommitResult| { &mut m.signature }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PBFTCommitResult", fields, oneofs, ) } } impl ::protobuf::Message for PBFTCommitResult { const NAME: &'static str = "PBFTCommitResult"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.data = is.read_bytes()?; }, 18 => { self.signature.push(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.data); } for value in &self.signature { my_size += ::protobuf::rt::bytes_size(2, &value); }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.data.is_empty() { os.write_bytes(1, &self.data)?; } for v in &self.signature { os.write_bytes(2, &v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PBFTCommitResult { PBFTCommitResult::new() } fn clear(&mut self) { self.data.clear(); self.signature.clear(); self.special_fields.clear(); } fn default_instance() -> &'static PBFTCommitResult { static instance: PBFTCommitResult = PBFTCommitResult { data: ::std::vec::Vec::new(), signature: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PBFTCommitResult { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("PBFTCommitResult").unwrap()).clone() } } impl ::std::fmt::Display for PBFTCommitResult { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PBFTCommitResult { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.SRL) #[derive(PartialEq,Clone,Default,Debug)] pub struct SRL { // message fields // @@protoc_insertion_point(field:protocol.SRL.srAddress) pub srAddress: ::std::vec::Vec<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:protocol.SRL.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SRL { fn default() -> &'a SRL { ::default_instance() } } impl SRL { pub fn new() -> SRL { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "srAddress", |m: &SRL| { &m.srAddress }, |m: &mut SRL| { &mut m.srAddress }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SRL", fields, oneofs, ) } } impl ::protobuf::Message for SRL { const NAME: &'static str = "SRL"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.srAddress.push(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.srAddress { my_size += ::protobuf::rt::bytes_size(1, &value); }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.srAddress { os.write_bytes(1, &v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SRL { SRL::new() } fn clear(&mut self) { self.srAddress.clear(); self.special_fields.clear(); } fn default_instance() -> &'static SRL { static instance: SRL = SRL { srAddress: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SRL { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SRL").unwrap()).clone() } } impl ::std::fmt::Display for SRL { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SRL { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.AccountType) pub enum AccountType { // @@protoc_insertion_point(enum_value:protocol.AccountType.Normal) Normal = 0, // @@protoc_insertion_point(enum_value:protocol.AccountType.AssetIssue) AssetIssue = 1, // @@protoc_insertion_point(enum_value:protocol.AccountType.Contract) Contract = 2, } impl ::protobuf::Enum for AccountType { const NAME: &'static str = "AccountType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(AccountType::Normal), 1 => ::std::option::Option::Some(AccountType::AssetIssue), 2 => ::std::option::Option::Some(AccountType::Contract), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "Normal" => ::std::option::Option::Some(AccountType::Normal), "AssetIssue" => ::std::option::Option::Some(AccountType::AssetIssue), "Contract" => ::std::option::Option::Some(AccountType::Contract), _ => ::std::option::Option::None } } const VALUES: &'static [AccountType] = &[ AccountType::Normal, AccountType::AssetIssue, AccountType::Contract, ]; } impl ::protobuf::EnumFull for AccountType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().enum_by_package_relative_name("AccountType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for AccountType { fn default() -> Self { AccountType::Normal } } impl AccountType { fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("AccountType") } } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.ReasonCode) pub enum ReasonCode { // @@protoc_insertion_point(enum_value:protocol.ReasonCode.REQUESTED) REQUESTED = 0, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.BAD_PROTOCOL) BAD_PROTOCOL = 2, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.TOO_MANY_PEERS) TOO_MANY_PEERS = 4, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.DUPLICATE_PEER) DUPLICATE_PEER = 5, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.INCOMPATIBLE_PROTOCOL) INCOMPATIBLE_PROTOCOL = 6, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.RANDOM_ELIMINATION) RANDOM_ELIMINATION = 7, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.PEER_QUITING) PEER_QUITING = 8, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.UNEXPECTED_IDENTITY) UNEXPECTED_IDENTITY = 9, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.LOCAL_IDENTITY) LOCAL_IDENTITY = 10, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.PING_TIMEOUT) PING_TIMEOUT = 11, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.USER_REASON) USER_REASON = 16, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.RESET) RESET = 17, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.SYNC_FAIL) SYNC_FAIL = 18, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.FETCH_FAIL) FETCH_FAIL = 19, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.BAD_TX) BAD_TX = 20, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.BAD_BLOCK) BAD_BLOCK = 21, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.FORKED) FORKED = 22, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.UNLINKABLE) UNLINKABLE = 23, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.INCOMPATIBLE_VERSION) INCOMPATIBLE_VERSION = 24, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.INCOMPATIBLE_CHAIN) INCOMPATIBLE_CHAIN = 25, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.TIME_OUT) TIME_OUT = 32, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.CONNECT_FAIL) CONNECT_FAIL = 33, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.TOO_MANY_PEERS_WITH_SAME_IP) TOO_MANY_PEERS_WITH_SAME_IP = 34, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.LIGHT_NODE_SYNC_FAIL) LIGHT_NODE_SYNC_FAIL = 35, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.BELOW_THAN_ME) BELOW_THAN_ME = 36, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.NOT_WITNESS) NOT_WITNESS = 37, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.NO_SUCH_MESSAGE) NO_SUCH_MESSAGE = 38, // @@protoc_insertion_point(enum_value:protocol.ReasonCode.UNKNOWN) UNKNOWN = 255, } impl ::protobuf::Enum for ReasonCode { const NAME: &'static str = "ReasonCode"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(ReasonCode::REQUESTED), 2 => ::std::option::Option::Some(ReasonCode::BAD_PROTOCOL), 4 => ::std::option::Option::Some(ReasonCode::TOO_MANY_PEERS), 5 => ::std::option::Option::Some(ReasonCode::DUPLICATE_PEER), 6 => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_PROTOCOL), 7 => ::std::option::Option::Some(ReasonCode::RANDOM_ELIMINATION), 8 => ::std::option::Option::Some(ReasonCode::PEER_QUITING), 9 => ::std::option::Option::Some(ReasonCode::UNEXPECTED_IDENTITY), 10 => ::std::option::Option::Some(ReasonCode::LOCAL_IDENTITY), 11 => ::std::option::Option::Some(ReasonCode::PING_TIMEOUT), 16 => ::std::option::Option::Some(ReasonCode::USER_REASON), 17 => ::std::option::Option::Some(ReasonCode::RESET), 18 => ::std::option::Option::Some(ReasonCode::SYNC_FAIL), 19 => ::std::option::Option::Some(ReasonCode::FETCH_FAIL), 20 => ::std::option::Option::Some(ReasonCode::BAD_TX), 21 => ::std::option::Option::Some(ReasonCode::BAD_BLOCK), 22 => ::std::option::Option::Some(ReasonCode::FORKED), 23 => ::std::option::Option::Some(ReasonCode::UNLINKABLE), 24 => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_VERSION), 25 => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_CHAIN), 32 => ::std::option::Option::Some(ReasonCode::TIME_OUT), 33 => ::std::option::Option::Some(ReasonCode::CONNECT_FAIL), 34 => ::std::option::Option::Some(ReasonCode::TOO_MANY_PEERS_WITH_SAME_IP), 35 => ::std::option::Option::Some(ReasonCode::LIGHT_NODE_SYNC_FAIL), 36 => ::std::option::Option::Some(ReasonCode::BELOW_THAN_ME), 37 => ::std::option::Option::Some(ReasonCode::NOT_WITNESS), 38 => ::std::option::Option::Some(ReasonCode::NO_SUCH_MESSAGE), 255 => ::std::option::Option::Some(ReasonCode::UNKNOWN), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "REQUESTED" => ::std::option::Option::Some(ReasonCode::REQUESTED), "BAD_PROTOCOL" => ::std::option::Option::Some(ReasonCode::BAD_PROTOCOL), "TOO_MANY_PEERS" => ::std::option::Option::Some(ReasonCode::TOO_MANY_PEERS), "DUPLICATE_PEER" => ::std::option::Option::Some(ReasonCode::DUPLICATE_PEER), "INCOMPATIBLE_PROTOCOL" => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_PROTOCOL), "RANDOM_ELIMINATION" => ::std::option::Option::Some(ReasonCode::RANDOM_ELIMINATION), "PEER_QUITING" => ::std::option::Option::Some(ReasonCode::PEER_QUITING), "UNEXPECTED_IDENTITY" => ::std::option::Option::Some(ReasonCode::UNEXPECTED_IDENTITY), "LOCAL_IDENTITY" => ::std::option::Option::Some(ReasonCode::LOCAL_IDENTITY), "PING_TIMEOUT" => ::std::option::Option::Some(ReasonCode::PING_TIMEOUT), "USER_REASON" => ::std::option::Option::Some(ReasonCode::USER_REASON), "RESET" => ::std::option::Option::Some(ReasonCode::RESET), "SYNC_FAIL" => ::std::option::Option::Some(ReasonCode::SYNC_FAIL), "FETCH_FAIL" => ::std::option::Option::Some(ReasonCode::FETCH_FAIL), "BAD_TX" => ::std::option::Option::Some(ReasonCode::BAD_TX), "BAD_BLOCK" => ::std::option::Option::Some(ReasonCode::BAD_BLOCK), "FORKED" => ::std::option::Option::Some(ReasonCode::FORKED), "UNLINKABLE" => ::std::option::Option::Some(ReasonCode::UNLINKABLE), "INCOMPATIBLE_VERSION" => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_VERSION), "INCOMPATIBLE_CHAIN" => ::std::option::Option::Some(ReasonCode::INCOMPATIBLE_CHAIN), "TIME_OUT" => ::std::option::Option::Some(ReasonCode::TIME_OUT), "CONNECT_FAIL" => ::std::option::Option::Some(ReasonCode::CONNECT_FAIL), "TOO_MANY_PEERS_WITH_SAME_IP" => ::std::option::Option::Some(ReasonCode::TOO_MANY_PEERS_WITH_SAME_IP), "LIGHT_NODE_SYNC_FAIL" => ::std::option::Option::Some(ReasonCode::LIGHT_NODE_SYNC_FAIL), "BELOW_THAN_ME" => ::std::option::Option::Some(ReasonCode::BELOW_THAN_ME), "NOT_WITNESS" => ::std::option::Option::Some(ReasonCode::NOT_WITNESS), "NO_SUCH_MESSAGE" => ::std::option::Option::Some(ReasonCode::NO_SUCH_MESSAGE), "UNKNOWN" => ::std::option::Option::Some(ReasonCode::UNKNOWN), _ => ::std::option::Option::None } } const VALUES: &'static [ReasonCode] = &[ ReasonCode::REQUESTED, ReasonCode::BAD_PROTOCOL, ReasonCode::TOO_MANY_PEERS, ReasonCode::DUPLICATE_PEER, ReasonCode::INCOMPATIBLE_PROTOCOL, ReasonCode::RANDOM_ELIMINATION, ReasonCode::PEER_QUITING, ReasonCode::UNEXPECTED_IDENTITY, ReasonCode::LOCAL_IDENTITY, ReasonCode::PING_TIMEOUT, ReasonCode::USER_REASON, ReasonCode::RESET, ReasonCode::SYNC_FAIL, ReasonCode::FETCH_FAIL, ReasonCode::BAD_TX, ReasonCode::BAD_BLOCK, ReasonCode::FORKED, ReasonCode::UNLINKABLE, ReasonCode::INCOMPATIBLE_VERSION, ReasonCode::INCOMPATIBLE_CHAIN, ReasonCode::TIME_OUT, ReasonCode::CONNECT_FAIL, ReasonCode::TOO_MANY_PEERS_WITH_SAME_IP, ReasonCode::LIGHT_NODE_SYNC_FAIL, ReasonCode::BELOW_THAN_ME, ReasonCode::NOT_WITNESS, ReasonCode::NO_SUCH_MESSAGE, ReasonCode::UNKNOWN, ]; } impl ::protobuf::EnumFull for ReasonCode { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().enum_by_package_relative_name("ReasonCode").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = match self { ReasonCode::REQUESTED => 0, ReasonCode::BAD_PROTOCOL => 1, ReasonCode::TOO_MANY_PEERS => 2, ReasonCode::DUPLICATE_PEER => 3, ReasonCode::INCOMPATIBLE_PROTOCOL => 4, ReasonCode::RANDOM_ELIMINATION => 5, ReasonCode::PEER_QUITING => 6, ReasonCode::UNEXPECTED_IDENTITY => 7, ReasonCode::LOCAL_IDENTITY => 8, ReasonCode::PING_TIMEOUT => 9, ReasonCode::USER_REASON => 10, ReasonCode::RESET => 11, ReasonCode::SYNC_FAIL => 12, ReasonCode::FETCH_FAIL => 13, ReasonCode::BAD_TX => 14, ReasonCode::BAD_BLOCK => 15, ReasonCode::FORKED => 16, ReasonCode::UNLINKABLE => 17, ReasonCode::INCOMPATIBLE_VERSION => 18, ReasonCode::INCOMPATIBLE_CHAIN => 19, ReasonCode::TIME_OUT => 20, ReasonCode::CONNECT_FAIL => 21, ReasonCode::TOO_MANY_PEERS_WITH_SAME_IP => 22, ReasonCode::LIGHT_NODE_SYNC_FAIL => 23, ReasonCode::BELOW_THAN_ME => 24, ReasonCode::NOT_WITNESS => 25, ReasonCode::NO_SUCH_MESSAGE => 26, ReasonCode::UNKNOWN => 27, }; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for ReasonCode { fn default() -> Self { ReasonCode::REQUESTED } } impl ReasonCode { fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("ReasonCode") } } static file_descriptor_proto_data: &'static [u8] = b"\ \n\x0fcore/Tron.proto\x12\x08protocol\x1a\x19google/protobuf/any.proto\ \x1a\x13core/Discover.proto\x1a\x1acore/contract/common.proto\"9\n\tAcco\ untId\x12\x12\n\x04name\x18\x01\x20\x01(\x0cR\x04name\x12\x18\n\x07addre\ ss\x18\x02\x20\x01(\x0cR\x07address\"H\n\x04Vote\x12!\n\x0cvote_address\ \x18\x01\x20\x01(\x0cR\x0bvoteAddress\x12\x1d\n\nvote_count\x18\x02\x20\ \x01(\x03R\tvoteCount\"\xb4\x03\n\x08Proposal\x12\x1f\n\x0bproposal_id\ \x18\x01\x20\x01(\x03R\nproposalId\x12)\n\x10proposer_address\x18\x02\ \x20\x01(\x0cR\x0fproposerAddress\x12B\n\nparameters\x18\x03\x20\x03(\ \x0b2\".protocol.Proposal.ParametersEntryR\nparameters\x12'\n\x0fexpirat\ ion_time\x18\x04\x20\x01(\x03R\x0eexpirationTime\x12\x1f\n\x0bcreate_tim\ e\x18\x05\x20\x01(\x03R\ncreateTime\x12\x1c\n\tapprovals\x18\x06\x20\x03\ (\x0cR\tapprovals\x12.\n\x05state\x18\x07\x20\x01(\x0e2\x18.protocol.Pro\ posal.StateR\x05state\x1a=\n\x0fParametersEntry\x12\x10\n\x03key\x18\x01\ \x20\x01(\x03R\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x03R\x05value:\ \x028\x01\"A\n\x05State\x12\x0b\n\x07PENDING\x10\0\x12\x0f\n\x0bDISAPPRO\ VED\x10\x01\x12\x0c\n\x08APPROVED\x10\x02\x12\x0c\n\x08CANCELED\x10\x03\ \"\xa5\x02\n\x08Exchange\x12\x1f\n\x0bexchange_id\x18\x01\x20\x01(\x03R\ \nexchangeId\x12'\n\x0fcreator_address\x18\x02\x20\x01(\x0cR\x0ecreatorA\ ddress\x12\x1f\n\x0bcreate_time\x18\x03\x20\x01(\x03R\ncreateTime\x12$\n\ \x0efirst_token_id\x18\x06\x20\x01(\x0cR\x0cfirstTokenId\x12.\n\x13first\ _token_balance\x18\x07\x20\x01(\x03R\x11firstTokenBalance\x12&\n\x0fseco\ nd_token_id\x18\x08\x20\x01(\x0cR\rsecondTokenId\x120\n\x14second_token_\ balance\x18\t\x20\x01(\x03R\x12secondTokenBalance\"\x98\x04\n\x0bMarketO\ rder\x12\x19\n\x08order_id\x18\x01\x20\x01(\x0cR\x07orderId\x12#\n\rowne\ r_address\x18\x02\x20\x01(\x0cR\x0cownerAddress\x12\x1f\n\x0bcreate_time\ \x18\x03\x20\x01(\x03R\ncreateTime\x12\"\n\rsell_token_id\x18\x04\x20\ \x01(\x0cR\x0bsellTokenId\x12.\n\x13sell_token_quantity\x18\x05\x20\x01(\ \x03R\x11sellTokenQuantity\x12\x20\n\x0cbuy_token_id\x18\x06\x20\x01(\ \x0cR\nbuyTokenId\x12,\n\x12buy_token_quantity\x18\x07\x20\x01(\x03R\x10\ buyTokenQuantity\x12;\n\x1asell_token_quantity_remain\x18\t\x20\x01(\x03\ R\x17sellTokenQuantityRemain\x12;\n\x1asell_token_quantity_return\x18\n\ \x20\x01(\x03R\x17sellTokenQuantityReturn\x121\n\x05state\x18\x0b\x20\ \x01(\x0e2\x1b.protocol.MarketOrder.StateR\x05state\x12\x12\n\x04prev\ \x18\x0c\x20\x01(\x0cR\x04prev\x12\x12\n\x04next\x18\r\x20\x01(\x0cR\x04\ next\"/\n\x05State\x12\n\n\x06ACTIVE\x10\0\x12\x0c\n\x08INACTIVE\x10\x01\ \x12\x0c\n\x08CANCELED\x10\x02\"@\n\x0fMarketOrderList\x12-\n\x06orders\ \x18\x01\x20\x03(\x0b2\x15.protocol.MarketOrderR\x06orders\"N\n\x13Marke\ tOrderPairList\x127\n\torderPair\x18\x01\x20\x03(\x0b2\x19.protocol.Mark\ etOrderPairR\torderPair\"W\n\x0fMarketOrderPair\x12\"\n\rsell_token_id\ \x18\x01\x20\x01(\x0cR\x0bsellTokenId\x12\x20\n\x0cbuy_token_id\x18\x02\ \x20\x01(\x0cR\nbuyTokenId\"\x88\x01\n\x12MarketAccountOrder\x12#\n\rown\ er_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x16\n\x06orders\x18\ \x02\x20\x03(\x0cR\x06orders\x12\x14\n\x05count\x18\x03\x20\x01(\x03R\ \x05count\x12\x1f\n\x0btotal_count\x18\x04\x20\x01(\x03R\ntotalCount\"k\ \n\x0bMarketPrice\x12.\n\x13sell_token_quantity\x18\x01\x20\x01(\x03R\ \x11sellTokenQuantity\x12,\n\x12buy_token_quantity\x18\x02\x20\x01(\x03R\ \x10buyTokenQuantity\"\x86\x01\n\x0fMarketPriceList\x12\"\n\rsell_token_\ id\x18\x01\x20\x01(\x0cR\x0bsellTokenId\x12\x20\n\x0cbuy_token_id\x18\ \x02\x20\x01(\x0cR\nbuyTokenId\x12-\n\x06prices\x18\x03\x20\x03(\x0b2\ \x15.protocol.MarketPriceR\x06prices\";\n\x11MarketOrderIdList\x12\x12\n\ \x04head\x18\x01\x20\x01(\x0cR\x04head\x12\x12\n\x04tail\x18\x02\x20\x01\ (\x0cR\x04tail\"\x9d\x01\n\x0fChainParameters\x12P\n\x0echainParameter\ \x18\x01\x20\x03(\x0b2(.protocol.ChainParameters.ChainParameterR\x0echai\ nParameter\x1a8\n\x0eChainParameter\x12\x10\n\x03key\x18\x01\x20\x01(\tR\ \x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x03R\x05value\"\xca\x1e\n\ \x07Account\x12!\n\x0caccount_name\x18\x01\x20\x01(\x0cR\x0baccountName\ \x12)\n\x04type\x18\x02\x20\x01(\x0e2\x15.protocol.AccountTypeR\x04type\ \x12\x18\n\x07address\x18\x03\x20\x01(\x0cR\x07address\x12\x18\n\x07bala\ nce\x18\x04\x20\x01(\x03R\x07balance\x12$\n\x05votes\x18\x05\x20\x03(\ \x0b2\x0e.protocol.VoteR\x05votes\x122\n\x05asset\x18\x06\x20\x03(\x0b2\ \x1c.protocol.Account.AssetEntryR\x05asset\x128\n\x07assetV2\x188\x20\ \x03(\x0b2\x1e.protocol.Account.AssetV2EntryR\x07assetV2\x120\n\x06froze\ n\x18\x07\x20\x03(\x0b2\x18.protocol.Account.FrozenR\x06frozen\x12\x1b\n\ \tnet_usage\x18\x08\x20\x01(\x03R\x08netUsage\x12c\n/acquired_delegated_\ frozen_balance_for_bandwidth\x18)\x20\x01(\x03R*acquiredDelegatedFrozenB\ alanceForBandwidth\x12R\n&delegated_frozen_balance_for_bandwidth\x18*\ \x20\x01(\x03R\"delegatedFrozenBalanceForBandwidth\x12$\n\x0eold_tron_po\ wer\x18.\x20\x01(\x03R\x0coldTronPower\x127\n\ntron_power\x18/\x20\x01(\ \x0b2\x18.protocol.Account.FrozenR\ttronPower\x12'\n\x0fasset_optimized\ \x18<\x20\x01(\x08R\x0eassetOptimized\x12\x1f\n\x0bcreate_time\x18\t\x20\ \x01(\x03R\ncreateTime\x120\n\x14latest_opration_time\x18\n\x20\x01(\x03\ R\x12latestOprationTime\x12\x1c\n\tallowance\x18\x0b\x20\x01(\x03R\tallo\ wance\x120\n\x14latest_withdraw_time\x18\x0c\x20\x01(\x03R\x12latestWith\ drawTime\x12\x12\n\x04code\x18\r\x20\x01(\x0cR\x04code\x12\x1d\n\nis_wit\ ness\x18\x0e\x20\x01(\x08R\tisWitness\x12!\n\x0cis_committee\x18\x0f\x20\ \x01(\x08R\x0bisCommittee\x12=\n\rfrozen_supply\x18\x10\x20\x03(\x0b2\ \x18.protocol.Account.FrozenR\x0cfrozenSupply\x12*\n\x11asset_issued_nam\ e\x18\x11\x20\x01(\x0cR\x0fassetIssuedName\x12&\n\x0fasset_issued_ID\x18\ 9\x20\x01(\x0cR\rassetIssuedID\x12n\n\x1blatest_asset_operation_time\x18\ \x12\x20\x03(\x0b2/.protocol.Account.LatestAssetOperationTimeEntryR\x18l\ atestAssetOperationTime\x12t\n\x1dlatest_asset_operation_timeV2\x18:\x20\ \x03(\x0b21.protocol.Account.LatestAssetOperationTimeV2EntryR\x1alatestA\ ssetOperationTimeV2\x12$\n\x0efree_net_usage\x18\x13\x20\x01(\x03R\x0cfr\ eeNetUsage\x12Y\n\x14free_asset_net_usage\x18\x14\x20\x03(\x0b2(.protoco\ l.Account.FreeAssetNetUsageEntryR\x11freeAssetNetUsage\x12_\n\x16free_as\ set_net_usageV2\x18;\x20\x03(\x0b2*.protocol.Account.FreeAssetNetUsageV2\ EntryR\x13freeAssetNetUsageV2\x12.\n\x13latest_consume_time\x18\x15\x20\ \x01(\x03R\x11latestConsumeTime\x127\n\x18latest_consume_free_time\x18\ \x16\x20\x01(\x03R\x15latestConsumeFreeTime\x12\x1d\n\naccount_id\x18\ \x17\x20\x01(\x0cR\taccountId\x12&\n\x0fnet_window_size\x18\x18\x20\x01(\ \x03R\rnetWindowSize\x120\n\x14net_window_optimized\x18\x19\x20\x01(\x08\ R\x12netWindowOptimized\x12L\n\x10account_resource\x18\x1a\x20\x01(\x0b2\ !.protocol.Account.AccountResourceR\x0faccountResource\x12\x1a\n\x08code\ Hash\x18\x1e\x20\x01(\x0cR\x08codeHash\x12?\n\x10owner_permission\x18\ \x1f\x20\x01(\x0b2\x14.protocol.PermissionR\x0fownerPermission\x12C\n\ \x12witness_permission\x18\x20\x20\x01(\x0b2\x14.protocol.PermissionR\ \x11witnessPermission\x12A\n\x11active_permission\x18!\x20\x03(\x0b2\x14\ .protocol.PermissionR\x10activePermission\x126\n\x08frozenV2\x18\"\x20\ \x03(\x0b2\x1a.protocol.Account.FreezeV2R\x08frozenV2\x12<\n\nunfrozenV2\ \x18#\x20\x03(\x0b2\x1c.protocol.Account.UnFreezeV2R\nunfrozenV2\x12V\n(\ delegated_frozenV2_balance_for_bandwidth\x18$\x20\x01(\x03R$delegatedFro\ zenV2BalanceForBandwidth\x12g\n1acquired_delegated_frozenV2_balance_for_\ bandwidth\x18%\x20\x01(\x03R,acquiredDelegatedFrozenV2BalanceForBandwidt\ h\x1aP\n\x06Frozen\x12%\n\x0efrozen_balance\x18\x01\x20\x01(\x03R\rfroze\ nBalance\x12\x1f\n\x0bexpire_time\x18\x02\x20\x01(\x03R\nexpireTime\x1a8\ \n\nAssetEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05\ value\x18\x02\x20\x01(\x03R\x05value:\x028\x01\x1a:\n\x0cAssetV2Entry\ \x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\ \x20\x01(\x03R\x05value:\x028\x01\x1aK\n\x1dLatestAssetOperationTimeEntr\ y\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\ \x20\x01(\x03R\x05value:\x028\x01\x1aM\n\x1fLatestAssetOperationTimeV2En\ try\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\ \x02\x20\x01(\x03R\x05value:\x028\x01\x1aD\n\x16FreeAssetNetUsageEntry\ \x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\ \x20\x01(\x03R\x05value:\x028\x01\x1aF\n\x18FreeAssetNetUsageV2Entry\x12\ \x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\x02\x20\ \x01(\x03R\x05value:\x028\x01\x1a\xa0\x06\n\x0fAccountResource\x12!\n\ \x0cenergy_usage\x18\x01\x20\x01(\x03R\x0benergyUsage\x12S\n\x19frozen_b\ alance_for_energy\x18\x02\x20\x01(\x0b2\x18.protocol.Account.FrozenR\x16\ frozenBalanceForEnergy\x12B\n\x1elatest_consume_time_for_energy\x18\x03\ \x20\x01(\x03R\x1alatestConsumeTimeForEnergy\x12]\n,acquired_delegated_f\ rozen_balance_for_energy\x18\x04\x20\x01(\x03R'acquiredDelegatedFrozenBa\ lanceForEnergy\x12L\n#delegated_frozen_balance_for_energy\x18\x05\x20\ \x01(\x03R\x1fdelegatedFrozenBalanceForEnergy\x12#\n\rstorage_limit\x18\ \x06\x20\x01(\x03R\x0cstorageLimit\x12#\n\rstorage_usage\x18\x07\x20\x01\ (\x03R\x0cstorageUsage\x12?\n\x1clatest_exchange_storage_time\x18\x08\ \x20\x01(\x03R\x19latestExchangeStorageTime\x12,\n\x12energy_window_size\ \x18\t\x20\x01(\x03R\x10energyWindowSize\x12P\n%delegated_frozenV2_balan\ ce_for_energy\x18\n\x20\x01(\x03R!delegatedFrozenV2BalanceForEnergy\x12a\ \n.acquired_delegated_frozenV2_balance_for_energy\x18\x0b\x20\x01(\x03R)\ acquiredDelegatedFrozenV2BalanceForEnergy\x126\n\x17energy_window_optimi\ zed\x18\x0c\x20\x01(\x08R\x15energyWindowOptimized\x1aN\n\x08FreezeV2\ \x12*\n\x04type\x18\x01\x20\x01(\x0e2\x16.protocol.ResourceCodeR\x04type\ \x12\x16\n\x06amount\x18\x02\x20\x01(\x03R\x06amount\x1a\x93\x01\n\nUnFr\ eezeV2\x12*\n\x04type\x18\x01\x20\x01(\x0e2\x16.protocol.ResourceCodeR\ \x04type\x12'\n\x0funfreeze_amount\x18\x03\x20\x01(\x03R\x0eunfreezeAmou\ nt\x120\n\x14unfreeze_expire_time\x18\x04\x20\x01(\x03R\x12unfreezeExpir\ eTime\"7\n\x03Key\x12\x18\n\x07address\x18\x01\x20\x01(\x0cR\x07address\ \x12\x16\n\x06weight\x18\x02\x20\x01(\x03R\x06weight\"\xa3\x02\n\x11Dele\ gatedResource\x12\x12\n\x04from\x18\x01\x20\x01(\x0cR\x04from\x12\x0e\n\ \x02to\x18\x02\x20\x01(\x0cR\x02to\x12?\n\x1cfrozen_balance_for_bandwidt\ h\x18\x03\x20\x01(\x03R\x19frozenBalanceForBandwidth\x129\n\x19frozen_ba\ lance_for_energy\x18\x04\x20\x01(\x03R\x16frozenBalanceForEnergy\x129\n\ \x19expire_time_for_bandwidth\x18\x05\x20\x01(\x03R\x16expireTimeForBand\ width\x123\n\x16expire_time_for_energy\x18\x06\x20\x01(\x03R\x13expireTi\ meForEnergy\"c\n\tauthority\x12-\n\x07account\x18\x01\x20\x01(\x0b2\x13.\ protocol.AccountIdR\x07account\x12'\n\x0fpermission_name\x18\x02\x20\x01\ (\x0cR\x0epermissionName\"\xb2\x02\n\nPermission\x127\n\x04type\x18\x01\ \x20\x01(\x0e2#.protocol.Permission.PermissionTypeR\x04type\x12\x0e\n\ \x02id\x18\x02\x20\x01(\x05R\x02id\x12'\n\x0fpermission_name\x18\x03\x20\ \x01(\tR\x0epermissionName\x12\x1c\n\tthreshold\x18\x04\x20\x01(\x03R\tt\ hreshold\x12\x1b\n\tparent_id\x18\x05\x20\x01(\x05R\x08parentId\x12\x1e\ \n\noperations\x18\x06\x20\x01(\x0cR\noperations\x12!\n\x04keys\x18\x07\ \x20\x03(\x0b2\r.protocol.KeyR\x04keys\"4\n\x0ePermissionType\x12\t\n\ \x05Owner\x10\0\x12\x0b\n\x07Witness\x10\x01\x12\n\n\x06Active\x10\x02\"\ \x99\x02\n\x07Witness\x12\x18\n\x07address\x18\x01\x20\x01(\x0cR\x07addr\ ess\x12\x1c\n\tvoteCount\x18\x02\x20\x01(\x03R\tvoteCount\x12\x16\n\x06p\ ubKey\x18\x03\x20\x01(\x0cR\x06pubKey\x12\x10\n\x03url\x18\x04\x20\x01(\ \tR\x03url\x12$\n\rtotalProduced\x18\x05\x20\x01(\x03R\rtotalProduced\ \x12\x20\n\x0btotalMissed\x18\x06\x20\x01(\x03R\x0btotalMissed\x12&\n\ \x0elatestBlockNum\x18\x07\x20\x01(\x03R\x0elatestBlockNum\x12$\n\rlates\ tSlotNum\x18\x08\x20\x01(\x03R\rlatestSlotNum\x12\x16\n\x06isJobs\x18\t\ \x20\x01(\x08R\x06isJobs\"{\n\x05Votes\x12\x18\n\x07address\x18\x01\x20\ \x01(\x0cR\x07address\x12+\n\told_votes\x18\x02\x20\x03(\x0b2\x0e.protoc\ ol.VoteR\x08oldVotes\x12+\n\tnew_votes\x18\x03\x20\x03(\x0b2\x0e.protoco\ l.VoteR\x08newVotes\"@\n\x08TXOutput\x12\x14\n\x05value\x18\x01\x20\x01(\ \x03R\x05value\x12\x1e\n\npubKeyHash\x18\x02\x20\x01(\x0cR\npubKeyHash\"\ \xa0\x01\n\x07TXInput\x120\n\x08raw_data\x18\x01\x20\x01(\x0b2\x15.proto\ col.TXInput.rawR\x07rawData\x12\x1c\n\tsignature\x18\x04\x20\x01(\x0cR\t\ signature\x1aE\n\x03raw\x12\x12\n\x04txID\x18\x01\x20\x01(\x0cR\x04txID\ \x12\x12\n\x04vout\x18\x02\x20\x01(\x03R\x04vout\x12\x16\n\x06pubKey\x18\ \x03\x20\x01(\x0cR\x06pubKey\"9\n\tTXOutputs\x12,\n\x07outputs\x18\x01\ \x20\x03(\x0b2\x12.protocol.TXOutputR\x07outputs\"\xde\x02\n\x0fResource\ Receipt\x12!\n\x0cenergy_usage\x18\x01\x20\x01(\x03R\x0benergyUsage\x12\ \x1d\n\nenergy_fee\x18\x02\x20\x01(\x03R\tenergyFee\x12.\n\x13origin_ene\ rgy_usage\x18\x03\x20\x01(\x03R\x11originEnergyUsage\x12,\n\x12energy_us\ age_total\x18\x04\x20\x01(\x03R\x10energyUsageTotal\x12\x1b\n\tnet_usage\ \x18\x05\x20\x01(\x03R\x08netUsage\x12\x17\n\x07net_fee\x18\x06\x20\x01(\ \x03R\x06netFee\x12C\n\x06result\x18\x07\x20\x01(\x0e2+.protocol.Transac\ tion.Result.contractResultR\x06result\x120\n\x14energy_penalty_total\x18\ \x08\x20\x01(\x03R\x12energyPenaltyTotal\"\xb1\x01\n\x11MarketOrderDetai\ l\x12\"\n\x0cmakerOrderId\x18\x01\x20\x01(\x0cR\x0cmakerOrderId\x12\"\n\ \x0ctakerOrderId\x18\x02\x20\x01(\x0cR\x0ctakerOrderId\x12*\n\x10fillSel\ lQuantity\x18\x03\x20\x01(\x03R\x10fillSellQuantity\x12(\n\x0ffillBuyQua\ ntity\x18\x04\x20\x01(\x03R\x0ffillBuyQuantity\"\xdd\x18\n\x0bTransactio\ n\x124\n\x08raw_data\x18\x01\x20\x01(\x0b2\x19.protocol.Transaction.rawR\ \x07rawData\x12\x1c\n\tsignature\x18\x02\x20\x03(\x0cR\tsignature\x12.\n\ \x03ret\x18\x05\x20\x03(\x0b2\x1c.protocol.Transaction.ResultR\x03ret\ \x1a\xef\n\n\x08Contract\x12?\n\x04type\x18\x01\x20\x01(\x0e2+.protocol.\ Transaction.Contract.ContractTypeR\x04type\x122\n\tparameter\x18\x02\x20\ \x01(\x0b2\x14.google.protobuf.AnyR\tparameter\x12\x1a\n\x08provider\x18\ \x03\x20\x01(\x0cR\x08provider\x12\"\n\x0cContractName\x18\x04\x20\x01(\ \x0cR\x0cContractName\x12#\n\rPermission_id\x18\x05\x20\x01(\x05R\x0cPer\ missionId\"\x88\t\n\x0cContractType\x12\x19\n\x15AccountCreateContract\ \x10\0\x12\x14\n\x10TransferContract\x10\x01\x12\x19\n\x15TransferAssetC\ ontract\x10\x02\x12\x15\n\x11VoteAssetContract\x10\x03\x12\x17\n\x13Vote\ WitnessContract\x10\x04\x12\x19\n\x15WitnessCreateContract\x10\x05\x12\ \x16\n\x12AssetIssueContract\x10\x06\x12\x19\n\x15WitnessUpdateContract\ \x10\x08\x12!\n\x1dParticipateAssetIssueContract\x10\t\x12\x19\n\x15Acco\ untUpdateContract\x10\n\x12\x19\n\x15FreezeBalanceContract\x10\x0b\x12\ \x1b\n\x17UnfreezeBalanceContract\x10\x0c\x12\x1b\n\x17WithdrawBalanceCo\ ntract\x10\r\x12\x19\n\x15UnfreezeAssetContract\x10\x0e\x12\x17\n\x13Upd\ ateAssetContract\x10\x0f\x12\x1a\n\x16ProposalCreateContract\x10\x10\x12\ \x1b\n\x17ProposalApproveContract\x10\x11\x12\x1a\n\x16ProposalDeleteCon\ tract\x10\x12\x12\x18\n\x14SetAccountIdContract\x10\x13\x12\x12\n\x0eCus\ tomContract\x10\x14\x12\x17\n\x13CreateSmartContract\x10\x1e\x12\x18\n\ \x14TriggerSmartContract\x10\x1f\x12\x0f\n\x0bGetContract\x10\x20\x12\ \x19\n\x15UpdateSettingContract\x10!\x12\x1a\n\x16ExchangeCreateContract\ \x10)\x12\x1a\n\x16ExchangeInjectContract\x10*\x12\x1c\n\x18ExchangeWith\ drawContract\x10+\x12\x1f\n\x1bExchangeTransactionContract\x10,\x12\x1d\ \n\x19UpdateEnergyLimitContract\x10-\x12#\n\x1fAccountPermissionUpdateCo\ ntract\x10.\x12\x14\n\x10ClearABIContract\x100\x12\x1b\n\x17UpdateBroker\ ageContract\x101\x12\x1c\n\x18ShieldedTransferContract\x103\x12\x1b\n\ \x17MarketSellAssetContract\x104\x12\x1d\n\x19MarketCancelOrderContract\ \x105\x12\x1b\n\x17FreezeBalanceV2Contract\x106\x12\x1d\n\x19UnfreezeBal\ anceV2Contract\x107\x12\"\n\x1eWithdrawExpireUnfreezeContract\x108\x12\ \x1c\n\x18DelegateResourceContract\x109\x12\x1e\n\x1aUnDelegateResourceC\ ontract\x10:\x12\x1f\n\x1bCancelAllUnfreezeV2Contract\x10;\x1a\xed\t\n\ \x06Result\x12\x10\n\x03fee\x18\x01\x20\x01(\x03R\x03fee\x123\n\x03ret\ \x18\x02\x20\x01(\x0e2!.protocol.Transaction.Result.codeR\x03ret\x12M\n\ \x0bcontractRet\x18\x03\x20\x01(\x0e2+.protocol.Transaction.Result.contr\ actResultR\x0bcontractRet\x12\"\n\x0cassetIssueID\x18\x0e\x20\x01(\tR\ \x0cassetIssueID\x12'\n\x0fwithdraw_amount\x18\x0f\x20\x01(\x03R\x0ewith\ drawAmount\x12'\n\x0funfreeze_amount\x18\x10\x20\x01(\x03R\x0eunfreezeAm\ ount\x128\n\x18exchange_received_amount\x18\x12\x20\x01(\x03R\x16exchang\ eReceivedAmount\x12C\n\x1eexchange_inject_another_amount\x18\x13\x20\x01\ (\x03R\x1bexchangeInjectAnotherAmount\x12G\n\x20exchange_withdraw_anothe\ r_amount\x18\x14\x20\x01(\x03R\x1dexchangeWithdrawAnotherAmount\x12\x1f\ \n\x0bexchange_id\x18\x15\x20\x01(\x03R\nexchangeId\x128\n\x18shielded_t\ ransaction_fee\x18\x16\x20\x01(\x03R\x16shieldedTransactionFee\x12\x18\n\ \x07orderId\x18\x19\x20\x01(\x0cR\x07orderId\x12?\n\x0corderDetails\x18\ \x1a\x20\x03(\x0b2\x1b.protocol.MarketOrderDetailR\x0corderDetails\x124\ \n\x16withdraw_expire_amount\x18\x1b\x20\x01(\x03R\x14withdrawExpireAmou\ nt\x12r\n\x18cancel_unfreezeV2_amount\x18\x1c\x20\x03(\x0b28.protocol.Tr\ ansaction.Result.CancelUnfreezeV2AmountEntryR\x16cancelUnfreezeV2Amount\ \x1aI\n\x1bCancelUnfreezeV2AmountEntry\x12\x10\n\x03key\x18\x01\x20\x01(\ \tR\x03key\x12\x14\n\x05value\x18\x02\x20\x01(\x03R\x05value:\x028\x01\"\ \x1e\n\x04code\x12\n\n\x06SUCESS\x10\0\x12\n\n\x06FAILED\x10\x01\"\xc3\ \x02\n\x0econtractResult\x12\x0b\n\x07DEFAULT\x10\0\x12\x0b\n\x07SUCCESS\ \x10\x01\x12\n\n\x06REVERT\x10\x02\x12\x18\n\x14BAD_JUMP_DESTINATION\x10\ \x03\x12\x11\n\rOUT_OF_MEMORY\x10\x04\x12\x18\n\x14PRECOMPILED_CONTRACT\ \x10\x05\x12\x13\n\x0fSTACK_TOO_SMALL\x10\x06\x12\x13\n\x0fSTACK_TOO_LAR\ GE\x10\x07\x12\x15\n\x11ILLEGAL_OPERATION\x10\x08\x12\x12\n\x0eSTACK_OVE\ RFLOW\x10\t\x12\x11\n\rOUT_OF_ENERGY\x10\n\x12\x0f\n\x0bOUT_OF_TIME\x10\ \x0b\x12\x17\n\x13JVM_STACK_OVER_FLOW\x10\x0c\x12\x0b\n\x07UNKNOWN\x10\r\ \x12\x13\n\x0fTRANSFER_FAILED\x10\x0e\x12\x10\n\x0cINVALID_CODE\x10\x0f\ \x1a\xe7\x02\n\x03raw\x12&\n\x0fref_block_bytes\x18\x01\x20\x01(\x0cR\rr\ efBlockBytes\x12\"\n\rref_block_num\x18\x03\x20\x01(\x03R\x0brefBlockNum\ \x12$\n\x0eref_block_hash\x18\x04\x20\x01(\x0cR\x0crefBlockHash\x12\x1e\ \n\nexpiration\x18\x08\x20\x01(\x03R\nexpiration\x12)\n\x05auths\x18\t\ \x20\x03(\x0b2\x13.protocol.authorityR\x05auths\x12\x12\n\x04data\x18\n\ \x20\x01(\x0cR\x04data\x12:\n\x08contract\x18\x0b\x20\x03(\x0b2\x1e.prot\ ocol.Transaction.ContractR\x08contract\x12\x18\n\x07scripts\x18\x0c\x20\ \x01(\x0cR\x07scripts\x12\x1c\n\ttimestamp\x18\x0e\x20\x01(\x03R\ttimest\ amp\x12\x1b\n\tfee_limit\x18\x12\x20\x01(\x03R\x08feeLimit\"\xd5\n\n\x0f\ TransactionInfo\x12\x0e\n\x02id\x18\x01\x20\x01(\x0cR\x02id\x12\x10\n\ \x03fee\x18\x02\x20\x01(\x03R\x03fee\x12\x20\n\x0bblockNumber\x18\x03\ \x20\x01(\x03R\x0bblockNumber\x12&\n\x0eblockTimeStamp\x18\x04\x20\x01(\ \x03R\x0eblockTimeStamp\x12&\n\x0econtractResult\x18\x05\x20\x03(\x0cR\ \x0econtractResult\x12)\n\x10contract_address\x18\x06\x20\x01(\x0cR\x0fc\ ontractAddress\x123\n\x07receipt\x18\x07\x20\x01(\x0b2\x19.protocol.Reso\ urceReceiptR\x07receipt\x12/\n\x03log\x18\x08\x20\x03(\x0b2\x1d.protocol\ .TransactionInfo.LogR\x03log\x126\n\x06result\x18\t\x20\x01(\x0e2\x1e.pr\ otocol.TransactionInfo.codeR\x06result\x12\x1e\n\nresMessage\x18\n\x20\ \x01(\x0cR\nresMessage\x12\"\n\x0cassetIssueID\x18\x0e\x20\x01(\tR\x0cas\ setIssueID\x12'\n\x0fwithdraw_amount\x18\x0f\x20\x01(\x03R\x0ewithdrawAm\ ount\x12'\n\x0funfreeze_amount\x18\x10\x20\x01(\x03R\x0eunfreezeAmount\ \x12R\n\x15internal_transactions\x18\x11\x20\x03(\x0b2\x1d.protocol.Inte\ rnalTransactionR\x14internalTransactions\x128\n\x18exchange_received_amo\ unt\x18\x12\x20\x01(\x03R\x16exchangeReceivedAmount\x12C\n\x1eexchange_i\ nject_another_amount\x18\x13\x20\x01(\x03R\x1bexchangeInjectAnotherAmoun\ t\x12G\n\x20exchange_withdraw_another_amount\x18\x14\x20\x01(\x03R\x1dex\ changeWithdrawAnotherAmount\x12\x1f\n\x0bexchange_id\x18\x15\x20\x01(\ \x03R\nexchangeId\x128\n\x18shielded_transaction_fee\x18\x16\x20\x01(\ \x03R\x16shieldedTransactionFee\x12\x18\n\x07orderId\x18\x19\x20\x01(\ \x0cR\x07orderId\x12?\n\x0corderDetails\x18\x1a\x20\x03(\x0b2\x1b.protoc\ ol.MarketOrderDetailR\x0corderDetails\x12\x1e\n\npackingFee\x18\x1b\x20\ \x01(\x03R\npackingFee\x124\n\x16withdraw_expire_amount\x18\x1c\x20\x01(\ \x03R\x14withdrawExpireAmount\x12o\n\x18cancel_unfreezeV2_amount\x18\x1d\ \x20\x03(\x0b25.protocol.TransactionInfo.CancelUnfreezeV2AmountEntryR\ \x16cancelUnfreezeV2Amount\x1aK\n\x03Log\x12\x18\n\x07address\x18\x01\ \x20\x01(\x0cR\x07address\x12\x16\n\x06topics\x18\x02\x20\x03(\x0cR\x06t\ opics\x12\x12\n\x04data\x18\x03\x20\x01(\x0cR\x04data\x1aI\n\x1bCancelUn\ freezeV2AmountEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\ \n\x05value\x18\x02\x20\x01(\x03R\x05value:\x028\x01\"\x1e\n\x04code\x12\ \n\n\x06SUCESS\x10\0\x12\n\n\x06FAILED\x10\x01\"\x9f\x01\n\x0eTransactio\ nRet\x12\x20\n\x0bblockNumber\x18\x01\x20\x01(\x03R\x0bblockNumber\x12&\ \n\x0eblockTimeStamp\x18\x02\x20\x01(\x03R\x0eblockTimeStamp\x12C\n\x0ft\ ransactioninfo\x18\x03\x20\x03(\x0b2\x19.protocol.TransactionInfoR\x0ftr\ ansactioninfo\"I\n\x0cTransactions\x129\n\x0ctransactions\x18\x01\x20\ \x03(\x0b2\x15.protocol.TransactionR\x0ctransactions\"\xfc\x02\n\x0bBloc\ kHeader\x124\n\x08raw_data\x18\x01\x20\x01(\x0b2\x19.protocol.BlockHeade\ r.rawR\x07rawData\x12+\n\x11witness_signature\x18\x02\x20\x01(\x0cR\x10w\ itnessSignature\x1a\x89\x02\n\x03raw\x12\x1c\n\ttimestamp\x18\x01\x20\ \x01(\x03R\ttimestamp\x12\x1e\n\ntxTrieRoot\x18\x02\x20\x01(\x0cR\ntxTri\ eRoot\x12\x1e\n\nparentHash\x18\x03\x20\x01(\x0cR\nparentHash\x12\x16\n\ \x06number\x18\x07\x20\x01(\x03R\x06number\x12\x1d\n\nwitness_id\x18\x08\ \x20\x01(\x03R\twitnessId\x12'\n\x0fwitness_address\x18\t\x20\x01(\x0cR\ \x0ewitnessAddress\x12\x18\n\x07version\x18\n\x20\x01(\x05R\x07version\ \x12*\n\x10accountStateRoot\x18\x0b\x20\x01(\x0cR\x10accountStateRoot\"|\ \n\x05Block\x129\n\x0ctransactions\x18\x01\x20\x03(\x0b2\x15.protocol.Tr\ ansactionR\x0ctransactions\x128\n\x0cblock_header\x18\x02\x20\x01(\x0b2\ \x15.protocol.BlockHeaderR\x0bblockHeader\"\x9a\x01\n\x0eChainInventory\ \x122\n\x03ids\x18\x01\x20\x03(\x0b2\x20.protocol.ChainInventory.BlockId\ R\x03ids\x12\x1d\n\nremain_num\x18\x02\x20\x01(\x03R\tremainNum\x1a5\n\ \x07BlockId\x12\x12\n\x04hash\x18\x01\x20\x01(\x0cR\x04hash\x12\x16\n\ \x06number\x18\x02\x20\x01(\x03R\x06number\"\xd8\x01\n\x0eBlockInventory\ \x122\n\x03ids\x18\x01\x20\x03(\x0b2\x20.protocol.BlockInventory.BlockId\ R\x03ids\x121\n\x04type\x18\x02\x20\x01(\x0e2\x1d.protocol.BlockInventor\ y.TypeR\x04type\x1a5\n\x07BlockId\x12\x12\n\x04hash\x18\x01\x20\x01(\x0c\ R\x04hash\x12\x16\n\x06number\x18\x02\x20\x01(\x03R\x06number\"(\n\x04Ty\ pe\x12\x08\n\x04SYNC\x10\0\x12\x0b\n\x07ADVTISE\x10\x01\x12\t\n\x05FETCH\ \x10\x02\"y\n\tInventory\x125\n\x04type\x18\x01\x20\x01(\x0e2!.protocol.\ Inventory.InventoryTypeR\x04type\x12\x10\n\x03ids\x18\x02\x20\x03(\x0cR\ \x03ids\"#\n\rInventoryType\x12\x07\n\x03TRX\x10\0\x12\t\n\x05BLOCK\x10\ \x01\"\x8f\x02\n\x05Items\x12,\n\x04type\x18\x01\x20\x01(\x0e2\x18.proto\ col.Items.ItemTypeR\x04type\x12'\n\x06blocks\x18\x02\x20\x03(\x0b2\x0f.p\ rotocol.BlockR\x06blocks\x12:\n\rblock_headers\x18\x03\x20\x03(\x0b2\x15\ .protocol.BlockHeaderR\x0cblockHeaders\x129\n\x0ctransactions\x18\x04\ \x20\x03(\x0b2\x15.protocol.TransactionR\x0ctransactions\"8\n\x08ItemTyp\ e\x12\x07\n\x03ERR\x10\0\x12\x07\n\x03TRX\x10\x01\x12\t\n\x05BLOCK\x10\ \x02\x12\x0f\n\x0bBLOCKHEADER\x10\x03\"J\n\x11DynamicProperties\x125\n\ \x17last_solidity_block_num\x18\x01\x20\x01(\x03R\x14lastSolidityBlockNu\ m\"A\n\x11DisconnectMessage\x12,\n\x06reason\x18\x01\x20\x01(\x0e2\x14.p\ rotocol.ReasonCodeR\x06reason\"\xef\x03\n\x0cHelloMessage\x12&\n\x04from\ \x18\x01\x20\x01(\x0b2\x12.protocol.EndpointR\x04from\x12\x18\n\x07versi\ on\x18\x02\x20\x01(\x05R\x07version\x12\x1c\n\ttimestamp\x18\x03\x20\x01\ (\x03R\ttimestamp\x12F\n\x0egenesisBlockId\x18\x04\x20\x01(\x0b2\x1e.pro\ tocol.HelloMessage.BlockIdR\x0egenesisBlockId\x12B\n\x0csolidBlockId\x18\ \x05\x20\x01(\x0b2\x1e.protocol.HelloMessage.BlockIdR\x0csolidBlockId\ \x12@\n\x0bheadBlockId\x18\x06\x20\x01(\x0b2\x1e.protocol.HelloMessage.B\ lockIdR\x0bheadBlockId\x12\x18\n\x07address\x18\x07\x20\x01(\x0cR\x07add\ ress\x12\x1c\n\tsignature\x18\x08\x20\x01(\x0cR\tsignature\x12\x1a\n\x08\ nodeType\x18\t\x20\x01(\x05R\x08nodeType\x12&\n\x0elowestBlockNum\x18\n\ \x20\x01(\x03R\x0elowestBlockNum\x1a5\n\x07BlockId\x12\x12\n\x04hash\x18\ \x01\x20\x01(\x0cR\x04hash\x12\x16\n\x06number\x18\x02\x20\x01(\x03R\x06\ number\"\xe1\x02\n\x13InternalTransaction\x12\x12\n\x04hash\x18\x01\x20\ \x01(\x0cR\x04hash\x12%\n\x0ecaller_address\x18\x02\x20\x01(\x0cR\rcalle\ rAddress\x12-\n\x12transferTo_address\x18\x03\x20\x01(\x0cR\x11transferT\ oAddress\x12Q\n\rcallValueInfo\x18\x04\x20\x03(\x0b2+.protocol.InternalT\ ransaction.CallValueInfoR\rcallValueInfo\x12\x12\n\x04note\x18\x05\x20\ \x01(\x0cR\x04note\x12\x1a\n\x08rejected\x18\x06\x20\x01(\x08R\x08reject\ ed\x12\x14\n\x05extra\x18\x07\x20\x01(\tR\x05extra\x1aG\n\rCallValueInfo\ \x12\x1c\n\tcallValue\x18\x01\x20\x01(\x03R\tcallValue\x12\x18\n\x07toke\ nId\x18\x02\x20\x01(\tR\x07tokenId\"\x9b\x01\n\x1dDelegatedResourceAccou\ ntIndex\x12\x18\n\x07account\x18\x01\x20\x01(\x0cR\x07account\x12\"\n\ \x0cfromAccounts\x18\x02\x20\x03(\x0cR\x0cfromAccounts\x12\x1e\n\ntoAcco\ unts\x18\x03\x20\x03(\x0cR\ntoAccounts\x12\x1c\n\ttimestamp\x18\x04\x20\ \x01(\x03R\ttimestamp\"\xbd\x1a\n\x08NodeInfo\x12\"\n\x0cbeginSyncNum\ \x18\x01\x20\x01(\x03R\x0cbeginSyncNum\x12\x14\n\x05block\x18\x02\x20\ \x01(\tR\x05block\x12$\n\rsolidityBlock\x18\x03\x20\x01(\tR\rsolidityBlo\ ck\x120\n\x13currentConnectCount\x18\x04\x20\x01(\x05R\x13currentConnect\ Count\x12.\n\x12activeConnectCount\x18\x05\x20\x01(\x05R\x12activeConnec\ tCount\x120\n\x13passiveConnectCount\x18\x06\x20\x01(\x05R\x13passiveCon\ nectCount\x12\x1c\n\ttotalFlow\x18\x07\x20\x01(\x03R\ttotalFlow\x12?\n\ \x0cpeerInfoList\x18\x08\x20\x03(\x0b2\x1b.protocol.NodeInfo.PeerInfoR\ \x0cpeerInfoList\x12I\n\x0econfigNodeInfo\x18\t\x20\x01(\x0b2!.protocol.\ NodeInfo.ConfigNodeInfoR\x0econfigNodeInfo\x12@\n\x0bmachineInfo\x18\n\ \x20\x01(\x0b2\x1e.protocol.NodeInfo.MachineInfoR\x0bmachineInfo\x12]\n\ \x13cheatWitnessInfoMap\x18\x0b\x20\x03(\x0b2+.protocol.NodeInfo.CheatWi\ tnessInfoMapEntryR\x13cheatWitnessInfoMap\x1aF\n\x18CheatWitnessInfoMapE\ ntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x14\n\x05value\x18\ \x02\x20\x01(\tR\x05value:\x028\x01\x1a\xc8\x07\n\x08PeerInfo\x12$\n\rla\ stSyncBlock\x18\x01\x20\x01(\tR\rlastSyncBlock\x12\x1c\n\tremainNum\x18\ \x02\x20\x01(\x03R\tremainNum\x120\n\x13lastBlockUpdateTime\x18\x03\x20\ \x01(\x03R\x13lastBlockUpdateTime\x12\x1a\n\x08syncFlag\x18\x04\x20\x01(\ \x08R\x08syncFlag\x128\n\x17headBlockTimeWeBothHave\x18\x05\x20\x01(\x03\ R\x17headBlockTimeWeBothHave\x12*\n\x10needSyncFromPeer\x18\x06\x20\x01(\ \x08R\x10needSyncFromPeer\x12&\n\x0eneedSyncFromUs\x18\x07\x20\x01(\x08R\ \x0eneedSyncFromUs\x12\x12\n\x04host\x18\x08\x20\x01(\tR\x04host\x12\x12\ \n\x04port\x18\t\x20\x01(\x05R\x04port\x12\x16\n\x06nodeId\x18\n\x20\x01\ (\tR\x06nodeId\x12\x20\n\x0bconnectTime\x18\x0b\x20\x01(\x03R\x0bconnect\ Time\x12\x1e\n\navgLatency\x18\x0c\x20\x01(\x01R\navgLatency\x12(\n\x0fs\ yncToFetchSize\x18\r\x20\x01(\x05R\x0fsyncToFetchSize\x126\n\x16syncToFe\ tchSizePeekNum\x18\x0e\x20\x01(\x03R\x16syncToFetchSizePeekNum\x126\n\ \x16syncBlockRequestedSize\x18\x0f\x20\x01(\x05R\x16syncBlockRequestedSi\ ze\x12$\n\runFetchSynNum\x18\x10\x20\x01(\x03R\runFetchSynNum\x12(\n\x0f\ blockInPorcSize\x18\x11\x20\x01(\x05R\x0fblockInPorcSize\x120\n\x13headB\ lockWeBothHave\x18\x12\x20\x01(\tR\x13headBlockWeBothHave\x12\x1a\n\x08i\ sActive\x18\x13\x20\x01(\x08R\x08isActive\x12\x14\n\x05score\x18\x14\x20\ \x01(\x05R\x05score\x12\x1c\n\tnodeCount\x18\x15\x20\x01(\x05R\tnodeCoun\ t\x12\x16\n\x06inFlow\x18\x16\x20\x01(\x03R\x06inFlow\x12(\n\x0fdisconne\ ctTimes\x18\x17\x20\x01(\x05R\x0fdisconnectTimes\x124\n\x15localDisconne\ ctReason\x18\x18\x20\x01(\tR\x15localDisconnectReason\x126\n\x16remoteDi\ sconnectReason\x18\x19\x20\x01(\tR\x16remoteDisconnectReason\x1a\xa2\x06\ \n\x0eConfigNodeInfo\x12\x20\n\x0bcodeVersion\x18\x01\x20\x01(\tR\x0bcod\ eVersion\x12\x1e\n\np2pVersion\x18\x02\x20\x01(\tR\np2pVersion\x12\x1e\n\ \nlistenPort\x18\x03\x20\x01(\x05R\nlistenPort\x12&\n\x0ediscoverEnable\ \x18\x04\x20\x01(\x08R\x0ediscoverEnable\x12&\n\x0eactiveNodeSize\x18\ \x05\x20\x01(\x05R\x0eactiveNodeSize\x12(\n\x0fpassiveNodeSize\x18\x06\ \x20\x01(\x05R\x0fpassiveNodeSize\x12\"\n\x0csendNodeSize\x18\x07\x20\ \x01(\x05R\x0csendNodeSize\x12(\n\x0fmaxConnectCount\x18\x08\x20\x01(\ \x05R\x0fmaxConnectCount\x124\n\x15sameIpMaxConnectCount\x18\t\x20\x01(\ \x05R\x15sameIpMaxConnectCount\x12*\n\x10backupListenPort\x18\n\x20\x01(\ \x05R\x10backupListenPort\x12*\n\x10backupMemberSize\x18\x0b\x20\x01(\ \x05R\x10backupMemberSize\x12&\n\x0ebackupPriority\x18\x0c\x20\x01(\x05R\ \x0ebackupPriority\x12\x1c\n\tdbVersion\x18\r\x20\x01(\x05R\tdbVersion\ \x122\n\x14minParticipationRate\x18\x0e\x20\x01(\x05R\x14minParticipatio\ nRate\x12(\n\x0fsupportConstant\x18\x0f\x20\x01(\x08R\x0fsupportConstant\ \x12\"\n\x0cminTimeRatio\x18\x10\x20\x01(\x01R\x0cminTimeRatio\x12\"\n\ \x0cmaxTimeRatio\x18\x11\x20\x01(\x01R\x0cmaxTimeRatio\x12:\n\x18allowCr\ eationOfContracts\x18\x12\x20\x01(\x03R\x18allowCreationOfContracts\x120\ \n\x13allowAdaptiveEnergy\x18\x13\x20\x01(\x03R\x13allowAdaptiveEnergy\ \x1a\xb9\x07\n\x0bMachineInfo\x12\x20\n\x0bthreadCount\x18\x01\x20\x01(\ \x05R\x0bthreadCount\x120\n\x13deadLockThreadCount\x18\x02\x20\x01(\x05R\ \x13deadLockThreadCount\x12\x1a\n\x08cpuCount\x18\x03\x20\x01(\x05R\x08c\ puCount\x12\x20\n\x0btotalMemory\x18\x04\x20\x01(\x03R\x0btotalMemory\ \x12\x1e\n\nfreeMemory\x18\x05\x20\x01(\x03R\nfreeMemory\x12\x18\n\x07cp\ uRate\x18\x06\x20\x01(\x01R\x07cpuRate\x12\x20\n\x0bjavaVersion\x18\x07\ \x20\x01(\tR\x0bjavaVersion\x12\x16\n\x06osName\x18\x08\x20\x01(\tR\x06o\ sName\x12&\n\x0ejvmTotalMemory\x18\t\x20\x01(\x03R\x0ejvmTotalMemory\x12\ $\n\rjvmFreeMemory\x18\n\x20\x01(\x03R\rjvmFreeMemory\x12&\n\x0eprocessC\ puRate\x18\x0b\x20\x01(\x01R\x0eprocessCpuRate\x12]\n\x12memoryDescInfoL\ ist\x18\x0c\x20\x03(\x0b2-.protocol.NodeInfo.MachineInfo.MemoryDescInfoR\ \x12memoryDescInfoList\x12i\n\x16deadLockThreadInfoList\x18\r\x20\x03(\ \x0b21.protocol.NodeInfo.MachineInfo.DeadLockThreadInfoR\x16deadLockThre\ adInfoList\x1a\x8e\x01\n\x0eMemoryDescInfo\x12\x12\n\x04name\x18\x01\x20\ \x01(\tR\x04name\x12\x1a\n\x08initSize\x18\x02\x20\x01(\x03R\x08initSize\ \x12\x18\n\x07useSize\x18\x03\x20\x01(\x03R\x07useSize\x12\x18\n\x07maxS\ ize\x18\x04\x20\x01(\x03R\x07maxSize\x12\x18\n\x07useRate\x18\x05\x20\ \x01(\x01R\x07useRate\x1a\xd2\x01\n\x12DeadLockThreadInfo\x12\x12\n\x04n\ ame\x18\x01\x20\x01(\tR\x04name\x12\x1a\n\x08lockName\x18\x02\x20\x01(\t\ R\x08lockName\x12\x1c\n\tlockOwner\x18\x03\x20\x01(\tR\tlockOwner\x12\ \x14\n\x05state\x18\x04\x20\x01(\tR\x05state\x12\x1c\n\tblockTime\x18\ \x05\x20\x01(\x03R\tblockTime\x12\x1a\n\x08waitTime\x18\x06\x20\x01(\x03\ R\x08waitTime\x12\x1e\n\nstackTrace\x18\x07\x20\x01(\tR\nstackTrace\"\ \xc0\x18\n\x0bMetricsInfo\x12\x1a\n\x08interval\x18\x01\x20\x01(\x03R\ \x08interval\x122\n\x04node\x18\x02\x20\x01(\x0b2\x1e.protocol.MetricsIn\ fo.NodeInfoR\x04node\x12D\n\nblockchain\x18\x03\x20\x01(\x0b2$.protocol.\ MetricsInfo.BlockChainInfoR\nblockchain\x12/\n\x03net\x18\x04\x20\x01(\ \x0b2\x1d.protocol.MetricsInfo.NetInfoR\x03net\x1at\n\x08NodeInfo\x12\ \x0e\n\x02ip\x18\x01\x20\x01(\tR\x02ip\x12\x1a\n\x08nodeType\x18\x02\x20\ \x01(\x05R\x08nodeType\x12\x18\n\x07version\x18\x03\x20\x01(\tR\x07versi\ on\x12\"\n\x0cbackupStatus\x18\x04\x20\x01(\x05R\x0cbackupStatus\x1a\xee\ \x06\n\x0eBlockChainInfo\x12\"\n\x0cheadBlockNum\x18\x01\x20\x01(\x03R\ \x0cheadBlockNum\x12.\n\x12headBlockTimestamp\x18\x02\x20\x01(\x03R\x12h\ eadBlockTimestamp\x12$\n\rheadBlockHash\x18\x03\x20\x01(\tR\rheadBlockHa\ sh\x12\x1c\n\tforkCount\x18\x04\x20\x01(\x05R\tforkCount\x12$\n\rfailFor\ kCount\x18\x05\x20\x01(\x05R\rfailForkCount\x12J\n\x10blockProcessTime\ \x18\x06\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x10blockProces\ sTime\x120\n\x03tps\x18\x07\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateI\ nfoR\x03tps\x122\n\x14transactionCacheSize\x18\x08\x20\x01(\x05R\x14tran\ sactionCacheSize\x12L\n\x11missedTransaction\x18\t\x20\x01(\x0b2\x1e.pro\ tocol.MetricsInfo.RateInfoR\x11missedTransaction\x12J\n\twitnesses\x18\n\ \x20\x03(\x0b2,.protocol.MetricsInfo.BlockChainInfo.WitnessR\twitnesses\ \x120\n\x13failProcessBlockNum\x18\x0b\x20\x01(\x03R\x13failProcessBlock\ Num\x126\n\x16failProcessBlockReason\x18\x0c\x20\x01(\tR\x16failProcessB\ lockReason\x12O\n\ndupWitness\x18\r\x20\x03(\x0b2/.protocol.MetricsInfo.\ BlockChainInfo.DupWitnessR\ndupWitness\x1a=\n\x07Witness\x12\x18\n\x07ad\ dress\x18\x01\x20\x01(\tR\x07address\x12\x18\n\x07version\x18\x02\x20\ \x01(\x05R\x07version\x1aX\n\nDupWitness\x12\x18\n\x07address\x18\x01\ \x20\x01(\tR\x07address\x12\x1a\n\x08blockNum\x18\x02\x20\x01(\x03R\x08b\ lockNum\x12\x14\n\x05count\x18\x03\x20\x01(\x05R\x05count\x1a\xb8\x01\n\ \x08RateInfo\x12\x14\n\x05count\x18\x01\x20\x01(\x03R\x05count\x12\x1a\n\ \x08meanRate\x18\x02\x20\x01(\x01R\x08meanRate\x12$\n\roneMinuteRate\x18\ \x03\x20\x01(\x01R\roneMinuteRate\x12&\n\x0efiveMinuteRate\x18\x04\x20\ \x01(\x01R\x0efiveMinuteRate\x12,\n\x11fifteenMinuteRate\x18\x05\x20\x01\ (\x01R\x11fifteenMinuteRate\x1a\xc7\r\n\x07NetInfo\x12(\n\x0ferrorProtoC\ ount\x18\x01\x20\x01(\x05R\x0ferrorProtoCount\x127\n\x03api\x18\x02\x20\ \x01(\x0b2%.protocol.MetricsInfo.NetInfo.ApiInfoR\x03api\x12(\n\x0fconne\ ctionCount\x18\x03\x20\x01(\x05R\x0fconnectionCount\x122\n\x14validConne\ ctionCount\x18\x04\x20\x01(\x05R\x14validConnectionCount\x12B\n\x0ctcpIn\ Traffic\x18\x05\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x0ctcpI\ nTraffic\x12D\n\rtcpOutTraffic\x18\x06\x20\x01(\x0b2\x1e.protocol.Metric\ sInfo.RateInfoR\rtcpOutTraffic\x12.\n\x12disconnectionCount\x18\x07\x20\ \x01(\x05R\x12disconnectionCount\x12g\n\x13disconnectionDetail\x18\x08\ \x20\x03(\x0b25.protocol.MetricsInfo.NetInfo.DisconnectionDetailInfoR\ \x13disconnectionDetail\x12B\n\x0cudpInTraffic\x18\t\x20\x01(\x0b2\x1e.p\ rotocol.MetricsInfo.RateInfoR\x0cudpInTraffic\x12D\n\rudpOutTraffic\x18\ \n\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\rudpOutTraffic\x12C\ \n\x07latency\x18\x0b\x20\x01(\x0b2).protocol.MetricsInfo.NetInfo.Latenc\ yInfoR\x07latency\x1a\xd4\x03\n\x07ApiInfo\x120\n\x03qps\x18\x01\x20\x01\ (\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x03qps\x128\n\x07failQps\x18\ \x02\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x07failQps\x12>\n\ \noutTraffic\x18\x03\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\no\ utTraffic\x12K\n\x06detail\x18\x04\x20\x03(\x0b23.protocol.MetricsInfo.N\ etInfo.ApiInfo.ApiDetailInfoR\x06detail\x1a\xcf\x01\n\rApiDetailInfo\x12\ \x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x120\n\x03qps\x18\x02\x20\x01\ (\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x03qps\x128\n\x07failQps\x18\ \x03\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\x07failQps\x12>\n\ \noutTraffic\x18\x04\x20\x01(\x0b2\x1e.protocol.MetricsInfo.RateInfoR\no\ utTraffic\x1aG\n\x17DisconnectionDetailInfo\x12\x16\n\x06reason\x18\x01\ \x20\x01(\tR\x06reason\x12\x14\n\x05count\x18\x02\x20\x01(\x05R\x05count\ \x1a\xe8\x03\n\x0bLatencyInfo\x12\x14\n\x05top99\x18\x01\x20\x01(\x05R\ \x05top99\x12\x14\n\x05top95\x18\x02\x20\x01(\x05R\x05top95\x12\x14\n\ \x05top75\x18\x03\x20\x01(\x05R\x05top75\x12\x1e\n\ntotalCount\x18\x04\ \x20\x01(\x05R\ntotalCount\x12\x18\n\x07delay1S\x18\x05\x20\x01(\x05R\ \x07delay1S\x12\x18\n\x07delay2S\x18\x06\x20\x01(\x05R\x07delay2S\x12\ \x18\n\x07delay3S\x18\x07\x20\x01(\x05R\x07delay3S\x12S\n\x06detail\x18\ \x08\x20\x03(\x0b2;.protocol.MetricsInfo.NetInfo.LatencyInfo.LatencyDeta\ ilInfoR\x06detail\x1a\xd3\x01\n\x11LatencyDetailInfo\x12\x18\n\x07witnes\ s\x18\x01\x20\x01(\tR\x07witness\x12\x14\n\x05top99\x18\x02\x20\x01(\x05\ R\x05top99\x12\x14\n\x05top95\x18\x03\x20\x01(\x05R\x05top95\x12\x14\n\ \x05top75\x18\x04\x20\x01(\x05R\x05top75\x12\x14\n\x05count\x18\x05\x20\ \x01(\x05R\x05count\x12\x18\n\x07delay1S\x18\x06\x20\x01(\x05R\x07delay1\ S\x12\x18\n\x07delay2S\x18\x07\x20\x01(\x05R\x07delay2S\x12\x18\n\x07del\ ay3S\x18\x08\x20\x01(\x05R\x07delay3S\"\x93\x03\n\x0bPBFTMessage\x124\n\ \x08raw_data\x18\x01\x20\x01(\x0b2\x19.protocol.PBFTMessage.RawR\x07rawD\ ata\x12\x1c\n\tsignature\x18\x02\x20\x01(\x0cR\tsignature\x1a\xbd\x01\n\ \x03Raw\x128\n\x08msg_type\x18\x01\x20\x01(\x0e2\x1d.protocol.PBFTMessag\ e.MsgTypeR\x07msgType\x12;\n\tdata_type\x18\x02\x20\x01(\x0e2\x1e.protoc\ ol.PBFTMessage.DataTypeR\x08dataType\x12\x15\n\x06view_n\x18\x03\x20\x01\ (\x03R\x05viewN\x12\x14\n\x05epoch\x18\x04\x20\x01(\x03R\x05epoch\x12\ \x12\n\x04data\x18\x05\x20\x01(\x0cR\x04data\"P\n\x07MsgType\x12\x0f\n\ \x0bVIEW_CHANGE\x10\0\x12\x0b\n\x07REQUEST\x10\x01\x12\x0e\n\nPREPREPARE\ \x10\x02\x12\x0b\n\x07PREPARE\x10\x03\x12\n\n\x06COMMIT\x10\x04\"\x1e\n\ \x08DataType\x12\t\n\x05BLOCK\x10\0\x12\x07\n\x03SRL\x10\x01\"D\n\x10PBF\ TCommitResult\x12\x12\n\x04data\x18\x01\x20\x01(\x0cR\x04data\x12\x1c\n\ \tsignature\x18\x02\x20\x03(\x0cR\tsignature\"#\n\x03SRL\x12\x1c\n\tsrAd\ dress\x18\x01\x20\x03(\x0cR\tsrAddress*7\n\x0bAccountType\x12\n\n\x06Nor\ mal\x10\0\x12\x0e\n\nAssetIssue\x10\x01\x12\x0c\n\x08Contract\x10\x02*\ \x9f\x04\n\nReasonCode\x12\r\n\tREQUESTED\x10\0\x12\x10\n\x0cBAD_PROTOCO\ L\x10\x02\x12\x12\n\x0eTOO_MANY_PEERS\x10\x04\x12\x12\n\x0eDUPLICATE_PEE\ R\x10\x05\x12\x19\n\x15INCOMPATIBLE_PROTOCOL\x10\x06\x12\x16\n\x12RANDOM\ _ELIMINATION\x10\x07\x12\x10\n\x0cPEER_QUITING\x10\x08\x12\x17\n\x13UNEX\ PECTED_IDENTITY\x10\t\x12\x12\n\x0eLOCAL_IDENTITY\x10\n\x12\x10\n\x0cPIN\ G_TIMEOUT\x10\x0b\x12\x0f\n\x0bUSER_REASON\x10\x10\x12\t\n\x05RESET\x10\ \x11\x12\r\n\tSYNC_FAIL\x10\x12\x12\x0e\n\nFETCH_FAIL\x10\x13\x12\n\n\ \x06BAD_TX\x10\x14\x12\r\n\tBAD_BLOCK\x10\x15\x12\n\n\x06FORKED\x10\x16\ \x12\x0e\n\nUNLINKABLE\x10\x17\x12\x18\n\x14INCOMPATIBLE_VERSION\x10\x18\ \x12\x16\n\x12INCOMPATIBLE_CHAIN\x10\x19\x12\x0c\n\x08TIME_OUT\x10\x20\ \x12\x10\n\x0cCONNECT_FAIL\x10!\x12\x1f\n\x1bTOO_MANY_PEERS_WITH_SAME_IP\ \x10\"\x12\x18\n\x14LIGHT_NODE_SYNC_FAIL\x10#\x12\x11\n\rBELOW_THAN_ME\ \x10$\x12\x0f\n\x0bNOT_WITNESS\x10%\x12\x13\n\x0fNO_SUCH_MESSAGE\x10&\ \x12\x0c\n\x07UNKNOWN\x10\xff\x01BF\n\x0forg.tron.protosB\x08ProtocolZ)g\ ithub.com/tronprotocol/grpc-gateway/coreJ\x9c\xb2\x02\n\x07\x12\x05\0\0\ \xfa\x06\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\t\n\x02\x03\0\x12\x03\x02\ \0#\n\t\n\x02\x03\x01\x12\x03\x03\0\x1d\n\t\n\x02\x03\x02\x12\x03\x04\0$\ \n\x08\n\x01\x02\x12\x03\x06\0\x11\n\x08\n\x01\x08\x12\x03\t\0(\nH\n\x02\ \x08\x01\x12\x03\t\0(\"=Specify\x20the\x20name\x20of\x20the\x20package\ \x20that\x20generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\n\ \0)\n=\n\x02\x08\x08\x12\x03\n\0)\"2Specify\x20the\x20class\x20name\x20o\ f\x20the\x20generated\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x0b\0@\n\ \t\n\x02\x08\x0b\x12\x03\x0b\0@\n\n\n\x02\x05\0\x12\x04\r\0\x11\x01\n\n\ \n\x03\x05\0\x01\x12\x03\r\x05\x10\n\x0b\n\x04\x05\0\x02\0\x12\x03\x0e\ \x02\r\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\x0e\x02\x08\n\x0c\n\x05\x05\0\ \x02\0\x02\x12\x03\x0e\x0b\x0c\n\x0b\n\x04\x05\0\x02\x01\x12\x03\x0f\x02\ \x11\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x0f\x02\x0c\n\x0c\n\x05\x05\0\ \x02\x01\x02\x12\x03\x0f\x0f\x10\n\x0b\n\x04\x05\0\x02\x02\x12\x03\x10\ \x02\x0f\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x10\x02\n\n\x0c\n\x05\x05\ \0\x02\x02\x02\x12\x03\x10\r\x0e\nf\n\x02\x04\0\x12\x04\x14\0\x17\x01\ \x1aZ\x20AccountId,\x20(name,\x20address)\x20use\x20name,\x20(null,\x20a\ ddress)\x20use\x20address,\x20(name,\x20null)\x20use\x20name,\n\n\n\n\ \x03\x04\0\x01\x12\x03\x14\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\x15\ \x02\x11\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x15\x02\x07\n\x0c\n\x05\x04\ \0\x02\0\x01\x12\x03\x15\x08\x0c\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x15\ \x0f\x10\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x16\x02\x14\n\x0c\n\x05\x04\0\ \x02\x01\x05\x12\x03\x16\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ \x16\x08\x0f\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x16\x12\x13\n\x1a\n\ \x02\x04\x01\x12\x04\x1a\0\x1f\x01\x1a\x0e\x20vote\x20message\n\n\n\n\ \x03\x04\x01\x01\x12\x03\x1a\x08\x0c\n$\n\x04\x04\x01\x02\0\x12\x03\x1c\ \x02\x19\x1a\x17\x20the\x20super\x20rep\x20address\n\n\x0c\n\x05\x04\x01\ \x02\0\x05\x12\x03\x1c\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x1c\ \x08\x14\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x1c\x17\x18\n.\n\x04\x04\ \x01\x02\x01\x12\x03\x1e\x02\x17\x1a!\x20the\x20vote\x20num\x20to\x20thi\ s\x20super\x20rep.\n\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x1e\x02\x07\ \n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x1e\x08\x12\n\x0c\n\x05\x04\x01\ \x02\x01\x03\x12\x03\x1e\x15\x16\n\x16\n\x02\x04\x02\x12\x04\"\00\x01\ \x1a\n\x20Proposal\n\n\n\n\x03\x04\x02\x01\x12\x03\"\x08\x10\n\x0b\n\x04\ \x04\x02\x02\0\x12\x03#\x02\x18\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03#\ \x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03#\x08\x13\n\x0c\n\x05\x04\ \x02\x02\0\x03\x12\x03#\x16\x17\n\x0b\n\x04\x04\x02\x02\x01\x12\x03$\x02\ \x1d\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03$\x02\x07\n\x0c\n\x05\x04\ \x02\x02\x01\x01\x12\x03$\x08\x18\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\ \x03$\x1b\x1c\n\x0b\n\x04\x04\x02\x02\x02\x12\x03%\x02#\n\x0c\n\x05\x04\ \x02\x02\x02\x06\x12\x03%\x02\x13\n\x0c\n\x05\x04\x02\x02\x02\x01\x12\ \x03%\x14\x1e\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03%!\"\n\x0b\n\x04\ \x04\x02\x02\x03\x12\x03&\x02\x1c\n\x0c\n\x05\x04\x02\x02\x03\x05\x12\ \x03&\x02\x07\n\x0c\n\x05\x04\x02\x02\x03\x01\x12\x03&\x08\x17\n\x0c\n\ \x05\x04\x02\x02\x03\x03\x12\x03&\x1a\x1b\n\x0b\n\x04\x04\x02\x02\x04\ \x12\x03'\x02\x18\n\x0c\n\x05\x04\x02\x02\x04\x05\x12\x03'\x02\x07\n\x0c\ \n\x05\x04\x02\x02\x04\x01\x12\x03'\x08\x13\n\x0c\n\x05\x04\x02\x02\x04\ \x03\x12\x03'\x16\x17\n\x0b\n\x04\x04\x02\x02\x05\x12\x03(\x02\x1f\n\x0c\ \n\x05\x04\x02\x02\x05\x04\x12\x03(\x02\n\n\x0c\n\x05\x04\x02\x02\x05\ \x05\x12\x03(\x0b\x10\n\x0c\n\x05\x04\x02\x02\x05\x01\x12\x03(\x11\x1a\n\ \x0c\n\x05\x04\x02\x02\x05\x03\x12\x03(\x1d\x1e\n\x0c\n\x04\x04\x02\x04\ \0\x12\x04)\x02.\x03\n\x0c\n\x05\x04\x02\x04\0\x01\x12\x03)\x07\x0c\n\r\ \n\x06\x04\x02\x04\0\x02\0\x12\x03*\x04\x10\n\x0e\n\x07\x04\x02\x04\0\ \x02\0\x01\x12\x03*\x04\x0b\n\x0e\n\x07\x04\x02\x04\0\x02\0\x02\x12\x03*\ \x0e\x0f\n\r\n\x06\x04\x02\x04\0\x02\x01\x12\x03+\x04\x14\n\x0e\n\x07\ \x04\x02\x04\0\x02\x01\x01\x12\x03+\x04\x0f\n\x0e\n\x07\x04\x02\x04\0\ \x02\x01\x02\x12\x03+\x12\x13\n\r\n\x06\x04\x02\x04\0\x02\x02\x12\x03,\ \x04\x11\n\x0e\n\x07\x04\x02\x04\0\x02\x02\x01\x12\x03,\x04\x0c\n\x0e\n\ \x07\x04\x02\x04\0\x02\x02\x02\x12\x03,\x0f\x10\n\r\n\x06\x04\x02\x04\0\ \x02\x03\x12\x03-\x04\x11\n\x0e\n\x07\x04\x02\x04\0\x02\x03\x01\x12\x03-\ \x04\x0c\n\x0e\n\x07\x04\x02\x04\0\x02\x03\x02\x12\x03-\x0f\x10\n\x0b\n\ \x04\x04\x02\x02\x06\x12\x03/\x02\x12\n\x0c\n\x05\x04\x02\x02\x06\x06\ \x12\x03/\x02\x07\n\x0c\n\x05\x04\x02\x02\x06\x01\x12\x03/\x08\r\n\x0c\n\ \x05\x04\x02\x02\x06\x03\x12\x03/\x10\x11\n\x16\n\x02\x04\x03\x12\x043\0\ ;\x01\x1a\n\x20Exchange\n\n\n\n\x03\x04\x03\x01\x12\x033\x08\x10\n\x0b\n\ \x04\x04\x03\x02\0\x12\x034\x02\x18\n\x0c\n\x05\x04\x03\x02\0\x05\x12\ \x034\x02\x07\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x034\x08\x13\n\x0c\n\x05\ \x04\x03\x02\0\x03\x12\x034\x16\x17\n\x0b\n\x04\x04\x03\x02\x01\x12\x035\ \x02\x1c\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x035\x02\x07\n\x0c\n\x05\ \x04\x03\x02\x01\x01\x12\x035\x08\x17\n\x0c\n\x05\x04\x03\x02\x01\x03\ \x12\x035\x1a\x1b\n\x0b\n\x04\x04\x03\x02\x02\x12\x036\x02\x18\n\x0c\n\ \x05\x04\x03\x02\x02\x05\x12\x036\x02\x07\n\x0c\n\x05\x04\x03\x02\x02\ \x01\x12\x036\x08\x13\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x036\x16\x17\n\ \x0b\n\x04\x04\x03\x02\x03\x12\x037\x02\x1b\n\x0c\n\x05\x04\x03\x02\x03\ \x05\x12\x037\x02\x07\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x037\x08\x16\n\ \x0c\n\x05\x04\x03\x02\x03\x03\x12\x037\x19\x1a\n\x0b\n\x04\x04\x03\x02\ \x04\x12\x038\x02\x20\n\x0c\n\x05\x04\x03\x02\x04\x05\x12\x038\x02\x07\n\ \x0c\n\x05\x04\x03\x02\x04\x01\x12\x038\x08\x1b\n\x0c\n\x05\x04\x03\x02\ \x04\x03\x12\x038\x1e\x1f\n\x0b\n\x04\x04\x03\x02\x05\x12\x039\x02\x1c\n\ \x0c\n\x05\x04\x03\x02\x05\x05\x12\x039\x02\x07\n\x0c\n\x05\x04\x03\x02\ \x05\x01\x12\x039\x08\x17\n\x0c\n\x05\x04\x03\x02\x05\x03\x12\x039\x1a\ \x1b\n\x0b\n\x04\x04\x03\x02\x06\x12\x03:\x02!\n\x0c\n\x05\x04\x03\x02\ \x06\x05\x12\x03:\x02\x07\n\x0c\n\x05\x04\x03\x02\x06\x01\x12\x03:\x08\ \x1c\n\x0c\n\x05\x04\x03\x02\x06\x03\x12\x03:\x1f\x20\n\x14\n\x02\x04\ \x04\x12\x04>\0T\x01\x1a\x08\x20market\n\n\n\n\x03\x04\x04\x01\x12\x03>\ \x08\x13\n\x0b\n\x04\x04\x04\x02\0\x12\x03?\x04\x17\n\x0c\n\x05\x04\x04\ \x02\0\x05\x12\x03?\x04\t\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03?\n\x12\n\ \x0c\n\x05\x04\x04\x02\0\x03\x12\x03?\x15\x16\n\x0b\n\x04\x04\x04\x02\ \x01\x12\x03@\x04\x1c\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03@\x04\t\n\ \x0c\n\x05\x04\x04\x02\x01\x01\x12\x03@\n\x17\n\x0c\n\x05\x04\x04\x02\ \x01\x03\x12\x03@\x1a\x1b\n\x0b\n\x04\x04\x04\x02\x02\x12\x03A\x04\x1a\n\ \x0c\n\x05\x04\x04\x02\x02\x05\x12\x03A\x04\t\n\x0c\n\x05\x04\x04\x02\ \x02\x01\x12\x03A\n\x15\n\x0c\n\x05\x04\x04\x02\x02\x03\x12\x03A\x18\x19\ \n\x0b\n\x04\x04\x04\x02\x03\x12\x03B\x04\x1c\n\x0c\n\x05\x04\x04\x02\ \x03\x05\x12\x03B\x04\t\n\x0c\n\x05\x04\x04\x02\x03\x01\x12\x03B\n\x17\n\ \x0c\n\x05\x04\x04\x02\x03\x03\x12\x03B\x1a\x1b\n\x0b\n\x04\x04\x04\x02\ \x04\x12\x03C\x04\"\n\x0c\n\x05\x04\x04\x02\x04\x05\x12\x03C\x04\t\n\x0c\ \n\x05\x04\x04\x02\x04\x01\x12\x03C\n\x1d\n\x0c\n\x05\x04\x04\x02\x04\ \x03\x12\x03C\x20!\n\x0b\n\x04\x04\x04\x02\x05\x12\x03D\x04\x1b\n\x0c\n\ \x05\x04\x04\x02\x05\x05\x12\x03D\x04\t\n\x0c\n\x05\x04\x04\x02\x05\x01\ \x12\x03D\n\x16\n\x0c\n\x05\x04\x04\x02\x05\x03\x12\x03D\x19\x1a\n\x1d\n\ \x04\x04\x04\x02\x06\x12\x03E\x04!\"\x10\x20min\x20to\x20receive\n\n\x0c\ \n\x05\x04\x04\x02\x06\x05\x12\x03E\x04\t\n\x0c\n\x05\x04\x04\x02\x06\ \x01\x12\x03E\n\x1c\n\x0c\n\x05\x04\x04\x02\x06\x03\x12\x03E\x1f\x20\n\ \x0b\n\x04\x04\x04\x02\x07\x12\x03F\x04)\n\x0c\n\x05\x04\x04\x02\x07\x05\ \x12\x03F\x04\t\n\x0c\n\x05\x04\x04\x02\x07\x01\x12\x03F\n$\n\x0c\n\x05\ \x04\x04\x02\x07\x03\x12\x03F'(\n\xa8\x01\n\x04\x04\x04\x02\x08\x12\x03I\ \x04*\x1a\x9a\x01\x20When\x20state\x20!=\x20ACTIVE\x20and\x20sell_token_\ quantity_return\x20!=0,\nit\x20means\x20that\x20some\x20sell\x20tokens\ \x20are\x20returned\x20to\x20the\x20account\x20due\x20to\x20insufficient\ \x20remaining\x20amount\n\n\x0c\n\x05\x04\x04\x02\x08\x05\x12\x03I\x04\t\ \n\x0c\n\x05\x04\x04\x02\x08\x01\x12\x03I\n$\n\x0c\n\x05\x04\x04\x02\x08\ \x03\x12\x03I')\n\x0c\n\x04\x04\x04\x04\0\x12\x04K\x04O\x05\n\x0c\n\x05\ \x04\x04\x04\0\x01\x12\x03K\t\x0e\n\r\n\x06\x04\x04\x04\0\x02\0\x12\x03L\ \x06\x11\n\x0e\n\x07\x04\x04\x04\0\x02\0\x01\x12\x03L\x06\x0c\n\x0e\n\ \x07\x04\x04\x04\0\x02\0\x02\x12\x03L\x0f\x10\n\r\n\x06\x04\x04\x04\0\ \x02\x01\x12\x03M\x06\x13\n\x0e\n\x07\x04\x04\x04\0\x02\x01\x01\x12\x03M\ \x06\x0e\n\x0e\n\x07\x04\x04\x04\0\x02\x01\x02\x12\x03M\x11\x12\n\r\n\ \x06\x04\x04\x04\0\x02\x02\x12\x03N\x06\x13\n\x0e\n\x07\x04\x04\x04\0\ \x02\x02\x01\x12\x03N\x06\x0e\n\x0e\n\x07\x04\x04\x04\0\x02\x02\x02\x12\ \x03N\x11\x12\n\x0b\n\x04\x04\x04\x02\t\x12\x03P\x04\x15\n\x0c\n\x05\x04\ \x04\x02\t\x06\x12\x03P\x04\t\n\x0c\n\x05\x04\x04\x02\t\x01\x12\x03P\n\ \x0f\n\x0c\n\x05\x04\x04\x02\t\x03\x12\x03P\x12\x14\n\x0b\n\x04\x04\x04\ \x02\n\x12\x03R\x04\x14\n\x0c\n\x05\x04\x04\x02\n\x05\x12\x03R\x04\t\n\ \x0c\n\x05\x04\x04\x02\n\x01\x12\x03R\n\x0e\n\x0c\n\x05\x04\x04\x02\n\ \x03\x12\x03R\x11\x13\n\x0b\n\x04\x04\x04\x02\x0b\x12\x03S\x04\x14\n\x0c\ \n\x05\x04\x04\x02\x0b\x05\x12\x03S\x04\t\n\x0c\n\x05\x04\x04\x02\x0b\ \x01\x12\x03S\n\x0e\n\x0c\n\x05\x04\x04\x02\x0b\x03\x12\x03S\x11\x13\n\n\ \n\x02\x04\x05\x12\x04V\0X\x01\n\n\n\x03\x04\x05\x01\x12\x03V\x08\x17\n\ \x0b\n\x04\x04\x05\x02\0\x12\x03W\x04$\n\x0c\n\x05\x04\x05\x02\0\x04\x12\ \x03W\x04\x0c\n\x0c\n\x05\x04\x05\x02\0\x06\x12\x03W\r\x18\n\x0c\n\x05\ \x04\x05\x02\0\x01\x12\x03W\x19\x1f\n\x0c\n\x05\x04\x05\x02\0\x03\x12\ \x03W\"#\n\n\n\x02\x04\x06\x12\x04Z\0\\\x01\n\n\n\x03\x04\x06\x01\x12\ \x03Z\x08\x1b\n\x0b\n\x04\x04\x06\x02\0\x12\x03[\x02)\n\x0c\n\x05\x04\ \x06\x02\0\x04\x12\x03[\x02\n\n\x0c\n\x05\x04\x06\x02\0\x06\x12\x03[\x0b\ \x1a\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x03[\x1b$\n\x0c\n\x05\x04\x06\x02\ \0\x03\x12\x03['(\n\n\n\x02\x04\x07\x12\x04^\0a\x01\n\n\n\x03\x04\x07\ \x01\x12\x03^\x08\x17\n\x0b\n\x04\x04\x07\x02\0\x12\x03_\x04\x1c\n\x0c\n\ \x05\x04\x07\x02\0\x05\x12\x03_\x04\t\n\x0c\n\x05\x04\x07\x02\0\x01\x12\ \x03_\n\x17\n\x0c\n\x05\x04\x07\x02\0\x03\x12\x03_\x1a\x1b\n\x0b\n\x04\ \x04\x07\x02\x01\x12\x03`\x04\x1b\n\x0c\n\x05\x04\x07\x02\x01\x05\x12\ \x03`\x04\t\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x03`\n\x16\n\x0c\n\x05\ \x04\x07\x02\x01\x03\x12\x03`\x19\x1a\n\n\n\x02\x04\x08\x12\x04c\0h\x01\ \n\n\n\x03\x04\x08\x01\x12\x03c\x08\x1a\n\x0b\n\x04\x04\x08\x02\0\x12\ \x03d\x02\x1a\n\x0c\n\x05\x04\x08\x02\0\x05\x12\x03d\x02\x07\n\x0c\n\x05\ \x04\x08\x02\0\x01\x12\x03d\x08\x15\n\x0c\n\x05\x04\x08\x02\0\x03\x12\ \x03d\x18\x19\n\x1c\n\x04\x04\x08\x02\x01\x12\x03e\x02\x1c\"\x0f\x20orde\ r_id\x20list\n\n\x0c\n\x05\x04\x08\x02\x01\x04\x12\x03e\x02\n\n\x0c\n\ \x05\x04\x08\x02\x01\x05\x12\x03e\x0b\x10\n\x0c\n\x05\x04\x08\x02\x01\ \x01\x12\x03e\x11\x17\n\x0c\n\x05\x04\x08\x02\x01\x03\x12\x03e\x1a\x1b\n\ \x1b\n\x04\x04\x08\x02\x02\x12\x03f\x02\x12\"\x0e\x20active\x20count\n\n\ \x0c\n\x05\x04\x08\x02\x02\x05\x12\x03f\x02\x07\n\x0c\n\x05\x04\x08\x02\ \x02\x01\x12\x03f\x08\r\n\x0c\n\x05\x04\x08\x02\x02\x03\x12\x03f\x10\x11\ \n\x0b\n\x04\x04\x08\x02\x03\x12\x03g\x02\x18\n\x0c\n\x05\x04\x08\x02\ \x03\x05\x12\x03g\x02\x07\n\x0c\n\x05\x04\x08\x02\x03\x01\x12\x03g\x08\ \x13\n\x0c\n\x05\x04\x08\x02\x03\x03\x12\x03g\x16\x17\n\n\n\x02\x04\t\ \x12\x04j\0m\x01\n\n\n\x03\x04\t\x01\x12\x03j\x08\x13\n\x0b\n\x04\x04\t\ \x02\0\x12\x03k\x02\x20\n\x0c\n\x05\x04\t\x02\0\x05\x12\x03k\x02\x07\n\ \x0c\n\x05\x04\t\x02\0\x01\x12\x03k\x08\x1b\n\x0c\n\x05\x04\t\x02\0\x03\ \x12\x03k\x1e\x1f\n\x0b\n\x04\x04\t\x02\x01\x12\x03l\x02\x1f\n\x0c\n\x05\ \x04\t\x02\x01\x05\x12\x03l\x02\x07\n\x0c\n\x05\x04\t\x02\x01\x01\x12\ \x03l\x08\x1a\n\x0c\n\x05\x04\t\x02\x01\x03\x12\x03l\x1d\x1e\n\n\n\x02\ \x04\n\x12\x04o\0s\x01\n\n\n\x03\x04\n\x01\x12\x03o\x08\x17\n\x0b\n\x04\ \x04\n\x02\0\x12\x03p\x02\x1a\n\x0c\n\x05\x04\n\x02\0\x05\x12\x03p\x02\ \x07\n\x0c\n\x05\x04\n\x02\0\x01\x12\x03p\x08\x15\n\x0c\n\x05\x04\n\x02\ \0\x03\x12\x03p\x18\x19\n\x0b\n\x04\x04\n\x02\x01\x12\x03q\x02\x19\n\x0c\ \n\x05\x04\n\x02\x01\x05\x12\x03q\x02\x07\n\x0c\n\x05\x04\n\x02\x01\x01\ \x12\x03q\x08\x14\n\x0c\n\x05\x04\n\x02\x01\x03\x12\x03q\x17\x18\n\x0b\n\ \x04\x04\n\x02\x02\x12\x03r\x02\"\n\x0c\n\x05\x04\n\x02\x02\x04\x12\x03r\ \x02\n\n\x0c\n\x05\x04\n\x02\x02\x06\x12\x03r\x0b\x16\n\x0c\n\x05\x04\n\ \x02\x02\x01\x12\x03r\x17\x1d\n\x0c\n\x05\x04\n\x02\x02\x03\x12\x03r\x20\ !\n\n\n\x02\x04\x0b\x12\x04u\0x\x01\n\n\n\x03\x04\x0b\x01\x12\x03u\x08\ \x19\n\x0b\n\x04\x04\x0b\x02\0\x12\x03v\x02\x11\n\x0c\n\x05\x04\x0b\x02\ \0\x05\x12\x03v\x02\x07\n\x0c\n\x05\x04\x0b\x02\0\x01\x12\x03v\x08\x0c\n\ \x0c\n\x05\x04\x0b\x02\0\x03\x12\x03v\x0f\x10\n\x0b\n\x04\x04\x0b\x02\ \x01\x12\x03w\x02\x11\n\x0c\n\x05\x04\x0b\x02\x01\x05\x12\x03w\x02\x07\n\ \x0c\n\x05\x04\x0b\x02\x01\x01\x12\x03w\x08\x0c\n\x0c\n\x05\x04\x0b\x02\ \x01\x03\x12\x03w\x0f\x10\n\x0b\n\x02\x04\x0c\x12\x05z\0\x80\x01\x01\n\n\ \n\x03\x04\x0c\x01\x12\x03z\x08\x17\n\x0b\n\x04\x04\x0c\x02\0\x12\x03{\ \x02-\n\x0c\n\x05\x04\x0c\x02\0\x04\x12\x03{\x02\n\n\x0c\n\x05\x04\x0c\ \x02\0\x06\x12\x03{\x0b\x19\n\x0c\n\x05\x04\x0c\x02\0\x01\x12\x03{\x1a(\ \n\x0c\n\x05\x04\x0c\x02\0\x03\x12\x03{+,\n\x0c\n\x04\x04\x0c\x03\0\x12\ \x04|\x02\x7f\x03\n\x0c\n\x05\x04\x0c\x03\0\x01\x12\x03|\n\x18\n\r\n\x06\ \x04\x0c\x03\0\x02\0\x12\x03}\x04\x13\n\x0e\n\x07\x04\x0c\x03\0\x02\0\ \x05\x12\x03}\x04\n\n\x0e\n\x07\x04\x0c\x03\0\x02\0\x01\x12\x03}\x0b\x0e\ \n\x0e\n\x07\x04\x0c\x03\0\x02\0\x03\x12\x03}\x11\x12\n\r\n\x06\x04\x0c\ \x03\0\x02\x01\x12\x03~\x04\x14\n\x0e\n\x07\x04\x0c\x03\0\x02\x01\x05\ \x12\x03~\x04\t\n\x0e\n\x07\x04\x0c\x03\0\x02\x01\x01\x12\x03~\n\x0f\n\ \x0e\n\x07\x04\x0c\x03\0\x02\x01\x03\x12\x03~\x12\x13\n\x17\n\x02\x04\r\ \x12\x06\x83\x01\0\xf0\x01\x01\x1a\t\x20Account\x20\n\x0b\n\x03\x04\r\ \x01\x12\x04\x83\x01\x08\x0f\n\x20\n\x04\x04\r\x03\0\x12\x06\x85\x01\x02\ \x88\x01\x03\x1a\x10\x20frozen\x20balance\x20\n\r\n\x05\x04\r\x03\0\x01\ \x12\x04\x85\x01\n\x10\n(\n\x06\x04\r\x03\0\x02\0\x12\x04\x86\x01\x04\ \x1d\"\x18\x20the\x20frozen\x20trx\x20balance\n\n\x0f\n\x07\x04\r\x03\0\ \x02\0\x05\x12\x04\x86\x01\x04\t\n\x0f\n\x07\x04\r\x03\0\x02\0\x01\x12\ \x04\x86\x01\n\x18\n\x0f\n\x07\x04\r\x03\0\x02\0\x03\x12\x04\x86\x01\x1b\ \x1c\n!\n\x06\x04\r\x03\0\x02\x01\x12\x04\x87\x01\x04\x1a\"\x11\x20the\ \x20expire\x20time\n\n\x0f\n\x07\x04\r\x03\0\x02\x01\x05\x12\x04\x87\x01\ \x04\t\n\x0f\n\x07\x04\r\x03\0\x02\x01\x01\x12\x04\x87\x01\n\x15\n\x0f\n\ \x07\x04\r\x03\0\x02\x01\x03\x12\x04\x87\x01\x18\x19\n!\n\x04\x04\r\x02\ \0\x12\x04\x8a\x01\x02\x19\x1a\x13\x20account\x20nick\x20name\n\n\r\n\ \x05\x04\r\x02\0\x05\x12\x04\x8a\x01\x02\x07\n\r\n\x05\x04\r\x02\0\x01\ \x12\x04\x8a\x01\x08\x14\n\r\n\x05\x04\r\x02\0\x03\x12\x04\x8a\x01\x17\ \x18\n\x0c\n\x04\x04\r\x02\x01\x12\x04\x8b\x01\x02\x17\n\r\n\x05\x04\r\ \x02\x01\x06\x12\x04\x8b\x01\x02\r\n\r\n\x05\x04\r\x02\x01\x01\x12\x04\ \x8b\x01\x0e\x12\n\r\n\x05\x04\r\x02\x01\x03\x12\x04\x8b\x01\x15\x16\n\"\ \n\x04\x04\r\x02\x02\x12\x04\x8d\x01\x02\x14\x1a\x14\x20the\x20create\ \x20address\n\n\r\n\x05\x04\r\x02\x02\x05\x12\x04\x8d\x01\x02\x07\n\r\n\ \x05\x04\r\x02\x02\x01\x12\x04\x8d\x01\x08\x0f\n\r\n\x05\x04\r\x02\x02\ \x03\x12\x04\x8d\x01\x12\x13\n\x1f\n\x04\x04\r\x02\x03\x12\x04\x8f\x01\ \x02\x14\x1a\x11\x20the\x20trx\x20balance\n\n\r\n\x05\x04\r\x02\x03\x05\ \x12\x04\x8f\x01\x02\x07\n\r\n\x05\x04\r\x02\x03\x01\x12\x04\x8f\x01\x08\ \x0f\n\r\n\x05\x04\r\x02\x03\x03\x12\x04\x8f\x01\x12\x13\n\x19\n\x04\x04\ \r\x02\x04\x12\x04\x91\x01\x02\x1a\x1a\x0b\x20the\x20votes\n\n\r\n\x05\ \x04\r\x02\x04\x04\x12\x04\x91\x01\x02\n\n\r\n\x05\x04\r\x02\x04\x06\x12\ \x04\x91\x01\x0b\x0f\n\r\n\x05\x04\r\x02\x04\x01\x12\x04\x91\x01\x10\x15\ \n\r\n\x05\x04\r\x02\x04\x03\x12\x04\x91\x01\x18\x19\n5\n\x04\x04\r\x02\ \x05\x12\x04\x93\x01\x02\x1f\x1a'\x20the\x20other\x20asset\x20owned\x20b\ y\x20this\x20account\n\n\r\n\x05\x04\r\x02\x05\x06\x12\x04\x93\x01\x02\ \x14\n\r\n\x05\x04\r\x02\x05\x01\x12\x04\x93\x01\x15\x1a\n\r\n\x05\x04\r\ \x02\x05\x03\x12\x04\x93\x01\x1d\x1e\nF\n\x04\x04\r\x02\x06\x12\x04\x96\ \x01\x02\"\x1a8\x20the\x20other\x20asset\x20owned\x20by\x20this\x20accou\ nt\xef\xbc\x8ckey\x20is\x20assetId\n\n\r\n\x05\x04\r\x02\x06\x06\x12\x04\ \x96\x01\x02\x14\n\r\n\x05\x04\r\x02\x06\x01\x12\x04\x96\x01\x15\x1c\n\r\ \n\x05\x04\r\x02\x06\x03\x12\x04\x96\x01\x1f!\n0\n\x04\x04\r\x02\x07\x12\ \x04\x99\x01\x02\x1d\x1a\"\x20the\x20frozen\x20balance\x20for\x20bandwid\ th\n\n\r\n\x05\x04\r\x02\x07\x04\x12\x04\x99\x01\x02\n\n\r\n\x05\x04\r\ \x02\x07\x06\x12\x04\x99\x01\x0b\x11\n\r\n\x05\x04\r\x02\x07\x01\x12\x04\ \x99\x01\x12\x18\n\r\n\x05\x04\r\x02\x07\x03\x12\x04\x99\x01\x1b\x1c\n*\ \n\x04\x04\r\x02\x08\x12\x04\x9b\x01\x02\x16\x1a\x1c\x20bandwidth,\x20ge\ t\x20from\x20frozen\n\n\r\n\x05\x04\r\x02\x08\x05\x12\x04\x9b\x01\x02\ \x07\n\r\n\x05\x04\r\x02\x08\x01\x12\x04\x9b\x01\x08\x11\n\r\n\x05\x04\r\ \x02\x08\x03\x12\x04\x9b\x01\x14\x15\nH\n\x04\x04\r\x02\t\x12\x04\x9d\ \x01\x02=\x1a:Frozen\x20balance\x20provided\x20by\x20other\x20accounts\ \x20to\x20this\x20account\n\n\r\n\x05\x04\r\x02\t\x05\x12\x04\x9d\x01\ \x02\x07\n\r\n\x05\x04\r\x02\t\x01\x12\x04\x9d\x01\x087\n\r\n\x05\x04\r\ \x02\t\x03\x12\x04\x9d\x01:<\n<\n\x04\x04\r\x02\n\x12\x04\x9f\x01\x024\ \x1a.Freeze\x20and\x20provide\x20balances\x20to\x20other\x20accounts\n\n\ \r\n\x05\x04\r\x02\n\x05\x12\x04\x9f\x01\x02\x07\n\r\n\x05\x04\r\x02\n\ \x01\x12\x04\x9f\x01\x08.\n\r\n\x05\x04\r\x02\n\x03\x12\x04\x9f\x0113\n\ \x0c\n\x04\x04\r\x02\x0b\x12\x04\xa1\x01\x02\x1c\n\r\n\x05\x04\r\x02\x0b\ \x05\x12\x04\xa1\x01\x02\x07\n\r\n\x05\x04\r\x02\x0b\x01\x12\x04\xa1\x01\ \x08\x16\n\r\n\x05\x04\r\x02\x0b\x03\x12\x04\xa1\x01\x19\x1b\n\x0c\n\x04\ \x04\r\x02\x0c\x12\x04\xa2\x01\x02\x19\n\r\n\x05\x04\r\x02\x0c\x06\x12\ \x04\xa2\x01\x02\x08\n\r\n\x05\x04\r\x02\x0c\x01\x12\x04\xa2\x01\t\x13\n\ \r\n\x05\x04\r\x02\x0c\x03\x12\x04\xa2\x01\x16\x18\n\x0c\n\x04\x04\r\x02\ \r\x12\x04\xa4\x01\x02\x1c\n\r\n\x05\x04\r\x02\r\x05\x12\x04\xa4\x01\x02\ \x06\n\r\n\x05\x04\r\x02\r\x01\x12\x04\xa4\x01\x07\x16\n\r\n\x05\x04\r\ \x02\r\x03\x12\x04\xa4\x01\x19\x1b\n(\n\x04\x04\r\x02\x0e\x12\x04\xa7\ \x01\x02\x1b\x1a\x1a\x20this\x20account\x20create\x20time\n\n\r\n\x05\ \x04\r\x02\x0e\x05\x12\x04\xa7\x01\x02\x07\n\r\n\x05\x04\r\x02\x0e\x01\ \x12\x04\xa7\x01\x08\x13\n\r\n\x05\x04\r\x02\x0e\x03\x12\x04\xa7\x01\x16\ \x1a\nc\n\x04\x04\r\x02\x0f\x12\x04\xa9\x01\x02\"\x1aU\x20this\x20last\ \x20operation\x20time,\x20including\x20transfer,\x20voting\x20and\x20so\ \x20on.\x20//FIXME\x20fix\x20grammar\n\n\r\n\x05\x04\r\x02\x0f\x05\x12\ \x04\xa9\x01\x02\x07\n\r\n\x05\x04\r\x02\x0f\x01\x12\x04\xa9\x01\x08\x1c\ \n\r\n\x05\x04\r\x02\x0f\x03\x12\x04\xa9\x01\x1f!\n1\n\x04\x04\r\x02\x10\ \x12\x04\xab\x01\x02\x19\x1a#\x20witness\x20block\x20producing\x20allowa\ nce\n\n\r\n\x05\x04\r\x02\x10\x05\x12\x04\xab\x01\x02\x07\n\r\n\x05\x04\ \r\x02\x10\x01\x12\x04\xab\x01\x08\x11\n\r\n\x05\x04\r\x02\x10\x03\x12\ \x04\xab\x01\x14\x18\n\"\n\x04\x04\r\x02\x11\x12\x04\xad\x01\x02$\x1a\ \x14\x20last\x20withdraw\x20time\n\n\r\n\x05\x04\r\x02\x11\x05\x12\x04\ \xad\x01\x02\x07\n\r\n\x05\x04\r\x02\x11\x01\x12\x04\xad\x01\x08\x1c\n\r\ \n\x05\x04\r\x02\x11\x03\x12\x04\xad\x01\x1f#\n\x1f\n\x04\x04\r\x02\x12\ \x12\x04\xaf\x01\x02\x12\x1a\x11\x20not\x20used\x20so\x20far\n\n\r\n\x05\ \x04\r\x02\x12\x05\x12\x04\xaf\x01\x02\x07\n\r\n\x05\x04\r\x02\x12\x01\ \x12\x04\xaf\x01\x08\x0c\n\r\n\x05\x04\r\x02\x12\x03\x12\x04\xaf\x01\x0f\ \x11\n\x0c\n\x04\x04\r\x02\x13\x12\x04\xb0\x01\x02\x17\n\r\n\x05\x04\r\ \x02\x13\x05\x12\x04\xb0\x01\x02\x06\n\r\n\x05\x04\r\x02\x13\x01\x12\x04\ \xb0\x01\x07\x11\n\r\n\x05\x04\r\x02\x13\x03\x12\x04\xb0\x01\x14\x16\n\ \x0c\n\x04\x04\r\x02\x14\x12\x04\xb1\x01\x02\x19\n\r\n\x05\x04\r\x02\x14\ \x05\x12\x04\xb1\x01\x02\x06\n\r\n\x05\x04\r\x02\x14\x01\x12\x04\xb1\x01\ \x07\x13\n\r\n\x05\x04\r\x02\x14\x03\x12\x04\xb1\x01\x16\x18\n.\n\x04\ \x04\r\x02\x15\x12\x04\xb3\x01\x02%\x1a\x20\x20frozen\x20asset(for\x20as\ set\x20issuer)\n\n\r\n\x05\x04\r\x02\x15\x04\x12\x04\xb3\x01\x02\n\n\r\n\ \x05\x04\r\x02\x15\x06\x12\x04\xb3\x01\x0b\x11\n\r\n\x05\x04\r\x02\x15\ \x01\x12\x04\xb3\x01\x12\x1f\n\r\n\x05\x04\r\x02\x15\x03\x12\x04\xb3\x01\ \"$\n!\n\x04\x04\r\x02\x16\x12\x04\xb5\x01\x02\x1f\x1a\x13\x20asset_issu\ ed_name\n\n\r\n\x05\x04\r\x02\x16\x05\x12\x04\xb5\x01\x02\x07\n\r\n\x05\ \x04\r\x02\x16\x01\x12\x04\xb5\x01\x08\x19\n\r\n\x05\x04\r\x02\x16\x03\ \x12\x04\xb5\x01\x1c\x1e\n\x0c\n\x04\x04\r\x02\x17\x12\x04\xb6\x01\x02\ \x1d\n\r\n\x05\x04\r\x02\x17\x05\x12\x04\xb6\x01\x02\x07\n\r\n\x05\x04\r\ \x02\x17\x01\x12\x04\xb6\x01\x08\x17\n\r\n\x05\x04\r\x02\x17\x03\x12\x04\ \xb6\x01\x1a\x1c\n\x0c\n\x04\x04\r\x02\x18\x12\x04\xb7\x01\x026\n\r\n\ \x05\x04\r\x02\x18\x06\x12\x04\xb7\x01\x02\x14\n\r\n\x05\x04\r\x02\x18\ \x01\x12\x04\xb7\x01\x150\n\r\n\x05\x04\r\x02\x18\x03\x12\x04\xb7\x0135\ \n\x0c\n\x04\x04\r\x02\x19\x12\x04\xb8\x01\x028\n\r\n\x05\x04\r\x02\x19\ \x06\x12\x04\xb8\x01\x02\x14\n\r\n\x05\x04\r\x02\x19\x01\x12\x04\xb8\x01\ \x152\n\r\n\x05\x04\r\x02\x19\x03\x12\x04\xb8\x0157\n\x0c\n\x04\x04\r\ \x02\x1a\x12\x04\xb9\x01\x02\x1c\n\r\n\x05\x04\r\x02\x1a\x05\x12\x04\xb9\ \x01\x02\x07\n\r\n\x05\x04\r\x02\x1a\x01\x12\x04\xb9\x01\x08\x16\n\r\n\ \x05\x04\r\x02\x1a\x03\x12\x04\xb9\x01\x19\x1b\n\x0c\n\x04\x04\r\x02\x1b\ \x12\x04\xba\x01\x02/\n\r\n\x05\x04\r\x02\x1b\x06\x12\x04\xba\x01\x02\ \x14\n\r\n\x05\x04\r\x02\x1b\x01\x12\x04\xba\x01\x15)\n\r\n\x05\x04\r\ \x02\x1b\x03\x12\x04\xba\x01,.\n\x0c\n\x04\x04\r\x02\x1c\x12\x04\xbb\x01\ \x021\n\r\n\x05\x04\r\x02\x1c\x06\x12\x04\xbb\x01\x02\x14\n\r\n\x05\x04\ \r\x02\x1c\x01\x12\x04\xbb\x01\x15+\n\r\n\x05\x04\r\x02\x1c\x03\x12\x04\ \xbb\x01.0\n\x0c\n\x04\x04\r\x02\x1d\x12\x04\xbc\x01\x02!\n\r\n\x05\x04\ \r\x02\x1d\x05\x12\x04\xbc\x01\x02\x07\n\r\n\x05\x04\r\x02\x1d\x01\x12\ \x04\xbc\x01\x08\x1b\n\r\n\x05\x04\r\x02\x1d\x03\x12\x04\xbc\x01\x1e\x20\ \n\x0c\n\x04\x04\r\x02\x1e\x12\x04\xbd\x01\x02&\n\r\n\x05\x04\r\x02\x1e\ \x05\x12\x04\xbd\x01\x02\x07\n\r\n\x05\x04\r\x02\x1e\x01\x12\x04\xbd\x01\ \x08\x20\n\r\n\x05\x04\r\x02\x1e\x03\x12\x04\xbd\x01#%\n>\n\x04\x04\r\ \x02\x1f\x12\x04\xc0\x01\x02\x18\x1a0\x20the\x20identity\x20of\x20this\ \x20account,\x20case\x20insensitive\n\n\r\n\x05\x04\r\x02\x1f\x05\x12\ \x04\xc0\x01\x02\x07\n\r\n\x05\x04\r\x02\x1f\x01\x12\x04\xc0\x01\x08\x12\ \n\r\n\x05\x04\r\x02\x1f\x03\x12\x04\xc0\x01\x15\x17\n\x0c\n\x04\x04\r\ \x02\x20\x12\x04\xc2\x01\x02\x1d\n\r\n\x05\x04\r\x02\x20\x05\x12\x04\xc2\ \x01\x02\x07\n\r\n\x05\x04\r\x02\x20\x01\x12\x04\xc2\x01\x08\x17\n\r\n\ \x05\x04\r\x02\x20\x03\x12\x04\xc2\x01\x1a\x1c\n\x0c\n\x04\x04\r\x02!\ \x12\x04\xc3\x01\x02!\n\r\n\x05\x04\r\x02!\x05\x12\x04\xc3\x01\x02\x06\n\ \r\n\x05\x04\r\x02!\x01\x12\x04\xc3\x01\x07\x1b\n\r\n\x05\x04\r\x02!\x03\ \x12\x04\xc3\x01\x1e\x20\n\x0e\n\x04\x04\r\x03\x07\x12\x06\xc5\x01\x02\ \xdb\x01\x03\n\r\n\x05\x04\r\x03\x07\x01\x12\x04\xc5\x01\n\x19\n2\n\x06\ \x04\r\x03\x07\x02\0\x12\x04\xc7\x01\x04\x1b\x1a\"\x20energy\x20resource\ ,\x20get\x20from\x20frozen\n\n\x0f\n\x07\x04\r\x03\x07\x02\0\x05\x12\x04\ \xc7\x01\x04\t\n\x0f\n\x07\x04\r\x03\x07\x02\0\x01\x12\x04\xc7\x01\n\x16\ \n\x0f\n\x07\x04\r\x03\x07\x02\0\x03\x12\x04\xc7\x01\x19\x1a\n/\n\x06\ \x04\r\x03\x07\x02\x01\x12\x04\xc9\x01\x04)\x1a\x1f\x20the\x20frozen\x20\ balance\x20for\x20energy\n\n\x0f\n\x07\x04\r\x03\x07\x02\x01\x06\x12\x04\ \xc9\x01\x04\n\n\x0f\n\x07\x04\r\x03\x07\x02\x01\x01\x12\x04\xc9\x01\x0b\ $\n\x0f\n\x07\x04\r\x03\x07\x02\x01\x03\x12\x04\xc9\x01'(\n\x0e\n\x06\ \x04\r\x03\x07\x02\x02\x12\x04\xca\x01\x04-\n\x0f\n\x07\x04\r\x03\x07\ \x02\x02\x05\x12\x04\xca\x01\x04\t\n\x0f\n\x07\x04\r\x03\x07\x02\x02\x01\ \x12\x04\xca\x01\n(\n\x0f\n\x07\x04\r\x03\x07\x02\x02\x03\x12\x04\xca\ \x01+,\nJ\n\x06\x04\r\x03\x07\x02\x03\x12\x04\xcd\x01\x04;\x1a:Frozen\ \x20balance\x20provided\x20by\x20other\x20accounts\x20to\x20this\x20acco\ unt\n\n\x0f\n\x07\x04\r\x03\x07\x02\x03\x05\x12\x04\xcd\x01\x04\t\n\x0f\ \n\x07\x04\r\x03\x07\x02\x03\x01\x12\x04\xcd\x01\n6\n\x0f\n\x07\x04\r\ \x03\x07\x02\x03\x03\x12\x04\xcd\x019:\n;\n\x06\x04\r\x03\x07\x02\x04\ \x12\x04\xcf\x01\x042\x1a+Frozen\x20balances\x20provided\x20to\x20other\ \x20accounts\n\n\x0f\n\x07\x04\r\x03\x07\x02\x04\x05\x12\x04\xcf\x01\x04\ \t\n\x0f\n\x07\x04\r\x03\x07\x02\x04\x01\x12\x04\xcf\x01\n-\n\x0f\n\x07\ \x04\r\x03\x07\x02\x04\x03\x12\x04\xcf\x0101\n3\n\x06\x04\r\x03\x07\x02\ \x05\x12\x04\xd2\x01\x04\x1c\x1a#\x20storage\x20resource,\x20get\x20from\ \x20market\n\n\x0f\n\x07\x04\r\x03\x07\x02\x05\x05\x12\x04\xd2\x01\x04\t\ \n\x0f\n\x07\x04\r\x03\x07\x02\x05\x01\x12\x04\xd2\x01\n\x17\n\x0f\n\x07\ \x04\r\x03\x07\x02\x05\x03\x12\x04\xd2\x01\x1a\x1b\n\x0e\n\x06\x04\r\x03\ \x07\x02\x06\x12\x04\xd3\x01\x04\x1c\n\x0f\n\x07\x04\r\x03\x07\x02\x06\ \x05\x12\x04\xd3\x01\x04\t\n\x0f\n\x07\x04\r\x03\x07\x02\x06\x01\x12\x04\ \xd3\x01\n\x17\n\x0f\n\x07\x04\r\x03\x07\x02\x06\x03\x12\x04\xd3\x01\x1a\ \x1b\n\x0e\n\x06\x04\r\x03\x07\x02\x07\x12\x04\xd4\x01\x04+\n\x0f\n\x07\ \x04\r\x03\x07\x02\x07\x05\x12\x04\xd4\x01\x04\t\n\x0f\n\x07\x04\r\x03\ \x07\x02\x07\x01\x12\x04\xd4\x01\n&\n\x0f\n\x07\x04\r\x03\x07\x02\x07\ \x03\x12\x04\xd4\x01)*\n\x0e\n\x06\x04\r\x03\x07\x02\x08\x12\x04\xd6\x01\ \x04!\n\x0f\n\x07\x04\r\x03\x07\x02\x08\x05\x12\x04\xd6\x01\x04\t\n\x0f\ \n\x07\x04\r\x03\x07\x02\x08\x01\x12\x04\xd6\x01\n\x1c\n\x0f\n\x07\x04\r\ \x03\x07\x02\x08\x03\x12\x04\xd6\x01\x1f\x20\n\x0e\n\x06\x04\r\x03\x07\ \x02\t\x12\x04\xd8\x01\x045\n\x0f\n\x07\x04\r\x03\x07\x02\t\x05\x12\x04\ \xd8\x01\x04\t\n\x0f\n\x07\x04\r\x03\x07\x02\t\x01\x12\x04\xd8\x01\n/\n\ \x0f\n\x07\x04\r\x03\x07\x02\t\x03\x12\x04\xd8\x0124\n\x0e\n\x06\x04\r\ \x03\x07\x02\n\x12\x04\xd9\x01\x04>\n\x0f\n\x07\x04\r\x03\x07\x02\n\x05\ \x12\x04\xd9\x01\x04\t\n\x0f\n\x07\x04\r\x03\x07\x02\n\x01\x12\x04\xd9\ \x01\n8\n\x0f\n\x07\x04\r\x03\x07\x02\n\x03\x12\x04\xd9\x01;=\n\x0e\n\ \x06\x04\r\x03\x07\x02\x0b\x12\x04\xda\x01\x04&\n\x0f\n\x07\x04\r\x03\ \x07\x02\x0b\x05\x12\x04\xda\x01\x04\x08\n\x0f\n\x07\x04\r\x03\x07\x02\ \x0b\x01\x12\x04\xda\x01\t\x20\n\x0f\n\x07\x04\r\x03\x07\x02\x0b\x03\x12\ \x04\xda\x01#%\n\x0c\n\x04\x04\r\x02\"\x12\x04\xdc\x01\x02(\n\r\n\x05\ \x04\r\x02\"\x06\x12\x04\xdc\x01\x02\x11\n\r\n\x05\x04\r\x02\"\x01\x12\ \x04\xdc\x01\x12\"\n\r\n\x05\x04\r\x02\"\x03\x12\x04\xdc\x01%'\n\x0c\n\ \x04\x04\r\x02#\x12\x04\xdd\x01\x02\x16\n\r\n\x05\x04\r\x02#\x05\x12\x04\ \xdd\x01\x02\x07\n\r\n\x05\x04\r\x02#\x01\x12\x04\xdd\x01\x08\x10\n\r\n\ \x05\x04\r\x02#\x03\x12\x04\xdd\x01\x13\x15\n\x0c\n\x04\x04\r\x02$\x12\ \x04\xde\x01\x02#\n\r\n\x05\x04\r\x02$\x06\x12\x04\xde\x01\x02\x0c\n\r\n\ \x05\x04\r\x02$\x01\x12\x04\xde\x01\r\x1d\n\r\n\x05\x04\r\x02$\x03\x12\ \x04\xde\x01\x20\"\n\x0c\n\x04\x04\r\x02%\x12\x04\xdf\x01\x02%\n\r\n\x05\ \x04\r\x02%\x06\x12\x04\xdf\x01\x02\x0c\n\r\n\x05\x04\r\x02%\x01\x12\x04\ \xdf\x01\r\x1f\n\r\n\x05\x04\r\x02%\x03\x12\x04\xdf\x01\"$\n\x0c\n\x04\ \x04\r\x02&\x12\x04\xe0\x01\x02-\n\r\n\x05\x04\r\x02&\x04\x12\x04\xe0\ \x01\x02\n\n\r\n\x05\x04\r\x02&\x06\x12\x04\xe0\x01\x0b\x15\n\r\n\x05\ \x04\r\x02&\x01\x12\x04\xe0\x01\x16'\n\r\n\x05\x04\r\x02&\x03\x12\x04\ \xe0\x01*,\n\x0e\n\x04\x04\r\x03\x08\x12\x06\xe2\x01\x02\xe5\x01\x03\n\r\ \n\x05\x04\r\x03\x08\x01\x12\x04\xe2\x01\n\x12\n\x0e\n\x06\x04\r\x03\x08\ \x02\0\x12\x04\xe3\x01\x04\x1a\n\x0f\n\x07\x04\r\x03\x08\x02\0\x06\x12\ \x04\xe3\x01\x04\x10\n\x0f\n\x07\x04\r\x03\x08\x02\0\x01\x12\x04\xe3\x01\ \x11\x15\n\x0f\n\x07\x04\r\x03\x08\x02\0\x03\x12\x04\xe3\x01\x18\x19\n\ \x0e\n\x06\x04\r\x03\x08\x02\x01\x12\x04\xe4\x01\x04\x15\n\x0f\n\x07\x04\ \r\x03\x08\x02\x01\x05\x12\x04\xe4\x01\x04\t\n\x0f\n\x07\x04\r\x03\x08\ \x02\x01\x01\x12\x04\xe4\x01\n\x10\n\x0f\n\x07\x04\r\x03\x08\x02\x01\x03\ \x12\x04\xe4\x01\x13\x14\n\x0e\n\x04\x04\r\x03\t\x12\x06\xe6\x01\x02\xea\ \x01\x03\n\r\n\x05\x04\r\x03\t\x01\x12\x04\xe6\x01\n\x14\n\x0e\n\x06\x04\ \r\x03\t\x02\0\x12\x04\xe7\x01\x04\x1a\n\x0f\n\x07\x04\r\x03\t\x02\0\x06\ \x12\x04\xe7\x01\x04\x10\n\x0f\n\x07\x04\r\x03\t\x02\0\x01\x12\x04\xe7\ \x01\x11\x15\n\x0f\n\x07\x04\r\x03\t\x02\0\x03\x12\x04\xe7\x01\x18\x19\n\ \x0e\n\x06\x04\r\x03\t\x02\x01\x12\x04\xe8\x01\x04\x1e\n\x0f\n\x07\x04\r\ \x03\t\x02\x01\x05\x12\x04\xe8\x01\x04\t\n\x0f\n\x07\x04\r\x03\t\x02\x01\ \x01\x12\x04\xe8\x01\n\x19\n\x0f\n\x07\x04\r\x03\t\x02\x01\x03\x12\x04\ \xe8\x01\x1c\x1d\n\x0e\n\x06\x04\r\x03\t\x02\x02\x12\x04\xe9\x01\x04#\n\ \x0f\n\x07\x04\r\x03\t\x02\x02\x05\x12\x04\xe9\x01\x04\t\n\x0f\n\x07\x04\ \r\x03\t\x02\x02\x01\x12\x04\xe9\x01\n\x1e\n\x0f\n\x07\x04\r\x03\t\x02\ \x02\x03\x12\x04\xe9\x01!\"\n\x0c\n\x04\x04\r\x02'\x12\x04\xeb\x01\x02\"\ \n\r\n\x05\x04\r\x02'\x04\x12\x04\xeb\x01\x02\n\n\r\n\x05\x04\r\x02'\x06\ \x12\x04\xeb\x01\x0b\x13\n\r\n\x05\x04\r\x02'\x01\x12\x04\xeb\x01\x14\ \x1c\n\r\n\x05\x04\r\x02'\x03\x12\x04\xeb\x01\x1f!\n\x0c\n\x04\x04\r\x02\ (\x12\x04\xec\x01\x02&\n\r\n\x05\x04\r\x02(\x04\x12\x04\xec\x01\x02\n\n\ \r\n\x05\x04\r\x02(\x06\x12\x04\xec\x01\x0b\x15\n\r\n\x05\x04\r\x02(\x01\ \x12\x04\xec\x01\x16\x20\n\r\n\x05\x04\r\x02(\x03\x12\x04\xec\x01#%\n\ \x0c\n\x04\x04\r\x02)\x12\x04\xee\x01\x026\n\r\n\x05\x04\r\x02)\x05\x12\ \x04\xee\x01\x02\x07\n\r\n\x05\x04\r\x02)\x01\x12\x04\xee\x01\x080\n\r\n\ \x05\x04\r\x02)\x03\x12\x04\xee\x0135\n\x0c\n\x04\x04\r\x02*\x12\x04\xef\ \x01\x02?\n\r\n\x05\x04\r\x02*\x05\x12\x04\xef\x01\x02\x07\n\r\n\x05\x04\ \r\x02*\x01\x12\x04\xef\x01\x089\n\r\n\x05\x04\r\x02*\x03\x12\x04\xef\ \x01<>\n\x0c\n\x02\x04\x0e\x12\x06\xf2\x01\0\xf5\x01\x01\n\x0b\n\x03\x04\ \x0e\x01\x12\x04\xf2\x01\x08\x0b\n\x0c\n\x04\x04\x0e\x02\0\x12\x04\xf3\ \x01\x02\x14\n\r\n\x05\x04\x0e\x02\0\x05\x12\x04\xf3\x01\x02\x07\n\r\n\ \x05\x04\x0e\x02\0\x01\x12\x04\xf3\x01\x08\x0f\n\r\n\x05\x04\x0e\x02\0\ \x03\x12\x04\xf3\x01\x12\x13\n\x0c\n\x04\x04\x0e\x02\x01\x12\x04\xf4\x01\ \x02\x13\n\r\n\x05\x04\x0e\x02\x01\x05\x12\x04\xf4\x01\x02\x07\n\r\n\x05\ \x04\x0e\x02\x01\x01\x12\x04\xf4\x01\x08\x0e\n\r\n\x05\x04\x0e\x02\x01\ \x03\x12\x04\xf4\x01\x11\x12\n\x0c\n\x02\x04\x0f\x12\x06\xf7\x01\0\xfe\ \x01\x01\n\x0b\n\x03\x04\x0f\x01\x12\x04\xf7\x01\x08\x19\n\x0c\n\x04\x04\ \x0f\x02\0\x12\x04\xf8\x01\x02\x11\n\r\n\x05\x04\x0f\x02\0\x05\x12\x04\ \xf8\x01\x02\x07\n\r\n\x05\x04\x0f\x02\0\x01\x12\x04\xf8\x01\x08\x0c\n\r\ \n\x05\x04\x0f\x02\0\x03\x12\x04\xf8\x01\x0f\x10\n\x0c\n\x04\x04\x0f\x02\ \x01\x12\x04\xf9\x01\x02\x0f\n\r\n\x05\x04\x0f\x02\x01\x05\x12\x04\xf9\ \x01\x02\x07\n\r\n\x05\x04\x0f\x02\x01\x01\x12\x04\xf9\x01\x08\n\n\r\n\ \x05\x04\x0f\x02\x01\x03\x12\x04\xf9\x01\r\x0e\n\x0c\n\x04\x04\x0f\x02\ \x02\x12\x04\xfa\x01\x02)\n\r\n\x05\x04\x0f\x02\x02\x05\x12\x04\xfa\x01\ \x02\x07\n\r\n\x05\x04\x0f\x02\x02\x01\x12\x04\xfa\x01\x08$\n\r\n\x05\ \x04\x0f\x02\x02\x03\x12\x04\xfa\x01'(\n\x0c\n\x04\x04\x0f\x02\x03\x12\ \x04\xfb\x01\x02&\n\r\n\x05\x04\x0f\x02\x03\x05\x12\x04\xfb\x01\x02\x07\ \n\r\n\x05\x04\x0f\x02\x03\x01\x12\x04\xfb\x01\x08!\n\r\n\x05\x04\x0f\ \x02\x03\x03\x12\x04\xfb\x01$%\n\x0c\n\x04\x04\x0f\x02\x04\x12\x04\xfc\ \x01\x02&\n\r\n\x05\x04\x0f\x02\x04\x05\x12\x04\xfc\x01\x02\x07\n\r\n\ \x05\x04\x0f\x02\x04\x01\x12\x04\xfc\x01\x08!\n\r\n\x05\x04\x0f\x02\x04\ \x03\x12\x04\xfc\x01$%\n\x0c\n\x04\x04\x0f\x02\x05\x12\x04\xfd\x01\x02#\ \n\r\n\x05\x04\x0f\x02\x05\x05\x12\x04\xfd\x01\x02\x07\n\r\n\x05\x04\x0f\ \x02\x05\x01\x12\x04\xfd\x01\x08\x1e\n\r\n\x05\x04\x0f\x02\x05\x03\x12\ \x04\xfd\x01!\"\n\x0c\n\x02\x04\x10\x12\x06\x80\x02\0\x83\x02\x01\n\x0b\ \n\x03\x04\x10\x01\x12\x04\x80\x02\x08\x11\n\x0c\n\x04\x04\x10\x02\0\x12\ \x04\x81\x02\x02\x18\n\r\n\x05\x04\x10\x02\0\x06\x12\x04\x81\x02\x02\x0b\ \n\r\n\x05\x04\x10\x02\0\x01\x12\x04\x81\x02\x0c\x13\n\r\n\x05\x04\x10\ \x02\0\x03\x12\x04\x81\x02\x16\x17\n\x0c\n\x04\x04\x10\x02\x01\x12\x04\ \x82\x02\x02\x1c\n\r\n\x05\x04\x10\x02\x01\x05\x12\x04\x82\x02\x02\x07\n\ \r\n\x05\x04\x10\x02\x01\x01\x12\x04\x82\x02\x08\x17\n\r\n\x05\x04\x10\ \x02\x01\x03\x12\x04\x82\x02\x1a\x1b\n\x0c\n\x02\x04\x11\x12\x06\x85\x02\ \0\x92\x02\x01\n\x0b\n\x03\x04\x11\x01\x12\x04\x85\x02\x08\x12\n\x0e\n\ \x04\x04\x11\x04\0\x12\x06\x86\x02\x02\x8a\x02\x03\n\r\n\x05\x04\x11\x04\ \0\x01\x12\x04\x86\x02\x07\x15\n\x0e\n\x06\x04\x11\x04\0\x02\0\x12\x04\ \x87\x02\x04\x0e\n\x0f\n\x07\x04\x11\x04\0\x02\0\x01\x12\x04\x87\x02\x04\ \t\n\x0f\n\x07\x04\x11\x04\0\x02\0\x02\x12\x04\x87\x02\x0c\r\n\x0e\n\x06\ \x04\x11\x04\0\x02\x01\x12\x04\x88\x02\x04\x10\n\x0f\n\x07\x04\x11\x04\0\ \x02\x01\x01\x12\x04\x88\x02\x04\x0b\n\x0f\n\x07\x04\x11\x04\0\x02\x01\ \x02\x12\x04\x88\x02\x0e\x0f\n\x0e\n\x06\x04\x11\x04\0\x02\x02\x12\x04\ \x89\x02\x04\x0f\n\x0f\n\x07\x04\x11\x04\0\x02\x02\x01\x12\x04\x89\x02\ \x04\n\n\x0f\n\x07\x04\x11\x04\0\x02\x02\x02\x12\x04\x89\x02\r\x0e\n\x0c\ \n\x04\x04\x11\x02\0\x12\x04\x8b\x02\x02\x1a\n\r\n\x05\x04\x11\x02\0\x06\ \x12\x04\x8b\x02\x02\x10\n\r\n\x05\x04\x11\x02\0\x01\x12\x04\x8b\x02\x11\ \x15\n\r\n\x05\x04\x11\x02\0\x03\x12\x04\x8b\x02\x18\x19\n=\n\x04\x04\ \x11\x02\x01\x12\x04\x8c\x02\x02\x0f\"/Owner\x20id=0,\x20Witness\x20id=1\ ,\x20Active\x20id\x20start\x20by\x202\n\n\r\n\x05\x04\x11\x02\x01\x05\ \x12\x04\x8c\x02\x02\x07\n\r\n\x05\x04\x11\x02\x01\x01\x12\x04\x8c\x02\ \x08\n\n\r\n\x05\x04\x11\x02\x01\x03\x12\x04\x8c\x02\r\x0e\n\x0c\n\x04\ \x04\x11\x02\x02\x12\x04\x8d\x02\x02\x1d\n\r\n\x05\x04\x11\x02\x02\x05\ \x12\x04\x8d\x02\x02\x08\n\r\n\x05\x04\x11\x02\x02\x01\x12\x04\x8d\x02\t\ \x18\n\r\n\x05\x04\x11\x02\x02\x03\x12\x04\x8d\x02\x1b\x1c\n\x0c\n\x04\ \x04\x11\x02\x03\x12\x04\x8e\x02\x02\x16\n\r\n\x05\x04\x11\x02\x03\x05\ \x12\x04\x8e\x02\x02\x07\n\r\n\x05\x04\x11\x02\x03\x01\x12\x04\x8e\x02\ \x08\x11\n\r\n\x05\x04\x11\x02\x03\x03\x12\x04\x8e\x02\x14\x15\n\x0c\n\ \x04\x04\x11\x02\x04\x12\x04\x8f\x02\x02\x16\n\r\n\x05\x04\x11\x02\x04\ \x05\x12\x04\x8f\x02\x02\x07\n\r\n\x05\x04\x11\x02\x04\x01\x12\x04\x8f\ \x02\x08\x11\n\r\n\x05\x04\x11\x02\x04\x03\x12\x04\x8f\x02\x14\x15\n\x1f\ \n\x04\x04\x11\x02\x05\x12\x04\x90\x02\x02\x17\"\x111\x20bit\x201\x20con\ tract\n\n\r\n\x05\x04\x11\x02\x05\x05\x12\x04\x90\x02\x02\x07\n\r\n\x05\ \x04\x11\x02\x05\x01\x12\x04\x90\x02\x08\x12\n\r\n\x05\x04\x11\x02\x05\ \x03\x12\x04\x90\x02\x15\x16\n\x0c\n\x04\x04\x11\x02\x06\x12\x04\x91\x02\ \x02\x18\n\r\n\x05\x04\x11\x02\x06\x04\x12\x04\x91\x02\x02\n\n\r\n\x05\ \x04\x11\x02\x06\x06\x12\x04\x91\x02\x0b\x0e\n\r\n\x05\x04\x11\x02\x06\ \x01\x12\x04\x91\x02\x0f\x13\n\r\n\x05\x04\x11\x02\x06\x03\x12\x04\x91\ \x02\x16\x17\n\x17\n\x02\x04\x12\x12\x06\x95\x02\0\x9f\x02\x01\x1a\t\x20\ Witness\n\n\x0b\n\x03\x04\x12\x01\x12\x04\x95\x02\x08\x0f\n\x0c\n\x04\ \x04\x12\x02\0\x12\x04\x96\x02\x02\x14\n\r\n\x05\x04\x12\x02\0\x05\x12\ \x04\x96\x02\x02\x07\n\r\n\x05\x04\x12\x02\0\x01\x12\x04\x96\x02\x08\x0f\ \n\r\n\x05\x04\x12\x02\0\x03\x12\x04\x96\x02\x12\x13\n\x0c\n\x04\x04\x12\ \x02\x01\x12\x04\x97\x02\x02\x16\n\r\n\x05\x04\x12\x02\x01\x05\x12\x04\ \x97\x02\x02\x07\n\r\n\x05\x04\x12\x02\x01\x01\x12\x04\x97\x02\x08\x11\n\ \r\n\x05\x04\x12\x02\x01\x03\x12\x04\x97\x02\x14\x15\n\x0c\n\x04\x04\x12\ \x02\x02\x12\x04\x98\x02\x02\x13\n\r\n\x05\x04\x12\x02\x02\x05\x12\x04\ \x98\x02\x02\x07\n\r\n\x05\x04\x12\x02\x02\x01\x12\x04\x98\x02\x08\x0e\n\ \r\n\x05\x04\x12\x02\x02\x03\x12\x04\x98\x02\x11\x12\n\x0c\n\x04\x04\x12\ \x02\x03\x12\x04\x99\x02\x02\x11\n\r\n\x05\x04\x12\x02\x03\x05\x12\x04\ \x99\x02\x02\x08\n\r\n\x05\x04\x12\x02\x03\x01\x12\x04\x99\x02\t\x0c\n\r\ \n\x05\x04\x12\x02\x03\x03\x12\x04\x99\x02\x0f\x10\n\x0c\n\x04\x04\x12\ \x02\x04\x12\x04\x9a\x02\x02\x1a\n\r\n\x05\x04\x12\x02\x04\x05\x12\x04\ \x9a\x02\x02\x07\n\r\n\x05\x04\x12\x02\x04\x01\x12\x04\x9a\x02\x08\x15\n\ \r\n\x05\x04\x12\x02\x04\x03\x12\x04\x9a\x02\x18\x19\n\x0c\n\x04\x04\x12\ \x02\x05\x12\x04\x9b\x02\x02\x18\n\r\n\x05\x04\x12\x02\x05\x05\x12\x04\ \x9b\x02\x02\x07\n\r\n\x05\x04\x12\x02\x05\x01\x12\x04\x9b\x02\x08\x13\n\ \r\n\x05\x04\x12\x02\x05\x03\x12\x04\x9b\x02\x16\x17\n\x0c\n\x04\x04\x12\ \x02\x06\x12\x04\x9c\x02\x02\x1b\n\r\n\x05\x04\x12\x02\x06\x05\x12\x04\ \x9c\x02\x02\x07\n\r\n\x05\x04\x12\x02\x06\x01\x12\x04\x9c\x02\x08\x16\n\ \r\n\x05\x04\x12\x02\x06\x03\x12\x04\x9c\x02\x19\x1a\n\x0c\n\x04\x04\x12\ \x02\x07\x12\x04\x9d\x02\x02\x1a\n\r\n\x05\x04\x12\x02\x07\x05\x12\x04\ \x9d\x02\x02\x07\n\r\n\x05\x04\x12\x02\x07\x01\x12\x04\x9d\x02\x08\x15\n\ \r\n\x05\x04\x12\x02\x07\x03\x12\x04\x9d\x02\x18\x19\n\x0c\n\x04\x04\x12\ \x02\x08\x12\x04\x9e\x02\x02\x12\n\r\n\x05\x04\x12\x02\x08\x05\x12\x04\ \x9e\x02\x02\x06\n\r\n\x05\x04\x12\x02\x08\x01\x12\x04\x9e\x02\x07\r\n\r\ \n\x05\x04\x12\x02\x08\x03\x12\x04\x9e\x02\x10\x11\n\x1b\n\x02\x04\x13\ \x12\x06\xa2\x02\0\xa6\x02\x01\x1a\r\x20Vote\x20Change\n\n\x0b\n\x03\x04\ \x13\x01\x12\x04\xa2\x02\x08\r\n\x0c\n\x04\x04\x13\x02\0\x12\x04\xa3\x02\ \x02\x14\n\r\n\x05\x04\x13\x02\0\x05\x12\x04\xa3\x02\x02\x07\n\r\n\x05\ \x04\x13\x02\0\x01\x12\x04\xa3\x02\x08\x0f\n\r\n\x05\x04\x13\x02\0\x03\ \x12\x04\xa3\x02\x12\x13\n\x0c\n\x04\x04\x13\x02\x01\x12\x04\xa4\x02\x02\ \x1e\n\r\n\x05\x04\x13\x02\x01\x04\x12\x04\xa4\x02\x02\n\n\r\n\x05\x04\ \x13\x02\x01\x06\x12\x04\xa4\x02\x0b\x0f\n\r\n\x05\x04\x13\x02\x01\x01\ \x12\x04\xa4\x02\x10\x19\n\r\n\x05\x04\x13\x02\x01\x03\x12\x04\xa4\x02\ \x1c\x1d\n\x0c\n\x04\x04\x13\x02\x02\x12\x04\xa5\x02\x02\x1e\n\r\n\x05\ \x04\x13\x02\x02\x04\x12\x04\xa5\x02\x02\n\n\r\n\x05\x04\x13\x02\x02\x06\ \x12\x04\xa5\x02\x0b\x0f\n\r\n\x05\x04\x13\x02\x02\x01\x12\x04\xa5\x02\ \x10\x19\n\r\n\x05\x04\x13\x02\x02\x03\x12\x04\xa5\x02\x1c\x1d\n\x1b\n\ \x02\x04\x14\x12\x06\xaa\x02\0\xad\x02\x012\r\x20Transcation\n\n\x0b\n\ \x03\x04\x14\x01\x12\x04\xaa\x02\x08\x10\n\x0c\n\x04\x04\x14\x02\0\x12\ \x04\xab\x02\x02\x12\n\r\n\x05\x04\x14\x02\0\x05\x12\x04\xab\x02\x02\x07\ \n\r\n\x05\x04\x14\x02\0\x01\x12\x04\xab\x02\x08\r\n\r\n\x05\x04\x14\x02\ \0\x03\x12\x04\xab\x02\x10\x11\n\x0c\n\x04\x04\x14\x02\x01\x12\x04\xac\ \x02\x02\x17\n\r\n\x05\x04\x14\x02\x01\x05\x12\x04\xac\x02\x02\x07\n\r\n\ \x05\x04\x14\x02\x01\x01\x12\x04\xac\x02\x08\x12\n\r\n\x05\x04\x14\x02\ \x01\x03\x12\x04\xac\x02\x15\x16\n\x0c\n\x02\x04\x15\x12\x06\xaf\x02\0\ \xb7\x02\x01\n\x0b\n\x03\x04\x15\x01\x12\x04\xaf\x02\x08\x0f\n\x0e\n\x04\ \x04\x15\x03\0\x12\x06\xb0\x02\x02\xb4\x02\x03\n\r\n\x05\x04\x15\x03\0\ \x01\x12\x04\xb0\x02\n\r\n\x0e\n\x06\x04\x15\x03\0\x02\0\x12\x04\xb1\x02\ \x04\x13\n\x0f\n\x07\x04\x15\x03\0\x02\0\x05\x12\x04\xb1\x02\x04\t\n\x0f\ \n\x07\x04\x15\x03\0\x02\0\x01\x12\x04\xb1\x02\n\x0e\n\x0f\n\x07\x04\x15\ \x03\0\x02\0\x03\x12\x04\xb1\x02\x11\x12\n\x0e\n\x06\x04\x15\x03\0\x02\ \x01\x12\x04\xb2\x02\x04\x13\n\x0f\n\x07\x04\x15\x03\0\x02\x01\x05\x12\ \x04\xb2\x02\x04\t\n\x0f\n\x07\x04\x15\x03\0\x02\x01\x01\x12\x04\xb2\x02\ \n\x0e\n\x0f\n\x07\x04\x15\x03\0\x02\x01\x03\x12\x04\xb2\x02\x11\x12\n\ \x0e\n\x06\x04\x15\x03\0\x02\x02\x12\x04\xb3\x02\x04\x15\n\x0f\n\x07\x04\ \x15\x03\0\x02\x02\x05\x12\x04\xb3\x02\x04\t\n\x0f\n\x07\x04\x15\x03\0\ \x02\x02\x01\x12\x04\xb3\x02\n\x10\n\x0f\n\x07\x04\x15\x03\0\x02\x02\x03\ \x12\x04\xb3\x02\x13\x14\n\x0c\n\x04\x04\x15\x02\0\x12\x04\xb5\x02\x02\ \x13\n\r\n\x05\x04\x15\x02\0\x06\x12\x04\xb5\x02\x02\x05\n\r\n\x05\x04\ \x15\x02\0\x01\x12\x04\xb5\x02\x06\x0e\n\r\n\x05\x04\x15\x02\0\x03\x12\ \x04\xb5\x02\x11\x12\n\x0c\n\x04\x04\x15\x02\x01\x12\x04\xb6\x02\x02\x16\ \n\r\n\x05\x04\x15\x02\x01\x05\x12\x04\xb6\x02\x02\x07\n\r\n\x05\x04\x15\ \x02\x01\x01\x12\x04\xb6\x02\x08\x11\n\r\n\x05\x04\x15\x02\x01\x03\x12\ \x04\xb6\x02\x14\x15\n\x0c\n\x02\x04\x16\x12\x06\xb9\x02\0\xbb\x02\x01\n\ \x0b\n\x03\x04\x16\x01\x12\x04\xb9\x02\x08\x11\n\x0c\n\x04\x04\x16\x02\0\ \x12\x04\xba\x02\x02\x20\n\r\n\x05\x04\x16\x02\0\x04\x12\x04\xba\x02\x02\ \n\n\r\n\x05\x04\x16\x02\0\x06\x12\x04\xba\x02\x0b\x13\n\r\n\x05\x04\x16\ \x02\0\x01\x12\x04\xba\x02\x14\x1b\n\r\n\x05\x04\x16\x02\0\x03\x12\x04\ \xba\x02\x1e\x1f\n\x0c\n\x02\x04\x17\x12\x06\xbd\x02\0\xc6\x02\x01\n\x0b\ \n\x03\x04\x17\x01\x12\x04\xbd\x02\x08\x17\n\x0c\n\x04\x04\x17\x02\0\x12\ \x04\xbe\x02\x02\x19\n\r\n\x05\x04\x17\x02\0\x05\x12\x04\xbe\x02\x02\x07\ \n\r\n\x05\x04\x17\x02\0\x01\x12\x04\xbe\x02\x08\x14\n\r\n\x05\x04\x17\ \x02\0\x03\x12\x04\xbe\x02\x17\x18\n\x0c\n\x04\x04\x17\x02\x01\x12\x04\ \xbf\x02\x02\x17\n\r\n\x05\x04\x17\x02\x01\x05\x12\x04\xbf\x02\x02\x07\n\ \r\n\x05\x04\x17\x02\x01\x01\x12\x04\xbf\x02\x08\x12\n\r\n\x05\x04\x17\ \x02\x01\x03\x12\x04\xbf\x02\x15\x16\n\x0c\n\x04\x04\x17\x02\x02\x12\x04\ \xc0\x02\x02\x20\n\r\n\x05\x04\x17\x02\x02\x05\x12\x04\xc0\x02\x02\x07\n\ \r\n\x05\x04\x17\x02\x02\x01\x12\x04\xc0\x02\x08\x1b\n\r\n\x05\x04\x17\ \x02\x02\x03\x12\x04\xc0\x02\x1e\x1f\n\x0c\n\x04\x04\x17\x02\x03\x12\x04\ \xc1\x02\x02\x1f\n\r\n\x05\x04\x17\x02\x03\x05\x12\x04\xc1\x02\x02\x07\n\ \r\n\x05\x04\x17\x02\x03\x01\x12\x04\xc1\x02\x08\x1a\n\r\n\x05\x04\x17\ \x02\x03\x03\x12\x04\xc1\x02\x1d\x1e\n\x0c\n\x04\x04\x17\x02\x04\x12\x04\ \xc2\x02\x02\x16\n\r\n\x05\x04\x17\x02\x04\x05\x12\x04\xc2\x02\x02\x07\n\ \r\n\x05\x04\x17\x02\x04\x01\x12\x04\xc2\x02\x08\x11\n\r\n\x05\x04\x17\ \x02\x04\x03\x12\x04\xc2\x02\x14\x15\n\x0c\n\x04\x04\x17\x02\x05\x12\x04\ \xc3\x02\x02\x14\n\r\n\x05\x04\x17\x02\x05\x05\x12\x04\xc3\x02\x02\x07\n\ \r\n\x05\x04\x17\x02\x05\x01\x12\x04\xc3\x02\x08\x0f\n\r\n\x05\x04\x17\ \x02\x05\x03\x12\x04\xc3\x02\x12\x13\n\x0c\n\x04\x04\x17\x02\x06\x12\x04\ \xc4\x02\x02/\n\r\n\x05\x04\x17\x02\x06\x06\x12\x04\xc4\x02\x02#\n\r\n\ \x05\x04\x17\x02\x06\x01\x12\x04\xc4\x02$*\n\r\n\x05\x04\x17\x02\x06\x03\ \x12\x04\xc4\x02-.\n\x0c\n\x04\x04\x17\x02\x07\x12\x04\xc5\x02\x02!\n\r\ \n\x05\x04\x17\x02\x07\x05\x12\x04\xc5\x02\x02\x07\n\r\n\x05\x04\x17\x02\ \x07\x01\x12\x04\xc5\x02\x08\x1c\n\r\n\x05\x04\x17\x02\x07\x03\x12\x04\ \xc5\x02\x1f\x20\n\x0c\n\x02\x04\x18\x12\x06\xc8\x02\0\xcd\x02\x01\n\x0b\ \n\x03\x04\x18\x01\x12\x04\xc8\x02\x08\x19\n\x0c\n\x04\x04\x18\x02\0\x12\ \x04\xc9\x02\x02\x19\n\r\n\x05\x04\x18\x02\0\x05\x12\x04\xc9\x02\x02\x07\ \n\r\n\x05\x04\x18\x02\0\x01\x12\x04\xc9\x02\x08\x14\n\r\n\x05\x04\x18\ \x02\0\x03\x12\x04\xc9\x02\x17\x18\n\x0c\n\x04\x04\x18\x02\x01\x12\x04\ \xca\x02\x02\x19\n\r\n\x05\x04\x18\x02\x01\x05\x12\x04\xca\x02\x02\x07\n\ \r\n\x05\x04\x18\x02\x01\x01\x12\x04\xca\x02\x08\x14\n\r\n\x05\x04\x18\ \x02\x01\x03\x12\x04\xca\x02\x17\x18\n\x0c\n\x04\x04\x18\x02\x02\x12\x04\ \xcb\x02\x02\x1d\n\r\n\x05\x04\x18\x02\x02\x05\x12\x04\xcb\x02\x02\x07\n\ \r\n\x05\x04\x18\x02\x02\x01\x12\x04\xcb\x02\x08\x18\n\r\n\x05\x04\x18\ \x02\x02\x03\x12\x04\xcb\x02\x1b\x1c\n\x0c\n\x04\x04\x18\x02\x03\x12\x04\ \xcc\x02\x02\x1c\n\r\n\x05\x04\x18\x02\x03\x05\x12\x04\xcc\x02\x02\x07\n\ \r\n\x05\x04\x18\x02\x03\x01\x12\x04\xcc\x02\x08\x17\n\r\n\x05\x04\x18\ \x02\x03\x03\x12\x04\xcc\x02\x1a\x1b\n\x0c\n\x02\x04\x19\x12\x06\xcf\x02\ \0\xc2\x03\x01\n\x0b\n\x03\x04\x19\x01\x12\x04\xcf\x02\x08\x13\n\x0e\n\ \x04\x04\x19\x03\0\x12\x06\xd0\x02\x02\x81\x03\x03\n\r\n\x05\x04\x19\x03\ \0\x01\x12\x04\xd0\x02\n\x12\n\x10\n\x06\x04\x19\x03\0\x04\0\x12\x06\xd1\ \x02\x04\xfb\x02\x05\n\x0f\n\x07\x04\x19\x03\0\x04\0\x01\x12\x04\xd1\x02\ \t\x15\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\0\x12\x04\xd2\x02\x06\x20\n\ \x11\n\t\x04\x19\x03\0\x04\0\x02\0\x01\x12\x04\xd2\x02\x06\x1b\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\0\x02\x12\x04\xd2\x02\x1e\x1f\n\x10\n\x08\x04\ \x19\x03\0\x04\0\x02\x01\x12\x04\xd3\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\ \x04\0\x02\x01\x01\x12\x04\xd3\x02\x06\x16\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\x01\x02\x12\x04\xd3\x02\x19\x1a\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\ \x02\x12\x04\xd4\x02\x06\x20\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x02\x01\ \x12\x04\xd4\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x02\x02\x12\ \x04\xd4\x02\x1e\x1f\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x03\x12\x04\xd5\ \x02\x06\x1c\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x03\x01\x12\x04\xd5\x02\ \x06\x17\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x03\x02\x12\x04\xd5\x02\x1a\ \x1b\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x04\x12\x04\xd6\x02\x06\x1e\n\ \x11\n\t\x04\x19\x03\0\x04\0\x02\x04\x01\x12\x04\xd6\x02\x06\x19\n\x11\n\ \t\x04\x19\x03\0\x04\0\x02\x04\x02\x12\x04\xd6\x02\x1c\x1d\n\x10\n\x08\ \x04\x19\x03\0\x04\0\x02\x05\x12\x04\xd7\x02\x06\x20\n\x11\n\t\x04\x19\ \x03\0\x04\0\x02\x05\x01\x12\x04\xd7\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\ \x04\0\x02\x05\x02\x12\x04\xd7\x02\x1e\x1f\n\x10\n\x08\x04\x19\x03\0\x04\ \0\x02\x06\x12\x04\xd8\x02\x06\x1d\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x06\ \x01\x12\x04\xd8\x02\x06\x18\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x06\x02\ \x12\x04\xd8\x02\x1b\x1c\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x07\x12\x04\ \xd9\x02\x06\x20\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x07\x01\x12\x04\xd9\ \x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x07\x02\x12\x04\xd9\x02\ \x1e\x1f\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x08\x12\x04\xda\x02\x06(\n\ \x11\n\t\x04\x19\x03\0\x04\0\x02\x08\x01\x12\x04\xda\x02\x06#\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\x08\x02\x12\x04\xda\x02&'\n\x10\n\x08\x04\x19\ \x03\0\x04\0\x02\t\x12\x04\xdb\x02\x06!\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\t\x01\x12\x04\xdb\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\t\ \x02\x12\x04\xdb\x02\x1e\x20\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\n\x12\ \x04\xdc\x02\x06!\n\x11\n\t\x04\x19\x03\0\x04\0\x02\n\x01\x12\x04\xdc\ \x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\n\x02\x12\x04\xdc\x02\x1e\ \x20\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x0b\x12\x04\xdd\x02\x06#\n\x11\ \n\t\x04\x19\x03\0\x04\0\x02\x0b\x01\x12\x04\xdd\x02\x06\x1d\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\x0b\x02\x12\x04\xdd\x02\x20\"\n\x10\n\x08\x04\ \x19\x03\0\x04\0\x02\x0c\x12\x04\xde\x02\x06#\n\x11\n\t\x04\x19\x03\0\ \x04\0\x02\x0c\x01\x12\x04\xde\x02\x06\x1d\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\x0c\x02\x12\x04\xde\x02\x20\"\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\r\ \x12\x04\xdf\x02\x06!\n\x11\n\t\x04\x19\x03\0\x04\0\x02\r\x01\x12\x04\ \xdf\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\r\x02\x12\x04\xdf\x02\ \x1e\x20\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x0e\x12\x04\xe0\x02\x06\x1f\ \n\x11\n\t\x04\x19\x03\0\x04\0\x02\x0e\x01\x12\x04\xe0\x02\x06\x19\n\x11\ \n\t\x04\x19\x03\0\x04\0\x02\x0e\x02\x12\x04\xe0\x02\x1c\x1e\n\x10\n\x08\ \x04\x19\x03\0\x04\0\x02\x0f\x12\x04\xe1\x02\x06\"\n\x11\n\t\x04\x19\x03\ \0\x04\0\x02\x0f\x01\x12\x04\xe1\x02\x06\x1c\n\x11\n\t\x04\x19\x03\0\x04\ \0\x02\x0f\x02\x12\x04\xe1\x02\x1f!\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\ \x10\x12\x04\xe2\x02\x06#\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x10\x01\x12\ \x04\xe2\x02\x06\x1d\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x10\x02\x12\x04\ \xe2\x02\x20\"\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x11\x12\x04\xe3\x02\ \x06\"\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x11\x01\x12\x04\xe3\x02\x06\x1c\ \n\x11\n\t\x04\x19\x03\0\x04\0\x02\x11\x02\x12\x04\xe3\x02\x1f!\n\x10\n\ \x08\x04\x19\x03\0\x04\0\x02\x12\x12\x04\xe4\x02\x06\x20\n\x11\n\t\x04\ \x19\x03\0\x04\0\x02\x12\x01\x12\x04\xe4\x02\x06\x1a\n\x11\n\t\x04\x19\ \x03\0\x04\0\x02\x12\x02\x12\x04\xe4\x02\x1d\x1f\n\x10\n\x08\x04\x19\x03\ \0\x04\0\x02\x13\x12\x04\xe5\x02\x06\x1a\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\x13\x01\x12\x04\xe5\x02\x06\x14\n\x11\n\t\x04\x19\x03\0\x04\0\x02\ \x13\x02\x12\x04\xe5\x02\x17\x19\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x14\ \x12\x04\xe6\x02\x06\x1f\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x14\x01\x12\ \x04\xe6\x02\x06\x19\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x14\x02\x12\x04\ \xe6\x02\x1c\x1e\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x15\x12\x04\xe7\x02\ \x06\x20\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x15\x01\x12\x04\xe7\x02\x06\ \x1a\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x15\x02\x12\x04\xe7\x02\x1d\x1f\n\ \x10\n\x08\x04\x19\x03\0\x04\0\x02\x16\x12\x04\xe8\x02\x06\x17\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\x16\x01\x12\x04\xe8\x02\x06\x11\n\x11\n\t\x04\ \x19\x03\0\x04\0\x02\x16\x02\x12\x04\xe8\x02\x14\x16\n\x10\n\x08\x04\x19\ \x03\0\x04\0\x02\x17\x12\x04\xe9\x02\x06!\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\x17\x01\x12\x04\xe9\x02\x06\x1b\n\x11\n\t\x04\x19\x03\0\x04\0\x02\ \x17\x02\x12\x04\xe9\x02\x1e\x20\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x18\ \x12\x04\xea\x02\x06\"\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x18\x01\x12\x04\ \xea\x02\x06\x1c\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x18\x02\x12\x04\xea\ \x02\x1f!\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x19\x12\x04\xeb\x02\x06\"\ \n\x11\n\t\x04\x19\x03\0\x04\0\x02\x19\x01\x12\x04\xeb\x02\x06\x1c\n\x11\ \n\t\x04\x19\x03\0\x04\0\x02\x19\x02\x12\x04\xeb\x02\x1f!\n\x10\n\x08\ \x04\x19\x03\0\x04\0\x02\x1a\x12\x04\xec\x02\x06$\n\x11\n\t\x04\x19\x03\ \0\x04\0\x02\x1a\x01\x12\x04\xec\x02\x06\x1e\n\x11\n\t\x04\x19\x03\0\x04\ \0\x02\x1a\x02\x12\x04\xec\x02!#\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x1b\ \x12\x04\xed\x02\x06'\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x1b\x01\x12\x04\ \xed\x02\x06!\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x1b\x02\x12\x04\xed\x02$\ &\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x1c\x12\x04\xee\x02\x06%\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\x1c\x01\x12\x04\xee\x02\x06\x1f\n\x11\n\t\x04\ \x19\x03\0\x04\0\x02\x1c\x02\x12\x04\xee\x02\"$\n\x10\n\x08\x04\x19\x03\ \0\x04\0\x02\x1d\x12\x04\xef\x02\x06+\n\x11\n\t\x04\x19\x03\0\x04\0\x02\ \x1d\x01\x12\x04\xef\x02\x06%\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x1d\x02\ \x12\x04\xef\x02(*\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x1e\x12\x04\xf0\ \x02\x06\x1c\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x1e\x01\x12\x04\xf0\x02\ \x06\x16\n\x11\n\t\x04\x19\x03\0\x04\0\x02\x1e\x02\x12\x04\xf0\x02\x19\ \x1b\n\x10\n\x08\x04\x19\x03\0\x04\0\x02\x1f\x12\x04\xf1\x02\x06#\n\x11\ \n\t\x04\x19\x03\0\x04\0\x02\x1f\x01\x12\x04\xf1\x02\x06\x1d\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02\x1f\x02\x12\x04\xf1\x02\x20\"\n\x10\n\x08\x04\ \x19\x03\0\x04\0\x02\x20\x12\x04\xf2\x02\x06$\n\x11\n\t\x04\x19\x03\0\ \x04\0\x02\x20\x01\x12\x04\xf2\x02\x06\x1e\n\x11\n\t\x04\x19\x03\0\x04\0\ \x02\x20\x02\x12\x04\xf2\x02!#\n\x10\n\x08\x04\x19\x03\0\x04\0\x02!\x12\ \x04\xf3\x02\x06#\n\x11\n\t\x04\x19\x03\0\x04\0\x02!\x01\x12\x04\xf3\x02\ \x06\x1d\n\x11\n\t\x04\x19\x03\0\x04\0\x02!\x02\x12\x04\xf3\x02\x20\"\n\ \x10\n\x08\x04\x19\x03\0\x04\0\x02\"\x12\x04\xf4\x02\x06%\n\x11\n\t\x04\ \x19\x03\0\x04\0\x02\"\x01\x12\x04\xf4\x02\x06\x1f\n\x11\n\t\x04\x19\x03\ \0\x04\0\x02\"\x02\x12\x04\xf4\x02\"$\n\x10\n\x08\x04\x19\x03\0\x04\0\ \x02#\x12\x04\xf5\x02\x06#\n\x11\n\t\x04\x19\x03\0\x04\0\x02#\x01\x12\ \x04\xf5\x02\x06\x1d\n\x11\n\t\x04\x19\x03\0\x04\0\x02#\x02\x12\x04\xf5\ \x02\x20\"\n\x10\n\x08\x04\x19\x03\0\x04\0\x02$\x12\x04\xf6\x02\x06%\n\ \x11\n\t\x04\x19\x03\0\x04\0\x02$\x01\x12\x04\xf6\x02\x06\x1f\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02$\x02\x12\x04\xf6\x02\"$\n\x10\n\x08\x04\x19\x03\ \0\x04\0\x02%\x12\x04\xf7\x02\x06*\n\x11\n\t\x04\x19\x03\0\x04\0\x02%\ \x01\x12\x04\xf7\x02\x06$\n\x11\n\t\x04\x19\x03\0\x04\0\x02%\x02\x12\x04\ \xf7\x02')\n\x10\n\x08\x04\x19\x03\0\x04\0\x02&\x12\x04\xf8\x02\x06$\n\ \x11\n\t\x04\x19\x03\0\x04\0\x02&\x01\x12\x04\xf8\x02\x06\x1e\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02&\x02\x12\x04\xf8\x02!#\n\x10\n\x08\x04\x19\x03\ \0\x04\0\x02'\x12\x04\xf9\x02\x06&\n\x11\n\t\x04\x19\x03\0\x04\0\x02'\ \x01\x12\x04\xf9\x02\x06\x20\n\x11\n\t\x04\x19\x03\0\x04\0\x02'\x02\x12\ \x04\xf9\x02#%\n\x10\n\x08\x04\x19\x03\0\x04\0\x02(\x12\x04\xfa\x02\x06'\ \n\x11\n\t\x04\x19\x03\0\x04\0\x02(\x01\x12\x04\xfa\x02\x06!\n\x11\n\t\ \x04\x19\x03\0\x04\0\x02(\x02\x12\x04\xfa\x02$&\n\x0e\n\x06\x04\x19\x03\ \0\x02\0\x12\x04\xfc\x02\x04\x1a\n\x0f\n\x07\x04\x19\x03\0\x02\0\x06\x12\ \x04\xfc\x02\x04\x10\n\x0f\n\x07\x04\x19\x03\0\x02\0\x01\x12\x04\xfc\x02\ \x11\x15\n\x0f\n\x07\x04\x19\x03\0\x02\0\x03\x12\x04\xfc\x02\x18\x19\n\ \x0e\n\x06\x04\x19\x03\0\x02\x01\x12\x04\xfd\x02\x04&\n\x0f\n\x07\x04\ \x19\x03\0\x02\x01\x06\x12\x04\xfd\x02\x04\x17\n\x0f\n\x07\x04\x19\x03\0\ \x02\x01\x01\x12\x04\xfd\x02\x18!\n\x0f\n\x07\x04\x19\x03\0\x02\x01\x03\ \x12\x04\xfd\x02$%\n\x0e\n\x06\x04\x19\x03\0\x02\x02\x12\x04\xfe\x02\x04\ \x17\n\x0f\n\x07\x04\x19\x03\0\x02\x02\x05\x12\x04\xfe\x02\x04\t\n\x0f\n\ \x07\x04\x19\x03\0\x02\x02\x01\x12\x04\xfe\x02\n\x12\n\x0f\n\x07\x04\x19\ \x03\0\x02\x02\x03\x12\x04\xfe\x02\x15\x16\n\x0e\n\x06\x04\x19\x03\0\x02\ \x03\x12\x04\xff\x02\x04\x1b\n\x0f\n\x07\x04\x19\x03\0\x02\x03\x05\x12\ \x04\xff\x02\x04\t\n\x0f\n\x07\x04\x19\x03\0\x02\x03\x01\x12\x04\xff\x02\ \n\x16\n\x0f\n\x07\x04\x19\x03\0\x02\x03\x03\x12\x04\xff\x02\x19\x1a\n\ \x0e\n\x06\x04\x19\x03\0\x02\x04\x12\x04\x80\x03\x04\x1c\n\x0f\n\x07\x04\ \x19\x03\0\x02\x04\x05\x12\x04\x80\x03\x04\t\n\x0f\n\x07\x04\x19\x03\0\ \x02\x04\x01\x12\x04\x80\x03\n\x17\n\x0f\n\x07\x04\x19\x03\0\x02\x04\x03\ \x12\x04\x80\x03\x1a\x1b\n\x0e\n\x04\x04\x19\x03\x01\x12\x06\x83\x03\x02\ \xac\x03\x03\n\r\n\x05\x04\x19\x03\x01\x01\x12\x04\x83\x03\n\x10\n\x10\n\ \x06\x04\x19\x03\x01\x04\0\x12\x06\x84\x03\x04\x87\x03\x05\n\x0f\n\x07\ \x04\x19\x03\x01\x04\0\x01\x12\x04\x84\x03\t\r\n\x10\n\x08\x04\x19\x03\ \x01\x04\0\x02\0\x12\x04\x85\x03\x06\x11\n\x11\n\t\x04\x19\x03\x01\x04\0\ \x02\0\x01\x12\x04\x85\x03\x06\x0c\n\x11\n\t\x04\x19\x03\x01\x04\0\x02\0\ \x02\x12\x04\x85\x03\x0f\x10\n\x10\n\x08\x04\x19\x03\x01\x04\0\x02\x01\ \x12\x04\x86\x03\x06\x11\n\x11\n\t\x04\x19\x03\x01\x04\0\x02\x01\x01\x12\ \x04\x86\x03\x06\x0c\n\x11\n\t\x04\x19\x03\x01\x04\0\x02\x01\x02\x12\x04\ \x86\x03\x0f\x10\n\x10\n\x06\x04\x19\x03\x01\x04\x01\x12\x06\x88\x03\x04\ \x99\x03\x05\n\x0f\n\x07\x04\x19\x03\x01\x04\x01\x01\x12\x04\x88\x03\t\ \x17\n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\0\x12\x04\x89\x03\x06\x12\n\ \x11\n\t\x04\x19\x03\x01\x04\x01\x02\0\x01\x12\x04\x89\x03\x06\r\n\x11\n\ \t\x04\x19\x03\x01\x04\x01\x02\0\x02\x12\x04\x89\x03\x10\x11\n\x10\n\x08\ \x04\x19\x03\x01\x04\x01\x02\x01\x12\x04\x8a\x03\x06\x12\n\x11\n\t\x04\ \x19\x03\x01\x04\x01\x02\x01\x01\x12\x04\x8a\x03\x06\r\n\x11\n\t\x04\x19\ \x03\x01\x04\x01\x02\x01\x02\x12\x04\x8a\x03\x10\x11\n\x10\n\x08\x04\x19\ \x03\x01\x04\x01\x02\x02\x12\x04\x8b\x03\x06\x11\n\x11\n\t\x04\x19\x03\ \x01\x04\x01\x02\x02\x01\x12\x04\x8b\x03\x06\x0c\n\x11\n\t\x04\x19\x03\ \x01\x04\x01\x02\x02\x02\x12\x04\x8b\x03\x0f\x10\n\x10\n\x08\x04\x19\x03\ \x01\x04\x01\x02\x03\x12\x04\x8c\x03\x06\x1f\n\x11\n\t\x04\x19\x03\x01\ \x04\x01\x02\x03\x01\x12\x04\x8c\x03\x06\x1a\n\x11\n\t\x04\x19\x03\x01\ \x04\x01\x02\x03\x02\x12\x04\x8c\x03\x1d\x1e\n\x10\n\x08\x04\x19\x03\x01\ \x04\x01\x02\x04\x12\x04\x8d\x03\x06\x18\n\x11\n\t\x04\x19\x03\x01\x04\ \x01\x02\x04\x01\x12\x04\x8d\x03\x06\x13\n\x11\n\t\x04\x19\x03\x01\x04\ \x01\x02\x04\x02\x12\x04\x8d\x03\x16\x17\n\x10\n\x08\x04\x19\x03\x01\x04\ \x01\x02\x05\x12\x04\x8e\x03\x06\x1f\n\x11\n\t\x04\x19\x03\x01\x04\x01\ \x02\x05\x01\x12\x04\x8e\x03\x06\x1a\n\x11\n\t\x04\x19\x03\x01\x04\x01\ \x02\x05\x02\x12\x04\x8e\x03\x1d\x1e\n\x10\n\x08\x04\x19\x03\x01\x04\x01\ \x02\x06\x12\x04\x8f\x03\x06\x1a\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\ \x06\x01\x12\x04\x8f\x03\x06\x15\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\ \x06\x02\x12\x04\x8f\x03\x18\x19\n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\ \x07\x12\x04\x90\x03\x06\x1a\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\x07\ \x01\x12\x04\x90\x03\x06\x15\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\x07\ \x02\x12\x04\x90\x03\x18\x19\n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\x08\ \x12\x04\x91\x03\x06\x1c\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\x08\x01\ \x12\x04\x91\x03\x06\x17\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\x08\x02\ \x12\x04\x91\x03\x1a\x1b\n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\t\x12\ \x04\x92\x03\x06\x19\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\t\x01\x12\x04\ \x92\x03\x06\x14\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\t\x02\x12\x04\x92\ \x03\x17\x18\n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\n\x12\x04\x93\x03\ \x06\x19\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\n\x01\x12\x04\x93\x03\x06\ \x13\n\x11\n\t\x04\x19\x03\x01\x04\x01\x02\n\x02\x12\x04\x93\x03\x16\x18\ \n\x10\n\x08\x04\x19\x03\x01\x04\x01\x02\x0b\x12\x04\x94\x03\x06\x17\n\ \x11\n\t\x04\x19\x03\x01\x04\x01\x02\x0b\x01\x12\x04\x94\x03\x06\x11\n\ \x11\n\t\x04\x19\x03\x01\x04\x01\x02\x0b\x02\x12\x04\x94\x03\x14\x16\n\ \x10\n\x08\x04\x19\x03\x01\x04\x01\x02\x0c\x12\x04\x95\x03\x06\x1f\n\x11\ \n\t\x04\x19\x03\x01\x04\x01\x02\x0c\x01\x12\x04\x95\x03\x06\x19\n\x11\n\ \t\x04\x19\x03\x01\x04\x01\x02\x0c\x02\x12\x04\x95\x03\x1c\x1e\n\x10\n\ \x08\x04\x19\x03\x01\x04\x01\x02\r\x12\x04\x96\x03\x06\x13\n\x11\n\t\x04\ \x19\x03\x01\x04\x01\x02\r\x01\x12\x04\x96\x03\x06\r\n\x11\n\t\x04\x19\ \x03\x01\x04\x01\x02\r\x02\x12\x04\x96\x03\x10\x12\n\x10\n\x08\x04\x19\ \x03\x01\x04\x01\x02\x0e\x12\x04\x97\x03\x06\x1b\n\x11\n\t\x04\x19\x03\ \x01\x04\x01\x02\x0e\x01\x12\x04\x97\x03\x06\x15\n\x11\n\t\x04\x19\x03\ \x01\x04\x01\x02\x0e\x02\x12\x04\x97\x03\x18\x1a\n\x10\n\x08\x04\x19\x03\ \x01\x04\x01\x02\x0f\x12\x04\x98\x03\x06\x18\n\x11\n\t\x04\x19\x03\x01\ \x04\x01\x02\x0f\x01\x12\x04\x98\x03\x06\x12\n\x11\n\t\x04\x19\x03\x01\ \x04\x01\x02\x0f\x02\x12\x04\x98\x03\x15\x17\n\x0e\n\x06\x04\x19\x03\x01\ \x02\0\x12\x04\x9a\x03\x04\x12\n\x0f\n\x07\x04\x19\x03\x01\x02\0\x05\x12\ \x04\x9a\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\0\x01\x12\x04\x9a\x03\ \n\r\n\x0f\n\x07\x04\x19\x03\x01\x02\0\x03\x12\x04\x9a\x03\x10\x11\n\x0e\ \n\x06\x04\x19\x03\x01\x02\x01\x12\x04\x9b\x03\x04\x11\n\x0f\n\x07\x04\ \x19\x03\x01\x02\x01\x06\x12\x04\x9b\x03\x04\x08\n\x0f\n\x07\x04\x19\x03\ \x01\x02\x01\x01\x12\x04\x9b\x03\t\x0c\n\x0f\n\x07\x04\x19\x03\x01\x02\ \x01\x03\x12\x04\x9b\x03\x0f\x10\n\x0e\n\x06\x04\x19\x03\x01\x02\x02\x12\ \x04\x9c\x03\x04#\n\x0f\n\x07\x04\x19\x03\x01\x02\x02\x06\x12\x04\x9c\ \x03\x04\x12\n\x0f\n\x07\x04\x19\x03\x01\x02\x02\x01\x12\x04\x9c\x03\x13\ \x1e\n\x0f\n\x07\x04\x19\x03\x01\x02\x02\x03\x12\x04\x9c\x03!\"\n\x0e\n\ \x06\x04\x19\x03\x01\x02\x03\x12\x04\x9e\x03\x04\x1d\n\x0f\n\x07\x04\x19\ \x03\x01\x02\x03\x05\x12\x04\x9e\x03\x04\n\n\x0f\n\x07\x04\x19\x03\x01\ \x02\x03\x01\x12\x04\x9e\x03\x0b\x17\n\x0f\n\x07\x04\x19\x03\x01\x02\x03\ \x03\x12\x04\x9e\x03\x1a\x1c\n\x0e\n\x06\x04\x19\x03\x01\x02\x04\x12\x04\ \x9f\x03\x04\x1f\n\x0f\n\x07\x04\x19\x03\x01\x02\x04\x05\x12\x04\x9f\x03\ \x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\x04\x01\x12\x04\x9f\x03\n\x19\n\ \x0f\n\x07\x04\x19\x03\x01\x02\x04\x03\x12\x04\x9f\x03\x1c\x1e\n\x0e\n\ \x06\x04\x19\x03\x01\x02\x05\x12\x04\xa0\x03\x04\x1f\n\x0f\n\x07\x04\x19\ \x03\x01\x02\x05\x05\x12\x04\xa0\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x01\ \x02\x05\x01\x12\x04\xa0\x03\n\x19\n\x0f\n\x07\x04\x19\x03\x01\x02\x05\ \x03\x12\x04\xa0\x03\x1c\x1e\n\x0e\n\x06\x04\x19\x03\x01\x02\x06\x12\x04\ \xa1\x03\x04(\n\x0f\n\x07\x04\x19\x03\x01\x02\x06\x05\x12\x04\xa1\x03\ \x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\x06\x01\x12\x04\xa1\x03\n\"\n\x0f\ \n\x07\x04\x19\x03\x01\x02\x06\x03\x12\x04\xa1\x03%'\n\x0e\n\x06\x04\x19\ \x03\x01\x02\x07\x12\x04\xa2\x03\x04.\n\x0f\n\x07\x04\x19\x03\x01\x02\ \x07\x05\x12\x04\xa2\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\x07\x01\ \x12\x04\xa2\x03\n(\n\x0f\n\x07\x04\x19\x03\x01\x02\x07\x03\x12\x04\xa2\ \x03+-\n\x0e\n\x06\x04\x19\x03\x01\x02\x08\x12\x04\xa3\x03\x040\n\x0f\n\ \x07\x04\x19\x03\x01\x02\x08\x05\x12\x04\xa3\x03\x04\t\n\x0f\n\x07\x04\ \x19\x03\x01\x02\x08\x01\x12\x04\xa3\x03\n*\n\x0f\n\x07\x04\x19\x03\x01\ \x02\x08\x03\x12\x04\xa3\x03-/\n\x0e\n\x06\x04\x19\x03\x01\x02\t\x12\x04\ \xa4\x03\x04\x1b\n\x0f\n\x07\x04\x19\x03\x01\x02\t\x05\x12\x04\xa4\x03\ \x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\t\x01\x12\x04\xa4\x03\n\x15\n\x0f\ \n\x07\x04\x19\x03\x01\x02\t\x03\x12\x04\xa4\x03\x18\x1a\n\x0e\n\x06\x04\ \x19\x03\x01\x02\n\x12\x04\xa5\x03\x04(\n\x0f\n\x07\x04\x19\x03\x01\x02\ \n\x05\x12\x04\xa5\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\n\x01\x12\ \x04\xa5\x03\n\"\n\x0f\n\x07\x04\x19\x03\x01\x02\n\x03\x12\x04\xa5\x03%'\ \n\x0e\n\x06\x04\x19\x03\x01\x02\x0b\x12\x04\xa8\x03\x04\x17\n\x0f\n\x07\ \x04\x19\x03\x01\x02\x0b\x05\x12\x04\xa8\x03\x04\t\n\x0f\n\x07\x04\x19\ \x03\x01\x02\x0b\x01\x12\x04\xa8\x03\n\x11\n\x0f\n\x07\x04\x19\x03\x01\ \x02\x0b\x03\x12\x04\xa8\x03\x14\x16\n\x0e\n\x06\x04\x19\x03\x01\x02\x0c\ \x12\x04\xa9\x03\x041\n\x0f\n\x07\x04\x19\x03\x01\x02\x0c\x04\x12\x04\ \xa9\x03\x04\x0c\n\x0f\n\x07\x04\x19\x03\x01\x02\x0c\x06\x12\x04\xa9\x03\ \r\x1e\n\x0f\n\x07\x04\x19\x03\x01\x02\x0c\x01\x12\x04\xa9\x03\x1f+\n\ \x0f\n\x07\x04\x19\x03\x01\x02\x0c\x03\x12\x04\xa9\x03.0\n\x0e\n\x06\x04\ \x19\x03\x01\x02\r\x12\x04\xaa\x03\x04&\n\x0f\n\x07\x04\x19\x03\x01\x02\ \r\x05\x12\x04\xaa\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x01\x02\r\x01\x12\ \x04\xaa\x03\n\x20\n\x0f\n\x07\x04\x19\x03\x01\x02\r\x03\x12\x04\xaa\x03\ #%\n\x0e\n\x06\x04\x19\x03\x01\x02\x0e\x12\x04\xab\x03\x045\n\x0f\n\x07\ \x04\x19\x03\x01\x02\x0e\x06\x12\x04\xab\x03\x04\x16\n\x0f\n\x07\x04\x19\ \x03\x01\x02\x0e\x01\x12\x04\xab\x03\x17/\n\x0f\n\x07\x04\x19\x03\x01\ \x02\x0e\x03\x12\x04\xab\x0324\n\x0e\n\x04\x04\x19\x03\x02\x12\x06\xae\ \x03\x02\xbc\x03\x03\n\r\n\x05\x04\x19\x03\x02\x01\x12\x04\xae\x03\n\r\n\ \x0e\n\x06\x04\x19\x03\x02\x02\0\x12\x04\xaf\x03\x04\x1e\n\x0f\n\x07\x04\ \x19\x03\x02\x02\0\x05\x12\x04\xaf\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x02\ \x02\0\x01\x12\x04\xaf\x03\n\x19\n\x0f\n\x07\x04\x19\x03\x02\x02\0\x03\ \x12\x04\xaf\x03\x1c\x1d\n\x0e\n\x06\x04\x19\x03\x02\x02\x01\x12\x04\xb0\ \x03\x04\x1c\n\x0f\n\x07\x04\x19\x03\x02\x02\x01\x05\x12\x04\xb0\x03\x04\ \t\n\x0f\n\x07\x04\x19\x03\x02\x02\x01\x01\x12\x04\xb0\x03\n\x17\n\x0f\n\ \x07\x04\x19\x03\x02\x02\x01\x03\x12\x04\xb0\x03\x1a\x1b\n\x0e\n\x06\x04\ \x19\x03\x02\x02\x02\x12\x04\xb1\x03\x04\x1d\n\x0f\n\x07\x04\x19\x03\x02\ \x02\x02\x05\x12\x04\xb1\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x02\x02\x02\ \x01\x12\x04\xb1\x03\n\x18\n\x0f\n\x07\x04\x19\x03\x02\x02\x02\x03\x12\ \x04\xb1\x03\x1b\x1c\n\x0e\n\x06\x04\x19\x03\x02\x02\x03\x12\x04\xb2\x03\ \x04\x19\n\x0f\n\x07\x04\x19\x03\x02\x02\x03\x05\x12\x04\xb2\x03\x04\t\n\ \x0f\n\x07\x04\x19\x03\x02\x02\x03\x01\x12\x04\xb2\x03\n\x14\n\x0f\n\x07\ \x04\x19\x03\x02\x02\x03\x03\x12\x04\xb2\x03\x17\x18\n\x0e\n\x06\x04\x19\ \x03\x02\x02\x04\x12\x04\xb3\x03\x04!\n\x0f\n\x07\x04\x19\x03\x02\x02\ \x04\x04\x12\x04\xb3\x03\x04\x0c\n\x0f\n\x07\x04\x19\x03\x02\x02\x04\x06\ \x12\x04\xb3\x03\r\x16\n\x0f\n\x07\x04\x19\x03\x02\x02\x04\x01\x12\x04\ \xb3\x03\x17\x1c\n\x0f\n\x07\x04\x19\x03\x02\x02\x04\x03\x12\x04\xb3\x03\ \x1f\x20\n\x1f\n\x06\x04\x19\x03\x02\x02\x05\x12\x04\xb5\x03\x04\x14\x1a\ \x0f\x20data\x20not\x20used\n\n\x0f\n\x07\x04\x19\x03\x02\x02\x05\x05\ \x12\x04\xb5\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x02\x02\x05\x01\x12\x04\ \xb5\x03\n\x0e\n\x0f\n\x07\x04\x19\x03\x02\x02\x05\x03\x12\x04\xb5\x03\ \x11\x13\nI\n\x06\x04\x19\x03\x02\x02\x06\x12\x04\xb7\x03\x04$\x1a9only\ \x20support\x20size\x20=\x201,\x20\x20repeated\x20list\x20here\x20for\ \x20extension\n\n\x0f\n\x07\x04\x19\x03\x02\x02\x06\x04\x12\x04\xb7\x03\ \x04\x0c\n\x0f\n\x07\x04\x19\x03\x02\x02\x06\x06\x12\x04\xb7\x03\r\x15\n\ \x0f\n\x07\x04\x19\x03\x02\x02\x06\x01\x12\x04\xb7\x03\x16\x1e\n\x0f\n\ \x07\x04\x19\x03\x02\x02\x06\x03\x12\x04\xb7\x03!#\n\"\n\x06\x04\x19\x03\ \x02\x02\x07\x12\x04\xb9\x03\x04\x17\x1a\x12\x20scripts\x20not\x20used\n\ \n\x0f\n\x07\x04\x19\x03\x02\x02\x07\x05\x12\x04\xb9\x03\x04\t\n\x0f\n\ \x07\x04\x19\x03\x02\x02\x07\x01\x12\x04\xb9\x03\n\x11\n\x0f\n\x07\x04\ \x19\x03\x02\x02\x07\x03\x12\x04\xb9\x03\x14\x16\n\x0e\n\x06\x04\x19\x03\ \x02\x02\x08\x12\x04\xba\x03\x04\x19\n\x0f\n\x07\x04\x19\x03\x02\x02\x08\ \x05\x12\x04\xba\x03\x04\t\n\x0f\n\x07\x04\x19\x03\x02\x02\x08\x01\x12\ \x04\xba\x03\n\x13\n\x0f\n\x07\x04\x19\x03\x02\x02\x08\x03\x12\x04\xba\ \x03\x16\x18\n\x0e\n\x06\x04\x19\x03\x02\x02\t\x12\x04\xbb\x03\x04\x19\n\ \x0f\n\x07\x04\x19\x03\x02\x02\t\x05\x12\x04\xbb\x03\x04\t\n\x0f\n\x07\ \x04\x19\x03\x02\x02\t\x01\x12\x04\xbb\x03\n\x13\n\x0f\n\x07\x04\x19\x03\ \x02\x02\t\x03\x12\x04\xbb\x03\x16\x18\n\x0c\n\x04\x04\x19\x02\0\x12\x04\ \xbe\x03\x02\x13\n\r\n\x05\x04\x19\x02\0\x06\x12\x04\xbe\x03\x02\x05\n\r\ \n\x05\x04\x19\x02\0\x01\x12\x04\xbe\x03\x06\x0e\n\r\n\x05\x04\x19\x02\0\ \x03\x12\x04\xbe\x03\x11\x12\nQ\n\x04\x04\x19\x02\x01\x12\x04\xc0\x03\ \x02\x1f\x1aC\x20only\x20support\x20size\x20=\x201,\x20\x20repeated\x20l\ ist\x20here\x20for\x20muti-sig\x20extension\n\n\r\n\x05\x04\x19\x02\x01\ \x04\x12\x04\xc0\x03\x02\n\n\r\n\x05\x04\x19\x02\x01\x05\x12\x04\xc0\x03\ \x0b\x10\n\r\n\x05\x04\x19\x02\x01\x01\x12\x04\xc0\x03\x11\x1a\n\r\n\x05\ \x04\x19\x02\x01\x03\x12\x04\xc0\x03\x1d\x1e\n\x0c\n\x04\x04\x19\x02\x02\ \x12\x04\xc1\x03\x02\x1a\n\r\n\x05\x04\x19\x02\x02\x04\x12\x04\xc1\x03\ \x02\n\n\r\n\x05\x04\x19\x02\x02\x06\x12\x04\xc1\x03\x0b\x11\n\r\n\x05\ \x04\x19\x02\x02\x01\x12\x04\xc1\x03\x12\x15\n\r\n\x05\x04\x19\x02\x02\ \x03\x12\x04\xc1\x03\x18\x19\n\x0c\n\x02\x04\x1a\x12\x06\xc4\x03\0\xe9\ \x03\x01\n\x0b\n\x03\x04\x1a\x01\x12\x04\xc4\x03\x08\x17\n\x0e\n\x04\x04\ \x1a\x04\0\x12\x06\xc5\x03\x02\xc8\x03\x03\n\r\n\x05\x04\x1a\x04\0\x01\ \x12\x04\xc5\x03\x07\x0b\n\x0e\n\x06\x04\x1a\x04\0\x02\0\x12\x04\xc6\x03\ \x04\x0f\n\x0f\n\x07\x04\x1a\x04\0\x02\0\x01\x12\x04\xc6\x03\x04\n\n\x0f\ \n\x07\x04\x1a\x04\0\x02\0\x02\x12\x04\xc6\x03\r\x0e\n\x0e\n\x06\x04\x1a\ \x04\0\x02\x01\x12\x04\xc7\x03\x04\x0f\n\x0f\n\x07\x04\x1a\x04\0\x02\x01\ \x01\x12\x04\xc7\x03\x04\n\n\x0f\n\x07\x04\x1a\x04\0\x02\x01\x02\x12\x04\ \xc7\x03\r\x0e\n\x0e\n\x04\x04\x1a\x03\0\x12\x06\xc9\x03\x02\xcd\x03\x03\ \n\r\n\x05\x04\x1a\x03\0\x01\x12\x04\xc9\x03\n\r\n\x0e\n\x06\x04\x1a\x03\ \0\x02\0\x12\x04\xca\x03\x04\x16\n\x0f\n\x07\x04\x1a\x03\0\x02\0\x05\x12\ \x04\xca\x03\x04\t\n\x0f\n\x07\x04\x1a\x03\0\x02\0\x01\x12\x04\xca\x03\n\ \x11\n\x0f\n\x07\x04\x1a\x03\0\x02\0\x03\x12\x04\xca\x03\x14\x15\n\x0e\n\ \x06\x04\x1a\x03\0\x02\x01\x12\x04\xcb\x03\x04\x1e\n\x0f\n\x07\x04\x1a\ \x03\0\x02\x01\x04\x12\x04\xcb\x03\x04\x0c\n\x0f\n\x07\x04\x1a\x03\0\x02\ \x01\x05\x12\x04\xcb\x03\r\x12\n\x0f\n\x07\x04\x1a\x03\0\x02\x01\x01\x12\ \x04\xcb\x03\x13\x19\n\x0f\n\x07\x04\x1a\x03\0\x02\x01\x03\x12\x04\xcb\ \x03\x1c\x1d\n\x0e\n\x06\x04\x1a\x03\0\x02\x02\x12\x04\xcc\x03\x04\x13\n\ \x0f\n\x07\x04\x1a\x03\0\x02\x02\x05\x12\x04\xcc\x03\x04\t\n\x0f\n\x07\ \x04\x1a\x03\0\x02\x02\x01\x12\x04\xcc\x03\n\x0e\n\x0f\n\x07\x04\x1a\x03\ \0\x02\x02\x03\x12\x04\xcc\x03\x11\x12\n\x0c\n\x04\x04\x1a\x02\0\x12\x04\ \xce\x03\x02\x0f\n\r\n\x05\x04\x1a\x02\0\x05\x12\x04\xce\x03\x02\x07\n\r\ \n\x05\x04\x1a\x02\0\x01\x12\x04\xce\x03\x08\n\n\r\n\x05\x04\x1a\x02\0\ \x03\x12\x04\xce\x03\r\x0e\n\x0c\n\x04\x04\x1a\x02\x01\x12\x04\xcf\x03\ \x02\x10\n\r\n\x05\x04\x1a\x02\x01\x05\x12\x04\xcf\x03\x02\x07\n\r\n\x05\ \x04\x1a\x02\x01\x01\x12\x04\xcf\x03\x08\x0b\n\r\n\x05\x04\x1a\x02\x01\ \x03\x12\x04\xcf\x03\x0e\x0f\n\x0c\n\x04\x04\x1a\x02\x02\x12\x04\xd0\x03\ \x02\x18\n\r\n\x05\x04\x1a\x02\x02\x05\x12\x04\xd0\x03\x02\x07\n\r\n\x05\ \x04\x1a\x02\x02\x01\x12\x04\xd0\x03\x08\x13\n\r\n\x05\x04\x1a\x02\x02\ \x03\x12\x04\xd0\x03\x16\x17\n\x0c\n\x04\x04\x1a\x02\x03\x12\x04\xd1\x03\ \x02\x1b\n\r\n\x05\x04\x1a\x02\x03\x05\x12\x04\xd1\x03\x02\x07\n\r\n\x05\ \x04\x1a\x02\x03\x01\x12\x04\xd1\x03\x08\x16\n\r\n\x05\x04\x1a\x02\x03\ \x03\x12\x04\xd1\x03\x19\x1a\n\x0c\n\x04\x04\x1a\x02\x04\x12\x04\xd2\x03\ \x02$\n\r\n\x05\x04\x1a\x02\x04\x04\x12\x04\xd2\x03\x02\n\n\r\n\x05\x04\ \x1a\x02\x04\x05\x12\x04\xd2\x03\x0b\x10\n\r\n\x05\x04\x1a\x02\x04\x01\ \x12\x04\xd2\x03\x11\x1f\n\r\n\x05\x04\x1a\x02\x04\x03\x12\x04\xd2\x03\"\ #\n\x0c\n\x04\x04\x1a\x02\x05\x12\x04\xd3\x03\x02\x1d\n\r\n\x05\x04\x1a\ \x02\x05\x05\x12\x04\xd3\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x05\x01\x12\ \x04\xd3\x03\x08\x18\n\r\n\x05\x04\x1a\x02\x05\x03\x12\x04\xd3\x03\x1b\ \x1c\n\x0c\n\x04\x04\x1a\x02\x06\x12\x04\xd4\x03\x02\x1e\n\r\n\x05\x04\ \x1a\x02\x06\x06\x12\x04\xd4\x03\x02\x11\n\r\n\x05\x04\x1a\x02\x06\x01\ \x12\x04\xd4\x03\x12\x19\n\r\n\x05\x04\x1a\x02\x06\x03\x12\x04\xd4\x03\ \x1c\x1d\n\x0c\n\x04\x04\x1a\x02\x07\x12\x04\xd5\x03\x02\x17\n\r\n\x05\ \x04\x1a\x02\x07\x04\x12\x04\xd5\x03\x02\n\n\r\n\x05\x04\x1a\x02\x07\x06\ \x12\x04\xd5\x03\x0b\x0e\n\r\n\x05\x04\x1a\x02\x07\x01\x12\x04\xd5\x03\ \x0f\x12\n\r\n\x05\x04\x1a\x02\x07\x03\x12\x04\xd5\x03\x15\x16\n\x0c\n\ \x04\x04\x1a\x02\x08\x12\x04\xd6\x03\x02\x12\n\r\n\x05\x04\x1a\x02\x08\ \x06\x12\x04\xd6\x03\x02\x06\n\r\n\x05\x04\x1a\x02\x08\x01\x12\x04\xd6\ \x03\x07\r\n\r\n\x05\x04\x1a\x02\x08\x03\x12\x04\xd6\x03\x10\x11\n\x0c\n\ \x04\x04\x1a\x02\t\x12\x04\xd7\x03\x02\x18\n\r\n\x05\x04\x1a\x02\t\x05\ \x12\x04\xd7\x03\x02\x07\n\r\n\x05\x04\x1a\x02\t\x01\x12\x04\xd7\x03\x08\ \x12\n\r\n\x05\x04\x1a\x02\t\x03\x12\x04\xd7\x03\x15\x17\n\x0c\n\x04\x04\ \x1a\x02\n\x12\x04\xd9\x03\x02\x1b\n\r\n\x05\x04\x1a\x02\n\x05\x12\x04\ \xd9\x03\x02\x08\n\r\n\x05\x04\x1a\x02\n\x01\x12\x04\xd9\x03\t\x15\n\r\n\ \x05\x04\x1a\x02\n\x03\x12\x04\xd9\x03\x18\x1a\n\x0c\n\x04\x04\x1a\x02\ \x0b\x12\x04\xda\x03\x02\x1d\n\r\n\x05\x04\x1a\x02\x0b\x05\x12\x04\xda\ \x03\x02\x07\n\r\n\x05\x04\x1a\x02\x0b\x01\x12\x04\xda\x03\x08\x17\n\r\n\ \x05\x04\x1a\x02\x0b\x03\x12\x04\xda\x03\x1a\x1c\n\x0c\n\x04\x04\x1a\x02\ \x0c\x12\x04\xdb\x03\x02\x1d\n\r\n\x05\x04\x1a\x02\x0c\x05\x12\x04\xdb\ \x03\x02\x07\n\r\n\x05\x04\x1a\x02\x0c\x01\x12\x04\xdb\x03\x08\x17\n\r\n\ \x05\x04\x1a\x02\x0c\x03\x12\x04\xdb\x03\x1a\x1c\n\x0c\n\x04\x04\x1a\x02\ \r\x12\x04\xdc\x03\x02:\n\r\n\x05\x04\x1a\x02\r\x04\x12\x04\xdc\x03\x02\ \n\n\r\n\x05\x04\x1a\x02\r\x06\x12\x04\xdc\x03\x0b\x1e\n\r\n\x05\x04\x1a\ \x02\r\x01\x12\x04\xdc\x03\x1f4\n\r\n\x05\x04\x1a\x02\r\x03\x12\x04\xdc\ \x0379\n\x0c\n\x04\x04\x1a\x02\x0e\x12\x04\xdd\x03\x02&\n\r\n\x05\x04\ \x1a\x02\x0e\x05\x12\x04\xdd\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x0e\x01\ \x12\x04\xdd\x03\x08\x20\n\r\n\x05\x04\x1a\x02\x0e\x03\x12\x04\xdd\x03#%\ \n\x0c\n\x04\x04\x1a\x02\x0f\x12\x04\xde\x03\x02,\n\r\n\x05\x04\x1a\x02\ \x0f\x05\x12\x04\xde\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x0f\x01\x12\x04\ \xde\x03\x08&\n\r\n\x05\x04\x1a\x02\x0f\x03\x12\x04\xde\x03)+\n\x0c\n\ \x04\x04\x1a\x02\x10\x12\x04\xdf\x03\x02.\n\r\n\x05\x04\x1a\x02\x10\x05\ \x12\x04\xdf\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x10\x01\x12\x04\xdf\x03\ \x08(\n\r\n\x05\x04\x1a\x02\x10\x03\x12\x04\xdf\x03+-\n\x0c\n\x04\x04\ \x1a\x02\x11\x12\x04\xe0\x03\x02\x19\n\r\n\x05\x04\x1a\x02\x11\x05\x12\ \x04\xe0\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x11\x01\x12\x04\xe0\x03\x08\ \x13\n\r\n\x05\x04\x1a\x02\x11\x03\x12\x04\xe0\x03\x16\x18\n\x0c\n\x04\ \x04\x1a\x02\x12\x12\x04\xe1\x03\x02&\n\r\n\x05\x04\x1a\x02\x12\x05\x12\ \x04\xe1\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x12\x01\x12\x04\xe1\x03\x08\ \x20\n\r\n\x05\x04\x1a\x02\x12\x03\x12\x04\xe1\x03#%\n\x0c\n\x04\x04\x1a\ \x02\x13\x12\x04\xe3\x03\x02\x15\n\r\n\x05\x04\x1a\x02\x13\x05\x12\x04\ \xe3\x03\x02\x07\n\r\n\x05\x04\x1a\x02\x13\x01\x12\x04\xe3\x03\x08\x0f\n\ \r\n\x05\x04\x1a\x02\x13\x03\x12\x04\xe3\x03\x12\x14\n\x0c\n\x04\x04\x1a\ \x02\x14\x12\x04\xe4\x03\x02/\n\r\n\x05\x04\x1a\x02\x14\x04\x12\x04\xe4\ \x03\x02\n\n\r\n\x05\x04\x1a\x02\x14\x06\x12\x04\xe4\x03\x0b\x1c\n\r\n\ \x05\x04\x1a\x02\x14\x01\x12\x04\xe4\x03\x1d)\n\r\n\x05\x04\x1a\x02\x14\ \x03\x12\x04\xe4\x03,.\n\x0c\n\x04\x04\x1a\x02\x15\x12\x04\xe5\x03\x02\ \x18\n\r\n\x05\x04\x1a\x02\x15\x05\x12\x04\xe5\x03\x02\x07\n\r\n\x05\x04\ \x1a\x02\x15\x01\x12\x04\xe5\x03\x08\x12\n\r\n\x05\x04\x1a\x02\x15\x03\ \x12\x04\xe5\x03\x15\x17\n\x0c\n\x04\x04\x1a\x02\x16\x12\x04\xe7\x03\x02\ $\n\r\n\x05\x04\x1a\x02\x16\x05\x12\x04\xe7\x03\x02\x07\n\r\n\x05\x04\ \x1a\x02\x16\x01\x12\x04\xe7\x03\x08\x1e\n\r\n\x05\x04\x1a\x02\x16\x03\ \x12\x04\xe7\x03!#\n\x0c\n\x04\x04\x1a\x02\x17\x12\x04\xe8\x03\x023\n\r\ \n\x05\x04\x1a\x02\x17\x06\x12\x04\xe8\x03\x02\x14\n\r\n\x05\x04\x1a\x02\ \x17\x01\x12\x04\xe8\x03\x15-\n\r\n\x05\x04\x1a\x02\x17\x03\x12\x04\xe8\ \x0302\n\x0c\n\x02\x04\x1b\x12\x06\xeb\x03\0\xef\x03\x01\n\x0b\n\x03\x04\ \x1b\x01\x12\x04\xeb\x03\x08\x16\n\x0c\n\x04\x04\x1b\x02\0\x12\x04\xec\ \x03\x02\x18\n\r\n\x05\x04\x1b\x02\0\x05\x12\x04\xec\x03\x02\x07\n\r\n\ \x05\x04\x1b\x02\0\x01\x12\x04\xec\x03\x08\x13\n\r\n\x05\x04\x1b\x02\0\ \x03\x12\x04\xec\x03\x16\x17\n\x0c\n\x04\x04\x1b\x02\x01\x12\x04\xed\x03\ \x02\x1b\n\r\n\x05\x04\x1b\x02\x01\x05\x12\x04\xed\x03\x02\x07\n\r\n\x05\ \x04\x1b\x02\x01\x01\x12\x04\xed\x03\x08\x16\n\r\n\x05\x04\x1b\x02\x01\ \x03\x12\x04\xed\x03\x19\x1a\n\x0c\n\x04\x04\x1b\x02\x02\x12\x04\xee\x03\ \x02/\n\r\n\x05\x04\x1b\x02\x02\x04\x12\x04\xee\x03\x02\n\n\r\n\x05\x04\ \x1b\x02\x02\x06\x12\x04\xee\x03\x0b\x1a\n\r\n\x05\x04\x1b\x02\x02\x01\ \x12\x04\xee\x03\x1b*\n\r\n\x05\x04\x1b\x02\x02\x03\x12\x04\xee\x03-.\n\ \x0c\n\x02\x04\x1c\x12\x06\xf1\x03\0\xf3\x03\x01\n\x0b\n\x03\x04\x1c\x01\ \x12\x04\xf1\x03\x08\x14\n\x0c\n\x04\x04\x1c\x02\0\x12\x04\xf2\x03\x02(\ \n\r\n\x05\x04\x1c\x02\0\x04\x12\x04\xf2\x03\x02\n\n\r\n\x05\x04\x1c\x02\ \0\x06\x12\x04\xf2\x03\x0b\x16\n\r\n\x05\x04\x1c\x02\0\x01\x12\x04\xf2\ \x03\x17#\n\r\n\x05\x04\x1c\x02\0\x03\x12\x04\xf2\x03&'\n\x0c\n\x02\x04\ \x1d\x12\x06\xf5\x03\0\x84\x04\x01\n\x0b\n\x03\x04\x1d\x01\x12\x04\xf5\ \x03\x08\x13\n\x0e\n\x04\x04\x1d\x03\0\x12\x06\xf6\x03\x02\x81\x04\x03\n\ \r\n\x05\x04\x1d\x03\0\x01\x12\x04\xf6\x03\n\r\n\x0e\n\x06\x04\x1d\x03\0\ \x02\0\x12\x04\xf7\x03\x04\x18\n\x0f\n\x07\x04\x1d\x03\0\x02\0\x05\x12\ \x04\xf7\x03\x04\t\n\x0f\n\x07\x04\x1d\x03\0\x02\0\x01\x12\x04\xf7\x03\n\ \x13\n\x0f\n\x07\x04\x1d\x03\0\x02\0\x03\x12\x04\xf7\x03\x16\x17\n\x0e\n\ \x06\x04\x1d\x03\0\x02\x01\x12\x04\xf8\x03\x04\x19\n\x0f\n\x07\x04\x1d\ \x03\0\x02\x01\x05\x12\x04\xf8\x03\x04\t\n\x0f\n\x07\x04\x1d\x03\0\x02\ \x01\x01\x12\x04\xf8\x03\n\x14\n\x0f\n\x07\x04\x1d\x03\0\x02\x01\x03\x12\ \x04\xf8\x03\x17\x18\n\x0e\n\x06\x04\x1d\x03\0\x02\x02\x12\x04\xf9\x03\ \x04\x19\n\x0f\n\x07\x04\x1d\x03\0\x02\x02\x05\x12\x04\xf9\x03\x04\t\n\ \x0f\n\x07\x04\x1d\x03\0\x02\x02\x01\x12\x04\xf9\x03\n\x14\n\x0f\n\x07\ \x04\x1d\x03\0\x02\x02\x03\x12\x04\xf9\x03\x17\x18\n7\n\x06\x04\x1d\x03\ \0\x02\x03\x12\x04\xfc\x03\x04\x15\x1a'bytes\x20nonce\x20=\x205;\nbytes\ \x20difficulty\x20=\x206;\n\n\x0f\n\x07\x04\x1d\x03\0\x02\x03\x05\x12\ \x04\xfc\x03\x04\t\n\x0f\n\x07\x04\x1d\x03\0\x02\x03\x01\x12\x04\xfc\x03\ \n\x10\n\x0f\n\x07\x04\x1d\x03\0\x02\x03\x03\x12\x04\xfc\x03\x13\x14\n\ \x0e\n\x06\x04\x1d\x03\0\x02\x04\x12\x04\xfd\x03\x04\x19\n\x0f\n\x07\x04\ \x1d\x03\0\x02\x04\x05\x12\x04\xfd\x03\x04\t\n\x0f\n\x07\x04\x1d\x03\0\ \x02\x04\x01\x12\x04\xfd\x03\n\x14\n\x0f\n\x07\x04\x1d\x03\0\x02\x04\x03\ \x12\x04\xfd\x03\x17\x18\n\x0e\n\x06\x04\x1d\x03\0\x02\x05\x12\x04\xfe\ \x03\x04\x1e\n\x0f\n\x07\x04\x1d\x03\0\x02\x05\x05\x12\x04\xfe\x03\x04\t\ \n\x0f\n\x07\x04\x1d\x03\0\x02\x05\x01\x12\x04\xfe\x03\n\x19\n\x0f\n\x07\ \x04\x1d\x03\0\x02\x05\x03\x12\x04\xfe\x03\x1c\x1d\n\x0e\n\x06\x04\x1d\ \x03\0\x02\x06\x12\x04\xff\x03\x04\x17\n\x0f\n\x07\x04\x1d\x03\0\x02\x06\ \x05\x12\x04\xff\x03\x04\t\n\x0f\n\x07\x04\x1d\x03\0\x02\x06\x01\x12\x04\ \xff\x03\n\x11\n\x0f\n\x07\x04\x1d\x03\0\x02\x06\x03\x12\x04\xff\x03\x14\ \x16\n\x0e\n\x06\x04\x1d\x03\0\x02\x07\x12\x04\x80\x04\x04\x20\n\x0f\n\ \x07\x04\x1d\x03\0\x02\x07\x05\x12\x04\x80\x04\x04\t\n\x0f\n\x07\x04\x1d\ \x03\0\x02\x07\x01\x12\x04\x80\x04\n\x1a\n\x0f\n\x07\x04\x1d\x03\0\x02\ \x07\x03\x12\x04\x80\x04\x1d\x1f\n\x0c\n\x04\x04\x1d\x02\0\x12\x04\x82\ \x04\x02\x13\n\r\n\x05\x04\x1d\x02\0\x06\x12\x04\x82\x04\x02\x05\n\r\n\ \x05\x04\x1d\x02\0\x01\x12\x04\x82\x04\x06\x0e\n\r\n\x05\x04\x1d\x02\0\ \x03\x12\x04\x82\x04\x11\x12\n\x0c\n\x04\x04\x1d\x02\x01\x12\x04\x83\x04\ \x02\x1e\n\r\n\x05\x04\x1d\x02\x01\x05\x12\x04\x83\x04\x02\x07\n\r\n\x05\ \x04\x1d\x02\x01\x01\x12\x04\x83\x04\x08\x19\n\r\n\x05\x04\x1d\x02\x01\ \x03\x12\x04\x83\x04\x1c\x1d\n\x15\n\x02\x04\x1e\x12\x06\x87\x04\0\x8a\ \x04\x01\x1a\x07\x20block\n\n\x0b\n\x03\x04\x1e\x01\x12\x04\x87\x04\x08\ \r\n\x0c\n\x04\x04\x1e\x02\0\x12\x04\x88\x04\x02(\n\r\n\x05\x04\x1e\x02\ \0\x04\x12\x04\x88\x04\x02\n\n\r\n\x05\x04\x1e\x02\0\x06\x12\x04\x88\x04\ \x0b\x16\n\r\n\x05\x04\x1e\x02\0\x01\x12\x04\x88\x04\x17#\n\r\n\x05\x04\ \x1e\x02\0\x03\x12\x04\x88\x04&'\n\x0c\n\x04\x04\x1e\x02\x01\x12\x04\x89\ \x04\x02\x1f\n\r\n\x05\x04\x1e\x02\x01\x06\x12\x04\x89\x04\x02\r\n\r\n\ \x05\x04\x1e\x02\x01\x01\x12\x04\x89\x04\x0e\x1a\n\r\n\x05\x04\x1e\x02\ \x01\x03\x12\x04\x89\x04\x1d\x1e\n\x0c\n\x02\x04\x1f\x12\x06\x8c\x04\0\ \x93\x04\x01\n\x0b\n\x03\x04\x1f\x01\x12\x04\x8c\x04\x08\x16\n\x0e\n\x04\ \x04\x1f\x03\0\x12\x06\x8d\x04\x02\x90\x04\x03\n\r\n\x05\x04\x1f\x03\0\ \x01\x12\x04\x8d\x04\n\x11\n\x0e\n\x06\x04\x1f\x03\0\x02\0\x12\x04\x8e\ \x04\x04\x13\n\x0f\n\x07\x04\x1f\x03\0\x02\0\x05\x12\x04\x8e\x04\x04\t\n\ \x0f\n\x07\x04\x1f\x03\0\x02\0\x01\x12\x04\x8e\x04\n\x0e\n\x0f\n\x07\x04\ \x1f\x03\0\x02\0\x03\x12\x04\x8e\x04\x11\x12\n\x0e\n\x06\x04\x1f\x03\0\ \x02\x01\x12\x04\x8f\x04\x04\x15\n\x0f\n\x07\x04\x1f\x03\0\x02\x01\x05\ \x12\x04\x8f\x04\x04\t\n\x0f\n\x07\x04\x1f\x03\0\x02\x01\x01\x12\x04\x8f\ \x04\n\x10\n\x0f\n\x07\x04\x1f\x03\0\x02\x01\x03\x12\x04\x8f\x04\x13\x14\ \n\x0c\n\x04\x04\x1f\x02\0\x12\x04\x91\x04\x02\x1b\n\r\n\x05\x04\x1f\x02\ \0\x04\x12\x04\x91\x04\x02\n\n\r\n\x05\x04\x1f\x02\0\x06\x12\x04\x91\x04\ \x0b\x12\n\r\n\x05\x04\x1f\x02\0\x01\x12\x04\x91\x04\x13\x16\n\r\n\x05\ \x04\x1f\x02\0\x03\x12\x04\x91\x04\x19\x1a\n\x0c\n\x04\x04\x1f\x02\x01\ \x12\x04\x92\x04\x02\x17\n\r\n\x05\x04\x1f\x02\x01\x05\x12\x04\x92\x04\ \x02\x07\n\r\n\x05\x04\x1f\x02\x01\x01\x12\x04\x92\x04\x08\x12\n\r\n\x05\ \x04\x1f\x02\x01\x03\x12\x04\x92\x04\x15\x16\n\x19\n\x02\x04\x20\x12\x06\ \x96\x04\0\xa3\x04\x01\x1a\x0b\x20Inventory\n\n\x0b\n\x03\x04\x20\x01\ \x12\x04\x96\x04\x08\x16\n\x0e\n\x04\x04\x20\x04\0\x12\x06\x97\x04\x02\ \x9b\x04\x03\n\r\n\x05\x04\x20\x04\0\x01\x12\x04\x97\x04\x07\x0b\n\x0e\n\ \x06\x04\x20\x04\0\x02\0\x12\x04\x98\x04\x04\r\n\x0f\n\x07\x04\x20\x04\0\ \x02\0\x01\x12\x04\x98\x04\x04\x08\n\x0f\n\x07\x04\x20\x04\0\x02\0\x02\ \x12\x04\x98\x04\x0b\x0c\n\x0e\n\x06\x04\x20\x04\0\x02\x01\x12\x04\x99\ \x04\x04\x10\n\x0f\n\x07\x04\x20\x04\0\x02\x01\x01\x12\x04\x99\x04\x04\ \x0b\n\x0f\n\x07\x04\x20\x04\0\x02\x01\x02\x12\x04\x99\x04\x0e\x0f\n\x0e\ \n\x06\x04\x20\x04\0\x02\x02\x12\x04\x9a\x04\x04\x0e\n\x0f\n\x07\x04\x20\ \x04\0\x02\x02\x01\x12\x04\x9a\x04\x04\t\n\x0f\n\x07\x04\x20\x04\0\x02\ \x02\x02\x12\x04\x9a\x04\x0c\r\n\x0e\n\x04\x04\x20\x03\0\x12\x06\x9d\x04\ \x02\xa0\x04\x03\n\r\n\x05\x04\x20\x03\0\x01\x12\x04\x9d\x04\n\x11\n\x0e\ \n\x06\x04\x20\x03\0\x02\0\x12\x04\x9e\x04\x04\x13\n\x0f\n\x07\x04\x20\ \x03\0\x02\0\x05\x12\x04\x9e\x04\x04\t\n\x0f\n\x07\x04\x20\x03\0\x02\0\ \x01\x12\x04\x9e\x04\n\x0e\n\x0f\n\x07\x04\x20\x03\0\x02\0\x03\x12\x04\ \x9e\x04\x11\x12\n\x0e\n\x06\x04\x20\x03\0\x02\x01\x12\x04\x9f\x04\x04\ \x15\n\x0f\n\x07\x04\x20\x03\0\x02\x01\x05\x12\x04\x9f\x04\x04\t\n\x0f\n\ \x07\x04\x20\x03\0\x02\x01\x01\x12\x04\x9f\x04\n\x10\n\x0f\n\x07\x04\x20\ \x03\0\x02\x01\x03\x12\x04\x9f\x04\x13\x14\n\x0c\n\x04\x04\x20\x02\0\x12\ \x04\xa1\x04\x02\x1b\n\r\n\x05\x04\x20\x02\0\x04\x12\x04\xa1\x04\x02\n\n\ \r\n\x05\x04\x20\x02\0\x06\x12\x04\xa1\x04\x0b\x12\n\r\n\x05\x04\x20\x02\ \0\x01\x12\x04\xa1\x04\x13\x16\n\r\n\x05\x04\x20\x02\0\x03\x12\x04\xa1\ \x04\x19\x1a\n\x0c\n\x04\x04\x20\x02\x01\x12\x04\xa2\x04\x02\x10\n\r\n\ \x05\x04\x20\x02\x01\x06\x12\x04\xa2\x04\x02\x06\n\r\n\x05\x04\x20\x02\ \x01\x01\x12\x04\xa2\x04\x07\x0b\n\r\n\x05\x04\x20\x02\x01\x03\x12\x04\ \xa2\x04\x0e\x0f\n\x0c\n\x02\x04!\x12\x06\xa5\x04\0\xac\x04\x01\n\x0b\n\ \x03\x04!\x01\x12\x04\xa5\x04\x08\x11\n\x0e\n\x04\x04!\x04\0\x12\x06\xa6\ \x04\x02\xa9\x04\x03\n\r\n\x05\x04!\x04\0\x01\x12\x04\xa6\x04\x07\x14\n\ \x0e\n\x06\x04!\x04\0\x02\0\x12\x04\xa7\x04\x04\x0c\n\x0f\n\x07\x04!\x04\ \0\x02\0\x01\x12\x04\xa7\x04\x04\x07\n\x0f\n\x07\x04!\x04\0\x02\0\x02\ \x12\x04\xa7\x04\n\x0b\n\x0e\n\x06\x04!\x04\0\x02\x01\x12\x04\xa8\x04\ \x04\x0e\n\x0f\n\x07\x04!\x04\0\x02\x01\x01\x12\x04\xa8\x04\x04\t\n\x0f\ \n\x07\x04!\x04\0\x02\x01\x02\x12\x04\xa8\x04\x0c\r\n\x0c\n\x04\x04!\x02\ \0\x12\x04\xaa\x04\x02\x19\n\r\n\x05\x04!\x02\0\x06\x12\x04\xaa\x04\x02\ \x0f\n\r\n\x05\x04!\x02\0\x01\x12\x04\xaa\x04\x10\x14\n\r\n\x05\x04!\x02\ \0\x03\x12\x04\xaa\x04\x17\x18\n\x0c\n\x04\x04!\x02\x01\x12\x04\xab\x04\ \x02\x19\n\r\n\x05\x04!\x02\x01\x04\x12\x04\xab\x04\x02\n\n\r\n\x05\x04!\ \x02\x01\x05\x12\x04\xab\x04\x0b\x10\n\r\n\x05\x04!\x02\x01\x01\x12\x04\ \xab\x04\x11\x14\n\r\n\x05\x04!\x02\x01\x03\x12\x04\xab\x04\x17\x18\n\ \x0c\n\x02\x04\"\x12\x06\xae\x04\0\xba\x04\x01\n\x0b\n\x03\x04\"\x01\x12\ \x04\xae\x04\x08\r\n\x0e\n\x04\x04\"\x04\0\x12\x06\xaf\x04\x02\xb4\x04\ \x03\n\r\n\x05\x04\"\x04\0\x01\x12\x04\xaf\x04\x07\x0f\n\x0e\n\x06\x04\"\ \x04\0\x02\0\x12\x04\xb0\x04\x04\x0c\n\x0f\n\x07\x04\"\x04\0\x02\0\x01\ \x12\x04\xb0\x04\x04\x07\n\x0f\n\x07\x04\"\x04\0\x02\0\x02\x12\x04\xb0\ \x04\n\x0b\n\x0e\n\x06\x04\"\x04\0\x02\x01\x12\x04\xb1\x04\x04\x0c\n\x0f\ \n\x07\x04\"\x04\0\x02\x01\x01\x12\x04\xb1\x04\x04\x07\n\x0f\n\x07\x04\"\ \x04\0\x02\x01\x02\x12\x04\xb1\x04\n\x0b\n\x0e\n\x06\x04\"\x04\0\x02\x02\ \x12\x04\xb2\x04\x04\x0e\n\x0f\n\x07\x04\"\x04\0\x02\x02\x01\x12\x04\xb2\ \x04\x04\t\n\x0f\n\x07\x04\"\x04\0\x02\x02\x02\x12\x04\xb2\x04\x0c\r\n\ \x0e\n\x06\x04\"\x04\0\x02\x03\x12\x04\xb3\x04\x04\x14\n\x0f\n\x07\x04\"\ \x04\0\x02\x03\x01\x12\x04\xb3\x04\x04\x0f\n\x0f\n\x07\x04\"\x04\0\x02\ \x03\x02\x12\x04\xb3\x04\x12\x13\n\x0c\n\x04\x04\"\x02\0\x12\x04\xb6\x04\ \x02\x14\n\r\n\x05\x04\"\x02\0\x06\x12\x04\xb6\x04\x02\n\n\r\n\x05\x04\"\ \x02\0\x01\x12\x04\xb6\x04\x0b\x0f\n\r\n\x05\x04\"\x02\0\x03\x12\x04\xb6\ \x04\x12\x13\n\x0c\n\x04\x04\"\x02\x01\x12\x04\xb7\x04\x02\x1c\n\r\n\x05\ \x04\"\x02\x01\x04\x12\x04\xb7\x04\x02\n\n\r\n\x05\x04\"\x02\x01\x06\x12\ \x04\xb7\x04\x0b\x10\n\r\n\x05\x04\"\x02\x01\x01\x12\x04\xb7\x04\x11\x17\ \n\r\n\x05\x04\"\x02\x01\x03\x12\x04\xb7\x04\x1a\x1b\n\x0c\n\x04\x04\"\ \x02\x02\x12\x04\xb8\x04\x02)\n\r\n\x05\x04\"\x02\x02\x04\x12\x04\xb8\ \x04\x02\n\n\r\n\x05\x04\"\x02\x02\x06\x12\x04\xb8\x04\x0b\x16\n\r\n\x05\ \x04\"\x02\x02\x01\x12\x04\xb8\x04\x17$\n\r\n\x05\x04\"\x02\x02\x03\x12\ \x04\xb8\x04'(\n\x0c\n\x04\x04\"\x02\x03\x12\x04\xb9\x04\x02(\n\r\n\x05\ \x04\"\x02\x03\x04\x12\x04\xb9\x04\x02\n\n\r\n\x05\x04\"\x02\x03\x06\x12\ \x04\xb9\x04\x0b\x16\n\r\n\x05\x04\"\x02\x03\x01\x12\x04\xb9\x04\x17#\n\ \r\n\x05\x04\"\x02\x03\x03\x12\x04\xb9\x04&'\n!\n\x02\x04#\x12\x06\xbd\ \x04\0\xbf\x04\x01\x1a\x13\x20DynamicProperties\n\n\x0b\n\x03\x04#\x01\ \x12\x04\xbd\x04\x08\x19\n\x0c\n\x04\x04#\x02\0\x12\x04\xbe\x04\x02$\n\r\ \n\x05\x04#\x02\0\x05\x12\x04\xbe\x04\x02\x07\n\r\n\x05\x04#\x02\0\x01\ \x12\x04\xbe\x04\x08\x1f\n\r\n\x05\x04#\x02\0\x03\x12\x04\xbe\x04\"#\n\ \x0c\n\x02\x05\x01\x12\x06\xc1\x04\0\xde\x04\x01\n\x0b\n\x03\x05\x01\x01\ \x12\x04\xc1\x04\x05\x0f\n\x0c\n\x04\x05\x01\x02\0\x12\x04\xc2\x04\x02\ \x13\n\r\n\x05\x05\x01\x02\0\x01\x12\x04\xc2\x04\x02\x0b\n\r\n\x05\x05\ \x01\x02\0\x02\x12\x04\xc2\x04\x0e\x12\n\x0c\n\x04\x05\x01\x02\x01\x12\ \x04\xc3\x04\x02\x16\n\r\n\x05\x05\x01\x02\x01\x01\x12\x04\xc3\x04\x02\ \x0e\n\r\n\x05\x05\x01\x02\x01\x02\x12\x04\xc3\x04\x11\x15\n\x0c\n\x04\ \x05\x01\x02\x02\x12\x04\xc4\x04\x02\x18\n\r\n\x05\x05\x01\x02\x02\x01\ \x12\x04\xc4\x04\x02\x10\n\r\n\x05\x05\x01\x02\x02\x02\x12\x04\xc4\x04\ \x13\x17\n\x0c\n\x04\x05\x01\x02\x03\x12\x04\xc5\x04\x02\x18\n\r\n\x05\ \x05\x01\x02\x03\x01\x12\x04\xc5\x04\x02\x10\n\r\n\x05\x05\x01\x02\x03\ \x02\x12\x04\xc5\x04\x13\x17\n\x0c\n\x04\x05\x01\x02\x04\x12\x04\xc6\x04\ \x02\x1f\n\r\n\x05\x05\x01\x02\x04\x01\x12\x04\xc6\x04\x02\x17\n\r\n\x05\ \x05\x01\x02\x04\x02\x12\x04\xc6\x04\x1a\x1e\n\x0c\n\x04\x05\x01\x02\x05\ \x12\x04\xc7\x04\x02\x1c\n\r\n\x05\x05\x01\x02\x05\x01\x12\x04\xc7\x04\ \x02\x14\n\r\n\x05\x05\x01\x02\x05\x02\x12\x04\xc7\x04\x17\x1b\n\x0c\n\ \x04\x05\x01\x02\x06\x12\x04\xc8\x04\x02\x16\n\r\n\x05\x05\x01\x02\x06\ \x01\x12\x04\xc8\x04\x02\x0e\n\r\n\x05\x05\x01\x02\x06\x02\x12\x04\xc8\ \x04\x11\x15\n\x0c\n\x04\x05\x01\x02\x07\x12\x04\xc9\x04\x02\x1d\n\r\n\ \x05\x05\x01\x02\x07\x01\x12\x04\xc9\x04\x02\x15\n\r\n\x05\x05\x01\x02\ \x07\x02\x12\x04\xc9\x04\x18\x1c\n\x0c\n\x04\x05\x01\x02\x08\x12\x04\xca\ \x04\x02\x18\n\r\n\x05\x05\x01\x02\x08\x01\x12\x04\xca\x04\x02\x10\n\r\n\ \x05\x05\x01\x02\x08\x02\x12\x04\xca\x04\x13\x17\n\x0c\n\x04\x05\x01\x02\ \t\x12\x04\xcb\x04\x02\x16\n\r\n\x05\x05\x01\x02\t\x01\x12\x04\xcb\x04\ \x02\x0e\n\r\n\x05\x05\x01\x02\t\x02\x12\x04\xcb\x04\x11\x15\n\x0c\n\x04\ \x05\x01\x02\n\x12\x04\xcc\x04\x02\x15\n\r\n\x05\x05\x01\x02\n\x01\x12\ \x04\xcc\x04\x02\r\n\r\n\x05\x05\x01\x02\n\x02\x12\x04\xcc\x04\x10\x14\n\ \x0c\n\x04\x05\x01\x02\x0b\x12\x04\xcd\x04\x02\x0f\n\r\n\x05\x05\x01\x02\ \x0b\x01\x12\x04\xcd\x04\x02\x07\n\r\n\x05\x05\x01\x02\x0b\x02\x12\x04\ \xcd\x04\n\x0e\n\x0c\n\x04\x05\x01\x02\x0c\x12\x04\xce\x04\x02\x13\n\r\n\ \x05\x05\x01\x02\x0c\x01\x12\x04\xce\x04\x02\x0b\n\r\n\x05\x05\x01\x02\ \x0c\x02\x12\x04\xce\x04\x0e\x12\n\x0c\n\x04\x05\x01\x02\r\x12\x04\xcf\ \x04\x02\x14\n\r\n\x05\x05\x01\x02\r\x01\x12\x04\xcf\x04\x02\x0c\n\r\n\ \x05\x05\x01\x02\r\x02\x12\x04\xcf\x04\x0f\x13\n\x0c\n\x04\x05\x01\x02\ \x0e\x12\x04\xd0\x04\x02\x10\n\r\n\x05\x05\x01\x02\x0e\x01\x12\x04\xd0\ \x04\x02\x08\n\r\n\x05\x05\x01\x02\x0e\x02\x12\x04\xd0\x04\x0b\x0f\n\x0c\ \n\x04\x05\x01\x02\x0f\x12\x04\xd1\x04\x02\x13\n\r\n\x05\x05\x01\x02\x0f\ \x01\x12\x04\xd1\x04\x02\x0b\n\r\n\x05\x05\x01\x02\x0f\x02\x12\x04\xd1\ \x04\x0e\x12\n\x0c\n\x04\x05\x01\x02\x10\x12\x04\xd2\x04\x02\x10\n\r\n\ \x05\x05\x01\x02\x10\x01\x12\x04\xd2\x04\x02\x08\n\r\n\x05\x05\x01\x02\ \x10\x02\x12\x04\xd2\x04\x0b\x0f\n\x0c\n\x04\x05\x01\x02\x11\x12\x04\xd3\ \x04\x02\x14\n\r\n\x05\x05\x01\x02\x11\x01\x12\x04\xd3\x04\x02\x0c\n\r\n\ \x05\x05\x01\x02\x11\x02\x12\x04\xd3\x04\x0f\x13\n\x0c\n\x04\x05\x01\x02\ \x12\x12\x04\xd4\x04\x02\x1e\n\r\n\x05\x05\x01\x02\x12\x01\x12\x04\xd4\ \x04\x02\x16\n\r\n\x05\x05\x01\x02\x12\x02\x12\x04\xd4\x04\x19\x1d\n\x0c\ \n\x04\x05\x01\x02\x13\x12\x04\xd5\x04\x02\x1c\n\r\n\x05\x05\x01\x02\x13\ \x01\x12\x04\xd5\x04\x02\x14\n\r\n\x05\x05\x01\x02\x13\x02\x12\x04\xd5\ \x04\x17\x1b\n\x0c\n\x04\x05\x01\x02\x14\x12\x04\xd6\x04\x02\x12\n\r\n\ \x05\x05\x01\x02\x14\x01\x12\x04\xd6\x04\x02\n\n\r\n\x05\x05\x01\x02\x14\ \x02\x12\x04\xd6\x04\r\x11\n\x0c\n\x04\x05\x01\x02\x15\x12\x04\xd7\x04\ \x02\x16\n\r\n\x05\x05\x01\x02\x15\x01\x12\x04\xd7\x04\x02\x0e\n\r\n\x05\ \x05\x01\x02\x15\x02\x12\x04\xd7\x04\x11\x15\n\x0c\n\x04\x05\x01\x02\x16\ \x12\x04\xd8\x04\x02%\n\r\n\x05\x05\x01\x02\x16\x01\x12\x04\xd8\x04\x02\ \x1d\n\r\n\x05\x05\x01\x02\x16\x02\x12\x04\xd8\x04\x20$\n\x0c\n\x04\x05\ \x01\x02\x17\x12\x04\xd9\x04\x02\x1e\n\r\n\x05\x05\x01\x02\x17\x01\x12\ \x04\xd9\x04\x02\x16\n\r\n\x05\x05\x01\x02\x17\x02\x12\x04\xd9\x04\x19\ \x1d\n\x0c\n\x04\x05\x01\x02\x18\x12\x04\xda\x04\x02\x17\n\r\n\x05\x05\ \x01\x02\x18\x01\x12\x04\xda\x04\x02\x0f\n\r\n\x05\x05\x01\x02\x18\x02\ \x12\x04\xda\x04\x12\x16\n\x0c\n\x04\x05\x01\x02\x19\x12\x04\xdb\x04\x02\ \x15\n\r\n\x05\x05\x01\x02\x19\x01\x12\x04\xdb\x04\x02\r\n\r\n\x05\x05\ \x01\x02\x19\x02\x12\x04\xdb\x04\x10\x14\n\x0c\n\x04\x05\x01\x02\x1a\x12\ \x04\xdc\x04\x02\x19\n\r\n\x05\x05\x01\x02\x1a\x01\x12\x04\xdc\x04\x02\ \x11\n\r\n\x05\x05\x01\x02\x1a\x02\x12\x04\xdc\x04\x14\x18\n\x0c\n\x04\ \x05\x01\x02\x1b\x12\x04\xdd\x04\x02\x11\n\r\n\x05\x05\x01\x02\x1b\x01\ \x12\x04\xdd\x04\x02\t\n\r\n\x05\x05\x01\x02\x1b\x02\x12\x04\xdd\x04\x0c\ \x10\n\x0c\n\x02\x04$\x12\x06\xe0\x04\0\xe2\x04\x01\n\x0b\n\x03\x04$\x01\ \x12\x04\xe0\x04\x08\x19\n\x0c\n\x04\x04$\x02\0\x12\x04\xe1\x04\x02\x18\ \n\r\n\x05\x04$\x02\0\x06\x12\x04\xe1\x04\x02\x0c\n\r\n\x05\x04$\x02\0\ \x01\x12\x04\xe1\x04\r\x13\n\r\n\x05\x04$\x02\0\x03\x12\x04\xe1\x04\x16\ \x17\n\x0c\n\x02\x04%\x12\x06\xe4\x04\0\xf4\x04\x01\n\x0b\n\x03\x04%\x01\ \x12\x04\xe4\x04\x08\x14\n\x0e\n\x04\x04%\x03\0\x12\x06\xe5\x04\x02\xe8\ \x04\x03\n\r\n\x05\x04%\x03\0\x01\x12\x04\xe5\x04\n\x11\n\x0e\n\x06\x04%\ \x03\0\x02\0\x12\x04\xe6\x04\x04\x13\n\x0f\n\x07\x04%\x03\0\x02\0\x05\ \x12\x04\xe6\x04\x04\t\n\x0f\n\x07\x04%\x03\0\x02\0\x01\x12\x04\xe6\x04\ \n\x0e\n\x0f\n\x07\x04%\x03\0\x02\0\x03\x12\x04\xe6\x04\x11\x12\n\x0e\n\ \x06\x04%\x03\0\x02\x01\x12\x04\xe7\x04\x04\x15\n\x0f\n\x07\x04%\x03\0\ \x02\x01\x05\x12\x04\xe7\x04\x04\t\n\x0f\n\x07\x04%\x03\0\x02\x01\x01\ \x12\x04\xe7\x04\n\x10\n\x0f\n\x07\x04%\x03\0\x02\x01\x03\x12\x04\xe7\ \x04\x13\x14\n\x0c\n\x04\x04%\x02\0\x12\x04\xea\x04\x02\x14\n\r\n\x05\ \x04%\x02\0\x06\x12\x04\xea\x04\x02\n\n\r\n\x05\x04%\x02\0\x01\x12\x04\ \xea\x04\x0b\x0f\n\r\n\x05\x04%\x02\0\x03\x12\x04\xea\x04\x12\x13\n\x0c\ \n\x04\x04%\x02\x01\x12\x04\xeb\x04\x02\x14\n\r\n\x05\x04%\x02\x01\x05\ \x12\x04\xeb\x04\x02\x07\n\r\n\x05\x04%\x02\x01\x01\x12\x04\xeb\x04\x08\ \x0f\n\r\n\x05\x04%\x02\x01\x03\x12\x04\xeb\x04\x12\x13\n\x0c\n\x04\x04%\ \x02\x02\x12\x04\xec\x04\x02\x16\n\r\n\x05\x04%\x02\x02\x05\x12\x04\xec\ \x04\x02\x07\n\r\n\x05\x04%\x02\x02\x01\x12\x04\xec\x04\x08\x11\n\r\n\ \x05\x04%\x02\x02\x03\x12\x04\xec\x04\x14\x15\n\x0c\n\x04\x04%\x02\x03\ \x12\x04\xed\x04\x02\x1d\n\r\n\x05\x04%\x02\x03\x06\x12\x04\xed\x04\x02\ \t\n\r\n\x05\x04%\x02\x03\x01\x12\x04\xed\x04\n\x18\n\r\n\x05\x04%\x02\ \x03\x03\x12\x04\xed\x04\x1b\x1c\n\x0c\n\x04\x04%\x02\x04\x12\x04\xee\ \x04\x02\x1b\n\r\n\x05\x04%\x02\x04\x06\x12\x04\xee\x04\x02\t\n\r\n\x05\ \x04%\x02\x04\x01\x12\x04\xee\x04\n\x16\n\r\n\x05\x04%\x02\x04\x03\x12\ \x04\xee\x04\x19\x1a\n\x0c\n\x04\x04%\x02\x05\x12\x04\xef\x04\x02\x1a\n\ \r\n\x05\x04%\x02\x05\x06\x12\x04\xef\x04\x02\t\n\r\n\x05\x04%\x02\x05\ \x01\x12\x04\xef\x04\n\x15\n\r\n\x05\x04%\x02\x05\x03\x12\x04\xef\x04\ \x18\x19\n\x0c\n\x04\x04%\x02\x06\x12\x04\xf0\x04\x02\x14\n\r\n\x05\x04%\ \x02\x06\x05\x12\x04\xf0\x04\x02\x07\n\r\n\x05\x04%\x02\x06\x01\x12\x04\ \xf0\x04\x08\x0f\n\r\n\x05\x04%\x02\x06\x03\x12\x04\xf0\x04\x12\x13\n\ \x0c\n\x04\x04%\x02\x07\x12\x04\xf1\x04\x02\x16\n\r\n\x05\x04%\x02\x07\ \x05\x12\x04\xf1\x04\x02\x07\n\r\n\x05\x04%\x02\x07\x01\x12\x04\xf1\x04\ \x08\x11\n\r\n\x05\x04%\x02\x07\x03\x12\x04\xf1\x04\x14\x15\n\x0c\n\x04\ \x04%\x02\x08\x12\x04\xf2\x04\x02\x15\n\r\n\x05\x04%\x02\x08\x05\x12\x04\ \xf2\x04\x02\x07\n\r\n\x05\x04%\x02\x08\x01\x12\x04\xf2\x04\x08\x10\n\r\ \n\x05\x04%\x02\x08\x03\x12\x04\xf2\x04\x13\x14\n\x0c\n\x04\x04%\x02\t\ \x12\x04\xf3\x04\x02\x1c\n\r\n\x05\x04%\x02\t\x05\x12\x04\xf3\x04\x02\ \x07\n\r\n\x05\x04%\x02\t\x01\x12\x04\xf3\x04\x08\x16\n\r\n\x05\x04%\x02\ \t\x03\x12\x04\xf3\x04\x19\x1b\n\x0c\n\x02\x04&\x12\x06\xf6\x04\0\x88\ \x05\x01\n\x0b\n\x03\x04&\x01\x12\x04\xf6\x04\x08\x1b\nv\n\x04\x04&\x02\ \0\x12\x04\xf9\x04\x02\x11\x1ah\x20internalTransaction\x20identity,\x20t\ he\x20root\x20InternalTransaction\x20hash\n\x20should\x20equals\x20to\ \x20root\x20transaction\x20id.\n\n\r\n\x05\x04&\x02\0\x05\x12\x04\xf9\ \x04\x02\x07\n\r\n\x05\x04&\x02\0\x01\x12\x04\xf9\x04\x08\x0c\n\r\n\x05\ \x04&\x02\0\x03\x12\x04\xf9\x04\x0f\x10\n=\n\x04\x04&\x02\x01\x12\x04\ \xfb\x04\x02\x1b\x1a/\x20the\x20one\x20send\x20trx\x20(TBD:\x20or\x20tok\ en)\x20via\x20function\n\n\r\n\x05\x04&\x02\x01\x05\x12\x04\xfb\x04\x02\ \x07\n\r\n\x05\x04&\x02\x01\x01\x12\x04\xfb\x04\x08\x16\n\r\n\x05\x04&\ \x02\x01\x03\x12\x04\xfb\x04\x19\x1a\n@\n\x04\x04&\x02\x02\x12\x04\xfd\ \x04\x02\x1f\x1a2\x20the\x20one\x20recieve\x20trx\x20(TBD:\x20or\x20toke\ n)\x20via\x20function\n\n\r\n\x05\x04&\x02\x02\x05\x12\x04\xfd\x04\x02\ \x07\n\r\n\x05\x04&\x02\x02\x01\x12\x04\xfd\x04\x08\x1a\n\r\n\x05\x04&\ \x02\x02\x03\x12\x04\xfd\x04\x1d\x1e\n\x0e\n\x04\x04&\x03\0\x12\x06\xfe\ \x04\x02\x83\x05\x03\n\r\n\x05\x04&\x03\0\x01\x12\x04\xfe\x04\n\x17\n+\n\ \x06\x04&\x03\0\x02\0\x12\x04\x80\x05\x04\x18\x1a\x1b\x20trx\x20(TBD:\ \x20or\x20token)\x20value\n\n\x0f\n\x07\x04&\x03\0\x02\0\x05\x12\x04\x80\ \x05\x04\t\n\x0f\n\x07\x04&\x03\0\x02\0\x01\x12\x04\x80\x05\n\x13\n\x0f\ \n\x07\x04&\x03\0\x02\0\x03\x12\x04\x80\x05\x16\x17\n5\n\x06\x04&\x03\0\ \x02\x01\x12\x04\x82\x05\x04\x17\x1a%\x20TBD:\x20tokenName,\x20trx\x20sh\ ould\x20be\x20empty\n\n\x0f\n\x07\x04&\x03\0\x02\x01\x05\x12\x04\x82\x05\ \x04\n\n\x0f\n\x07\x04&\x03\0\x02\x01\x01\x12\x04\x82\x05\x0b\x12\n\x0f\ \n\x07\x04&\x03\0\x02\x01\x03\x12\x04\x82\x05\x15\x16\n\x0c\n\x04\x04&\ \x02\x03\x12\x04\x84\x05\x02+\n\r\n\x05\x04&\x02\x03\x04\x12\x04\x84\x05\ \x02\n\n\r\n\x05\x04&\x02\x03\x06\x12\x04\x84\x05\x0b\x18\n\r\n\x05\x04&\ \x02\x03\x01\x12\x04\x84\x05\x19&\n\r\n\x05\x04&\x02\x03\x03\x12\x04\x84\ \x05)*\n\x0c\n\x04\x04&\x02\x04\x12\x04\x85\x05\x02\x11\n\r\n\x05\x04&\ \x02\x04\x05\x12\x04\x85\x05\x02\x07\n\r\n\x05\x04&\x02\x04\x01\x12\x04\ \x85\x05\x08\x0c\n\r\n\x05\x04&\x02\x04\x03\x12\x04\x85\x05\x0f\x10\n\ \x0c\n\x04\x04&\x02\x05\x12\x04\x86\x05\x02\x14\n\r\n\x05\x04&\x02\x05\ \x05\x12\x04\x86\x05\x02\x06\n\r\n\x05\x04&\x02\x05\x01\x12\x04\x86\x05\ \x07\x0f\n\r\n\x05\x04&\x02\x05\x03\x12\x04\x86\x05\x12\x13\n\x0c\n\x04\ \x04&\x02\x06\x12\x04\x87\x05\x02\x13\n\r\n\x05\x04&\x02\x06\x05\x12\x04\ \x87\x05\x02\x08\n\r\n\x05\x04&\x02\x06\x01\x12\x04\x87\x05\t\x0e\n\r\n\ \x05\x04&\x02\x06\x03\x12\x04\x87\x05\x11\x12\n\x0c\n\x02\x04'\x12\x06\ \x8a\x05\0\x8f\x05\x01\n\x0b\n\x03\x04'\x01\x12\x04\x8a\x05\x08%\n\x0c\n\ \x04\x04'\x02\0\x12\x04\x8b\x05\x02\x14\n\r\n\x05\x04'\x02\0\x05\x12\x04\ \x8b\x05\x02\x07\n\r\n\x05\x04'\x02\0\x01\x12\x04\x8b\x05\x08\x0f\n\r\n\ \x05\x04'\x02\0\x03\x12\x04\x8b\x05\x12\x13\n\x0c\n\x04\x04'\x02\x01\x12\ \x04\x8c\x05\x02\"\n\r\n\x05\x04'\x02\x01\x04\x12\x04\x8c\x05\x02\n\n\r\ \n\x05\x04'\x02\x01\x05\x12\x04\x8c\x05\x0b\x10\n\r\n\x05\x04'\x02\x01\ \x01\x12\x04\x8c\x05\x11\x1d\n\r\n\x05\x04'\x02\x01\x03\x12\x04\x8c\x05\ \x20!\n\x0c\n\x04\x04'\x02\x02\x12\x04\x8d\x05\x02\x20\n\r\n\x05\x04'\ \x02\x02\x04\x12\x04\x8d\x05\x02\n\n\r\n\x05\x04'\x02\x02\x05\x12\x04\ \x8d\x05\x0b\x10\n\r\n\x05\x04'\x02\x02\x01\x12\x04\x8d\x05\x11\x1b\n\r\ \n\x05\x04'\x02\x02\x03\x12\x04\x8d\x05\x1e\x1f\n\x0c\n\x04\x04'\x02\x03\ \x12\x04\x8e\x05\x02\x16\n\r\n\x05\x04'\x02\x03\x05\x12\x04\x8e\x05\x02\ \x07\n\r\n\x05\x04'\x02\x03\x01\x12\x04\x8e\x05\x08\x11\n\r\n\x05\x04'\ \x02\x03\x03\x12\x04\x8e\x05\x14\x15\n\x0c\n\x02\x04(\x12\x06\x91\x05\0\ \xf2\x05\x01\n\x0b\n\x03\x04(\x01\x12\x04\x91\x05\x08\x10\n\x0c\n\x04\ \x04(\x02\0\x12\x04\x92\x05\x02\x19\n\r\n\x05\x04(\x02\0\x05\x12\x04\x92\ \x05\x02\x07\n\r\n\x05\x04(\x02\0\x01\x12\x04\x92\x05\x08\x14\n\r\n\x05\ \x04(\x02\0\x03\x12\x04\x92\x05\x17\x18\n\x0c\n\x04\x04(\x02\x01\x12\x04\ \x93\x05\x02\x13\n\r\n\x05\x04(\x02\x01\x05\x12\x04\x93\x05\x02\x08\n\r\ \n\x05\x04(\x02\x01\x01\x12\x04\x93\x05\t\x0e\n\r\n\x05\x04(\x02\x01\x03\ \x12\x04\x93\x05\x11\x12\n\x0c\n\x04\x04(\x02\x02\x12\x04\x94\x05\x02\ \x1b\n\r\n\x05\x04(\x02\x02\x05\x12\x04\x94\x05\x02\x08\n\r\n\x05\x04(\ \x02\x02\x01\x12\x04\x94\x05\t\x16\n\r\n\x05\x04(\x02\x02\x03\x12\x04\ \x94\x05\x19\x1a\n\"\n\x04\x04(\x02\x03\x12\x04\x96\x05\x02\x20\x1a\x14c\ onnect\x20information\n\n\r\n\x05\x04(\x02\x03\x05\x12\x04\x96\x05\x02\ \x07\n\r\n\x05\x04(\x02\x03\x01\x12\x04\x96\x05\x08\x1b\n\r\n\x05\x04(\ \x02\x03\x03\x12\x04\x96\x05\x1e\x1f\n\x0c\n\x04\x04(\x02\x04\x12\x04\ \x97\x05\x02\x1f\n\r\n\x05\x04(\x02\x04\x05\x12\x04\x97\x05\x02\x07\n\r\ \n\x05\x04(\x02\x04\x01\x12\x04\x97\x05\x08\x1a\n\r\n\x05\x04(\x02\x04\ \x03\x12\x04\x97\x05\x1d\x1e\n\x0c\n\x04\x04(\x02\x05\x12\x04\x98\x05\ \x02\x20\n\r\n\x05\x04(\x02\x05\x05\x12\x04\x98\x05\x02\x07\n\r\n\x05\ \x04(\x02\x05\x01\x12\x04\x98\x05\x08\x1b\n\r\n\x05\x04(\x02\x05\x03\x12\ \x04\x98\x05\x1e\x1f\n\x0c\n\x04\x04(\x02\x06\x12\x04\x99\x05\x02\x16\n\ \r\n\x05\x04(\x02\x06\x05\x12\x04\x99\x05\x02\x07\n\r\n\x05\x04(\x02\x06\ \x01\x12\x04\x99\x05\x08\x11\n\r\n\x05\x04(\x02\x06\x03\x12\x04\x99\x05\ \x14\x15\n\x0c\n\x04\x04(\x02\x07\x12\x04\x9a\x05\x02%\n\r\n\x05\x04(\ \x02\x07\x04\x12\x04\x9a\x05\x02\n\n\r\n\x05\x04(\x02\x07\x06\x12\x04\ \x9a\x05\x0b\x13\n\r\n\x05\x04(\x02\x07\x01\x12\x04\x9a\x05\x14\x20\n\r\ \n\x05\x04(\x02\x07\x03\x12\x04\x9a\x05#$\n\x0c\n\x04\x04(\x02\x08\x12\ \x04\x9b\x05\x02$\n\r\n\x05\x04(\x02\x08\x06\x12\x04\x9b\x05\x02\x10\n\r\ \n\x05\x04(\x02\x08\x01\x12\x04\x9b\x05\x11\x1f\n\r\n\x05\x04(\x02\x08\ \x03\x12\x04\x9b\x05\"#\n\x0c\n\x04\x04(\x02\t\x12\x04\x9c\x05\x02\x1f\n\ \r\n\x05\x04(\x02\t\x06\x12\x04\x9c\x05\x02\r\n\r\n\x05\x04(\x02\t\x01\ \x12\x04\x9c\x05\x0e\x19\n\r\n\x05\x04(\x02\t\x03\x12\x04\x9c\x05\x1c\ \x1e\n\x0c\n\x04\x04(\x02\n\x12\x04\x9d\x05\x02/\n\r\n\x05\x04(\x02\n\ \x06\x12\x04\x9d\x05\x02\x15\n\r\n\x05\x04(\x02\n\x01\x12\x04\x9d\x05\ \x16)\n\r\n\x05\x04(\x02\n\x03\x12\x04\x9d\x05,.\n\x0e\n\x04\x04(\x03\ \x01\x12\x06\x9f\x05\x02\xb9\x05\x03\n\r\n\x05\x04(\x03\x01\x01\x12\x04\ \x9f\x05\n\x12\n\x0e\n\x06\x04(\x03\x01\x02\0\x12\x04\xa0\x05\x04\x1d\n\ \x0f\n\x07\x04(\x03\x01\x02\0\x05\x12\x04\xa0\x05\x04\n\n\x0f\n\x07\x04(\ \x03\x01\x02\0\x01\x12\x04\xa0\x05\x0b\x18\n\x0f\n\x07\x04(\x03\x01\x02\ \0\x03\x12\x04\xa0\x05\x1b\x1c\n\x0e\n\x06\x04(\x03\x01\x02\x01\x12\x04\ \xa1\x05\x04\x18\n\x0f\n\x07\x04(\x03\x01\x02\x01\x05\x12\x04\xa1\x05\ \x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x01\x01\x12\x04\xa1\x05\n\x13\n\x0f\ \n\x07\x04(\x03\x01\x02\x01\x03\x12\x04\xa1\x05\x16\x17\n\x0e\n\x06\x04(\ \x03\x01\x02\x02\x12\x04\xa2\x05\x04\"\n\x0f\n\x07\x04(\x03\x01\x02\x02\ \x05\x12\x04\xa2\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x02\x01\x12\x04\ \xa2\x05\n\x1d\n\x0f\n\x07\x04(\x03\x01\x02\x02\x03\x12\x04\xa2\x05\x20!\ \n\x0e\n\x06\x04(\x03\x01\x02\x03\x12\x04\xa3\x05\x04\x16\n\x0f\n\x07\ \x04(\x03\x01\x02\x03\x05\x12\x04\xa3\x05\x04\x08\n\x0f\n\x07\x04(\x03\ \x01\x02\x03\x01\x12\x04\xa3\x05\t\x11\n\x0f\n\x07\x04(\x03\x01\x02\x03\ \x03\x12\x04\xa3\x05\x14\x15\n\x0e\n\x06\x04(\x03\x01\x02\x04\x12\x04\ \xa4\x05\x04&\n\x0f\n\x07\x04(\x03\x01\x02\x04\x05\x12\x04\xa4\x05\x04\t\ \n\x0f\n\x07\x04(\x03\x01\x02\x04\x01\x12\x04\xa4\x05\n!\n\x0f\n\x07\x04\ (\x03\x01\x02\x04\x03\x12\x04\xa4\x05$%\n\x0e\n\x06\x04(\x03\x01\x02\x05\ \x12\x04\xa5\x05\x04\x1e\n\x0f\n\x07\x04(\x03\x01\x02\x05\x05\x12\x04\ \xa5\x05\x04\x08\n\x0f\n\x07\x04(\x03\x01\x02\x05\x01\x12\x04\xa5\x05\t\ \x19\n\x0f\n\x07\x04(\x03\x01\x02\x05\x03\x12\x04\xa5\x05\x1c\x1d\n\x0e\ \n\x06\x04(\x03\x01\x02\x06\x12\x04\xa6\x05\x04\x1c\n\x0f\n\x07\x04(\x03\ \x01\x02\x06\x05\x12\x04\xa6\x05\x04\x08\n\x0f\n\x07\x04(\x03\x01\x02\ \x06\x01\x12\x04\xa6\x05\t\x17\n\x0f\n\x07\x04(\x03\x01\x02\x06\x03\x12\ \x04\xa6\x05\x1a\x1b\n\x0e\n\x06\x04(\x03\x01\x02\x07\x12\x04\xa7\x05\ \x04\x14\n\x0f\n\x07\x04(\x03\x01\x02\x07\x05\x12\x04\xa7\x05\x04\n\n\ \x0f\n\x07\x04(\x03\x01\x02\x07\x01\x12\x04\xa7\x05\x0b\x0f\n\x0f\n\x07\ \x04(\x03\x01\x02\x07\x03\x12\x04\xa7\x05\x12\x13\n\x0e\n\x06\x04(\x03\ \x01\x02\x08\x12\x04\xa8\x05\x04\x13\n\x0f\n\x07\x04(\x03\x01\x02\x08\ \x05\x12\x04\xa8\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x08\x01\x12\x04\ \xa8\x05\n\x0e\n\x0f\n\x07\x04(\x03\x01\x02\x08\x03\x12\x04\xa8\x05\x11\ \x12\n\x0e\n\x06\x04(\x03\x01\x02\t\x12\x04\xa9\x05\x04\x17\n\x0f\n\x07\ \x04(\x03\x01\x02\t\x05\x12\x04\xa9\x05\x04\n\n\x0f\n\x07\x04(\x03\x01\ \x02\t\x01\x12\x04\xa9\x05\x0b\x11\n\x0f\n\x07\x04(\x03\x01\x02\t\x03\ \x12\x04\xa9\x05\x14\x16\n\x0e\n\x06\x04(\x03\x01\x02\n\x12\x04\xaa\x05\ \x04\x1b\n\x0f\n\x07\x04(\x03\x01\x02\n\x05\x12\x04\xaa\x05\x04\t\n\x0f\ \n\x07\x04(\x03\x01\x02\n\x01\x12\x04\xaa\x05\n\x15\n\x0f\n\x07\x04(\x03\ \x01\x02\n\x03\x12\x04\xaa\x05\x18\x1a\n\x0e\n\x06\x04(\x03\x01\x02\x0b\ \x12\x04\xab\x05\x04\x1b\n\x0f\n\x07\x04(\x03\x01\x02\x0b\x05\x12\x04\ \xab\x05\x04\n\n\x0f\n\x07\x04(\x03\x01\x02\x0b\x01\x12\x04\xab\x05\x0b\ \x15\n\x0f\n\x07\x04(\x03\x01\x02\x0b\x03\x12\x04\xab\x05\x18\x1a\n\x0e\ \n\x06\x04(\x03\x01\x02\x0c\x12\x04\xac\x05\x04\x1f\n\x0f\n\x07\x04(\x03\ \x01\x02\x0c\x05\x12\x04\xac\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x0c\ \x01\x12\x04\xac\x05\n\x19\n\x0f\n\x07\x04(\x03\x01\x02\x0c\x03\x12\x04\ \xac\x05\x1c\x1e\n\x0e\n\x06\x04(\x03\x01\x02\r\x12\x04\xad\x05\x04&\n\ \x0f\n\x07\x04(\x03\x01\x02\r\x05\x12\x04\xad\x05\x04\t\n\x0f\n\x07\x04(\ \x03\x01\x02\r\x01\x12\x04\xad\x05\n\x20\n\x0f\n\x07\x04(\x03\x01\x02\r\ \x03\x12\x04\xad\x05#%\n\x0e\n\x06\x04(\x03\x01\x02\x0e\x12\x04\xae\x05\ \x04&\n\x0f\n\x07\x04(\x03\x01\x02\x0e\x05\x12\x04\xae\x05\x04\t\n\x0f\n\ \x07\x04(\x03\x01\x02\x0e\x01\x12\x04\xae\x05\n\x20\n\x0f\n\x07\x04(\x03\ \x01\x02\x0e\x03\x12\x04\xae\x05#%\n\x0e\n\x06\x04(\x03\x01\x02\x0f\x12\ \x04\xaf\x05\x04\x1d\n\x0f\n\x07\x04(\x03\x01\x02\x0f\x05\x12\x04\xaf\ \x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x0f\x01\x12\x04\xaf\x05\n\x17\n\ \x0f\n\x07\x04(\x03\x01\x02\x0f\x03\x12\x04\xaf\x05\x1a\x1c\n\x0e\n\x06\ \x04(\x03\x01\x02\x10\x12\x04\xb0\x05\x04\x1f\n\x0f\n\x07\x04(\x03\x01\ \x02\x10\x05\x12\x04\xb0\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x10\x01\ \x12\x04\xb0\x05\n\x19\n\x0f\n\x07\x04(\x03\x01\x02\x10\x03\x12\x04\xb0\ \x05\x1c\x1e\n\x0e\n\x06\x04(\x03\x01\x02\x11\x12\x04\xb1\x05\x04$\n\x0f\ \n\x07\x04(\x03\x01\x02\x11\x05\x12\x04\xb1\x05\x04\n\n\x0f\n\x07\x04(\ \x03\x01\x02\x11\x01\x12\x04\xb1\x05\x0b\x1e\n\x0f\n\x07\x04(\x03\x01\ \x02\x11\x03\x12\x04\xb1\x05!#\n\x0e\n\x06\x04(\x03\x01\x02\x12\x12\x04\ \xb2\x05\x04\x17\n\x0f\n\x07\x04(\x03\x01\x02\x12\x05\x12\x04\xb2\x05\ \x04\x08\n\x0f\n\x07\x04(\x03\x01\x02\x12\x01\x12\x04\xb2\x05\t\x11\n\ \x0f\n\x07\x04(\x03\x01\x02\x12\x03\x12\x04\xb2\x05\x14\x16\n\x0e\n\x06\ \x04(\x03\x01\x02\x13\x12\x04\xb3\x05\x04\x15\n\x0f\n\x07\x04(\x03\x01\ \x02\x13\x05\x12\x04\xb3\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x13\x01\ \x12\x04\xb3\x05\n\x0f\n\x0f\n\x07\x04(\x03\x01\x02\x13\x03\x12\x04\xb3\ \x05\x12\x14\n\x0e\n\x06\x04(\x03\x01\x02\x14\x12\x04\xb4\x05\x04\x19\n\ \x0f\n\x07\x04(\x03\x01\x02\x14\x05\x12\x04\xb4\x05\x04\t\n\x0f\n\x07\ \x04(\x03\x01\x02\x14\x01\x12\x04\xb4\x05\n\x13\n\x0f\n\x07\x04(\x03\x01\ \x02\x14\x03\x12\x04\xb4\x05\x16\x18\n\x0e\n\x06\x04(\x03\x01\x02\x15\ \x12\x04\xb5\x05\x04\x16\n\x0f\n\x07\x04(\x03\x01\x02\x15\x05\x12\x04\ \xb5\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x15\x01\x12\x04\xb5\x05\n\ \x10\n\x0f\n\x07\x04(\x03\x01\x02\x15\x03\x12\x04\xb5\x05\x13\x15\n\x0e\ \n\x06\x04(\x03\x01\x02\x16\x12\x04\xb6\x05\x04\x1f\n\x0f\n\x07\x04(\x03\ \x01\x02\x16\x05\x12\x04\xb6\x05\x04\t\n\x0f\n\x07\x04(\x03\x01\x02\x16\ \x01\x12\x04\xb6\x05\n\x19\n\x0f\n\x07\x04(\x03\x01\x02\x16\x03\x12\x04\ \xb6\x05\x1c\x1e\n\x0e\n\x06\x04(\x03\x01\x02\x17\x12\x04\xb7\x05\x04&\n\ \x0f\n\x07\x04(\x03\x01\x02\x17\x05\x12\x04\xb7\x05\x04\n\n\x0f\n\x07\ \x04(\x03\x01\x02\x17\x01\x12\x04\xb7\x05\x0b\x20\n\x0f\n\x07\x04(\x03\ \x01\x02\x17\x03\x12\x04\xb7\x05#%\n\x0e\n\x06\x04(\x03\x01\x02\x18\x12\ \x04\xb8\x05\x04'\n\x0f\n\x07\x04(\x03\x01\x02\x18\x05\x12\x04\xb8\x05\ \x04\n\n\x0f\n\x07\x04(\x03\x01\x02\x18\x01\x12\x04\xb8\x05\x0b!\n\x0f\n\ \x07\x04(\x03\x01\x02\x18\x03\x12\x04\xb8\x05$&\n\x0e\n\x04\x04(\x03\x02\ \x12\x06\xbb\x05\x02\xcf\x05\x03\n\r\n\x05\x04(\x03\x02\x01\x12\x04\xbb\ \x05\n\x18\n\x0e\n\x06\x04(\x03\x02\x02\0\x12\x04\xbc\x05\x04\x1b\n\x0f\ \n\x07\x04(\x03\x02\x02\0\x05\x12\x04\xbc\x05\x04\n\n\x0f\n\x07\x04(\x03\ \x02\x02\0\x01\x12\x04\xbc\x05\x0b\x16\n\x0f\n\x07\x04(\x03\x02\x02\0\ \x03\x12\x04\xbc\x05\x19\x1a\n\x0e\n\x06\x04(\x03\x02\x02\x01\x12\x04\ \xbd\x05\x04\x1a\n\x0f\n\x07\x04(\x03\x02\x02\x01\x05\x12\x04\xbd\x05\ \x04\n\n\x0f\n\x07\x04(\x03\x02\x02\x01\x01\x12\x04\xbd\x05\x0b\x15\n\ \x0f\n\x07\x04(\x03\x02\x02\x01\x03\x12\x04\xbd\x05\x18\x19\n\x0e\n\x06\ \x04(\x03\x02\x02\x02\x12\x04\xbe\x05\x04\x19\n\x0f\n\x07\x04(\x03\x02\ \x02\x02\x05\x12\x04\xbe\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x02\x01\ \x12\x04\xbe\x05\n\x14\n\x0f\n\x07\x04(\x03\x02\x02\x02\x03\x12\x04\xbe\ \x05\x17\x18\n\x0e\n\x06\x04(\x03\x02\x02\x03\x12\x04\xbf\x05\x04\x1c\n\ \x0f\n\x07\x04(\x03\x02\x02\x03\x05\x12\x04\xbf\x05\x04\x08\n\x0f\n\x07\ \x04(\x03\x02\x02\x03\x01\x12\x04\xbf\x05\t\x17\n\x0f\n\x07\x04(\x03\x02\ \x02\x03\x03\x12\x04\xbf\x05\x1a\x1b\n\x0e\n\x06\x04(\x03\x02\x02\x04\ \x12\x04\xc0\x05\x04\x1d\n\x0f\n\x07\x04(\x03\x02\x02\x04\x05\x12\x04\ \xc0\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x04\x01\x12\x04\xc0\x05\n\ \x18\n\x0f\n\x07\x04(\x03\x02\x02\x04\x03\x12\x04\xc0\x05\x1b\x1c\n\x0e\ \n\x06\x04(\x03\x02\x02\x05\x12\x04\xc1\x05\x04\x1e\n\x0f\n\x07\x04(\x03\ \x02\x02\x05\x05\x12\x04\xc1\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x05\ \x01\x12\x04\xc1\x05\n\x19\n\x0f\n\x07\x04(\x03\x02\x02\x05\x03\x12\x04\ \xc1\x05\x1c\x1d\n\x0e\n\x06\x04(\x03\x02\x02\x06\x12\x04\xc2\x05\x04\ \x1b\n\x0f\n\x07\x04(\x03\x02\x02\x06\x05\x12\x04\xc2\x05\x04\t\n\x0f\n\ \x07\x04(\x03\x02\x02\x06\x01\x12\x04\xc2\x05\n\x16\n\x0f\n\x07\x04(\x03\ \x02\x02\x06\x03\x12\x04\xc2\x05\x19\x1a\n\x0e\n\x06\x04(\x03\x02\x02\ \x07\x12\x04\xc3\x05\x04\x1e\n\x0f\n\x07\x04(\x03\x02\x02\x07\x05\x12\ \x04\xc3\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x07\x01\x12\x04\xc3\x05\ \n\x19\n\x0f\n\x07\x04(\x03\x02\x02\x07\x03\x12\x04\xc3\x05\x1c\x1d\n\ \x0e\n\x06\x04(\x03\x02\x02\x08\x12\x04\xc4\x05\x04$\n\x0f\n\x07\x04(\ \x03\x02\x02\x08\x05\x12\x04\xc4\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\ \x08\x01\x12\x04\xc4\x05\n\x1f\n\x0f\n\x07\x04(\x03\x02\x02\x08\x03\x12\ \x04\xc4\x05\"#\n\x0e\n\x06\x04(\x03\x02\x02\t\x12\x04\xc5\x05\x04\x20\n\ \x0f\n\x07\x04(\x03\x02\x02\t\x05\x12\x04\xc5\x05\x04\t\n\x0f\n\x07\x04(\ \x03\x02\x02\t\x01\x12\x04\xc5\x05\n\x1a\n\x0f\n\x07\x04(\x03\x02\x02\t\ \x03\x12\x04\xc5\x05\x1d\x1f\n\x0e\n\x06\x04(\x03\x02\x02\n\x12\x04\xc6\ \x05\x04\x20\n\x0f\n\x07\x04(\x03\x02\x02\n\x05\x12\x04\xc6\x05\x04\t\n\ \x0f\n\x07\x04(\x03\x02\x02\n\x01\x12\x04\xc6\x05\n\x1a\n\x0f\n\x07\x04(\ \x03\x02\x02\n\x03\x12\x04\xc6\x05\x1d\x1f\n\x0e\n\x06\x04(\x03\x02\x02\ \x0b\x12\x04\xc7\x05\x04\x1e\n\x0f\n\x07\x04(\x03\x02\x02\x0b\x05\x12\ \x04\xc7\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x0b\x01\x12\x04\xc7\x05\ \n\x18\n\x0f\n\x07\x04(\x03\x02\x02\x0b\x03\x12\x04\xc7\x05\x1b\x1d\n\ \x0e\n\x06\x04(\x03\x02\x02\x0c\x12\x04\xc8\x05\x04\x19\n\x0f\n\x07\x04(\ \x03\x02\x02\x0c\x05\x12\x04\xc8\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\ \x0c\x01\x12\x04\xc8\x05\n\x13\n\x0f\n\x07\x04(\x03\x02\x02\x0c\x03\x12\ \x04\xc8\x05\x16\x18\n\x0e\n\x06\x04(\x03\x02\x02\r\x12\x04\xc9\x05\x04$\ \n\x0f\n\x07\x04(\x03\x02\x02\r\x05\x12\x04\xc9\x05\x04\t\n\x0f\n\x07\ \x04(\x03\x02\x02\r\x01\x12\x04\xc9\x05\n\x1e\n\x0f\n\x07\x04(\x03\x02\ \x02\r\x03\x12\x04\xc9\x05!#\n\x0e\n\x06\x04(\x03\x02\x02\x0e\x12\x04\ \xca\x05\x04\x1e\n\x0f\n\x07\x04(\x03\x02\x02\x0e\x05\x12\x04\xca\x05\ \x04\x08\n\x0f\n\x07\x04(\x03\x02\x02\x0e\x01\x12\x04\xca\x05\t\x18\n\ \x0f\n\x07\x04(\x03\x02\x02\x0e\x03\x12\x04\xca\x05\x1b\x1d\n\x0e\n\x06\ \x04(\x03\x02\x02\x0f\x12\x04\xcb\x05\x04\x1d\n\x0f\n\x07\x04(\x03\x02\ \x02\x0f\x05\x12\x04\xcb\x05\x04\n\n\x0f\n\x07\x04(\x03\x02\x02\x0f\x01\ \x12\x04\xcb\x05\x0b\x17\n\x0f\n\x07\x04(\x03\x02\x02\x0f\x03\x12\x04\ \xcb\x05\x1a\x1c\n\x0e\n\x06\x04(\x03\x02\x02\x10\x12\x04\xcc\x05\x04\ \x1d\n\x0f\n\x07\x04(\x03\x02\x02\x10\x05\x12\x04\xcc\x05\x04\n\n\x0f\n\ \x07\x04(\x03\x02\x02\x10\x01\x12\x04\xcc\x05\x0b\x17\n\x0f\n\x07\x04(\ \x03\x02\x02\x10\x03\x12\x04\xcc\x05\x1a\x1c\n\x0e\n\x06\x04(\x03\x02\ \x02\x11\x12\x04\xcd\x05\x04(\n\x0f\n\x07\x04(\x03\x02\x02\x11\x05\x12\ \x04\xcd\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x11\x01\x12\x04\xcd\x05\ \n\"\n\x0f\n\x07\x04(\x03\x02\x02\x11\x03\x12\x04\xcd\x05%'\n\x0e\n\x06\ \x04(\x03\x02\x02\x12\x12\x04\xce\x05\x04#\n\x0f\n\x07\x04(\x03\x02\x02\ \x12\x05\x12\x04\xce\x05\x04\t\n\x0f\n\x07\x04(\x03\x02\x02\x12\x01\x12\ \x04\xce\x05\n\x1d\n\x0f\n\x07\x04(\x03\x02\x02\x12\x03\x12\x04\xce\x05\ \x20\"\n\x0e\n\x04\x04(\x03\x03\x12\x06\xd1\x05\x02\xf1\x05\x03\n\r\n\ \x05\x04(\x03\x03\x01\x12\x04\xd1\x05\n\x15\n\x0e\n\x06\x04(\x03\x03\x02\ \0\x12\x04\xd2\x05\x04\x1a\n\x0f\n\x07\x04(\x03\x03\x02\0\x05\x12\x04\ \xd2\x05\x04\t\n\x0f\n\x07\x04(\x03\x03\x02\0\x01\x12\x04\xd2\x05\n\x15\ \n\x0f\n\x07\x04(\x03\x03\x02\0\x03\x12\x04\xd2\x05\x18\x19\n\x0e\n\x06\ \x04(\x03\x03\x02\x01\x12\x04\xd3\x05\x04\"\n\x0f\n\x07\x04(\x03\x03\x02\ \x01\x05\x12\x04\xd3\x05\x04\t\n\x0f\n\x07\x04(\x03\x03\x02\x01\x01\x12\ \x04\xd3\x05\n\x1d\n\x0f\n\x07\x04(\x03\x03\x02\x01\x03\x12\x04\xd3\x05\ \x20!\n\x0e\n\x06\x04(\x03\x03\x02\x02\x12\x04\xd4\x05\x04\x17\n\x0f\n\ \x07\x04(\x03\x03\x02\x02\x05\x12\x04\xd4\x05\x04\t\n\x0f\n\x07\x04(\x03\ \x03\x02\x02\x01\x12\x04\xd4\x05\n\x12\n\x0f\n\x07\x04(\x03\x03\x02\x02\ \x03\x12\x04\xd4\x05\x15\x16\n\x0e\n\x06\x04(\x03\x03\x02\x03\x12\x04\ \xd5\x05\x04\x1a\n\x0f\n\x07\x04(\x03\x03\x02\x03\x05\x12\x04\xd5\x05\ \x04\t\n\x0f\n\x07\x04(\x03\x03\x02\x03\x01\x12\x04\xd5\x05\n\x15\n\x0f\ \n\x07\x04(\x03\x03\x02\x03\x03\x12\x04\xd5\x05\x18\x19\n\x0e\n\x06\x04(\ \x03\x03\x02\x04\x12\x04\xd6\x05\x04\x19\n\x0f\n\x07\x04(\x03\x03\x02\ \x04\x05\x12\x04\xd6\x05\x04\t\n\x0f\n\x07\x04(\x03\x03\x02\x04\x01\x12\ \x04\xd6\x05\n\x14\n\x0f\n\x07\x04(\x03\x03\x02\x04\x03\x12\x04\xd6\x05\ \x17\x18\n\x0e\n\x06\x04(\x03\x03\x02\x05\x12\x04\xd7\x05\x04\x17\n\x0f\ \n\x07\x04(\x03\x03\x02\x05\x05\x12\x04\xd7\x05\x04\n\n\x0f\n\x07\x04(\ \x03\x03\x02\x05\x01\x12\x04\xd7\x05\x0b\x12\n\x0f\n\x07\x04(\x03\x03\ \x02\x05\x03\x12\x04\xd7\x05\x15\x16\n\x0e\n\x06\x04(\x03\x03\x02\x06\ \x12\x04\xd8\x05\x04\x1b\n\x0f\n\x07\x04(\x03\x03\x02\x06\x05\x12\x04\ \xd8\x05\x04\n\n\x0f\n\x07\x04(\x03\x03\x02\x06\x01\x12\x04\xd8\x05\x0b\ \x16\n\x0f\n\x07\x04(\x03\x03\x02\x06\x03\x12\x04\xd8\x05\x19\x1a\n\x0e\ \n\x06\x04(\x03\x03\x02\x07\x12\x04\xd9\x05\x04\x16\n\x0f\n\x07\x04(\x03\ \x03\x02\x07\x05\x12\x04\xd9\x05\x04\n\n\x0f\n\x07\x04(\x03\x03\x02\x07\ \x01\x12\x04\xd9\x05\x0b\x11\n\x0f\n\x07\x04(\x03\x03\x02\x07\x03\x12\ \x04\xd9\x05\x14\x15\n\x0e\n\x06\x04(\x03\x03\x02\x08\x12\x04\xda\x05\ \x04\x1d\n\x0f\n\x07\x04(\x03\x03\x02\x08\x05\x12\x04\xda\x05\x04\t\n\ \x0f\n\x07\x04(\x03\x03\x02\x08\x01\x12\x04\xda\x05\n\x18\n\x0f\n\x07\ \x04(\x03\x03\x02\x08\x03\x12\x04\xda\x05\x1b\x1c\n\x0e\n\x06\x04(\x03\ \x03\x02\t\x12\x04\xdb\x05\x04\x1d\n\x0f\n\x07\x04(\x03\x03\x02\t\x05\ \x12\x04\xdb\x05\x04\t\n\x0f\n\x07\x04(\x03\x03\x02\t\x01\x12\x04\xdb\ \x05\n\x17\n\x0f\n\x07\x04(\x03\x03\x02\t\x03\x12\x04\xdb\x05\x1a\x1c\n\ \x0e\n\x06\x04(\x03\x03\x02\n\x12\x04\xdc\x05\x04\x1f\n\x0f\n\x07\x04(\ \x03\x03\x02\n\x05\x12\x04\xdc\x05\x04\n\n\x0f\n\x07\x04(\x03\x03\x02\n\ \x01\x12\x04\xdc\x05\x0b\x19\n\x0f\n\x07\x04(\x03\x03\x02\n\x03\x12\x04\ \xdc\x05\x1c\x1e\n\x0e\n\x06\x04(\x03\x03\x02\x0b\x12\x04\xdd\x05\x044\n\ \x0f\n\x07\x04(\x03\x03\x02\x0b\x04\x12\x04\xdd\x05\x04\x0c\n\x0f\n\x07\ \x04(\x03\x03\x02\x0b\x06\x12\x04\xdd\x05\r\x1b\n\x0f\n\x07\x04(\x03\x03\ \x02\x0b\x01\x12\x04\xdd\x05\x1c.\n\x0f\n\x07\x04(\x03\x03\x02\x0b\x03\ \x12\x04\xdd\x0513\n\x0e\n\x06\x04(\x03\x03\x02\x0c\x12\x04\xde\x05\x04<\ \n\x0f\n\x07\x04(\x03\x03\x02\x0c\x04\x12\x04\xde\x05\x04\x0c\n\x0f\n\ \x07\x04(\x03\x03\x02\x0c\x06\x12\x04\xde\x05\r\x1f\n\x0f\n\x07\x04(\x03\ \x03\x02\x0c\x01\x12\x04\xde\x05\x206\n\x0f\n\x07\x04(\x03\x03\x02\x0c\ \x03\x12\x04\xde\x059;\n\x10\n\x06\x04(\x03\x03\x03\0\x12\x06\xe0\x05\ \x04\xe6\x05\x05\n\x0f\n\x07\x04(\x03\x03\x03\0\x01\x12\x04\xe0\x05\x0c\ \x1a\n\x10\n\x08\x04(\x03\x03\x03\0\x02\0\x12\x04\xe1\x05\x06\x16\n\x11\ \n\t\x04(\x03\x03\x03\0\x02\0\x05\x12\x04\xe1\x05\x06\x0c\n\x11\n\t\x04(\ \x03\x03\x03\0\x02\0\x01\x12\x04\xe1\x05\r\x11\n\x11\n\t\x04(\x03\x03\ \x03\0\x02\0\x03\x12\x04\xe1\x05\x14\x15\n\x10\n\x08\x04(\x03\x03\x03\0\ \x02\x01\x12\x04\xe2\x05\x06\x19\n\x11\n\t\x04(\x03\x03\x03\0\x02\x01\ \x05\x12\x04\xe2\x05\x06\x0b\n\x11\n\t\x04(\x03\x03\x03\0\x02\x01\x01\ \x12\x04\xe2\x05\x0c\x14\n\x11\n\t\x04(\x03\x03\x03\0\x02\x01\x03\x12\ \x04\xe2\x05\x17\x18\n\x10\n\x08\x04(\x03\x03\x03\0\x02\x02\x12\x04\xe3\ \x05\x06\x18\n\x11\n\t\x04(\x03\x03\x03\0\x02\x02\x05\x12\x04\xe3\x05\ \x06\x0b\n\x11\n\t\x04(\x03\x03\x03\0\x02\x02\x01\x12\x04\xe3\x05\x0c\ \x13\n\x11\n\t\x04(\x03\x03\x03\0\x02\x02\x03\x12\x04\xe3\x05\x16\x17\n\ \x10\n\x08\x04(\x03\x03\x03\0\x02\x03\x12\x04\xe4\x05\x06\x18\n\x11\n\t\ \x04(\x03\x03\x03\0\x02\x03\x05\x12\x04\xe4\x05\x06\x0b\n\x11\n\t\x04(\ \x03\x03\x03\0\x02\x03\x01\x12\x04\xe4\x05\x0c\x13\n\x11\n\t\x04(\x03\ \x03\x03\0\x02\x03\x03\x12\x04\xe4\x05\x16\x17\n\x10\n\x08\x04(\x03\x03\ \x03\0\x02\x04\x12\x04\xe5\x05\x06\x19\n\x11\n\t\x04(\x03\x03\x03\0\x02\ \x04\x05\x12\x04\xe5\x05\x06\x0c\n\x11\n\t\x04(\x03\x03\x03\0\x02\x04\ \x01\x12\x04\xe5\x05\r\x14\n\x11\n\t\x04(\x03\x03\x03\0\x02\x04\x03\x12\ \x04\xe5\x05\x17\x18\n\x10\n\x06\x04(\x03\x03\x03\x01\x12\x06\xe8\x05\ \x04\xf0\x05\x05\n\x0f\n\x07\x04(\x03\x03\x03\x01\x01\x12\x04\xe8\x05\ \x0c\x1e\n\x10\n\x08\x04(\x03\x03\x03\x01\x02\0\x12\x04\xe9\x05\x06\x16\ \n\x11\n\t\x04(\x03\x03\x03\x01\x02\0\x05\x12\x04\xe9\x05\x06\x0c\n\x11\ \n\t\x04(\x03\x03\x03\x01\x02\0\x01\x12\x04\xe9\x05\r\x11\n\x11\n\t\x04(\ \x03\x03\x03\x01\x02\0\x03\x12\x04\xe9\x05\x14\x15\n\x10\n\x08\x04(\x03\ \x03\x03\x01\x02\x01\x12\x04\xea\x05\x06\x1a\n\x11\n\t\x04(\x03\x03\x03\ \x01\x02\x01\x05\x12\x04\xea\x05\x06\x0c\n\x11\n\t\x04(\x03\x03\x03\x01\ \x02\x01\x01\x12\x04\xea\x05\r\x15\n\x11\n\t\x04(\x03\x03\x03\x01\x02\ \x01\x03\x12\x04\xea\x05\x18\x19\n\x10\n\x08\x04(\x03\x03\x03\x01\x02\ \x02\x12\x04\xeb\x05\x06\x1b\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x02\x05\ \x12\x04\xeb\x05\x06\x0c\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x02\x01\x12\ \x04\xeb\x05\r\x16\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x02\x03\x12\x04\ \xeb\x05\x19\x1a\n\x10\n\x08\x04(\x03\x03\x03\x01\x02\x03\x12\x04\xec\ \x05\x06\x17\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x03\x05\x12\x04\xec\x05\ \x06\x0c\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x03\x01\x12\x04\xec\x05\r\ \x12\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x03\x03\x12\x04\xec\x05\x15\x16\ \n\x10\n\x08\x04(\x03\x03\x03\x01\x02\x04\x12\x04\xed\x05\x06\x1a\n\x11\ \n\t\x04(\x03\x03\x03\x01\x02\x04\x05\x12\x04\xed\x05\x06\x0b\n\x11\n\t\ \x04(\x03\x03\x03\x01\x02\x04\x01\x12\x04\xed\x05\x0c\x15\n\x11\n\t\x04(\ \x03\x03\x03\x01\x02\x04\x03\x12\x04\xed\x05\x18\x19\n\x10\n\x08\x04(\ \x03\x03\x03\x01\x02\x05\x12\x04\xee\x05\x06\x19\n\x11\n\t\x04(\x03\x03\ \x03\x01\x02\x05\x05\x12\x04\xee\x05\x06\x0b\n\x11\n\t\x04(\x03\x03\x03\ \x01\x02\x05\x01\x12\x04\xee\x05\x0c\x14\n\x11\n\t\x04(\x03\x03\x03\x01\ \x02\x05\x03\x12\x04\xee\x05\x17\x18\n\x10\n\x08\x04(\x03\x03\x03\x01\ \x02\x06\x12\x04\xef\x05\x06\x1c\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x06\ \x05\x12\x04\xef\x05\x06\x0c\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x06\x01\ \x12\x04\xef\x05\r\x17\n\x11\n\t\x04(\x03\x03\x03\x01\x02\x06\x03\x12\ \x04\xef\x05\x1a\x1b\n\x0c\n\x02\x04)\x12\x06\xf4\x05\0\xda\x06\x01\n\ \x0b\n\x03\x04)\x01\x12\x04\xf4\x05\x08\x13\n\x0c\n\x04\x04)\x02\0\x12\ \x04\xf5\x05\x02\x15\n\r\n\x05\x04)\x02\0\x05\x12\x04\xf5\x05\x02\x07\n\ \r\n\x05\x04)\x02\0\x01\x12\x04\xf5\x05\x08\x10\n\r\n\x05\x04)\x02\0\x03\ \x12\x04\xf5\x05\x13\x14\n\x0c\n\x04\x04)\x02\x01\x12\x04\xf6\x05\x02\ \x14\n\r\n\x05\x04)\x02\x01\x06\x12\x04\xf6\x05\x02\n\n\r\n\x05\x04)\x02\ \x01\x01\x12\x04\xf6\x05\x0b\x0f\n\r\n\x05\x04)\x02\x01\x03\x12\x04\xf6\ \x05\x12\x13\n\x0c\n\x04\x04)\x02\x02\x12\x04\xf7\x05\x02\x20\n\r\n\x05\ \x04)\x02\x02\x06\x12\x04\xf7\x05\x02\x10\n\r\n\x05\x04)\x02\x02\x01\x12\ \x04\xf7\x05\x11\x1b\n\r\n\x05\x04)\x02\x02\x03\x12\x04\xf7\x05\x1e\x1f\ \n\x0c\n\x04\x04)\x02\x03\x12\x04\xf8\x05\x02\x12\n\r\n\x05\x04)\x02\x03\ \x06\x12\x04\xf8\x05\x02\t\n\r\n\x05\x04)\x02\x03\x01\x12\x04\xf8\x05\n\ \r\n\r\n\x05\x04)\x02\x03\x03\x12\x04\xf8\x05\x10\x11\n\x0e\n\x04\x04)\ \x03\0\x12\x06\xfa\x05\x02\xff\x05\x03\n\r\n\x05\x04)\x03\0\x01\x12\x04\ \xfa\x05\n\x12\n\x0e\n\x06\x04)\x03\0\x02\0\x12\x04\xfb\x05\x04\x12\n\ \x0f\n\x07\x04)\x03\0\x02\0\x05\x12\x04\xfb\x05\x04\n\n\x0f\n\x07\x04)\ \x03\0\x02\0\x01\x12\x04\xfb\x05\x0b\r\n\x0f\n\x07\x04)\x03\0\x02\0\x03\ \x12\x04\xfb\x05\x10\x11\n\x0e\n\x06\x04)\x03\0\x02\x01\x12\x04\xfc\x05\ \x04\x17\n\x0f\n\x07\x04)\x03\0\x02\x01\x05\x12\x04\xfc\x05\x04\t\n\x0f\ \n\x07\x04)\x03\0\x02\x01\x01\x12\x04\xfc\x05\n\x12\n\x0f\n\x07\x04)\x03\ \0\x02\x01\x03\x12\x04\xfc\x05\x15\x16\n\x0e\n\x06\x04)\x03\0\x02\x02\ \x12\x04\xfd\x05\x04\x17\n\x0f\n\x07\x04)\x03\0\x02\x02\x05\x12\x04\xfd\ \x05\x04\n\n\x0f\n\x07\x04)\x03\0\x02\x02\x01\x12\x04\xfd\x05\x0b\x12\n\ \x0f\n\x07\x04)\x03\0\x02\x02\x03\x12\x04\xfd\x05\x15\x16\n\x0e\n\x06\ \x04)\x03\0\x02\x03\x12\x04\xfe\x05\x04\x1b\n\x0f\n\x07\x04)\x03\0\x02\ \x03\x05\x12\x04\xfe\x05\x04\t\n\x0f\n\x07\x04)\x03\0\x02\x03\x01\x12\ \x04\xfe\x05\n\x16\n\x0f\n\x07\x04)\x03\0\x02\x03\x03\x12\x04\xfe\x05\ \x19\x1a\n\x0e\n\x04\x04)\x03\x01\x12\x06\x81\x06\x02\x9a\x06\x03\n\r\n\ \x05\x04)\x03\x01\x01\x12\x04\x81\x06\n\x18\n\x0e\n\x06\x04)\x03\x01\x02\ \0\x12\x04\x82\x06\x04\x1b\n\x0f\n\x07\x04)\x03\x01\x02\0\x05\x12\x04\ \x82\x06\x04\t\n\x0f\n\x07\x04)\x03\x01\x02\0\x01\x12\x04\x82\x06\n\x16\ \n\x0f\n\x07\x04)\x03\x01\x02\0\x03\x12\x04\x82\x06\x19\x1a\n\x0e\n\x06\ \x04)\x03\x01\x02\x01\x12\x04\x83\x06\x04!\n\x0f\n\x07\x04)\x03\x01\x02\ \x01\x05\x12\x04\x83\x06\x04\t\n\x0f\n\x07\x04)\x03\x01\x02\x01\x01\x12\ \x04\x83\x06\n\x1c\n\x0f\n\x07\x04)\x03\x01\x02\x01\x03\x12\x04\x83\x06\ \x1f\x20\n\x0e\n\x06\x04)\x03\x01\x02\x02\x12\x04\x84\x06\x04\x1d\n\x0f\ \n\x07\x04)\x03\x01\x02\x02\x05\x12\x04\x84\x06\x04\n\n\x0f\n\x07\x04)\ \x03\x01\x02\x02\x01\x12\x04\x84\x06\x0b\x18\n\x0f\n\x07\x04)\x03\x01\ \x02\x02\x03\x12\x04\x84\x06\x1b\x1c\n\x0e\n\x06\x04)\x03\x01\x02\x03\ \x12\x04\x85\x06\x04\x18\n\x0f\n\x07\x04)\x03\x01\x02\x03\x05\x12\x04\ \x85\x06\x04\t\n\x0f\n\x07\x04)\x03\x01\x02\x03\x01\x12\x04\x85\x06\n\ \x13\n\x0f\n\x07\x04)\x03\x01\x02\x03\x03\x12\x04\x85\x06\x16\x17\n\x0e\ \n\x06\x04)\x03\x01\x02\x04\x12\x04\x86\x06\x04\x1c\n\x0f\n\x07\x04)\x03\ \x01\x02\x04\x05\x12\x04\x86\x06\x04\t\n\x0f\n\x07\x04)\x03\x01\x02\x04\ \x01\x12\x04\x86\x06\n\x17\n\x0f\n\x07\x04)\x03\x01\x02\x04\x03\x12\x04\ \x86\x06\x1a\x1b\n\x0e\n\x06\x04)\x03\x01\x02\x05\x12\x04\x87\x06\x04\"\ \n\x0f\n\x07\x04)\x03\x01\x02\x05\x06\x12\x04\x87\x06\x04\x0c\n\x0f\n\ \x07\x04)\x03\x01\x02\x05\x01\x12\x04\x87\x06\r\x1d\n\x0f\n\x07\x04)\x03\ \x01\x02\x05\x03\x12\x04\x87\x06\x20!\n\x0e\n\x06\x04)\x03\x01\x02\x06\ \x12\x04\x88\x06\x04\x15\n\x0f\n\x07\x04)\x03\x01\x02\x06\x06\x12\x04\ \x88\x06\x04\x0c\n\x0f\n\x07\x04)\x03\x01\x02\x06\x01\x12\x04\x88\x06\r\ \x10\n\x0f\n\x07\x04)\x03\x01\x02\x06\x03\x12\x04\x88\x06\x13\x14\n\x0e\ \n\x06\x04)\x03\x01\x02\x07\x12\x04\x89\x06\x04#\n\x0f\n\x07\x04)\x03\ \x01\x02\x07\x05\x12\x04\x89\x06\x04\t\n\x0f\n\x07\x04)\x03\x01\x02\x07\ \x01\x12\x04\x89\x06\n\x1e\n\x0f\n\x07\x04)\x03\x01\x02\x07\x03\x12\x04\ \x89\x06!\"\n\x0e\n\x06\x04)\x03\x01\x02\x08\x12\x04\x8a\x06\x04#\n\x0f\ \n\x07\x04)\x03\x01\x02\x08\x06\x12\x04\x8a\x06\x04\x0c\n\x0f\n\x07\x04)\ \x03\x01\x02\x08\x01\x12\x04\x8a\x06\r\x1e\n\x0f\n\x07\x04)\x03\x01\x02\ \x08\x03\x12\x04\x8a\x06!\"\n\x0e\n\x06\x04)\x03\x01\x02\t\x12\x04\x8b\ \x06\x04$\n\x0f\n\x07\x04)\x03\x01\x02\t\x04\x12\x04\x8b\x06\x04\x0c\n\ \x0f\n\x07\x04)\x03\x01\x02\t\x06\x12\x04\x8b\x06\r\x14\n\x0f\n\x07\x04)\ \x03\x01\x02\t\x01\x12\x04\x8b\x06\x15\x1e\n\x0f\n\x07\x04)\x03\x01\x02\ \t\x03\x12\x04\x8b\x06!#\n\x0e\n\x06\x04)\x03\x01\x02\n\x12\x04\x8c\x06\ \x04#\n\x0f\n\x07\x04)\x03\x01\x02\n\x05\x12\x04\x8c\x06\x04\t\n\x0f\n\ \x07\x04)\x03\x01\x02\n\x01\x12\x04\x8c\x06\n\x1d\n\x0f\n\x07\x04)\x03\ \x01\x02\n\x03\x12\x04\x8c\x06\x20\"\n\x0e\n\x06\x04)\x03\x01\x02\x0b\ \x12\x04\x8d\x06\x04'\n\x0f\n\x07\x04)\x03\x01\x02\x0b\x05\x12\x04\x8d\ \x06\x04\n\n\x0f\n\x07\x04)\x03\x01\x02\x0b\x01\x12\x04\x8d\x06\x0b!\n\ \x0f\n\x07\x04)\x03\x01\x02\x0b\x03\x12\x04\x8d\x06$&\n\x0e\n\x06\x04)\ \x03\x01\x02\x0c\x12\x04\x8e\x06\x04(\n\x0f\n\x07\x04)\x03\x01\x02\x0c\ \x04\x12\x04\x8e\x06\x04\x0c\n\x0f\n\x07\x04)\x03\x01\x02\x0c\x06\x12\ \x04\x8e\x06\r\x17\n\x0f\n\x07\x04)\x03\x01\x02\x0c\x01\x12\x04\x8e\x06\ \x18\"\n\x0f\n\x07\x04)\x03\x01\x02\x0c\x03\x12\x04\x8e\x06%'\n\x10\n\ \x06\x04)\x03\x01\x03\0\x12\x06\x90\x06\x04\x93\x06\x05\n\x0f\n\x07\x04)\ \x03\x01\x03\0\x01\x12\x04\x90\x06\x0c\x13\n\x10\n\x08\x04)\x03\x01\x03\ \0\x02\0\x12\x04\x91\x06\x06\x19\n\x11\n\t\x04)\x03\x01\x03\0\x02\0\x05\ \x12\x04\x91\x06\x06\x0c\n\x11\n\t\x04)\x03\x01\x03\0\x02\0\x01\x12\x04\ \x91\x06\r\x14\n\x11\n\t\x04)\x03\x01\x03\0\x02\0\x03\x12\x04\x91\x06\ \x17\x18\n\x10\n\x08\x04)\x03\x01\x03\0\x02\x01\x12\x04\x92\x06\x06\x18\ \n\x11\n\t\x04)\x03\x01\x03\0\x02\x01\x05\x12\x04\x92\x06\x06\x0b\n\x11\ \n\t\x04)\x03\x01\x03\0\x02\x01\x01\x12\x04\x92\x06\x0c\x13\n\x11\n\t\ \x04)\x03\x01\x03\0\x02\x01\x03\x12\x04\x92\x06\x16\x17\n\x10\n\x06\x04)\ \x03\x01\x03\x01\x12\x06\x95\x06\x04\x99\x06\x05\n\x0f\n\x07\x04)\x03\ \x01\x03\x01\x01\x12\x04\x95\x06\x0c\x16\n\x10\n\x08\x04)\x03\x01\x03\ \x01\x02\0\x12\x04\x96\x06\x06\x19\n\x11\n\t\x04)\x03\x01\x03\x01\x02\0\ \x05\x12\x04\x96\x06\x06\x0c\n\x11\n\t\x04)\x03\x01\x03\x01\x02\0\x01\ \x12\x04\x96\x06\r\x14\n\x11\n\t\x04)\x03\x01\x03\x01\x02\0\x03\x12\x04\ \x96\x06\x17\x18\n\x10\n\x08\x04)\x03\x01\x03\x01\x02\x01\x12\x04\x97\ \x06\x06\x19\n\x11\n\t\x04)\x03\x01\x03\x01\x02\x01\x05\x12\x04\x97\x06\ \x06\x0b\n\x11\n\t\x04)\x03\x01\x03\x01\x02\x01\x01\x12\x04\x97\x06\x0c\ \x14\n\x11\n\t\x04)\x03\x01\x03\x01\x02\x01\x03\x12\x04\x97\x06\x17\x18\ \n\x10\n\x08\x04)\x03\x01\x03\x01\x02\x02\x12\x04\x98\x06\x06\x16\n\x11\ \n\t\x04)\x03\x01\x03\x01\x02\x02\x05\x12\x04\x98\x06\x06\x0b\n\x11\n\t\ \x04)\x03\x01\x03\x01\x02\x02\x01\x12\x04\x98\x06\x0c\x11\n\x11\n\t\x04)\ \x03\x01\x03\x01\x02\x02\x03\x12\x04\x98\x06\x14\x15\n\x0e\n\x04\x04)\ \x03\x02\x12\x06\x9c\x06\x02\xa2\x06\x03\n\r\n\x05\x04)\x03\x02\x01\x12\ \x04\x9c\x06\n\x12\n\x0e\n\x06\x04)\x03\x02\x02\0\x12\x04\x9d\x06\x04\ \x14\n\x0f\n\x07\x04)\x03\x02\x02\0\x05\x12\x04\x9d\x06\x04\t\n\x0f\n\ \x07\x04)\x03\x02\x02\0\x01\x12\x04\x9d\x06\n\x0f\n\x0f\n\x07\x04)\x03\ \x02\x02\0\x03\x12\x04\x9d\x06\x12\x13\n\x0e\n\x06\x04)\x03\x02\x02\x01\ \x12\x04\x9e\x06\x04\x18\n\x0f\n\x07\x04)\x03\x02\x02\x01\x05\x12\x04\ \x9e\x06\x04\n\n\x0f\n\x07\x04)\x03\x02\x02\x01\x01\x12\x04\x9e\x06\x0b\ \x13\n\x0f\n\x07\x04)\x03\x02\x02\x01\x03\x12\x04\x9e\x06\x16\x17\n\x0e\ \n\x06\x04)\x03\x02\x02\x02\x12\x04\x9f\x06\x04\x1d\n\x0f\n\x07\x04)\x03\ \x02\x02\x02\x05\x12\x04\x9f\x06\x04\n\n\x0f\n\x07\x04)\x03\x02\x02\x02\ \x01\x12\x04\x9f\x06\x0b\x18\n\x0f\n\x07\x04)\x03\x02\x02\x02\x03\x12\ \x04\x9f\x06\x1b\x1c\n\x0e\n\x06\x04)\x03\x02\x02\x03\x12\x04\xa0\x06\ \x04\x1e\n\x0f\n\x07\x04)\x03\x02\x02\x03\x05\x12\x04\xa0\x06\x04\n\n\ \x0f\n\x07\x04)\x03\x02\x02\x03\x01\x12\x04\xa0\x06\x0b\x19\n\x0f\n\x07\ \x04)\x03\x02\x02\x03\x03\x12\x04\xa0\x06\x1c\x1d\n\x0e\n\x06\x04)\x03\ \x02\x02\x04\x12\x04\xa1\x06\x04!\n\x0f\n\x07\x04)\x03\x02\x02\x04\x05\ \x12\x04\xa1\x06\x04\n\n\x0f\n\x07\x04)\x03\x02\x02\x04\x01\x12\x04\xa1\ \x06\x0b\x1c\n\x0f\n\x07\x04)\x03\x02\x02\x04\x03\x12\x04\xa1\x06\x1f\ \x20\n\x0e\n\x04\x04)\x03\x03\x12\x06\xa4\x06\x02\xd9\x06\x03\n\r\n\x05\ \x04)\x03\x03\x01\x12\x04\xa4\x06\n\x11\n\x0e\n\x06\x04)\x03\x03\x02\0\ \x12\x04\xa5\x06\x04\x1e\n\x0f\n\x07\x04)\x03\x03\x02\0\x05\x12\x04\xa5\ \x06\x04\t\n\x0f\n\x07\x04)\x03\x03\x02\0\x01\x12\x04\xa5\x06\n\x19\n\ \x0f\n\x07\x04)\x03\x03\x02\0\x03\x12\x04\xa5\x06\x1c\x1d\n\x0e\n\x06\ \x04)\x03\x03\x02\x01\x12\x04\xa6\x06\x04\x14\n\x0f\n\x07\x04)\x03\x03\ \x02\x01\x06\x12\x04\xa6\x06\x04\x0b\n\x0f\n\x07\x04)\x03\x03\x02\x01\ \x01\x12\x04\xa6\x06\x0c\x0f\n\x0f\n\x07\x04)\x03\x03\x02\x01\x03\x12\ \x04\xa6\x06\x12\x13\n\x0e\n\x06\x04)\x03\x03\x02\x02\x12\x04\xa7\x06\ \x04\x1e\n\x0f\n\x07\x04)\x03\x03\x02\x02\x05\x12\x04\xa7\x06\x04\t\n\ \x0f\n\x07\x04)\x03\x03\x02\x02\x01\x12\x04\xa7\x06\n\x19\n\x0f\n\x07\ \x04)\x03\x03\x02\x02\x03\x12\x04\xa7\x06\x1c\x1d\n\x0e\n\x06\x04)\x03\ \x03\x02\x03\x12\x04\xa8\x06\x04#\n\x0f\n\x07\x04)\x03\x03\x02\x03\x05\ \x12\x04\xa8\x06\x04\t\n\x0f\n\x07\x04)\x03\x03\x02\x03\x01\x12\x04\xa8\ \x06\n\x1e\n\x0f\n\x07\x04)\x03\x03\x02\x03\x03\x12\x04\xa8\x06!\"\n\x0e\ \n\x06\x04)\x03\x03\x02\x04\x12\x04\xa9\x06\x04\x1e\n\x0f\n\x07\x04)\x03\ \x03\x02\x04\x06\x12\x04\xa9\x06\x04\x0c\n\x0f\n\x07\x04)\x03\x03\x02\ \x04\x01\x12\x04\xa9\x06\r\x19\n\x0f\n\x07\x04)\x03\x03\x02\x04\x03\x12\ \x04\xa9\x06\x1c\x1d\n\x0e\n\x06\x04)\x03\x03\x02\x05\x12\x04\xaa\x06\ \x04\x1f\n\x0f\n\x07\x04)\x03\x03\x02\x05\x06\x12\x04\xaa\x06\x04\x0c\n\ \x0f\n\x07\x04)\x03\x03\x02\x05\x01\x12\x04\xaa\x06\r\x1a\n\x0f\n\x07\ \x04)\x03\x03\x02\x05\x03\x12\x04\xaa\x06\x1d\x1e\n\x0e\n\x06\x04)\x03\ \x03\x02\x06\x12\x04\xab\x06\x04!\n\x0f\n\x07\x04)\x03\x03\x02\x06\x05\ \x12\x04\xab\x06\x04\t\n\x0f\n\x07\x04)\x03\x03\x02\x06\x01\x12\x04\xab\ \x06\n\x1c\n\x0f\n\x07\x04)\x03\x03\x02\x06\x03\x12\x04\xab\x06\x1f\x20\ \n\x0e\n\x06\x04)\x03\x03\x02\x07\x12\x04\xac\x06\x04=\n\x0f\n\x07\x04)\ \x03\x03\x02\x07\x04\x12\x04\xac\x06\x04\x0c\n\x0f\n\x07\x04)\x03\x03\ \x02\x07\x06\x12\x04\xac\x06\r$\n\x0f\n\x07\x04)\x03\x03\x02\x07\x01\x12\ \x04\xac\x06%8\n\x0f\n\x07\x04)\x03\x03\x02\x07\x03\x12\x04\xac\x06;<\n\ \x0e\n\x06\x04)\x03\x03\x02\x08\x12\x04\xad\x06\x04\x1e\n\x0f\n\x07\x04)\ \x03\x03\x02\x08\x06\x12\x04\xad\x06\x04\x0c\n\x0f\n\x07\x04)\x03\x03\ \x02\x08\x01\x12\x04\xad\x06\r\x19\n\x0f\n\x07\x04)\x03\x03\x02\x08\x03\ \x12\x04\xad\x06\x1c\x1d\n\x0e\n\x06\x04)\x03\x03\x02\t\x12\x04\xae\x06\ \x04\x20\n\x0f\n\x07\x04)\x03\x03\x02\t\x06\x12\x04\xae\x06\x04\x0c\n\ \x0f\n\x07\x04)\x03\x03\x02\t\x01\x12\x04\xae\x06\r\x1a\n\x0f\n\x07\x04)\ \x03\x03\x02\t\x03\x12\x04\xae\x06\x1d\x1f\n\x0e\n\x06\x04)\x03\x03\x02\ \n\x12\x04\xaf\x06\x04\x1d\n\x0f\n\x07\x04)\x03\x03\x02\n\x06\x12\x04\ \xaf\x06\x04\x0f\n\x0f\n\x07\x04)\x03\x03\x02\n\x01\x12\x04\xaf\x06\x10\ \x17\n\x0f\n\x07\x04)\x03\x03\x02\n\x03\x12\x04\xaf\x06\x1a\x1c\n\x10\n\ \x06\x04)\x03\x03\x03\0\x12\x06\xb1\x06\x04\xbd\x06\x05\n\x0f\n\x07\x04)\ \x03\x03\x03\0\x01\x12\x04\xb1\x06\x0c\x13\n\x10\n\x08\x04)\x03\x03\x03\ \0\x02\0\x12\x04\xb2\x06\x06\x17\n\x11\n\t\x04)\x03\x03\x03\0\x02\0\x06\ \x12\x04\xb2\x06\x06\x0e\n\x11\n\t\x04)\x03\x03\x03\0\x02\0\x01\x12\x04\ \xb2\x06\x0f\x12\n\x11\n\t\x04)\x03\x03\x03\0\x02\0\x03\x12\x04\xb2\x06\ \x15\x16\n\x10\n\x08\x04)\x03\x03\x03\0\x02\x01\x12\x04\xb3\x06\x06\x1b\ \n\x11\n\t\x04)\x03\x03\x03\0\x02\x01\x06\x12\x04\xb3\x06\x06\x0e\n\x11\ \n\t\x04)\x03\x03\x03\0\x02\x01\x01\x12\x04\xb3\x06\x0f\x16\n\x11\n\t\ \x04)\x03\x03\x03\0\x02\x01\x03\x12\x04\xb3\x06\x19\x1a\n\x10\n\x08\x04)\ \x03\x03\x03\0\x02\x02\x12\x04\xb4\x06\x06\x1e\n\x11\n\t\x04)\x03\x03\ \x03\0\x02\x02\x06\x12\x04\xb4\x06\x06\x0e\n\x11\n\t\x04)\x03\x03\x03\0\ \x02\x02\x01\x12\x04\xb4\x06\x0f\x19\n\x11\n\t\x04)\x03\x03\x03\0\x02\ \x02\x03\x12\x04\xb4\x06\x1c\x1d\n\x10\n\x08\x04)\x03\x03\x03\0\x02\x03\ \x12\x04\xb5\x06\x06(\n\x11\n\t\x04)\x03\x03\x03\0\x02\x03\x04\x12\x04\ \xb5\x06\x06\x0e\n\x11\n\t\x04)\x03\x03\x03\0\x02\x03\x06\x12\x04\xb5\ \x06\x0f\x1c\n\x11\n\t\x04)\x03\x03\x03\0\x02\x03\x01\x12\x04\xb5\x06\ \x1d#\n\x11\n\t\x04)\x03\x03\x03\0\x02\x03\x03\x12\x04\xb5\x06&'\n\x12\n\ \x08\x04)\x03\x03\x03\0\x03\0\x12\x06\xb7\x06\x06\xbc\x06\x07\n\x11\n\t\ \x04)\x03\x03\x03\0\x03\0\x01\x12\x04\xb7\x06\x0e\x1b\n\x12\n\n\x04)\x03\ \x03\x03\0\x03\0\x02\0\x12\x04\xb8\x06\x08\x18\n\x13\n\x0b\x04)\x03\x03\ \x03\0\x03\0\x02\0\x05\x12\x04\xb8\x06\x08\x0e\n\x13\n\x0b\x04)\x03\x03\ \x03\0\x03\0\x02\0\x01\x12\x04\xb8\x06\x0f\x13\n\x13\n\x0b\x04)\x03\x03\ \x03\0\x03\0\x02\0\x03\x12\x04\xb8\x06\x16\x17\n\x12\n\n\x04)\x03\x03\ \x03\0\x03\0\x02\x01\x12\x04\xb9\x06\x08\x19\n\x13\n\x0b\x04)\x03\x03\ \x03\0\x03\0\x02\x01\x06\x12\x04\xb9\x06\x08\x10\n\x13\n\x0b\x04)\x03\ \x03\x03\0\x03\0\x02\x01\x01\x12\x04\xb9\x06\x11\x14\n\x13\n\x0b\x04)\ \x03\x03\x03\0\x03\0\x02\x01\x03\x12\x04\xb9\x06\x17\x18\n\x12\n\n\x04)\ \x03\x03\x03\0\x03\0\x02\x02\x12\x04\xba\x06\x08\x1d\n\x13\n\x0b\x04)\ \x03\x03\x03\0\x03\0\x02\x02\x06\x12\x04\xba\x06\x08\x10\n\x13\n\x0b\x04\ )\x03\x03\x03\0\x03\0\x02\x02\x01\x12\x04\xba\x06\x11\x18\n\x13\n\x0b\ \x04)\x03\x03\x03\0\x03\0\x02\x02\x03\x12\x04\xba\x06\x1b\x1c\n\x12\n\n\ \x04)\x03\x03\x03\0\x03\0\x02\x03\x12\x04\xbb\x06\x08\x20\n\x13\n\x0b\ \x04)\x03\x03\x03\0\x03\0\x02\x03\x06\x12\x04\xbb\x06\x08\x10\n\x13\n\ \x0b\x04)\x03\x03\x03\0\x03\0\x02\x03\x01\x12\x04\xbb\x06\x11\x1b\n\x13\ \n\x0b\x04)\x03\x03\x03\0\x03\0\x02\x03\x03\x12\x04\xbb\x06\x1e\x1f\n\ \x10\n\x06\x04)\x03\x03\x03\x01\x12\x06\xbf\x06\x04\xc2\x06\x05\n\x0f\n\ \x07\x04)\x03\x03\x03\x01\x01\x12\x04\xbf\x06\x0c#\n\x10\n\x08\x04)\x03\ \x03\x03\x01\x02\0\x12\x04\xc0\x06\x06\x18\n\x11\n\t\x04)\x03\x03\x03\ \x01\x02\0\x05\x12\x04\xc0\x06\x06\x0c\n\x11\n\t\x04)\x03\x03\x03\x01\ \x02\0\x01\x12\x04\xc0\x06\r\x13\n\x11\n\t\x04)\x03\x03\x03\x01\x02\0\ \x03\x12\x04\xc0\x06\x16\x17\n\x10\n\x08\x04)\x03\x03\x03\x01\x02\x01\ \x12\x04\xc1\x06\x06\x16\n\x11\n\t\x04)\x03\x03\x03\x01\x02\x01\x05\x12\ \x04\xc1\x06\x06\x0b\n\x11\n\t\x04)\x03\x03\x03\x01\x02\x01\x01\x12\x04\ \xc1\x06\x0c\x11\n\x11\n\t\x04)\x03\x03\x03\x01\x02\x01\x03\x12\x04\xc1\ \x06\x14\x15\n\x10\n\x06\x04)\x03\x03\x03\x02\x12\x06\xc4\x06\x04\xd8\ \x06\x05\n\x0f\n\x07\x04)\x03\x03\x03\x02\x01\x12\x04\xc4\x06\x0c\x17\n\ \x10\n\x08\x04)\x03\x03\x03\x02\x02\0\x12\x04\xc5\x06\x06\x16\n\x11\n\t\ \x04)\x03\x03\x03\x02\x02\0\x05\x12\x04\xc5\x06\x06\x0b\n\x11\n\t\x04)\ \x03\x03\x03\x02\x02\0\x01\x12\x04\xc5\x06\x0c\x11\n\x11\n\t\x04)\x03\ \x03\x03\x02\x02\0\x03\x12\x04\xc5\x06\x14\x15\n\x10\n\x08\x04)\x03\x03\ \x03\x02\x02\x01\x12\x04\xc6\x06\x06\x16\n\x11\n\t\x04)\x03\x03\x03\x02\ \x02\x01\x05\x12\x04\xc6\x06\x06\x0b\n\x11\n\t\x04)\x03\x03\x03\x02\x02\ \x01\x01\x12\x04\xc6\x06\x0c\x11\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x01\ \x03\x12\x04\xc6\x06\x14\x15\n\x10\n\x08\x04)\x03\x03\x03\x02\x02\x02\ \x12\x04\xc7\x06\x06\x16\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x02\x05\x12\ \x04\xc7\x06\x06\x0b\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x02\x01\x12\x04\ \xc7\x06\x0c\x11\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x02\x03\x12\x04\xc7\ \x06\x14\x15\n\x10\n\x08\x04)\x03\x03\x03\x02\x02\x03\x12\x04\xc8\x06\ \x06\x1b\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x03\x05\x12\x04\xc8\x06\x06\ \x0b\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x03\x01\x12\x04\xc8\x06\x0c\x16\ \n\x11\n\t\x04)\x03\x03\x03\x02\x02\x03\x03\x12\x04\xc8\x06\x19\x1a\n\ \x10\n\x08\x04)\x03\x03\x03\x02\x02\x04\x12\x04\xc9\x06\x06\x18\n\x11\n\ \t\x04)\x03\x03\x03\x02\x02\x04\x05\x12\x04\xc9\x06\x06\x0b\n\x11\n\t\ \x04)\x03\x03\x03\x02\x02\x04\x01\x12\x04\xc9\x06\x0c\x13\n\x11\n\t\x04)\ \x03\x03\x03\x02\x02\x04\x03\x12\x04\xc9\x06\x16\x17\n\x10\n\x08\x04)\ \x03\x03\x03\x02\x02\x05\x12\x04\xca\x06\x06\x18\n\x11\n\t\x04)\x03\x03\ \x03\x02\x02\x05\x05\x12\x04\xca\x06\x06\x0b\n\x11\n\t\x04)\x03\x03\x03\ \x02\x02\x05\x01\x12\x04\xca\x06\x0c\x13\n\x11\n\t\x04)\x03\x03\x03\x02\ \x02\x05\x03\x12\x04\xca\x06\x16\x17\n\x10\n\x08\x04)\x03\x03\x03\x02\ \x02\x06\x12\x04\xcb\x06\x06\x18\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x06\ \x05\x12\x04\xcb\x06\x06\x0b\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x06\x01\ \x12\x04\xcb\x06\x0c\x13\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x06\x03\x12\ \x04\xcb\x06\x16\x17\n\x10\n\x08\x04)\x03\x03\x03\x02\x02\x07\x12\x04\ \xcc\x06\x06,\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x07\x04\x12\x04\xcc\x06\ \x06\x0e\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x07\x06\x12\x04\xcc\x06\x0f\ \x20\n\x11\n\t\x04)\x03\x03\x03\x02\x02\x07\x01\x12\x04\xcc\x06!'\n\x11\ \n\t\x04)\x03\x03\x03\x02\x02\x07\x03\x12\x04\xcc\x06*+\n\x12\n\x08\x04)\ \x03\x03\x03\x02\x03\0\x12\x06\xce\x06\x06\xd7\x06\x07\n\x11\n\t\x04)\ \x03\x03\x03\x02\x03\0\x01\x12\x04\xce\x06\x0e\x1f\n\x12\n\n\x04)\x03\ \x03\x03\x02\x03\0\x02\0\x12\x04\xcf\x06\x08\x1b\n\x13\n\x0b\x04)\x03\ \x03\x03\x02\x03\0\x02\0\x05\x12\x04\xcf\x06\x08\x0e\n\x13\n\x0b\x04)\ \x03\x03\x03\x02\x03\0\x02\0\x01\x12\x04\xcf\x06\x0f\x16\n\x13\n\x0b\x04\ )\x03\x03\x03\x02\x03\0\x02\0\x03\x12\x04\xcf\x06\x19\x1a\n\x12\n\n\x04)\ \x03\x03\x03\x02\x03\0\x02\x01\x12\x04\xd0\x06\x08\x18\n\x13\n\x0b\x04)\ \x03\x03\x03\x02\x03\0\x02\x01\x05\x12\x04\xd0\x06\x08\r\n\x13\n\x0b\x04\ )\x03\x03\x03\x02\x03\0\x02\x01\x01\x12\x04\xd0\x06\x0e\x13\n\x13\n\x0b\ \x04)\x03\x03\x03\x02\x03\0\x02\x01\x03\x12\x04\xd0\x06\x16\x17\n\x12\n\ \n\x04)\x03\x03\x03\x02\x03\0\x02\x02\x12\x04\xd1\x06\x08\x18\n\x13\n\ \x0b\x04)\x03\x03\x03\x02\x03\0\x02\x02\x05\x12\x04\xd1\x06\x08\r\n\x13\ \n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x02\x01\x12\x04\xd1\x06\x0e\x13\n\ \x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x02\x03\x12\x04\xd1\x06\x16\ \x17\n\x12\n\n\x04)\x03\x03\x03\x02\x03\0\x02\x03\x12\x04\xd2\x06\x08\ \x18\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x03\x05\x12\x04\xd2\x06\ \x08\r\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x03\x01\x12\x04\xd2\ \x06\x0e\x13\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x03\x03\x12\x04\ \xd2\x06\x16\x17\n\x12\n\n\x04)\x03\x03\x03\x02\x03\0\x02\x04\x12\x04\ \xd3\x06\x08\x18\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x04\x05\x12\ \x04\xd3\x06\x08\r\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x04\x01\ \x12\x04\xd3\x06\x0e\x13\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\x04\ \x03\x12\x04\xd3\x06\x16\x17\n\x12\n\n\x04)\x03\x03\x03\x02\x03\0\x02\ \x05\x12\x04\xd4\x06\x08\x1a\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\x02\ \x05\x05\x12\x04\xd4\x06\x08\r\n\x13\n\x0b\x04)\x03\x03\x03\x02\x03\0\ \x02\x05\x01\x12\x04\xd4\x06\x0e\x15\n\x13\n\x0b\x04)\x03\x03\x03\x02\ \x03\0\x02\x05\x03\x12\x04\xd4\x06\x18\x19\n\x12\n\n\x04)\x03\x03\x03\ \x02\x03\0\x02\x06\x12\x04\xd5\x06\x08\x1a\n\x13\n\x0b\x04)\x03\x03\x03\ \x02\x03\0\x02\x06\x05\x12\x04\xd5\x06\x08\r\n\x13\n\x0b\x04)\x03\x03\ \x03\x02\x03\0\x02\x06\x01\x12\x04\xd5\x06\x0e\x15\n\x13\n\x0b\x04)\x03\ \x03\x03\x02\x03\0\x02\x06\x03\x12\x04\xd5\x06\x18\x19\n\x12\n\n\x04)\ \x03\x03\x03\x02\x03\0\x02\x07\x12\x04\xd6\x06\x08\x1a\n\x13\n\x0b\x04)\ \x03\x03\x03\x02\x03\0\x02\x07\x05\x12\x04\xd6\x06\x08\r\n\x13\n\x0b\x04\ )\x03\x03\x03\x02\x03\0\x02\x07\x01\x12\x04\xd6\x06\x0e\x15\n\x13\n\x0b\ \x04)\x03\x03\x03\x02\x03\0\x02\x07\x03\x12\x04\xd6\x06\x18\x19\n\x0c\n\ \x02\x04*\x12\x06\xdc\x06\0\xf1\x06\x01\n\x0b\n\x03\x04*\x01\x12\x04\xdc\ \x06\x08\x13\n\x0e\n\x04\x04*\x04\0\x12\x06\xdd\x06\x02\xe3\x06\x03\n\r\ \n\x05\x04*\x04\0\x01\x12\x04\xdd\x06\x07\x0e\n\x0e\n\x06\x04*\x04\0\x02\ \0\x12\x04\xde\x06\x04\x14\n\x0f\n\x07\x04*\x04\0\x02\0\x01\x12\x04\xde\ \x06\x04\x0f\n\x0f\n\x07\x04*\x04\0\x02\0\x02\x12\x04\xde\x06\x12\x13\n\ \x0e\n\x06\x04*\x04\0\x02\x01\x12\x04\xdf\x06\x04\x10\n\x0f\n\x07\x04*\ \x04\0\x02\x01\x01\x12\x04\xdf\x06\x04\x0b\n\x0f\n\x07\x04*\x04\0\x02\ \x01\x02\x12\x04\xdf\x06\x0e\x0f\n\x0e\n\x06\x04*\x04\0\x02\x02\x12\x04\ \xe0\x06\x04\x13\n\x0f\n\x07\x04*\x04\0\x02\x02\x01\x12\x04\xe0\x06\x04\ \x0e\n\x0f\n\x07\x04*\x04\0\x02\x02\x02\x12\x04\xe0\x06\x11\x12\n\x0e\n\ \x06\x04*\x04\0\x02\x03\x12\x04\xe1\x06\x04\x10\n\x0f\n\x07\x04*\x04\0\ \x02\x03\x01\x12\x04\xe1\x06\x04\x0b\n\x0f\n\x07\x04*\x04\0\x02\x03\x02\ \x12\x04\xe1\x06\x0e\x0f\n\x0e\n\x06\x04*\x04\0\x02\x04\x12\x04\xe2\x06\ \x04\x0f\n\x0f\n\x07\x04*\x04\0\x02\x04\x01\x12\x04\xe2\x06\x04\n\n\x0f\ \n\x07\x04*\x04\0\x02\x04\x02\x12\x04\xe2\x06\r\x0e\n\x0e\n\x04\x04*\x04\ \x01\x12\x06\xe4\x06\x02\xe7\x06\x03\n\r\n\x05\x04*\x04\x01\x01\x12\x04\ \xe4\x06\x07\x0f\n\x0e\n\x06\x04*\x04\x01\x02\0\x12\x04\xe5\x06\x04\x0e\ \n\x0f\n\x07\x04*\x04\x01\x02\0\x01\x12\x04\xe5\x06\x04\t\n\x0f\n\x07\ \x04*\x04\x01\x02\0\x02\x12\x04\xe5\x06\x0c\r\n\x0e\n\x06\x04*\x04\x01\ \x02\x01\x12\x04\xe6\x06\x04\x0c\n\x0f\n\x07\x04*\x04\x01\x02\x01\x01\ \x12\x04\xe6\x06\x04\x07\n\x0f\n\x07\x04*\x04\x01\x02\x01\x02\x12\x04\ \xe6\x06\n\x0b\n\x0e\n\x04\x04*\x03\0\x12\x06\xe8\x06\x02\xee\x06\x03\n\ \r\n\x05\x04*\x03\0\x01\x12\x04\xe8\x06\n\r\n\x0e\n\x06\x04*\x03\0\x02\0\ \x12\x04\xe9\x06\x04\x19\n\x0f\n\x07\x04*\x03\0\x02\0\x06\x12\x04\xe9\ \x06\x04\x0b\n\x0f\n\x07\x04*\x03\0\x02\0\x01\x12\x04\xe9\x06\x0c\x14\n\ \x0f\n\x07\x04*\x03\0\x02\0\x03\x12\x04\xe9\x06\x17\x18\n\x0e\n\x06\x04*\ \x03\0\x02\x01\x12\x04\xea\x06\x04\x1b\n\x0f\n\x07\x04*\x03\0\x02\x01\ \x06\x12\x04\xea\x06\x04\x0c\n\x0f\n\x07\x04*\x03\0\x02\x01\x01\x12\x04\ \xea\x06\r\x16\n\x0f\n\x07\x04*\x03\0\x02\x01\x03\x12\x04\xea\x06\x19\ \x1a\n\x0e\n\x06\x04*\x03\0\x02\x02\x12\x04\xeb\x06\x04\x15\n\x0f\n\x07\ \x04*\x03\0\x02\x02\x05\x12\x04\xeb\x06\x04\t\n\x0f\n\x07\x04*\x03\0\x02\ \x02\x01\x12\x04\xeb\x06\n\x10\n\x0f\n\x07\x04*\x03\0\x02\x02\x03\x12\ \x04\xeb\x06\x13\x14\n\x0e\n\x06\x04*\x03\0\x02\x03\x12\x04\xec\x06\x04\ \x14\n\x0f\n\x07\x04*\x03\0\x02\x03\x05\x12\x04\xec\x06\x04\t\n\x0f\n\ \x07\x04*\x03\0\x02\x03\x01\x12\x04\xec\x06\n\x0f\n\x0f\n\x07\x04*\x03\0\ \x02\x03\x03\x12\x04\xec\x06\x12\x13\n\x0e\n\x06\x04*\x03\0\x02\x04\x12\ \x04\xed\x06\x04\x13\n\x0f\n\x07\x04*\x03\0\x02\x04\x05\x12\x04\xed\x06\ \x04\t\n\x0f\n\x07\x04*\x03\0\x02\x04\x01\x12\x04\xed\x06\n\x0e\n\x0f\n\ \x07\x04*\x03\0\x02\x04\x03\x12\x04\xed\x06\x11\x12\n\x0c\n\x04\x04*\x02\ \0\x12\x04\xef\x06\x02\x13\n\r\n\x05\x04*\x02\0\x06\x12\x04\xef\x06\x02\ \x05\n\r\n\x05\x04*\x02\0\x01\x12\x04\xef\x06\x06\x0e\n\r\n\x05\x04*\x02\ \0\x03\x12\x04\xef\x06\x11\x12\n\x0c\n\x04\x04*\x02\x01\x12\x04\xf0\x06\ \x02\x16\n\r\n\x05\x04*\x02\x01\x05\x12\x04\xf0\x06\x02\x07\n\r\n\x05\ \x04*\x02\x01\x01\x12\x04\xf0\x06\x08\x11\n\r\n\x05\x04*\x02\x01\x03\x12\ \x04\xf0\x06\x14\x15\n\x0c\n\x02\x04+\x12\x06\xf3\x06\0\xf6\x06\x01\n\ \x0b\n\x03\x04+\x01\x12\x04\xf3\x06\x08\x18\n\x0c\n\x04\x04+\x02\0\x12\ \x04\xf4\x06\x02\x11\n\r\n\x05\x04+\x02\0\x05\x12\x04\xf4\x06\x02\x07\n\ \r\n\x05\x04+\x02\0\x01\x12\x04\xf4\x06\x08\x0c\n\r\n\x05\x04+\x02\0\x03\ \x12\x04\xf4\x06\x0f\x10\n\x0c\n\x04\x04+\x02\x01\x12\x04\xf5\x06\x02\ \x1f\n\r\n\x05\x04+\x02\x01\x04\x12\x04\xf5\x06\x02\n\n\r\n\x05\x04+\x02\ \x01\x05\x12\x04\xf5\x06\x0b\x10\n\r\n\x05\x04+\x02\x01\x01\x12\x04\xf5\ \x06\x11\x1a\n\r\n\x05\x04+\x02\x01\x03\x12\x04\xf5\x06\x1d\x1e\n\x0c\n\ \x02\x04,\x12\x06\xf8\x06\0\xfa\x06\x01\n\x0b\n\x03\x04,\x01\x12\x04\xf8\ \x06\x08\x0b\n\x0c\n\x04\x04,\x02\0\x12\x04\xf9\x06\x02\x1f\n\r\n\x05\ \x04,\x02\0\x04\x12\x04\xf9\x06\x02\n\n\r\n\x05\x04,\x02\0\x05\x12\x04\ \xf9\x06\x0b\x10\n\r\n\x05\x04,\x02\0\x01\x12\x04\xf9\x06\x11\x1a\n\r\n\ \x05\x04,\x02\0\x03\x12\x04\xf9\x06\x1d\x1eb\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(3); deps.push(::protobuf::well_known_types::any::file_descriptor().clone()); deps.push(super::Discover::file_descriptor().clone()); deps.push(super::common::file_descriptor().clone()); let mut messages = ::std::vec::Vec::with_capacity(77); messages.push(AccountId::generated_message_descriptor_data()); messages.push(Vote::generated_message_descriptor_data()); messages.push(Proposal::generated_message_descriptor_data()); messages.push(Exchange::generated_message_descriptor_data()); messages.push(MarketOrder::generated_message_descriptor_data()); messages.push(MarketOrderList::generated_message_descriptor_data()); messages.push(MarketOrderPairList::generated_message_descriptor_data()); messages.push(MarketOrderPair::generated_message_descriptor_data()); messages.push(MarketAccountOrder::generated_message_descriptor_data()); messages.push(MarketPrice::generated_message_descriptor_data()); messages.push(MarketPriceList::generated_message_descriptor_data()); messages.push(MarketOrderIdList::generated_message_descriptor_data()); messages.push(ChainParameters::generated_message_descriptor_data()); messages.push(Account::generated_message_descriptor_data()); messages.push(Key::generated_message_descriptor_data()); messages.push(DelegatedResource::generated_message_descriptor_data()); messages.push(Authority::generated_message_descriptor_data()); messages.push(Permission::generated_message_descriptor_data()); messages.push(Witness::generated_message_descriptor_data()); messages.push(Votes::generated_message_descriptor_data()); messages.push(TXOutput::generated_message_descriptor_data()); messages.push(TXInput::generated_message_descriptor_data()); messages.push(TXOutputs::generated_message_descriptor_data()); messages.push(ResourceReceipt::generated_message_descriptor_data()); messages.push(MarketOrderDetail::generated_message_descriptor_data()); messages.push(Transaction::generated_message_descriptor_data()); messages.push(TransactionInfo::generated_message_descriptor_data()); messages.push(TransactionRet::generated_message_descriptor_data()); messages.push(Transactions::generated_message_descriptor_data()); messages.push(BlockHeader::generated_message_descriptor_data()); messages.push(Block::generated_message_descriptor_data()); messages.push(ChainInventory::generated_message_descriptor_data()); messages.push(BlockInventory::generated_message_descriptor_data()); messages.push(Inventory::generated_message_descriptor_data()); messages.push(Items::generated_message_descriptor_data()); messages.push(DynamicProperties::generated_message_descriptor_data()); messages.push(DisconnectMessage::generated_message_descriptor_data()); messages.push(HelloMessage::generated_message_descriptor_data()); messages.push(InternalTransaction::generated_message_descriptor_data()); messages.push(DelegatedResourceAccountIndex::generated_message_descriptor_data()); messages.push(NodeInfo::generated_message_descriptor_data()); messages.push(MetricsInfo::generated_message_descriptor_data()); messages.push(PBFTMessage::generated_message_descriptor_data()); messages.push(PBFTCommitResult::generated_message_descriptor_data()); messages.push(SRL::generated_message_descriptor_data()); messages.push(chain_parameters::ChainParameter::generated_message_descriptor_data()); messages.push(account::Frozen::generated_message_descriptor_data()); messages.push(account::AccountResource::generated_message_descriptor_data()); messages.push(account::FreezeV2::generated_message_descriptor_data()); messages.push(account::UnFreezeV2::generated_message_descriptor_data()); messages.push(txinput::Raw::generated_message_descriptor_data()); messages.push(transaction::Contract::generated_message_descriptor_data()); messages.push(transaction::Result::generated_message_descriptor_data()); messages.push(transaction::Raw::generated_message_descriptor_data()); messages.push(transaction_info::Log::generated_message_descriptor_data()); messages.push(block_header::Raw::generated_message_descriptor_data()); messages.push(chain_inventory::BlockId::generated_message_descriptor_data()); messages.push(block_inventory::BlockId::generated_message_descriptor_data()); messages.push(hello_message::BlockId::generated_message_descriptor_data()); messages.push(internal_transaction::CallValueInfo::generated_message_descriptor_data()); messages.push(node_info::PeerInfo::generated_message_descriptor_data()); messages.push(node_info::ConfigNodeInfo::generated_message_descriptor_data()); messages.push(node_info::MachineInfo::generated_message_descriptor_data()); messages.push(node_info::machine_info::MemoryDescInfo::generated_message_descriptor_data()); messages.push(node_info::machine_info::DeadLockThreadInfo::generated_message_descriptor_data()); messages.push(metrics_info::NodeInfo::generated_message_descriptor_data()); messages.push(metrics_info::BlockChainInfo::generated_message_descriptor_data()); messages.push(metrics_info::RateInfo::generated_message_descriptor_data()); messages.push(metrics_info::NetInfo::generated_message_descriptor_data()); messages.push(metrics_info::block_chain_info::Witness::generated_message_descriptor_data()); messages.push(metrics_info::block_chain_info::DupWitness::generated_message_descriptor_data()); messages.push(metrics_info::net_info::ApiInfo::generated_message_descriptor_data()); messages.push(metrics_info::net_info::DisconnectionDetailInfo::generated_message_descriptor_data()); messages.push(metrics_info::net_info::LatencyInfo::generated_message_descriptor_data()); messages.push(metrics_info::net_info::api_info::ApiDetailInfo::generated_message_descriptor_data()); messages.push(metrics_info::net_info::latency_info::LatencyDetailInfo::generated_message_descriptor_data()); messages.push(pbftmessage::Raw::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(14); enums.push(AccountType::generated_enum_descriptor_data()); enums.push(ReasonCode::generated_enum_descriptor_data()); enums.push(proposal::State::generated_enum_descriptor_data()); enums.push(market_order::State::generated_enum_descriptor_data()); enums.push(permission::PermissionType::generated_enum_descriptor_data()); enums.push(transaction::contract::ContractType::generated_enum_descriptor_data()); enums.push(transaction::result::Code::generated_enum_descriptor_data()); enums.push(transaction::result::ContractResult::generated_enum_descriptor_data()); enums.push(transaction_info::Code::generated_enum_descriptor_data()); enums.push(block_inventory::Type::generated_enum_descriptor_data()); enums.push(inventory::InventoryType::generated_enum_descriptor_data()); enums.push(items::ItemType::generated_enum_descriptor_data()); enums.push(pbftmessage::MsgType::generated_enum_descriptor_data()); enums.push(pbftmessage::DataType::generated_enum_descriptor_data()); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/account_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/account_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.AccountCreateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountCreateContract { // message fields // @@protoc_insertion_point(field:protocol.AccountCreateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AccountCreateContract.account_address) pub account_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AccountCreateContract.type) pub type_: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.AccountCreateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountCreateContract { fn default() -> &'a AccountCreateContract { ::default_instance() } } impl AccountCreateContract { pub fn new() -> AccountCreateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &AccountCreateContract| { &m.owner_address }, |m: &mut AccountCreateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account_address", |m: &AccountCreateContract| { &m.account_address }, |m: &mut AccountCreateContract| { &mut m.account_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &AccountCreateContract| { &m.type_ }, |m: &mut AccountCreateContract| { &mut m.type_ }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountCreateContract", fields, oneofs, ) } } impl ::protobuf::Message for AccountCreateContract { const NAME: &'static str = "AccountCreateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.account_address = is.read_bytes()?; }, 24 => { self.type_ = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.account_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.account_address); } if self.type_ != ::protobuf::EnumOrUnknown::new(super::Tron::AccountType::Normal) { my_size += ::protobuf::rt::int32_size(3, self.type_.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.account_address.is_empty() { os.write_bytes(2, &self.account_address)?; } if self.type_ != ::protobuf::EnumOrUnknown::new(super::Tron::AccountType::Normal) { os.write_enum(3, ::protobuf::EnumOrUnknown::value(&self.type_))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountCreateContract { AccountCreateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.account_address.clear(); self.type_ = ::protobuf::EnumOrUnknown::new(super::Tron::AccountType::Normal); self.special_fields.clear(); } fn default_instance() -> &'static AccountCreateContract { static instance: AccountCreateContract = AccountCreateContract { owner_address: ::std::vec::Vec::new(), account_address: ::std::vec::Vec::new(), type_: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountCreateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountCreateContract").unwrap()).clone() } } impl ::std::fmt::Display for AccountCreateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountCreateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Update account name. Account name is not unique now. // @@protoc_insertion_point(message:protocol.AccountUpdateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountUpdateContract { // message fields // @@protoc_insertion_point(field:protocol.AccountUpdateContract.account_name) pub account_name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AccountUpdateContract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.AccountUpdateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountUpdateContract { fn default() -> &'a AccountUpdateContract { ::default_instance() } } impl AccountUpdateContract { pub fn new() -> AccountUpdateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account_name", |m: &AccountUpdateContract| { &m.account_name }, |m: &mut AccountUpdateContract| { &mut m.account_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &AccountUpdateContract| { &m.owner_address }, |m: &mut AccountUpdateContract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountUpdateContract", fields, oneofs, ) } } impl ::protobuf::Message for AccountUpdateContract { const NAME: &'static str = "AccountUpdateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.account_name = is.read_bytes()?; }, 18 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.account_name.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.account_name); } if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.account_name.is_empty() { os.write_bytes(1, &self.account_name)?; } if !self.owner_address.is_empty() { os.write_bytes(2, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountUpdateContract { AccountUpdateContract::new() } fn clear(&mut self) { self.account_name.clear(); self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountUpdateContract { static instance: AccountUpdateContract = AccountUpdateContract { account_name: ::std::vec::Vec::new(), owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountUpdateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountUpdateContract").unwrap()).clone() } } impl ::std::fmt::Display for AccountUpdateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountUpdateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Set account id if the account has no id. Account id is unique and case insensitive. // @@protoc_insertion_point(message:protocol.SetAccountIdContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct SetAccountIdContract { // message fields // @@protoc_insertion_point(field:protocol.SetAccountIdContract.account_id) pub account_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SetAccountIdContract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.SetAccountIdContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SetAccountIdContract { fn default() -> &'a SetAccountIdContract { ::default_instance() } } impl SetAccountIdContract { pub fn new() -> SetAccountIdContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "account_id", |m: &SetAccountIdContract| { &m.account_id }, |m: &mut SetAccountIdContract| { &mut m.account_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &SetAccountIdContract| { &m.owner_address }, |m: &mut SetAccountIdContract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SetAccountIdContract", fields, oneofs, ) } } impl ::protobuf::Message for SetAccountIdContract { const NAME: &'static str = "SetAccountIdContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.account_id = is.read_bytes()?; }, 18 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.account_id.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.account_id); } if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.account_id.is_empty() { os.write_bytes(1, &self.account_id)?; } if !self.owner_address.is_empty() { os.write_bytes(2, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SetAccountIdContract { SetAccountIdContract::new() } fn clear(&mut self) { self.account_id.clear(); self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static SetAccountIdContract { static instance: SetAccountIdContract = SetAccountIdContract { account_id: ::std::vec::Vec::new(), owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SetAccountIdContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SetAccountIdContract").unwrap()).clone() } } impl ::std::fmt::Display for SetAccountIdContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SetAccountIdContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.AccountPermissionUpdateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountPermissionUpdateContract { // message fields // @@protoc_insertion_point(field:protocol.AccountPermissionUpdateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AccountPermissionUpdateContract.owner) pub owner: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.AccountPermissionUpdateContract.witness) pub witness: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.AccountPermissionUpdateContract.actives) pub actives: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.AccountPermissionUpdateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountPermissionUpdateContract { fn default() -> &'a AccountPermissionUpdateContract { ::default_instance() } } impl AccountPermissionUpdateContract { pub fn new() -> AccountPermissionUpdateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &AccountPermissionUpdateContract| { &m.owner_address }, |m: &mut AccountPermissionUpdateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::Tron::Permission>( "owner", |m: &AccountPermissionUpdateContract| { &m.owner }, |m: &mut AccountPermissionUpdateContract| { &mut m.owner }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, super::Tron::Permission>( "witness", |m: &AccountPermissionUpdateContract| { &m.witness }, |m: &mut AccountPermissionUpdateContract| { &mut m.witness }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "actives", |m: &AccountPermissionUpdateContract| { &m.actives }, |m: &mut AccountPermissionUpdateContract| { &mut m.actives }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountPermissionUpdateContract", fields, oneofs, ) } } impl ::protobuf::Message for AccountPermissionUpdateContract { const NAME: &'static str = "AccountPermissionUpdateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.owner)?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.witness)?; }, 34 => { self.actives.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if let Some(v) = self.owner.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.witness.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.actives { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if let Some(v) = self.owner.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if let Some(v) = self.witness.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } for v in &self.actives { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountPermissionUpdateContract { AccountPermissionUpdateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.owner.clear(); self.witness.clear(); self.actives.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountPermissionUpdateContract { static instance: AccountPermissionUpdateContract = AccountPermissionUpdateContract { owner_address: ::std::vec::Vec::new(), owner: ::protobuf::MessageField::none(), witness: ::protobuf::MessageField::none(), actives: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountPermissionUpdateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountPermissionUpdateContract").unwrap()).clone() } } impl ::std::fmt::Display for AccountPermissionUpdateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountPermissionUpdateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n$core/contract/account_contract.proto\x12\x08protocol\x1a\x0fcore/Tron\ .proto\"\x90\x01\n\x15AccountCreateContract\x12#\n\rowner_address\x18\ \x01\x20\x01(\x0cR\x0cownerAddress\x12'\n\x0faccount_address\x18\x02\x20\ \x01(\x0cR\x0eaccountAddress\x12)\n\x04type\x18\x03\x20\x01(\x0e2\x15.pr\ otocol.AccountTypeR\x04type\"_\n\x15AccountUpdateContract\x12!\n\x0cacco\ unt_name\x18\x01\x20\x01(\x0cR\x0baccountName\x12#\n\rowner_address\x18\ \x02\x20\x01(\x0cR\x0cownerAddress\"Z\n\x14SetAccountIdContract\x12\x1d\ \n\naccount_id\x18\x01\x20\x01(\x0cR\taccountId\x12#\n\rowner_address\ \x18\x02\x20\x01(\x0cR\x0cownerAddress\"\xd2\x01\n\x1fAccountPermissionU\ pdateContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddres\ s\x12*\n\x05owner\x18\x02\x20\x01(\x0b2\x14.protocol.PermissionR\x05owne\ r\x12.\n\x07witness\x18\x03\x20\x01(\x0b2\x14.protocol.PermissionR\x07wi\ tness\x12.\n\x07actives\x18\x04\x20\x03(\x0b2\x14.protocol.PermissionR\ \x07activesBE\n\x18org.tron.protos.contractZ)github.com/tronprotocol/grp\ c-gateway/coreJ\xf2\r\n\x06\x12\x04\x0f\00\x01\n\xf4\x04\n\x01\x0c\x12\ \x03\x0f\0\x122\xe9\x04\n\x20java-tron\x20is\x20free\x20software:\x20you\ \x20can\x20redistribute\x20it\x20and/or\x20modify\n\x20it\x20under\x20th\ e\x20terms\x20of\x20the\x20GNU\x20General\x20Public\x20License\x20as\x20\ published\x20by\n\x20the\x20Free\x20Software\x20Foundation,\x20either\ \x20version\x203\x20of\x20the\x20License,\x20or\n\x20(at\x20your\x20opti\ on)\x20any\x20later\x20version.\n\n\x20java-tron\x20is\x20distributed\ \x20in\x20the\x20hope\x20that\x20it\x20will\x20be\x20useful,\n\x20but\ \x20WITHOUT\x20ANY\x20WARRANTY;\x20without\x20even\x20the\x20implied\x20\ warranty\x20of\n\x20MERCHANTABILITY\x20or\x20FITNESS\x20FOR\x20A\x20PART\ ICULAR\x20PURPOSE.\x20\x20See\x20the\n\x20GNU\x20General\x20Public\x20Li\ cense\x20for\x20more\x20details.\n\n\x20You\x20should\x20have\x20receive\ d\x20a\x20copy\x20of\x20the\x20GNU\x20General\x20Public\x20License\n\x20\ along\x20with\x20this\x20program.\x20\x20If\x20not,\x20see\x20.\n\n\x08\n\x01\x02\x12\x03\x11\0\x11\n\x08\n\x01\ \x08\x12\x03\x13\01\nH\n\x02\x08\x01\x12\x03\x13\01\"=Specify\x20the\x20\ name\x20of\x20the\x20package\x20that\x20generated\x20the\x20Java\x20file\ \n\n\x08\n\x01\x08\x12\x03\x15\0@\ni\n\x02\x08\x0b\x12\x03\x15\0@\x1a^op\ tion\x20java_outer_classname\x20=\x20\"Contract\";\x20//Specify\x20the\ \x20class\x20name\x20of\x20the\x20generated\x20Java\x20file\n\n\t\n\x02\ \x03\0\x12\x03\x17\0\x19\n\n\n\x02\x04\0\x12\x04\x19\0\x1d\x01\n\n\n\x03\ \x04\0\x01\x12\x03\x19\x08\x1d\n\x0b\n\x04\x04\0\x02\0\x12\x03\x1a\x02\ \x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x1a\x02\x07\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x03\x1a\x08\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x1a\ \x18\x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x1b\x02\x1c\n\x0c\n\x05\x04\0\ \x02\x01\x05\x12\x03\x1b\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ \x1b\x08\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x1b\x1a\x1b\n\x0b\n\ \x04\x04\0\x02\x02\x12\x03\x1c\x02\x17\n\x0c\n\x05\x04\0\x02\x02\x06\x12\ \x03\x1c\x02\r\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x1c\x0e\x12\n\x0c\n\ \x05\x04\0\x02\x02\x03\x12\x03\x1c\x15\x16\nB\n\x02\x04\x01\x12\x04\x20\ \0#\x01\x1a6\x20Update\x20account\x20name.\x20Account\x20name\x20is\x20n\ ot\x20unique\x20now.\n\n\n\n\x03\x04\x01\x01\x12\x03\x20\x08\x1d\n\x0b\n\ \x04\x04\x01\x02\0\x12\x03!\x02\x19\n\x0c\n\x05\x04\x01\x02\0\x05\x12\ \x03!\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03!\x08\x14\n\x0c\n\x05\ \x04\x01\x02\0\x03\x12\x03!\x17\x18\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\ \"\x02\x1a\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\"\x02\x07\n\x0c\n\x05\ \x04\x01\x02\x01\x01\x12\x03\"\x08\x15\n\x0c\n\x05\x04\x01\x02\x01\x03\ \x12\x03\"\x18\x19\na\n\x02\x04\x02\x12\x04&\0)\x01\x1aU\x20Set\x20accou\ nt\x20id\x20if\x20the\x20account\x20has\x20no\x20id.\x20Account\x20id\ \x20is\x20unique\x20and\x20case\x20insensitive.\n\n\n\n\x03\x04\x02\x01\ \x12\x03&\x08\x1c\n\x0b\n\x04\x04\x02\x02\0\x12\x03'\x02\x17\n\x0c\n\x05\ \x04\x02\x02\0\x05\x12\x03'\x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\ \x03'\x08\x12\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03'\x15\x16\n\x0b\n\x04\ \x04\x02\x02\x01\x12\x03(\x02\x1a\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\ \x03(\x02\x07\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03(\x08\x15\n\x0c\n\ \x05\x04\x02\x02\x01\x03\x12\x03(\x18\x19\n\n\n\x02\x04\x03\x12\x04+\00\ \x01\n\n\n\x03\x04\x03\x01\x12\x03+\x08'\n\x0b\n\x04\x04\x03\x02\0\x12\ \x03,\x02\x1a\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03,\x02\x07\n\x0c\n\x05\ \x04\x03\x02\0\x01\x12\x03,\x08\x15\n\x0c\n\x05\x04\x03\x02\0\x03\x12\ \x03,\x18\x19\n!\n\x04\x04\x03\x02\x01\x12\x03-\x02\x17\"\x14Empty\x20is\ \x20invalidate\n\n\x0c\n\x05\x04\x03\x02\x01\x06\x12\x03-\x02\x0c\n\x0c\ \n\x05\x04\x03\x02\x01\x01\x12\x03-\r\x12\n\x0c\n\x05\x04\x03\x02\x01\ \x03\x12\x03-\x15\x16\n\x1a\n\x04\x04\x03\x02\x02\x12\x03.\x02\x19\"\rCa\ n\x20be\x20empty\n\n\x0c\n\x05\x04\x03\x02\x02\x06\x12\x03.\x02\x0c\n\ \x0c\n\x05\x04\x03\x02\x02\x01\x12\x03.\r\x14\n\x0c\n\x05\x04\x03\x02\ \x02\x03\x12\x03.\x17\x18\n!\n\x04\x04\x03\x02\x03\x12\x03/\x02\"\"\x14E\ mpty\x20is\x20invalidate\n\n\x0c\n\x05\x04\x03\x02\x03\x04\x12\x03/\x02\ \n\n\x0c\n\x05\x04\x03\x02\x03\x06\x12\x03/\x0b\x15\n\x0c\n\x05\x04\x03\ \x02\x03\x01\x12\x03/\x16\x1d\n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x03/\ \x20!b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(1); deps.push(super::Tron::file_descriptor().clone()); let mut messages = ::std::vec::Vec::with_capacity(4); messages.push(AccountCreateContract::generated_message_descriptor_data()); messages.push(AccountUpdateContract::generated_message_descriptor_data()); messages.push(SetAccountIdContract::generated_message_descriptor_data()); messages.push(AccountPermissionUpdateContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/asset_issue_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/asset_issue_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.AssetIssueContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct AssetIssueContract { // message fields // @@protoc_insertion_point(field:protocol.AssetIssueContract.id) pub id: ::std::string::String, // @@protoc_insertion_point(field:protocol.AssetIssueContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.name) pub name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.abbr) pub abbr: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.total_supply) pub total_supply: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.frozen_supply) pub frozen_supply: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.trx_num) pub trx_num: i32, // @@protoc_insertion_point(field:protocol.AssetIssueContract.precision) pub precision: i32, // @@protoc_insertion_point(field:protocol.AssetIssueContract.num) pub num: i32, // @@protoc_insertion_point(field:protocol.AssetIssueContract.start_time) pub start_time: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.end_time) pub end_time: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.order) pub order: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.vote_score) pub vote_score: i32, // @@protoc_insertion_point(field:protocol.AssetIssueContract.description) pub description: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.url) pub url: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.AssetIssueContract.free_asset_net_limit) pub free_asset_net_limit: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.public_free_asset_net_limit) pub public_free_asset_net_limit: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.public_free_asset_net_usage) pub public_free_asset_net_usage: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.public_latest_free_net_time) pub public_latest_free_net_time: i64, // special fields // @@protoc_insertion_point(special_field:protocol.AssetIssueContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AssetIssueContract { fn default() -> &'a AssetIssueContract { ::default_instance() } } impl AssetIssueContract { pub fn new() -> AssetIssueContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(19); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "id", |m: &AssetIssueContract| { &m.id }, |m: &mut AssetIssueContract| { &mut m.id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &AssetIssueContract| { &m.owner_address }, |m: &mut AssetIssueContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &AssetIssueContract| { &m.name }, |m: &mut AssetIssueContract| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "abbr", |m: &AssetIssueContract| { &m.abbr }, |m: &mut AssetIssueContract| { &mut m.abbr }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "total_supply", |m: &AssetIssueContract| { &m.total_supply }, |m: &mut AssetIssueContract| { &mut m.total_supply }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "frozen_supply", |m: &AssetIssueContract| { &m.frozen_supply }, |m: &mut AssetIssueContract| { &mut m.frozen_supply }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "trx_num", |m: &AssetIssueContract| { &m.trx_num }, |m: &mut AssetIssueContract| { &mut m.trx_num }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "precision", |m: &AssetIssueContract| { &m.precision }, |m: &mut AssetIssueContract| { &mut m.precision }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "num", |m: &AssetIssueContract| { &m.num }, |m: &mut AssetIssueContract| { &mut m.num }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "start_time", |m: &AssetIssueContract| { &m.start_time }, |m: &mut AssetIssueContract| { &mut m.start_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "end_time", |m: &AssetIssueContract| { &m.end_time }, |m: &mut AssetIssueContract| { &mut m.end_time }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "order", |m: &AssetIssueContract| { &m.order }, |m: &mut AssetIssueContract| { &mut m.order }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vote_score", |m: &AssetIssueContract| { &m.vote_score }, |m: &mut AssetIssueContract| { &mut m.vote_score }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "description", |m: &AssetIssueContract| { &m.description }, |m: &mut AssetIssueContract| { &mut m.description }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "url", |m: &AssetIssueContract| { &m.url }, |m: &mut AssetIssueContract| { &mut m.url }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "free_asset_net_limit", |m: &AssetIssueContract| { &m.free_asset_net_limit }, |m: &mut AssetIssueContract| { &mut m.free_asset_net_limit }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "public_free_asset_net_limit", |m: &AssetIssueContract| { &m.public_free_asset_net_limit }, |m: &mut AssetIssueContract| { &mut m.public_free_asset_net_limit }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "public_free_asset_net_usage", |m: &AssetIssueContract| { &m.public_free_asset_net_usage }, |m: &mut AssetIssueContract| { &mut m.public_free_asset_net_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "public_latest_free_net_time", |m: &AssetIssueContract| { &m.public_latest_free_net_time }, |m: &mut AssetIssueContract| { &mut m.public_latest_free_net_time }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AssetIssueContract", fields, oneofs, ) } } impl ::protobuf::Message for AssetIssueContract { const NAME: &'static str = "AssetIssueContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 330 => { self.id = is.read_string()?; }, 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.name = is.read_bytes()?; }, 26 => { self.abbr = is.read_bytes()?; }, 32 => { self.total_supply = is.read_int64()?; }, 42 => { self.frozen_supply.push(is.read_message()?); }, 48 => { self.trx_num = is.read_int32()?; }, 56 => { self.precision = is.read_int32()?; }, 64 => { self.num = is.read_int32()?; }, 72 => { self.start_time = is.read_int64()?; }, 80 => { self.end_time = is.read_int64()?; }, 88 => { self.order = is.read_int64()?; }, 128 => { self.vote_score = is.read_int32()?; }, 162 => { self.description = is.read_bytes()?; }, 170 => { self.url = is.read_bytes()?; }, 176 => { self.free_asset_net_limit = is.read_int64()?; }, 184 => { self.public_free_asset_net_limit = is.read_int64()?; }, 192 => { self.public_free_asset_net_usage = is.read_int64()?; }, 200 => { self.public_latest_free_net_time = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.id.is_empty() { my_size += ::protobuf::rt::string_size(41, &self.id); } if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.name.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.name); } if !self.abbr.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.abbr); } if self.total_supply != 0 { my_size += ::protobuf::rt::int64_size(4, self.total_supply); } for value in &self.frozen_supply { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.trx_num != 0 { my_size += ::protobuf::rt::int32_size(6, self.trx_num); } if self.precision != 0 { my_size += ::protobuf::rt::int32_size(7, self.precision); } if self.num != 0 { my_size += ::protobuf::rt::int32_size(8, self.num); } if self.start_time != 0 { my_size += ::protobuf::rt::int64_size(9, self.start_time); } if self.end_time != 0 { my_size += ::protobuf::rt::int64_size(10, self.end_time); } if self.order != 0 { my_size += ::protobuf::rt::int64_size(11, self.order); } if self.vote_score != 0 { my_size += ::protobuf::rt::int32_size(16, self.vote_score); } if !self.description.is_empty() { my_size += ::protobuf::rt::bytes_size(20, &self.description); } if !self.url.is_empty() { my_size += ::protobuf::rt::bytes_size(21, &self.url); } if self.free_asset_net_limit != 0 { my_size += ::protobuf::rt::int64_size(22, self.free_asset_net_limit); } if self.public_free_asset_net_limit != 0 { my_size += ::protobuf::rt::int64_size(23, self.public_free_asset_net_limit); } if self.public_free_asset_net_usage != 0 { my_size += ::protobuf::rt::int64_size(24, self.public_free_asset_net_usage); } if self.public_latest_free_net_time != 0 { my_size += ::protobuf::rt::int64_size(25, self.public_latest_free_net_time); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.id.is_empty() { os.write_string(41, &self.id)?; } if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.name.is_empty() { os.write_bytes(2, &self.name)?; } if !self.abbr.is_empty() { os.write_bytes(3, &self.abbr)?; } if self.total_supply != 0 { os.write_int64(4, self.total_supply)?; } for v in &self.frozen_supply { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; }; if self.trx_num != 0 { os.write_int32(6, self.trx_num)?; } if self.precision != 0 { os.write_int32(7, self.precision)?; } if self.num != 0 { os.write_int32(8, self.num)?; } if self.start_time != 0 { os.write_int64(9, self.start_time)?; } if self.end_time != 0 { os.write_int64(10, self.end_time)?; } if self.order != 0 { os.write_int64(11, self.order)?; } if self.vote_score != 0 { os.write_int32(16, self.vote_score)?; } if !self.description.is_empty() { os.write_bytes(20, &self.description)?; } if !self.url.is_empty() { os.write_bytes(21, &self.url)?; } if self.free_asset_net_limit != 0 { os.write_int64(22, self.free_asset_net_limit)?; } if self.public_free_asset_net_limit != 0 { os.write_int64(23, self.public_free_asset_net_limit)?; } if self.public_free_asset_net_usage != 0 { os.write_int64(24, self.public_free_asset_net_usage)?; } if self.public_latest_free_net_time != 0 { os.write_int64(25, self.public_latest_free_net_time)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AssetIssueContract { AssetIssueContract::new() } fn clear(&mut self) { self.id.clear(); self.owner_address.clear(); self.name.clear(); self.abbr.clear(); self.total_supply = 0; self.frozen_supply.clear(); self.trx_num = 0; self.precision = 0; self.num = 0; self.start_time = 0; self.end_time = 0; self.order = 0; self.vote_score = 0; self.description.clear(); self.url.clear(); self.free_asset_net_limit = 0; self.public_free_asset_net_limit = 0; self.public_free_asset_net_usage = 0; self.public_latest_free_net_time = 0; self.special_fields.clear(); } fn default_instance() -> &'static AssetIssueContract { static instance: AssetIssueContract = AssetIssueContract { id: ::std::string::String::new(), owner_address: ::std::vec::Vec::new(), name: ::std::vec::Vec::new(), abbr: ::std::vec::Vec::new(), total_supply: 0, frozen_supply: ::std::vec::Vec::new(), trx_num: 0, precision: 0, num: 0, start_time: 0, end_time: 0, order: 0, vote_score: 0, description: ::std::vec::Vec::new(), url: ::std::vec::Vec::new(), free_asset_net_limit: 0, public_free_asset_net_limit: 0, public_free_asset_net_usage: 0, public_latest_free_net_time: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AssetIssueContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AssetIssueContract").unwrap()).clone() } } impl ::std::fmt::Display for AssetIssueContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AssetIssueContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `AssetIssueContract` pub mod asset_issue_contract { // @@protoc_insertion_point(message:protocol.AssetIssueContract.FrozenSupply) #[derive(PartialEq,Clone,Default,Debug)] pub struct FrozenSupply { // message fields // @@protoc_insertion_point(field:protocol.AssetIssueContract.FrozenSupply.frozen_amount) pub frozen_amount: i64, // @@protoc_insertion_point(field:protocol.AssetIssueContract.FrozenSupply.frozen_days) pub frozen_days: i64, // special fields // @@protoc_insertion_point(special_field:protocol.AssetIssueContract.FrozenSupply.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a FrozenSupply { fn default() -> &'a FrozenSupply { ::default_instance() } } impl FrozenSupply { pub fn new() -> FrozenSupply { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_amount", |m: &FrozenSupply| { &m.frozen_amount }, |m: &mut FrozenSupply| { &mut m.frozen_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_days", |m: &FrozenSupply| { &m.frozen_days }, |m: &mut FrozenSupply| { &mut m.frozen_days }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AssetIssueContract.FrozenSupply", fields, oneofs, ) } } impl ::protobuf::Message for FrozenSupply { const NAME: &'static str = "FrozenSupply"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.frozen_amount = is.read_int64()?; }, 16 => { self.frozen_days = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.frozen_amount != 0 { my_size += ::protobuf::rt::int64_size(1, self.frozen_amount); } if self.frozen_days != 0 { my_size += ::protobuf::rt::int64_size(2, self.frozen_days); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.frozen_amount != 0 { os.write_int64(1, self.frozen_amount)?; } if self.frozen_days != 0 { os.write_int64(2, self.frozen_days)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> FrozenSupply { FrozenSupply::new() } fn clear(&mut self) { self.frozen_amount = 0; self.frozen_days = 0; self.special_fields.clear(); } fn default_instance() -> &'static FrozenSupply { static instance: FrozenSupply = FrozenSupply { frozen_amount: 0, frozen_days: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for FrozenSupply { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("AssetIssueContract.FrozenSupply").unwrap()).clone() } } impl ::std::fmt::Display for FrozenSupply { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for FrozenSupply { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.TransferAssetContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct TransferAssetContract { // message fields // @@protoc_insertion_point(field:protocol.TransferAssetContract.asset_name) pub asset_name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransferAssetContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransferAssetContract.to_address) pub to_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransferAssetContract.amount) pub amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.TransferAssetContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TransferAssetContract { fn default() -> &'a TransferAssetContract { ::default_instance() } } impl TransferAssetContract { pub fn new() -> TransferAssetContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "asset_name", |m: &TransferAssetContract| { &m.asset_name }, |m: &mut TransferAssetContract| { &mut m.asset_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &TransferAssetContract| { &m.owner_address }, |m: &mut TransferAssetContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "to_address", |m: &TransferAssetContract| { &m.to_address }, |m: &mut TransferAssetContract| { &mut m.to_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "amount", |m: &TransferAssetContract| { &m.amount }, |m: &mut TransferAssetContract| { &mut m.amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransferAssetContract", fields, oneofs, ) } } impl ::protobuf::Message for TransferAssetContract { const NAME: &'static str = "TransferAssetContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.asset_name = is.read_bytes()?; }, 18 => { self.owner_address = is.read_bytes()?; }, 26 => { self.to_address = is.read_bytes()?; }, 32 => { self.amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.asset_name.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.asset_name); } if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.owner_address); } if !self.to_address.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.to_address); } if self.amount != 0 { my_size += ::protobuf::rt::int64_size(4, self.amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.asset_name.is_empty() { os.write_bytes(1, &self.asset_name)?; } if !self.owner_address.is_empty() { os.write_bytes(2, &self.owner_address)?; } if !self.to_address.is_empty() { os.write_bytes(3, &self.to_address)?; } if self.amount != 0 { os.write_int64(4, self.amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TransferAssetContract { TransferAssetContract::new() } fn clear(&mut self) { self.asset_name.clear(); self.owner_address.clear(); self.to_address.clear(); self.amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static TransferAssetContract { static instance: TransferAssetContract = TransferAssetContract { asset_name: ::std::vec::Vec::new(), owner_address: ::std::vec::Vec::new(), to_address: ::std::vec::Vec::new(), amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TransferAssetContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TransferAssetContract").unwrap()).clone() } } impl ::std::fmt::Display for TransferAssetContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TransferAssetContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UnfreezeAssetContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UnfreezeAssetContract { // message fields // @@protoc_insertion_point(field:protocol.UnfreezeAssetContract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.UnfreezeAssetContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UnfreezeAssetContract { fn default() -> &'a UnfreezeAssetContract { ::default_instance() } } impl UnfreezeAssetContract { pub fn new() -> UnfreezeAssetContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UnfreezeAssetContract| { &m.owner_address }, |m: &mut UnfreezeAssetContract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UnfreezeAssetContract", fields, oneofs, ) } } impl ::protobuf::Message for UnfreezeAssetContract { const NAME: &'static str = "UnfreezeAssetContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UnfreezeAssetContract { UnfreezeAssetContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static UnfreezeAssetContract { static instance: UnfreezeAssetContract = UnfreezeAssetContract { owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UnfreezeAssetContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UnfreezeAssetContract").unwrap()).clone() } } impl ::std::fmt::Display for UnfreezeAssetContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UnfreezeAssetContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UpdateAssetContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UpdateAssetContract { // message fields // @@protoc_insertion_point(field:protocol.UpdateAssetContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateAssetContract.description) pub description: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateAssetContract.url) pub url: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateAssetContract.new_limit) pub new_limit: i64, // @@protoc_insertion_point(field:protocol.UpdateAssetContract.new_public_limit) pub new_public_limit: i64, // special fields // @@protoc_insertion_point(special_field:protocol.UpdateAssetContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UpdateAssetContract { fn default() -> &'a UpdateAssetContract { ::default_instance() } } impl UpdateAssetContract { pub fn new() -> UpdateAssetContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UpdateAssetContract| { &m.owner_address }, |m: &mut UpdateAssetContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "description", |m: &UpdateAssetContract| { &m.description }, |m: &mut UpdateAssetContract| { &mut m.description }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "url", |m: &UpdateAssetContract| { &m.url }, |m: &mut UpdateAssetContract| { &mut m.url }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "new_limit", |m: &UpdateAssetContract| { &m.new_limit }, |m: &mut UpdateAssetContract| { &mut m.new_limit }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "new_public_limit", |m: &UpdateAssetContract| { &m.new_public_limit }, |m: &mut UpdateAssetContract| { &mut m.new_public_limit }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UpdateAssetContract", fields, oneofs, ) } } impl ::protobuf::Message for UpdateAssetContract { const NAME: &'static str = "UpdateAssetContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.description = is.read_bytes()?; }, 26 => { self.url = is.read_bytes()?; }, 32 => { self.new_limit = is.read_int64()?; }, 40 => { self.new_public_limit = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.description.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.description); } if !self.url.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.url); } if self.new_limit != 0 { my_size += ::protobuf::rt::int64_size(4, self.new_limit); } if self.new_public_limit != 0 { my_size += ::protobuf::rt::int64_size(5, self.new_public_limit); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.description.is_empty() { os.write_bytes(2, &self.description)?; } if !self.url.is_empty() { os.write_bytes(3, &self.url)?; } if self.new_limit != 0 { os.write_int64(4, self.new_limit)?; } if self.new_public_limit != 0 { os.write_int64(5, self.new_public_limit)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UpdateAssetContract { UpdateAssetContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.description.clear(); self.url.clear(); self.new_limit = 0; self.new_public_limit = 0; self.special_fields.clear(); } fn default_instance() -> &'static UpdateAssetContract { static instance: UpdateAssetContract = UpdateAssetContract { owner_address: ::std::vec::Vec::new(), description: ::std::vec::Vec::new(), url: ::std::vec::Vec::new(), new_limit: 0, new_public_limit: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UpdateAssetContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UpdateAssetContract").unwrap()).clone() } } impl ::std::fmt::Display for UpdateAssetContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UpdateAssetContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ParticipateAssetIssueContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ParticipateAssetIssueContract { // message fields // @@protoc_insertion_point(field:protocol.ParticipateAssetIssueContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ParticipateAssetIssueContract.to_address) pub to_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ParticipateAssetIssueContract.asset_name) pub asset_name: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ParticipateAssetIssueContract.amount) pub amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ParticipateAssetIssueContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ParticipateAssetIssueContract { fn default() -> &'a ParticipateAssetIssueContract { ::default_instance() } } impl ParticipateAssetIssueContract { pub fn new() -> ParticipateAssetIssueContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ParticipateAssetIssueContract| { &m.owner_address }, |m: &mut ParticipateAssetIssueContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "to_address", |m: &ParticipateAssetIssueContract| { &m.to_address }, |m: &mut ParticipateAssetIssueContract| { &mut m.to_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "asset_name", |m: &ParticipateAssetIssueContract| { &m.asset_name }, |m: &mut ParticipateAssetIssueContract| { &mut m.asset_name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "amount", |m: &ParticipateAssetIssueContract| { &m.amount }, |m: &mut ParticipateAssetIssueContract| { &mut m.amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ParticipateAssetIssueContract", fields, oneofs, ) } } impl ::protobuf::Message for ParticipateAssetIssueContract { const NAME: &'static str = "ParticipateAssetIssueContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.to_address = is.read_bytes()?; }, 26 => { self.asset_name = is.read_bytes()?; }, 32 => { self.amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.to_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.to_address); } if !self.asset_name.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.asset_name); } if self.amount != 0 { my_size += ::protobuf::rt::int64_size(4, self.amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.to_address.is_empty() { os.write_bytes(2, &self.to_address)?; } if !self.asset_name.is_empty() { os.write_bytes(3, &self.asset_name)?; } if self.amount != 0 { os.write_int64(4, self.amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ParticipateAssetIssueContract { ParticipateAssetIssueContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.to_address.clear(); self.asset_name.clear(); self.amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static ParticipateAssetIssueContract { static instance: ParticipateAssetIssueContract = ParticipateAssetIssueContract { owner_address: ::std::vec::Vec::new(), to_address: ::std::vec::Vec::new(), asset_name: ::std::vec::Vec::new(), amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ParticipateAssetIssueContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ParticipateAssetIssueContract").unwrap()).clone() } } impl ::std::fmt::Display for ParticipateAssetIssueContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ParticipateAssetIssueContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n(core/contract/asset_issue_contract.proto\x12\x08protocol\"\x91\x06\n\ \x12AssetIssueContract\x12\x0e\n\x02id\x18)\x20\x01(\tR\x02id\x12#\n\row\ ner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x12\n\x04name\x18\ \x02\x20\x01(\x0cR\x04name\x12\x12\n\x04abbr\x18\x03\x20\x01(\x0cR\x04ab\ br\x12!\n\x0ctotal_supply\x18\x04\x20\x01(\x03R\x0btotalSupply\x12N\n\rf\ rozen_supply\x18\x05\x20\x03(\x0b2).protocol.AssetIssueContract.FrozenSu\ pplyR\x0cfrozenSupply\x12\x17\n\x07trx_num\x18\x06\x20\x01(\x05R\x06trxN\ um\x12\x1c\n\tprecision\x18\x07\x20\x01(\x05R\tprecision\x12\x10\n\x03nu\ m\x18\x08\x20\x01(\x05R\x03num\x12\x1d\n\nstart_time\x18\t\x20\x01(\x03R\ \tstartTime\x12\x19\n\x08end_time\x18\n\x20\x01(\x03R\x07endTime\x12\x14\ \n\x05order\x18\x0b\x20\x01(\x03R\x05order\x12\x1d\n\nvote_score\x18\x10\ \x20\x01(\x05R\tvoteScore\x12\x20\n\x0bdescription\x18\x14\x20\x01(\x0cR\ \x0bdescription\x12\x10\n\x03url\x18\x15\x20\x01(\x0cR\x03url\x12/\n\x14\ free_asset_net_limit\x18\x16\x20\x01(\x03R\x11freeAssetNetLimit\x12<\n\ \x1bpublic_free_asset_net_limit\x18\x17\x20\x01(\x03R\x17publicFreeAsset\ NetLimit\x12<\n\x1bpublic_free_asset_net_usage\x18\x18\x20\x01(\x03R\x17\ publicFreeAssetNetUsage\x12<\n\x1bpublic_latest_free_net_time\x18\x19\ \x20\x01(\x03R\x17publicLatestFreeNetTime\x1aT\n\x0cFrozenSupply\x12#\n\ \rfrozen_amount\x18\x01\x20\x01(\x03R\x0cfrozenAmount\x12\x1f\n\x0bfroze\ n_days\x18\x02\x20\x01(\x03R\nfrozenDays\"\x92\x01\n\x15TransferAssetCon\ tract\x12\x1d\n\nasset_name\x18\x01\x20\x01(\x0cR\tassetName\x12#\n\rown\ er_address\x18\x02\x20\x01(\x0cR\x0cownerAddress\x12\x1d\n\nto_address\ \x18\x03\x20\x01(\x0cR\ttoAddress\x12\x16\n\x06amount\x18\x04\x20\x01(\ \x03R\x06amount\"<\n\x15UnfreezeAssetContract\x12#\n\rowner_address\x18\ \x01\x20\x01(\x0cR\x0cownerAddress\"\xb5\x01\n\x13UpdateAssetContract\ \x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x20\n\ \x0bdescription\x18\x02\x20\x01(\x0cR\x0bdescription\x12\x10\n\x03url\ \x18\x03\x20\x01(\x0cR\x03url\x12\x1b\n\tnew_limit\x18\x04\x20\x01(\x03R\ \x08newLimit\x12(\n\x10new_public_limit\x18\x05\x20\x01(\x03R\x0enewPubl\ icLimit\"\x9a\x01\n\x1dParticipateAssetIssueContract\x12#\n\rowner_addre\ ss\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x1d\n\nto_address\x18\x02\ \x20\x01(\x0cR\ttoAddress\x12\x1d\n\nasset_name\x18\x03\x20\x01(\x0cR\ta\ ssetName\x12\x16\n\x06amount\x18\x04\x20\x01(\x03R\x06amountBE\n\x18org.\ tron.protos.contractZ)github.com/tronprotocol/grpc-gateway/coreJ\xf2\x14\ \n\x06\x12\x04\0\0;\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ \x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\ \x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20that\x20\ generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\ns\n\ \x02\x08\x0b\x12\x03\x06\0@\x1ahoption\x20java_outer_classname\x20=\x20\ \"AssetIssueContract\";\x20//Specify\x20the\x20class\x20name\x20of\x20th\ e\x20generated\x20Java\x20file\n\n\n\n\x02\x04\0\x12\x04\x08\0!\x01\n\n\ \n\x03\x04\0\x01\x12\x03\x08\x08\x1a\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\ \x02\x11\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\t\x02\x08\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x03\t\t\x0b\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x0e\x10\ \n\x0c\n\x04\x04\0\x03\0\x12\x04\x0b\x02\x0e\x03\n\x0c\n\x05\x04\0\x03\0\ \x01\x12\x03\x0b\n\x16\n\r\n\x06\x04\0\x03\0\x02\0\x12\x03\x0c\x04\x1c\n\ \x0e\n\x07\x04\0\x03\0\x02\0\x05\x12\x03\x0c\x04\t\n\x0e\n\x07\x04\0\x03\ \0\x02\0\x01\x12\x03\x0c\n\x17\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03\ \x0c\x1a\x1b\n\r\n\x06\x04\0\x03\0\x02\x01\x12\x03\r\x04\x1a\n\x0e\n\x07\ \x04\0\x03\0\x02\x01\x05\x12\x03\r\x04\t\n\x0e\n\x07\x04\0\x03\0\x02\x01\ \x01\x12\x03\r\n\x15\n\x0e\n\x07\x04\0\x03\0\x02\x01\x03\x12\x03\r\x18\ \x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0f\x02\x1a\n\x0c\n\x05\x04\0\x02\ \x01\x05\x12\x03\x0f\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x0f\ \x08\x15\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0f\x18\x19\n\x0b\n\x04\ \x04\0\x02\x02\x12\x03\x10\x02\x11\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\ \x10\x02\x07\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x10\x08\x0c\n\x0c\n\ \x05\x04\0\x02\x02\x03\x12\x03\x10\x0f\x10\n\x0b\n\x04\x04\0\x02\x03\x12\ \x03\x11\x02\x11\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x11\x02\x07\n\x0c\ \n\x05\x04\0\x02\x03\x01\x12\x03\x11\x08\x0c\n\x0c\n\x05\x04\0\x02\x03\ \x03\x12\x03\x11\x0f\x10\n\x0b\n\x04\x04\0\x02\x04\x12\x03\x12\x02\x19\n\ \x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x12\x02\x07\n\x0c\n\x05\x04\0\x02\ \x04\x01\x12\x03\x12\x08\x14\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x12\ \x17\x18\n\x0b\n\x04\x04\0\x02\x05\x12\x03\x13\x02*\n\x0c\n\x05\x04\0\ \x02\x05\x04\x12\x03\x13\x02\n\n\x0c\n\x05\x04\0\x02\x05\x06\x12\x03\x13\ \x0b\x17\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x03\x13\x18%\n\x0c\n\x05\x04\ \0\x02\x05\x03\x12\x03\x13()\n\x0b\n\x04\x04\0\x02\x06\x12\x03\x14\x02\ \x14\n\x0c\n\x05\x04\0\x02\x06\x05\x12\x03\x14\x02\x07\n\x0c\n\x05\x04\0\ \x02\x06\x01\x12\x03\x14\x08\x0f\n\x0c\n\x05\x04\0\x02\x06\x03\x12\x03\ \x14\x12\x13\n\x0b\n\x04\x04\0\x02\x07\x12\x03\x15\x02\x16\n\x0c\n\x05\ \x04\0\x02\x07\x05\x12\x03\x15\x02\x07\n\x0c\n\x05\x04\0\x02\x07\x01\x12\ \x03\x15\x08\x11\n\x0c\n\x05\x04\0\x02\x07\x03\x12\x03\x15\x14\x15\n\x0b\ \n\x04\x04\0\x02\x08\x12\x03\x16\x02\x10\n\x0c\n\x05\x04\0\x02\x08\x05\ \x12\x03\x16\x02\x07\n\x0c\n\x05\x04\0\x02\x08\x01\x12\x03\x16\x08\x0b\n\ \x0c\n\x05\x04\0\x02\x08\x03\x12\x03\x16\x0e\x0f\n\x0b\n\x04\x04\0\x02\t\ \x12\x03\x17\x02\x17\n\x0c\n\x05\x04\0\x02\t\x05\x12\x03\x17\x02\x07\n\ \x0c\n\x05\x04\0\x02\t\x01\x12\x03\x17\x08\x12\n\x0c\n\x05\x04\0\x02\t\ \x03\x12\x03\x17\x15\x16\n\x0b\n\x04\x04\0\x02\n\x12\x03\x18\x02\x16\n\ \x0c\n\x05\x04\0\x02\n\x05\x12\x03\x18\x02\x07\n\x0c\n\x05\x04\0\x02\n\ \x01\x12\x03\x18\x08\x10\n\x0c\n\x05\x04\0\x02\n\x03\x12\x03\x18\x13\x15\ \n\x16\n\x04\x04\0\x02\x0b\x12\x03\x19\x02\x13\"\t\x20useless\n\n\x0c\n\ \x05\x04\0\x02\x0b\x05\x12\x03\x19\x02\x07\n\x0c\n\x05\x04\0\x02\x0b\x01\ \x12\x03\x19\x08\r\n\x0c\n\x05\x04\0\x02\x0b\x03\x12\x03\x19\x10\x12\n\ \x0b\n\x04\x04\0\x02\x0c\x12\x03\x1a\x02\x18\n\x0c\n\x05\x04\0\x02\x0c\ \x05\x12\x03\x1a\x02\x07\n\x0c\n\x05\x04\0\x02\x0c\x01\x12\x03\x1a\x08\ \x12\n\x0c\n\x05\x04\0\x02\x0c\x03\x12\x03\x1a\x15\x17\n\x0b\n\x04\x04\0\ \x02\r\x12\x03\x1b\x02\x19\n\x0c\n\x05\x04\0\x02\r\x05\x12\x03\x1b\x02\ \x07\n\x0c\n\x05\x04\0\x02\r\x01\x12\x03\x1b\x08\x13\n\x0c\n\x05\x04\0\ \x02\r\x03\x12\x03\x1b\x16\x18\n\x0b\n\x04\x04\0\x02\x0e\x12\x03\x1c\x02\ \x11\n\x0c\n\x05\x04\0\x02\x0e\x05\x12\x03\x1c\x02\x07\n\x0c\n\x05\x04\0\ \x02\x0e\x01\x12\x03\x1c\x08\x0b\n\x0c\n\x05\x04\0\x02\x0e\x03\x12\x03\ \x1c\x0e\x10\n\x0b\n\x04\x04\0\x02\x0f\x12\x03\x1d\x02\"\n\x0c\n\x05\x04\ \0\x02\x0f\x05\x12\x03\x1d\x02\x07\n\x0c\n\x05\x04\0\x02\x0f\x01\x12\x03\ \x1d\x08\x1c\n\x0c\n\x05\x04\0\x02\x0f\x03\x12\x03\x1d\x1f!\n\x0b\n\x04\ \x04\0\x02\x10\x12\x03\x1e\x02)\n\x0c\n\x05\x04\0\x02\x10\x05\x12\x03\ \x1e\x02\x07\n\x0c\n\x05\x04\0\x02\x10\x01\x12\x03\x1e\x08#\n\x0c\n\x05\ \x04\0\x02\x10\x03\x12\x03\x1e&(\n\x0b\n\x04\x04\0\x02\x11\x12\x03\x1f\ \x02)\n\x0c\n\x05\x04\0\x02\x11\x05\x12\x03\x1f\x02\x07\n\x0c\n\x05\x04\ \0\x02\x11\x01\x12\x03\x1f\x08#\n\x0c\n\x05\x04\0\x02\x11\x03\x12\x03\ \x1f&(\n\x0b\n\x04\x04\0\x02\x12\x12\x03\x20\x02)\n\x0c\n\x05\x04\0\x02\ \x12\x05\x12\x03\x20\x02\x07\n\x0c\n\x05\x04\0\x02\x12\x01\x12\x03\x20\ \x08#\n\x0c\n\x05\x04\0\x02\x12\x03\x12\x03\x20&(\n\n\n\x02\x04\x01\x12\ \x04#\0(\x01\n\n\n\x03\x04\x01\x01\x12\x03#\x08\x1d\n\x9f\x01\n\x04\x04\ \x01\x02\0\x12\x03$\x02\x17\"\x91\x01\x20this\x20field\x20is\x20token\ \x20name\x20before\x20the\x20proposal\x20ALLOW_SAME_TOKEN_NAME\x20is\x20\ active,\x20otherwise\x20it\x20is\x20token\x20id\x20and\x20token\x20is\ \x20should\x20be\x20in\x20string\x20format.\n\n\x0c\n\x05\x04\x01\x02\0\ \x05\x12\x03$\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03$\x08\x12\n\ \x0c\n\x05\x04\x01\x02\0\x03\x12\x03$\x15\x16\n\x0b\n\x04\x04\x01\x02\ \x01\x12\x03%\x02\x1a\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03%\x02\x07\n\ \x0c\n\x05\x04\x01\x02\x01\x01\x12\x03%\x08\x15\n\x0c\n\x05\x04\x01\x02\ \x01\x03\x12\x03%\x18\x19\n\x0b\n\x04\x04\x01\x02\x02\x12\x03&\x02\x17\n\ \x0c\n\x05\x04\x01\x02\x02\x05\x12\x03&\x02\x07\n\x0c\n\x05\x04\x01\x02\ \x02\x01\x12\x03&\x08\x12\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03&\x15\ \x16\n\x0b\n\x04\x04\x01\x02\x03\x12\x03'\x02\x13\n\x0c\n\x05\x04\x01\ \x02\x03\x05\x12\x03'\x02\x07\n\x0c\n\x05\x04\x01\x02\x03\x01\x12\x03'\ \x08\x0e\n\x0c\n\x05\x04\x01\x02\x03\x03\x12\x03'\x11\x12\n\n\n\x02\x04\ \x02\x12\x04*\0,\x01\n\n\n\x03\x04\x02\x01\x12\x03*\x08\x1d\n\x0b\n\x04\ \x04\x02\x02\0\x12\x03+\x02\x1a\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03+\ \x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03+\x08\x15\n\x0c\n\x05\x04\ \x02\x02\0\x03\x12\x03+\x18\x19\n\n\n\x02\x04\x03\x12\x04.\04\x01\n\n\n\ \x03\x04\x03\x01\x12\x03.\x08\x1b\n\x0b\n\x04\x04\x03\x02\0\x12\x03/\x02\ \x1a\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03/\x02\x07\n\x0c\n\x05\x04\x03\ \x02\0\x01\x12\x03/\x08\x15\n\x0c\n\x05\x04\x03\x02\0\x03\x12\x03/\x18\ \x19\n\x0b\n\x04\x04\x03\x02\x01\x12\x030\x02\x18\n\x0c\n\x05\x04\x03\ \x02\x01\x05\x12\x030\x02\x07\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x030\ \x08\x13\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x030\x16\x17\n\x0b\n\x04\ \x04\x03\x02\x02\x12\x031\x02\x10\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\ \x031\x02\x07\n\x0c\n\x05\x04\x03\x02\x02\x01\x12\x031\x08\x0b\n\x0c\n\ \x05\x04\x03\x02\x02\x03\x12\x031\x0e\x0f\n\x0b\n\x04\x04\x03\x02\x03\ \x12\x032\x02\x16\n\x0c\n\x05\x04\x03\x02\x03\x05\x12\x032\x02\x07\n\x0c\ \n\x05\x04\x03\x02\x03\x01\x12\x032\x08\x11\n\x0c\n\x05\x04\x03\x02\x03\ \x03\x12\x032\x14\x15\n\x0b\n\x04\x04\x03\x02\x04\x12\x033\x02\x1d\n\x0c\ \n\x05\x04\x03\x02\x04\x05\x12\x033\x02\x07\n\x0c\n\x05\x04\x03\x02\x04\ \x01\x12\x033\x08\x18\n\x0c\n\x05\x04\x03\x02\x04\x03\x12\x033\x1b\x1c\n\ \n\n\x02\x04\x04\x12\x046\0;\x01\n\n\n\x03\x04\x04\x01\x12\x036\x08%\n\ \x0b\n\x04\x04\x04\x02\0\x12\x037\x02\x1a\n\x0c\n\x05\x04\x04\x02\0\x05\ \x12\x037\x02\x07\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x037\x08\x15\n\x0c\n\ \x05\x04\x04\x02\0\x03\x12\x037\x18\x19\n\x0b\n\x04\x04\x04\x02\x01\x12\ \x038\x02\x17\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x038\x02\x07\n\x0c\n\ \x05\x04\x04\x02\x01\x01\x12\x038\x08\x12\n\x0c\n\x05\x04\x04\x02\x01\ \x03\x12\x038\x15\x16\n\x9f\x01\n\x04\x04\x04\x02\x02\x12\x039\x02\x17\"\ \x91\x01\x20this\x20field\x20is\x20token\x20name\x20before\x20the\x20pro\ posal\x20ALLOW_SAME_TOKEN_NAME\x20is\x20active,\x20otherwise\x20it\x20is\ \x20token\x20id\x20and\x20token\x20is\x20should\x20be\x20in\x20string\ \x20format.\n\n\x0c\n\x05\x04\x04\x02\x02\x05\x12\x039\x02\x07\n\x0c\n\ \x05\x04\x04\x02\x02\x01\x12\x039\x08\x12\n\x0c\n\x05\x04\x04\x02\x02\ \x03\x12\x039\x15\x16\n\"\n\x04\x04\x04\x02\x03\x12\x03:\x02\x13\"\x15\ \x20the\x20amount\x20of\x20drops\n\n\x0c\n\x05\x04\x04\x02\x03\x05\x12\ \x03:\x02\x07\n\x0c\n\x05\x04\x04\x02\x03\x01\x12\x03:\x08\x0e\n\x0c\n\ \x05\x04\x04\x02\x03\x03\x12\x03:\x11\x12b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(6); messages.push(AssetIssueContract::generated_message_descriptor_data()); messages.push(TransferAssetContract::generated_message_descriptor_data()); messages.push(UnfreezeAssetContract::generated_message_descriptor_data()); messages.push(UpdateAssetContract::generated_message_descriptor_data()); messages.push(ParticipateAssetIssueContract::generated_message_descriptor_data()); messages.push(asset_issue_contract::FrozenSupply::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/balance_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/balance_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.FreezeBalanceContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct FreezeBalanceContract { // message fields // @@protoc_insertion_point(field:protocol.FreezeBalanceContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.FreezeBalanceContract.frozen_balance) pub frozen_balance: i64, // @@protoc_insertion_point(field:protocol.FreezeBalanceContract.frozen_duration) pub frozen_duration: i64, // @@protoc_insertion_point(field:protocol.FreezeBalanceContract.resource) pub resource: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.FreezeBalanceContract.receiver_address) pub receiver_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.FreezeBalanceContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a FreezeBalanceContract { fn default() -> &'a FreezeBalanceContract { ::default_instance() } } impl FreezeBalanceContract { pub fn new() -> FreezeBalanceContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &FreezeBalanceContract| { &m.owner_address }, |m: &mut FreezeBalanceContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_balance", |m: &FreezeBalanceContract| { &m.frozen_balance }, |m: &mut FreezeBalanceContract| { &mut m.frozen_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_duration", |m: &FreezeBalanceContract| { &m.frozen_duration }, |m: &mut FreezeBalanceContract| { &mut m.frozen_duration }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &FreezeBalanceContract| { &m.resource }, |m: &mut FreezeBalanceContract| { &mut m.resource }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "receiver_address", |m: &FreezeBalanceContract| { &m.receiver_address }, |m: &mut FreezeBalanceContract| { &mut m.receiver_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "FreezeBalanceContract", fields, oneofs, ) } } impl ::protobuf::Message for FreezeBalanceContract { const NAME: &'static str = "FreezeBalanceContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.frozen_balance = is.read_int64()?; }, 24 => { self.frozen_duration = is.read_int64()?; }, 80 => { self.resource = is.read_enum_or_unknown()?; }, 122 => { self.receiver_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.frozen_balance != 0 { my_size += ::protobuf::rt::int64_size(2, self.frozen_balance); } if self.frozen_duration != 0 { my_size += ::protobuf::rt::int64_size(3, self.frozen_duration); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(10, self.resource.value()); } if !self.receiver_address.is_empty() { my_size += ::protobuf::rt::bytes_size(15, &self.receiver_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.frozen_balance != 0 { os.write_int64(2, self.frozen_balance)?; } if self.frozen_duration != 0 { os.write_int64(3, self.frozen_duration)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(10, ::protobuf::EnumOrUnknown::value(&self.resource))?; } if !self.receiver_address.is_empty() { os.write_bytes(15, &self.receiver_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> FreezeBalanceContract { FreezeBalanceContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.frozen_balance = 0; self.frozen_duration = 0; self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.receiver_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static FreezeBalanceContract { static instance: FreezeBalanceContract = FreezeBalanceContract { owner_address: ::std::vec::Vec::new(), frozen_balance: 0, frozen_duration: 0, resource: ::protobuf::EnumOrUnknown::from_i32(0), receiver_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for FreezeBalanceContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("FreezeBalanceContract").unwrap()).clone() } } impl ::std::fmt::Display for FreezeBalanceContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for FreezeBalanceContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UnfreezeBalanceContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UnfreezeBalanceContract { // message fields // @@protoc_insertion_point(field:protocol.UnfreezeBalanceContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UnfreezeBalanceContract.resource) pub resource: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.UnfreezeBalanceContract.receiver_address) pub receiver_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.UnfreezeBalanceContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UnfreezeBalanceContract { fn default() -> &'a UnfreezeBalanceContract { ::default_instance() } } impl UnfreezeBalanceContract { pub fn new() -> UnfreezeBalanceContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UnfreezeBalanceContract| { &m.owner_address }, |m: &mut UnfreezeBalanceContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &UnfreezeBalanceContract| { &m.resource }, |m: &mut UnfreezeBalanceContract| { &mut m.resource }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "receiver_address", |m: &UnfreezeBalanceContract| { &m.receiver_address }, |m: &mut UnfreezeBalanceContract| { &mut m.receiver_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UnfreezeBalanceContract", fields, oneofs, ) } } impl ::protobuf::Message for UnfreezeBalanceContract { const NAME: &'static str = "UnfreezeBalanceContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 80 => { self.resource = is.read_enum_or_unknown()?; }, 122 => { self.receiver_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(10, self.resource.value()); } if !self.receiver_address.is_empty() { my_size += ::protobuf::rt::bytes_size(15, &self.receiver_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(10, ::protobuf::EnumOrUnknown::value(&self.resource))?; } if !self.receiver_address.is_empty() { os.write_bytes(15, &self.receiver_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UnfreezeBalanceContract { UnfreezeBalanceContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.receiver_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static UnfreezeBalanceContract { static instance: UnfreezeBalanceContract = UnfreezeBalanceContract { owner_address: ::std::vec::Vec::new(), resource: ::protobuf::EnumOrUnknown::from_i32(0), receiver_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UnfreezeBalanceContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UnfreezeBalanceContract").unwrap()).clone() } } impl ::std::fmt::Display for UnfreezeBalanceContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UnfreezeBalanceContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.WithdrawBalanceContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct WithdrawBalanceContract { // message fields // @@protoc_insertion_point(field:protocol.WithdrawBalanceContract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.WithdrawBalanceContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a WithdrawBalanceContract { fn default() -> &'a WithdrawBalanceContract { ::default_instance() } } impl WithdrawBalanceContract { pub fn new() -> WithdrawBalanceContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &WithdrawBalanceContract| { &m.owner_address }, |m: &mut WithdrawBalanceContract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "WithdrawBalanceContract", fields, oneofs, ) } } impl ::protobuf::Message for WithdrawBalanceContract { const NAME: &'static str = "WithdrawBalanceContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> WithdrawBalanceContract { WithdrawBalanceContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static WithdrawBalanceContract { static instance: WithdrawBalanceContract = WithdrawBalanceContract { owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for WithdrawBalanceContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("WithdrawBalanceContract").unwrap()).clone() } } impl ::std::fmt::Display for WithdrawBalanceContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for WithdrawBalanceContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.TransferContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct TransferContract { // message fields // @@protoc_insertion_point(field:protocol.TransferContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransferContract.to_address) pub to_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransferContract.amount) pub amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.TransferContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TransferContract { fn default() -> &'a TransferContract { ::default_instance() } } impl TransferContract { pub fn new() -> TransferContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &TransferContract| { &m.owner_address }, |m: &mut TransferContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "to_address", |m: &TransferContract| { &m.to_address }, |m: &mut TransferContract| { &mut m.to_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "amount", |m: &TransferContract| { &m.amount }, |m: &mut TransferContract| { &mut m.amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransferContract", fields, oneofs, ) } } impl ::protobuf::Message for TransferContract { const NAME: &'static str = "TransferContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.to_address = is.read_bytes()?; }, 24 => { self.amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.to_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.to_address); } if self.amount != 0 { my_size += ::protobuf::rt::int64_size(3, self.amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.to_address.is_empty() { os.write_bytes(2, &self.to_address)?; } if self.amount != 0 { os.write_int64(3, self.amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TransferContract { TransferContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.to_address.clear(); self.amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static TransferContract { static instance: TransferContract = TransferContract { owner_address: ::std::vec::Vec::new(), to_address: ::std::vec::Vec::new(), amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TransferContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TransferContract").unwrap()).clone() } } impl ::std::fmt::Display for TransferContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TransferContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.TransactionBalanceTrace) #[derive(PartialEq,Clone,Default,Debug)] pub struct TransactionBalanceTrace { // message fields // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.transaction_identifier) pub transaction_identifier: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.operation) pub operation: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.type) pub type_: ::std::string::String, // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.status) pub status: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.TransactionBalanceTrace.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TransactionBalanceTrace { fn default() -> &'a TransactionBalanceTrace { ::default_instance() } } impl TransactionBalanceTrace { pub fn new() -> TransactionBalanceTrace { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "transaction_identifier", |m: &TransactionBalanceTrace| { &m.transaction_identifier }, |m: &mut TransactionBalanceTrace| { &mut m.transaction_identifier }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "operation", |m: &TransactionBalanceTrace| { &m.operation }, |m: &mut TransactionBalanceTrace| { &mut m.operation }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &TransactionBalanceTrace| { &m.type_ }, |m: &mut TransactionBalanceTrace| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "status", |m: &TransactionBalanceTrace| { &m.status }, |m: &mut TransactionBalanceTrace| { &mut m.status }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransactionBalanceTrace", fields, oneofs, ) } } impl ::protobuf::Message for TransactionBalanceTrace { const NAME: &'static str = "TransactionBalanceTrace"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.transaction_identifier = is.read_bytes()?; }, 18 => { self.operation.push(is.read_message()?); }, 26 => { self.type_ = is.read_string()?; }, 34 => { self.status = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.transaction_identifier.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.transaction_identifier); } for value in &self.operation { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.type_.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.type_); } if !self.status.is_empty() { my_size += ::protobuf::rt::string_size(4, &self.status); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.transaction_identifier.is_empty() { os.write_bytes(1, &self.transaction_identifier)?; } for v in &self.operation { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; if !self.type_.is_empty() { os.write_string(3, &self.type_)?; } if !self.status.is_empty() { os.write_string(4, &self.status)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TransactionBalanceTrace { TransactionBalanceTrace::new() } fn clear(&mut self) { self.transaction_identifier.clear(); self.operation.clear(); self.type_.clear(); self.status.clear(); self.special_fields.clear(); } fn default_instance() -> &'static TransactionBalanceTrace { static instance: TransactionBalanceTrace = TransactionBalanceTrace { transaction_identifier: ::std::vec::Vec::new(), operation: ::std::vec::Vec::new(), type_: ::std::string::String::new(), status: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TransactionBalanceTrace { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TransactionBalanceTrace").unwrap()).clone() } } impl ::std::fmt::Display for TransactionBalanceTrace { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TransactionBalanceTrace { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `TransactionBalanceTrace` pub mod transaction_balance_trace { // @@protoc_insertion_point(message:protocol.TransactionBalanceTrace.Operation) #[derive(PartialEq,Clone,Default,Debug)] pub struct Operation { // message fields // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.Operation.operation_identifier) pub operation_identifier: i64, // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.Operation.address) pub address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TransactionBalanceTrace.Operation.amount) pub amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.TransactionBalanceTrace.Operation.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Operation { fn default() -> &'a Operation { ::default_instance() } } impl Operation { pub fn new() -> Operation { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "operation_identifier", |m: &Operation| { &m.operation_identifier }, |m: &mut Operation| { &mut m.operation_identifier }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &Operation| { &m.address }, |m: &mut Operation| { &mut m.address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "amount", |m: &Operation| { &m.amount }, |m: &mut Operation| { &mut m.amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TransactionBalanceTrace.Operation", fields, oneofs, ) } } impl ::protobuf::Message for Operation { const NAME: &'static str = "Operation"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.operation_identifier = is.read_int64()?; }, 18 => { self.address = is.read_bytes()?; }, 24 => { self.amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.operation_identifier != 0 { my_size += ::protobuf::rt::int64_size(1, self.operation_identifier); } if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.address); } if self.amount != 0 { my_size += ::protobuf::rt::int64_size(3, self.amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.operation_identifier != 0 { os.write_int64(1, self.operation_identifier)?; } if !self.address.is_empty() { os.write_bytes(2, &self.address)?; } if self.amount != 0 { os.write_int64(3, self.amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Operation { Operation::new() } fn clear(&mut self) { self.operation_identifier = 0; self.address.clear(); self.amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static Operation { static instance: Operation = Operation { operation_identifier: 0, address: ::std::vec::Vec::new(), amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Operation { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("TransactionBalanceTrace.Operation").unwrap()).clone() } } impl ::std::fmt::Display for Operation { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Operation { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.BlockBalanceTrace) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockBalanceTrace { // message fields // @@protoc_insertion_point(field:protocol.BlockBalanceTrace.block_identifier) pub block_identifier: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.BlockBalanceTrace.timestamp) pub timestamp: i64, // @@protoc_insertion_point(field:protocol.BlockBalanceTrace.transaction_balance_trace) pub transaction_balance_trace: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.BlockBalanceTrace.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockBalanceTrace { fn default() -> &'a BlockBalanceTrace { ::default_instance() } } impl BlockBalanceTrace { pub fn new() -> BlockBalanceTrace { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, block_balance_trace::BlockIdentifier>( "block_identifier", |m: &BlockBalanceTrace| { &m.block_identifier }, |m: &mut BlockBalanceTrace| { &mut m.block_identifier }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "timestamp", |m: &BlockBalanceTrace| { &m.timestamp }, |m: &mut BlockBalanceTrace| { &mut m.timestamp }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "transaction_balance_trace", |m: &BlockBalanceTrace| { &m.transaction_balance_trace }, |m: &mut BlockBalanceTrace| { &mut m.transaction_balance_trace }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockBalanceTrace", fields, oneofs, ) } } impl ::protobuf::Message for BlockBalanceTrace { const NAME: &'static str = "BlockBalanceTrace"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.block_identifier)?; }, 16 => { self.timestamp = is.read_int64()?; }, 26 => { self.transaction_balance_trace.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.block_identifier.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.timestamp != 0 { my_size += ::protobuf::rt::int64_size(2, self.timestamp); } for value in &self.transaction_balance_trace { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.block_identifier.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if self.timestamp != 0 { os.write_int64(2, self.timestamp)?; } for v in &self.transaction_balance_trace { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockBalanceTrace { BlockBalanceTrace::new() } fn clear(&mut self) { self.block_identifier.clear(); self.timestamp = 0; self.transaction_balance_trace.clear(); self.special_fields.clear(); } fn default_instance() -> &'static BlockBalanceTrace { static instance: BlockBalanceTrace = BlockBalanceTrace { block_identifier: ::protobuf::MessageField::none(), timestamp: 0, transaction_balance_trace: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockBalanceTrace { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BlockBalanceTrace").unwrap()).clone() } } impl ::std::fmt::Display for BlockBalanceTrace { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockBalanceTrace { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `BlockBalanceTrace` pub mod block_balance_trace { // @@protoc_insertion_point(message:protocol.BlockBalanceTrace.BlockIdentifier) #[derive(PartialEq,Clone,Default,Debug)] pub struct BlockIdentifier { // message fields // @@protoc_insertion_point(field:protocol.BlockBalanceTrace.BlockIdentifier.hash) pub hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BlockBalanceTrace.BlockIdentifier.number) pub number: i64, // special fields // @@protoc_insertion_point(special_field:protocol.BlockBalanceTrace.BlockIdentifier.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BlockIdentifier { fn default() -> &'a BlockIdentifier { ::default_instance() } } impl BlockIdentifier { pub fn new() -> BlockIdentifier { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &BlockIdentifier| { &m.hash }, |m: &mut BlockIdentifier| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "number", |m: &BlockIdentifier| { &m.number }, |m: &mut BlockIdentifier| { &mut m.number }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BlockBalanceTrace.BlockIdentifier", fields, oneofs, ) } } impl ::protobuf::Message for BlockIdentifier { const NAME: &'static str = "BlockIdentifier"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 16 => { self.number = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if self.number != 0 { my_size += ::protobuf::rt::int64_size(2, self.number); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if self.number != 0 { os.write_int64(2, self.number)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BlockIdentifier { BlockIdentifier::new() } fn clear(&mut self) { self.hash.clear(); self.number = 0; self.special_fields.clear(); } fn default_instance() -> &'static BlockIdentifier { static instance: BlockIdentifier = BlockIdentifier { hash: ::std::vec::Vec::new(), number: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BlockIdentifier { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("BlockBalanceTrace.BlockIdentifier").unwrap()).clone() } } impl ::std::fmt::Display for BlockIdentifier { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BlockIdentifier { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } // @@protoc_insertion_point(message:protocol.AccountTrace) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountTrace { // message fields // @@protoc_insertion_point(field:protocol.AccountTrace.balance) pub balance: i64, // @@protoc_insertion_point(field:protocol.AccountTrace.placeholder) pub placeholder: i64, // special fields // @@protoc_insertion_point(special_field:protocol.AccountTrace.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountTrace { fn default() -> &'a AccountTrace { ::default_instance() } } impl AccountTrace { pub fn new() -> AccountTrace { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "balance", |m: &AccountTrace| { &m.balance }, |m: &mut AccountTrace| { &mut m.balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "placeholder", |m: &AccountTrace| { &m.placeholder }, |m: &mut AccountTrace| { &mut m.placeholder }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountTrace", fields, oneofs, ) } } impl ::protobuf::Message for AccountTrace { const NAME: &'static str = "AccountTrace"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.balance = is.read_int64()?; }, 792 => { self.placeholder = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.balance != 0 { my_size += ::protobuf::rt::int64_size(1, self.balance); } if self.placeholder != 0 { my_size += ::protobuf::rt::int64_size(99, self.placeholder); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.balance != 0 { os.write_int64(1, self.balance)?; } if self.placeholder != 0 { os.write_int64(99, self.placeholder)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountTrace { AccountTrace::new() } fn clear(&mut self) { self.balance = 0; self.placeholder = 0; self.special_fields.clear(); } fn default_instance() -> &'static AccountTrace { static instance: AccountTrace = AccountTrace { balance: 0, placeholder: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountTrace { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountTrace").unwrap()).clone() } } impl ::std::fmt::Display for AccountTrace { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountTrace { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.AccountIdentifier) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountIdentifier { // message fields // @@protoc_insertion_point(field:protocol.AccountIdentifier.address) pub address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.AccountIdentifier.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountIdentifier { fn default() -> &'a AccountIdentifier { ::default_instance() } } impl AccountIdentifier { pub fn new() -> AccountIdentifier { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "address", |m: &AccountIdentifier| { &m.address }, |m: &mut AccountIdentifier| { &mut m.address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountIdentifier", fields, oneofs, ) } } impl ::protobuf::Message for AccountIdentifier { const NAME: &'static str = "AccountIdentifier"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.address.is_empty() { os.write_bytes(1, &self.address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountIdentifier { AccountIdentifier::new() } fn clear(&mut self) { self.address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountIdentifier { static instance: AccountIdentifier = AccountIdentifier { address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountIdentifier { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountIdentifier").unwrap()).clone() } } impl ::std::fmt::Display for AccountIdentifier { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountIdentifier { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.AccountBalanceRequest) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountBalanceRequest { // message fields // @@protoc_insertion_point(field:protocol.AccountBalanceRequest.account_identifier) pub account_identifier: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.AccountBalanceRequest.block_identifier) pub block_identifier: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.AccountBalanceRequest.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountBalanceRequest { fn default() -> &'a AccountBalanceRequest { ::default_instance() } } impl AccountBalanceRequest { pub fn new() -> AccountBalanceRequest { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, AccountIdentifier>( "account_identifier", |m: &AccountBalanceRequest| { &m.account_identifier }, |m: &mut AccountBalanceRequest| { &mut m.account_identifier }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, block_balance_trace::BlockIdentifier>( "block_identifier", |m: &AccountBalanceRequest| { &m.block_identifier }, |m: &mut AccountBalanceRequest| { &mut m.block_identifier }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountBalanceRequest", fields, oneofs, ) } } impl ::protobuf::Message for AccountBalanceRequest { const NAME: &'static str = "AccountBalanceRequest"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.account_identifier)?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.block_identifier)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.account_identifier.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.block_identifier.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.account_identifier.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if let Some(v) = self.block_identifier.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountBalanceRequest { AccountBalanceRequest::new() } fn clear(&mut self) { self.account_identifier.clear(); self.block_identifier.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountBalanceRequest { static instance: AccountBalanceRequest = AccountBalanceRequest { account_identifier: ::protobuf::MessageField::none(), block_identifier: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountBalanceRequest { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountBalanceRequest").unwrap()).clone() } } impl ::std::fmt::Display for AccountBalanceRequest { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountBalanceRequest { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.AccountBalanceResponse) #[derive(PartialEq,Clone,Default,Debug)] pub struct AccountBalanceResponse { // message fields // @@protoc_insertion_point(field:protocol.AccountBalanceResponse.balance) pub balance: i64, // @@protoc_insertion_point(field:protocol.AccountBalanceResponse.block_identifier) pub block_identifier: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.AccountBalanceResponse.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AccountBalanceResponse { fn default() -> &'a AccountBalanceResponse { ::default_instance() } } impl AccountBalanceResponse { pub fn new() -> AccountBalanceResponse { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "balance", |m: &AccountBalanceResponse| { &m.balance }, |m: &mut AccountBalanceResponse| { &mut m.balance }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, block_balance_trace::BlockIdentifier>( "block_identifier", |m: &AccountBalanceResponse| { &m.block_identifier }, |m: &mut AccountBalanceResponse| { &mut m.block_identifier }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AccountBalanceResponse", fields, oneofs, ) } } impl ::protobuf::Message for AccountBalanceResponse { const NAME: &'static str = "AccountBalanceResponse"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.balance = is.read_int64()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.block_identifier)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.balance != 0 { my_size += ::protobuf::rt::int64_size(1, self.balance); } if let Some(v) = self.block_identifier.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.balance != 0 { os.write_int64(1, self.balance)?; } if let Some(v) = self.block_identifier.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AccountBalanceResponse { AccountBalanceResponse::new() } fn clear(&mut self) { self.balance = 0; self.block_identifier.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AccountBalanceResponse { static instance: AccountBalanceResponse = AccountBalanceResponse { balance: 0, block_identifier: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AccountBalanceResponse { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AccountBalanceResponse").unwrap()).clone() } } impl ::std::fmt::Display for AccountBalanceResponse { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AccountBalanceResponse { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.FreezeBalanceV2Contract) #[derive(PartialEq,Clone,Default,Debug)] pub struct FreezeBalanceV2Contract { // message fields // @@protoc_insertion_point(field:protocol.FreezeBalanceV2Contract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.FreezeBalanceV2Contract.frozen_balance) pub frozen_balance: i64, // @@protoc_insertion_point(field:protocol.FreezeBalanceV2Contract.resource) pub resource: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.FreezeBalanceV2Contract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a FreezeBalanceV2Contract { fn default() -> &'a FreezeBalanceV2Contract { ::default_instance() } } impl FreezeBalanceV2Contract { pub fn new() -> FreezeBalanceV2Contract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &FreezeBalanceV2Contract| { &m.owner_address }, |m: &mut FreezeBalanceV2Contract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "frozen_balance", |m: &FreezeBalanceV2Contract| { &m.frozen_balance }, |m: &mut FreezeBalanceV2Contract| { &mut m.frozen_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &FreezeBalanceV2Contract| { &m.resource }, |m: &mut FreezeBalanceV2Contract| { &mut m.resource }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "FreezeBalanceV2Contract", fields, oneofs, ) } } impl ::protobuf::Message for FreezeBalanceV2Contract { const NAME: &'static str = "FreezeBalanceV2Contract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.frozen_balance = is.read_int64()?; }, 24 => { self.resource = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.frozen_balance != 0 { my_size += ::protobuf::rt::int64_size(2, self.frozen_balance); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(3, self.resource.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.frozen_balance != 0 { os.write_int64(2, self.frozen_balance)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(3, ::protobuf::EnumOrUnknown::value(&self.resource))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> FreezeBalanceV2Contract { FreezeBalanceV2Contract::new() } fn clear(&mut self) { self.owner_address.clear(); self.frozen_balance = 0; self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.special_fields.clear(); } fn default_instance() -> &'static FreezeBalanceV2Contract { static instance: FreezeBalanceV2Contract = FreezeBalanceV2Contract { owner_address: ::std::vec::Vec::new(), frozen_balance: 0, resource: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for FreezeBalanceV2Contract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("FreezeBalanceV2Contract").unwrap()).clone() } } impl ::std::fmt::Display for FreezeBalanceV2Contract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for FreezeBalanceV2Contract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UnfreezeBalanceV2Contract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UnfreezeBalanceV2Contract { // message fields // @@protoc_insertion_point(field:protocol.UnfreezeBalanceV2Contract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UnfreezeBalanceV2Contract.unfreeze_balance) pub unfreeze_balance: i64, // @@protoc_insertion_point(field:protocol.UnfreezeBalanceV2Contract.resource) pub resource: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.UnfreezeBalanceV2Contract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UnfreezeBalanceV2Contract { fn default() -> &'a UnfreezeBalanceV2Contract { ::default_instance() } } impl UnfreezeBalanceV2Contract { pub fn new() -> UnfreezeBalanceV2Contract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UnfreezeBalanceV2Contract| { &m.owner_address }, |m: &mut UnfreezeBalanceV2Contract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "unfreeze_balance", |m: &UnfreezeBalanceV2Contract| { &m.unfreeze_balance }, |m: &mut UnfreezeBalanceV2Contract| { &mut m.unfreeze_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &UnfreezeBalanceV2Contract| { &m.resource }, |m: &mut UnfreezeBalanceV2Contract| { &mut m.resource }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UnfreezeBalanceV2Contract", fields, oneofs, ) } } impl ::protobuf::Message for UnfreezeBalanceV2Contract { const NAME: &'static str = "UnfreezeBalanceV2Contract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.unfreeze_balance = is.read_int64()?; }, 24 => { self.resource = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.unfreeze_balance != 0 { my_size += ::protobuf::rt::int64_size(2, self.unfreeze_balance); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(3, self.resource.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.unfreeze_balance != 0 { os.write_int64(2, self.unfreeze_balance)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(3, ::protobuf::EnumOrUnknown::value(&self.resource))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UnfreezeBalanceV2Contract { UnfreezeBalanceV2Contract::new() } fn clear(&mut self) { self.owner_address.clear(); self.unfreeze_balance = 0; self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.special_fields.clear(); } fn default_instance() -> &'static UnfreezeBalanceV2Contract { static instance: UnfreezeBalanceV2Contract = UnfreezeBalanceV2Contract { owner_address: ::std::vec::Vec::new(), unfreeze_balance: 0, resource: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UnfreezeBalanceV2Contract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UnfreezeBalanceV2Contract").unwrap()).clone() } } impl ::std::fmt::Display for UnfreezeBalanceV2Contract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UnfreezeBalanceV2Contract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.WithdrawExpireUnfreezeContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct WithdrawExpireUnfreezeContract { // message fields // @@protoc_insertion_point(field:protocol.WithdrawExpireUnfreezeContract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.WithdrawExpireUnfreezeContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a WithdrawExpireUnfreezeContract { fn default() -> &'a WithdrawExpireUnfreezeContract { ::default_instance() } } impl WithdrawExpireUnfreezeContract { pub fn new() -> WithdrawExpireUnfreezeContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &WithdrawExpireUnfreezeContract| { &m.owner_address }, |m: &mut WithdrawExpireUnfreezeContract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "WithdrawExpireUnfreezeContract", fields, oneofs, ) } } impl ::protobuf::Message for WithdrawExpireUnfreezeContract { const NAME: &'static str = "WithdrawExpireUnfreezeContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> WithdrawExpireUnfreezeContract { WithdrawExpireUnfreezeContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static WithdrawExpireUnfreezeContract { static instance: WithdrawExpireUnfreezeContract = WithdrawExpireUnfreezeContract { owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for WithdrawExpireUnfreezeContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("WithdrawExpireUnfreezeContract").unwrap()).clone() } } impl ::std::fmt::Display for WithdrawExpireUnfreezeContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for WithdrawExpireUnfreezeContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.DelegateResourceContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct DelegateResourceContract { // message fields // @@protoc_insertion_point(field:protocol.DelegateResourceContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.DelegateResourceContract.resource) pub resource: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.DelegateResourceContract.balance) pub balance: i64, // @@protoc_insertion_point(field:protocol.DelegateResourceContract.receiver_address) pub receiver_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.DelegateResourceContract.lock) pub lock: bool, // @@protoc_insertion_point(field:protocol.DelegateResourceContract.lock_period) pub lock_period: i64, // special fields // @@protoc_insertion_point(special_field:protocol.DelegateResourceContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DelegateResourceContract { fn default() -> &'a DelegateResourceContract { ::default_instance() } } impl DelegateResourceContract { pub fn new() -> DelegateResourceContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &DelegateResourceContract| { &m.owner_address }, |m: &mut DelegateResourceContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &DelegateResourceContract| { &m.resource }, |m: &mut DelegateResourceContract| { &mut m.resource }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "balance", |m: &DelegateResourceContract| { &m.balance }, |m: &mut DelegateResourceContract| { &mut m.balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "receiver_address", |m: &DelegateResourceContract| { &m.receiver_address }, |m: &mut DelegateResourceContract| { &mut m.receiver_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lock", |m: &DelegateResourceContract| { &m.lock }, |m: &mut DelegateResourceContract| { &mut m.lock }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "lock_period", |m: &DelegateResourceContract| { &m.lock_period }, |m: &mut DelegateResourceContract| { &mut m.lock_period }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "DelegateResourceContract", fields, oneofs, ) } } impl ::protobuf::Message for DelegateResourceContract { const NAME: &'static str = "DelegateResourceContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.resource = is.read_enum_or_unknown()?; }, 24 => { self.balance = is.read_int64()?; }, 34 => { self.receiver_address = is.read_bytes()?; }, 40 => { self.lock = is.read_bool()?; }, 48 => { self.lock_period = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(2, self.resource.value()); } if self.balance != 0 { my_size += ::protobuf::rt::int64_size(3, self.balance); } if !self.receiver_address.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.receiver_address); } if self.lock != false { my_size += 1 + 1; } if self.lock_period != 0 { my_size += ::protobuf::rt::int64_size(6, self.lock_period); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.resource))?; } if self.balance != 0 { os.write_int64(3, self.balance)?; } if !self.receiver_address.is_empty() { os.write_bytes(4, &self.receiver_address)?; } if self.lock != false { os.write_bool(5, self.lock)?; } if self.lock_period != 0 { os.write_int64(6, self.lock_period)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> DelegateResourceContract { DelegateResourceContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.balance = 0; self.receiver_address.clear(); self.lock = false; self.lock_period = 0; self.special_fields.clear(); } fn default_instance() -> &'static DelegateResourceContract { static instance: DelegateResourceContract = DelegateResourceContract { owner_address: ::std::vec::Vec::new(), resource: ::protobuf::EnumOrUnknown::from_i32(0), balance: 0, receiver_address: ::std::vec::Vec::new(), lock: false, lock_period: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for DelegateResourceContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("DelegateResourceContract").unwrap()).clone() } } impl ::std::fmt::Display for DelegateResourceContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for DelegateResourceContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UnDelegateResourceContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UnDelegateResourceContract { // message fields // @@protoc_insertion_point(field:protocol.UnDelegateResourceContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UnDelegateResourceContract.resource) pub resource: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.UnDelegateResourceContract.balance) pub balance: i64, // @@protoc_insertion_point(field:protocol.UnDelegateResourceContract.receiver_address) pub receiver_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.UnDelegateResourceContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UnDelegateResourceContract { fn default() -> &'a UnDelegateResourceContract { ::default_instance() } } impl UnDelegateResourceContract { pub fn new() -> UnDelegateResourceContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UnDelegateResourceContract| { &m.owner_address }, |m: &mut UnDelegateResourceContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "resource", |m: &UnDelegateResourceContract| { &m.resource }, |m: &mut UnDelegateResourceContract| { &mut m.resource }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "balance", |m: &UnDelegateResourceContract| { &m.balance }, |m: &mut UnDelegateResourceContract| { &mut m.balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "receiver_address", |m: &UnDelegateResourceContract| { &m.receiver_address }, |m: &mut UnDelegateResourceContract| { &mut m.receiver_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UnDelegateResourceContract", fields, oneofs, ) } } impl ::protobuf::Message for UnDelegateResourceContract { const NAME: &'static str = "UnDelegateResourceContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.resource = is.read_enum_or_unknown()?; }, 24 => { self.balance = is.read_int64()?; }, 34 => { self.receiver_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { my_size += ::protobuf::rt::int32_size(2, self.resource.value()); } if self.balance != 0 { my_size += ::protobuf::rt::int64_size(3, self.balance); } if !self.receiver_address.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.receiver_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.resource != ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH) { os.write_enum(2, ::protobuf::EnumOrUnknown::value(&self.resource))?; } if self.balance != 0 { os.write_int64(3, self.balance)?; } if !self.receiver_address.is_empty() { os.write_bytes(4, &self.receiver_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UnDelegateResourceContract { UnDelegateResourceContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.resource = ::protobuf::EnumOrUnknown::new(super::common::ResourceCode::BANDWIDTH); self.balance = 0; self.receiver_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static UnDelegateResourceContract { static instance: UnDelegateResourceContract = UnDelegateResourceContract { owner_address: ::std::vec::Vec::new(), resource: ::protobuf::EnumOrUnknown::from_i32(0), balance: 0, receiver_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UnDelegateResourceContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UnDelegateResourceContract").unwrap()).clone() } } impl ::std::fmt::Display for UnDelegateResourceContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UnDelegateResourceContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.CancelAllUnfreezeV2Contract) #[derive(PartialEq,Clone,Default,Debug)] pub struct CancelAllUnfreezeV2Contract { // message fields // @@protoc_insertion_point(field:protocol.CancelAllUnfreezeV2Contract.owner_address) pub owner_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.CancelAllUnfreezeV2Contract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a CancelAllUnfreezeV2Contract { fn default() -> &'a CancelAllUnfreezeV2Contract { ::default_instance() } } impl CancelAllUnfreezeV2Contract { pub fn new() -> CancelAllUnfreezeV2Contract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &CancelAllUnfreezeV2Contract| { &m.owner_address }, |m: &mut CancelAllUnfreezeV2Contract| { &mut m.owner_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "CancelAllUnfreezeV2Contract", fields, oneofs, ) } } impl ::protobuf::Message for CancelAllUnfreezeV2Contract { const NAME: &'static str = "CancelAllUnfreezeV2Contract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> CancelAllUnfreezeV2Contract { CancelAllUnfreezeV2Contract::new() } fn clear(&mut self) { self.owner_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static CancelAllUnfreezeV2Contract { static instance: CancelAllUnfreezeV2Contract = CancelAllUnfreezeV2Contract { owner_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for CancelAllUnfreezeV2Contract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("CancelAllUnfreezeV2Contract").unwrap()).clone() } } impl ::std::fmt::Display for CancelAllUnfreezeV2Contract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for CancelAllUnfreezeV2Contract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n$core/contract/balance_contract.proto\x12\x08protocol\x1a\x1acore/cont\ ract/common.proto\"\xeb\x01\n\x15FreezeBalanceContract\x12#\n\rowner_add\ ress\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12%\n\x0efrozen_balance\x18\ \x02\x20\x01(\x03R\rfrozenBalance\x12'\n\x0ffrozen_duration\x18\x03\x20\ \x01(\x03R\x0efrozenDuration\x122\n\x08resource\x18\n\x20\x01(\x0e2\x16.\ protocol.ResourceCodeR\x08resource\x12)\n\x10receiver_address\x18\x0f\ \x20\x01(\x0cR\x0freceiverAddress\"\x9d\x01\n\x17UnfreezeBalanceContract\ \x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x122\n\x08r\ esource\x18\n\x20\x01(\x0e2\x16.protocol.ResourceCodeR\x08resource\x12)\ \n\x10receiver_address\x18\x0f\x20\x01(\x0cR\x0freceiverAddress\">\n\x17\ WithdrawBalanceContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0co\ wnerAddress\"n\n\x10TransferContract\x12#\n\rowner_address\x18\x01\x20\ \x01(\x0cR\x0cownerAddress\x12\x1d\n\nto_address\x18\x02\x20\x01(\x0cR\t\ toAddress\x12\x16\n\x06amount\x18\x03\x20\x01(\x03R\x06amount\"\xb9\x02\ \n\x17TransactionBalanceTrace\x125\n\x16transaction_identifier\x18\x01\ \x20\x01(\x0cR\x15transactionIdentifier\x12I\n\toperation\x18\x02\x20\ \x03(\x0b2+.protocol.TransactionBalanceTrace.OperationR\toperation\x12\ \x12\n\x04type\x18\x03\x20\x01(\tR\x04type\x12\x16\n\x06status\x18\x04\ \x20\x01(\tR\x06status\x1ap\n\tOperation\x121\n\x14operation_identifier\ \x18\x01\x20\x01(\x03R\x13operationIdentifier\x12\x18\n\x07address\x18\ \x02\x20\x01(\x0cR\x07address\x12\x16\n\x06amount\x18\x03\x20\x01(\x03R\ \x06amount\"\xa7\x02\n\x11BlockBalanceTrace\x12V\n\x10block_identifier\ \x18\x01\x20\x01(\x0b2+.protocol.BlockBalanceTrace.BlockIdentifierR\x0fb\ lockIdentifier\x12\x1c\n\ttimestamp\x18\x02\x20\x01(\x03R\ttimestamp\x12\ ]\n\x19transaction_balance_trace\x18\x03\x20\x03(\x0b2!.protocol.Transac\ tionBalanceTraceR\x17transactionBalanceTrace\x1a=\n\x0fBlockIdentifier\ \x12\x12\n\x04hash\x18\x01\x20\x01(\x0cR\x04hash\x12\x16\n\x06number\x18\ \x02\x20\x01(\x03R\x06number\"J\n\x0cAccountTrace\x12\x18\n\x07balance\ \x18\x01\x20\x01(\x03R\x07balance\x12\x20\n\x0bplaceholder\x18c\x20\x01(\ \x03R\x0bplaceholder\"-\n\x11AccountIdentifier\x12\x18\n\x07address\x18\ \x01\x20\x01(\x0cR\x07address\"\xbb\x01\n\x15AccountBalanceRequest\x12J\ \n\x12account_identifier\x18\x01\x20\x01(\x0b2\x1b.protocol.AccountIdent\ ifierR\x11accountIdentifier\x12V\n\x10block_identifier\x18\x02\x20\x01(\ \x0b2+.protocol.BlockBalanceTrace.BlockIdentifierR\x0fblockIdentifier\"\ \x8a\x01\n\x16AccountBalanceResponse\x12\x18\n\x07balance\x18\x01\x20\ \x01(\x03R\x07balance\x12V\n\x10block_identifier\x18\x02\x20\x01(\x0b2+.\ protocol.BlockBalanceTrace.BlockIdentifierR\x0fblockIdentifier\"\x99\x01\ \n\x17FreezeBalanceV2Contract\x12#\n\rowner_address\x18\x01\x20\x01(\x0c\ R\x0cownerAddress\x12%\n\x0efrozen_balance\x18\x02\x20\x01(\x03R\rfrozen\ Balance\x122\n\x08resource\x18\x03\x20\x01(\x0e2\x16.protocol.ResourceCo\ deR\x08resource\"\x9f\x01\n\x19UnfreezeBalanceV2Contract\x12#\n\rowner_a\ ddress\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12)\n\x10unfreeze_balance\ \x18\x02\x20\x01(\x03R\x0funfreezeBalance\x122\n\x08resource\x18\x03\x20\ \x01(\x0e2\x16.protocol.ResourceCodeR\x08resource\"E\n\x1eWithdrawExpire\ UnfreezeContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAdd\ ress\"\xed\x01\n\x18DelegateResourceContract\x12#\n\rowner_address\x18\ \x01\x20\x01(\x0cR\x0cownerAddress\x122\n\x08resource\x18\x02\x20\x01(\ \x0e2\x16.protocol.ResourceCodeR\x08resource\x12\x18\n\x07balance\x18\ \x03\x20\x01(\x03R\x07balance\x12)\n\x10receiver_address\x18\x04\x20\x01\ (\x0cR\x0freceiverAddress\x12\x12\n\x04lock\x18\x05\x20\x01(\x08R\x04loc\ k\x12\x1f\n\x0block_period\x18\x06\x20\x01(\x03R\nlockPeriod\"\xba\x01\n\ \x1aUnDelegateResourceContract\x12#\n\rowner_address\x18\x01\x20\x01(\ \x0cR\x0cownerAddress\x122\n\x08resource\x18\x02\x20\x01(\x0e2\x16.proto\ col.ResourceCodeR\x08resource\x12\x18\n\x07balance\x18\x03\x20\x01(\x03R\ \x07balance\x12)\n\x10receiver_address\x18\x04\x20\x01(\x0cR\x0freceiver\ Address\"B\n\x1bCancelAllUnfreezeV2Contract\x12#\n\rowner_address\x18\ \x01\x20\x01(\x0cR\x0cownerAddressBE\n\x18org.tron.protos.contractZ)gith\ ub.com/tronprotocol/grpc-gateway/coreJ\xb1\x1b\n\x06\x12\x04\0\0u\x01\n\ \x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x11\n\x08\n\ \x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\x03\x04\01\"=Specify\x20the\ \x20name\x20of\x20the\x20package\x20that\x20generated\x20the\x20Java\x20\ file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nv\n\x02\x08\x0b\x12\x03\x06\0@\ \x1akoption\x20java_outer_classname\x20=\x20\"FreezeBalanceContract\";\ \x20//Specify\x20the\x20class\x20name\x20of\x20the\x20generated\x20Java\ \x20file\n\n\t\n\x02\x03\0\x12\x03\x08\0$\n\n\n\x02\x04\0\x12\x04\n\0\ \x11\x01\n\n\n\x03\x04\0\x01\x12\x03\n\x08\x1d\n\x0b\n\x04\x04\0\x02\0\ \x12\x03\x0b\x02\x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0b\x02\x07\n\ \x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0b\x08\x15\n\x0c\n\x05\x04\0\x02\0\ \x03\x12\x03\x0b\x18\x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x0c\x02\x1b\n\ \x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x0c\x02\x07\n\x0c\n\x05\x04\0\x02\ \x01\x01\x12\x03\x0c\x08\x16\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x0c\ \x19\x1a\n\x0b\n\x04\x04\0\x02\x02\x12\x03\r\x02\x1c\n\x0c\n\x05\x04\0\ \x02\x02\x05\x12\x03\r\x02\x07\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\r\ \x08\x17\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\r\x1a\x1b\n\x0b\n\x04\x04\ \0\x02\x03\x12\x03\x0f\x02\x1d\n\x0c\n\x05\x04\0\x02\x03\x06\x12\x03\x0f\ \x02\x0e\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x0f\x0f\x17\n\x0c\n\x05\ \x04\0\x02\x03\x03\x12\x03\x0f\x1a\x1c\n\x0b\n\x04\x04\0\x02\x04\x12\x03\ \x10\x02\x1e\n\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x10\x02\x07\n\x0c\n\ \x05\x04\0\x02\x04\x01\x12\x03\x10\x08\x18\n\x0c\n\x05\x04\0\x02\x04\x03\ \x12\x03\x10\x1b\x1d\n\n\n\x02\x04\x01\x12\x04\x14\0\x19\x01\n\n\n\x03\ \x04\x01\x01\x12\x03\x14\x08\x1f\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x15\ \x02\x1a\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x15\x02\x07\n\x0c\n\x05\ \x04\x01\x02\0\x01\x12\x03\x15\x08\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\ \x03\x15\x18\x19\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x17\x02\x1d\n\x0c\n\ \x05\x04\x01\x02\x01\x06\x12\x03\x17\x02\x0e\n\x0c\n\x05\x04\x01\x02\x01\ \x01\x12\x03\x17\x0f\x17\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x17\x1a\ \x1c\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x18\x02\x1e\n\x0c\n\x05\x04\x01\ \x02\x02\x05\x12\x03\x18\x02\x07\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\ \x18\x08\x18\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x18\x1b\x1d\n\n\n\ \x02\x04\x02\x12\x04\x1b\0\x1d\x01\n\n\n\x03\x04\x02\x01\x12\x03\x1b\x08\ \x1f\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x1c\x02\x1a\n\x0c\n\x05\x04\x02\ \x02\0\x05\x12\x03\x1c\x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x1c\ \x08\x15\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x1c\x18\x19\n\n\n\x02\x04\ \x03\x12\x04\x1f\0#\x01\n\n\n\x03\x04\x03\x01\x12\x03\x1f\x08\x18\n\x0b\ \n\x04\x04\x03\x02\0\x12\x03\x20\x02\x1a\n\x0c\n\x05\x04\x03\x02\0\x05\ \x12\x03\x20\x02\x07\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x20\x08\x15\n\ \x0c\n\x05\x04\x03\x02\0\x03\x12\x03\x20\x18\x19\n\x0b\n\x04\x04\x03\x02\ \x01\x12\x03!\x02\x17\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03!\x02\x07\n\ \x0c\n\x05\x04\x03\x02\x01\x01\x12\x03!\x08\x12\n\x0c\n\x05\x04\x03\x02\ \x01\x03\x12\x03!\x15\x16\n\x0b\n\x04\x04\x03\x02\x02\x12\x03\"\x02\x13\ \n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03\"\x02\x07\n\x0c\n\x05\x04\x03\ \x02\x02\x01\x12\x03\"\x08\x0e\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03\"\ \x11\x12\n\n\n\x02\x04\x04\x12\x04%\00\x01\n\n\n\x03\x04\x04\x01\x12\x03\ %\x08\x1f\n\x0c\n\x04\x04\x04\x03\0\x12\x04&\x02*\x03\n\x0c\n\x05\x04\ \x04\x03\0\x01\x12\x03&\n\x13\n\r\n\x06\x04\x04\x03\0\x02\0\x12\x03'\x04\ #\n\x0e\n\x07\x04\x04\x03\0\x02\0\x05\x12\x03'\x04\t\n\x0e\n\x07\x04\x04\ \x03\0\x02\0\x01\x12\x03'\n\x1e\n\x0e\n\x07\x04\x04\x03\0\x02\0\x03\x12\ \x03'!\"\n\r\n\x06\x04\x04\x03\0\x02\x01\x12\x03(\x04\x16\n\x0e\n\x07\ \x04\x04\x03\0\x02\x01\x05\x12\x03(\x04\t\n\x0e\n\x07\x04\x04\x03\0\x02\ \x01\x01\x12\x03(\n\x11\n\x0e\n\x07\x04\x04\x03\0\x02\x01\x03\x12\x03(\ \x14\x15\n\r\n\x06\x04\x04\x03\0\x02\x02\x12\x03)\x04\x15\n\x0e\n\x07\ \x04\x04\x03\0\x02\x02\x05\x12\x03)\x04\t\n\x0e\n\x07\x04\x04\x03\0\x02\ \x02\x01\x12\x03)\n\x10\n\x0e\n\x07\x04\x04\x03\0\x02\x02\x03\x12\x03)\ \x13\x14\n\x0b\n\x04\x04\x04\x02\0\x12\x03,\x02#\n\x0c\n\x05\x04\x04\x02\ \0\x05\x12\x03,\x02\x07\n\x0c\n\x05\x04\x04\x02\0\x01\x12\x03,\x08\x1e\n\ \x0c\n\x05\x04\x04\x02\0\x03\x12\x03,!\"\n\x0b\n\x04\x04\x04\x02\x01\x12\ \x03-\x02#\n\x0c\n\x05\x04\x04\x02\x01\x04\x12\x03-\x02\n\n\x0c\n\x05\ \x04\x04\x02\x01\x06\x12\x03-\x0b\x14\n\x0c\n\x05\x04\x04\x02\x01\x01\ \x12\x03-\x15\x1e\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03-!\"\n\x0b\n\ \x04\x04\x04\x02\x02\x12\x03.\x02\x12\n\x0c\n\x05\x04\x04\x02\x02\x05\ \x12\x03.\x02\x08\n\x0c\n\x05\x04\x04\x02\x02\x01\x12\x03.\t\r\n\x0c\n\ \x05\x04\x04\x02\x02\x03\x12\x03.\x10\x11\n\x0b\n\x04\x04\x04\x02\x03\ \x12\x03/\x02\x14\n\x0c\n\x05\x04\x04\x02\x03\x05\x12\x03/\x02\x08\n\x0c\ \n\x05\x04\x04\x02\x03\x01\x12\x03/\t\x0f\n\x0c\n\x05\x04\x04\x02\x03\ \x03\x12\x03/\x12\x13\n\n\n\x02\x04\x05\x12\x044\0>\x01\n\n\n\x03\x04\ \x05\x01\x12\x034\x08\x19\n\x0c\n\x04\x04\x05\x03\0\x12\x045\x028\x03\n\ \x0c\n\x05\x04\x05\x03\0\x01\x12\x035\n\x19\n\r\n\x06\x04\x05\x03\0\x02\ \0\x12\x036\x04\x13\n\x0e\n\x07\x04\x05\x03\0\x02\0\x05\x12\x036\x04\t\n\ \x0e\n\x07\x04\x05\x03\0\x02\0\x01\x12\x036\n\x0e\n\x0e\n\x07\x04\x05\ \x03\0\x02\0\x03\x12\x036\x11\x12\n\r\n\x06\x04\x05\x03\0\x02\x01\x12\ \x037\x04\x15\n\x0e\n\x07\x04\x05\x03\0\x02\x01\x05\x12\x037\x04\t\n\x0e\ \n\x07\x04\x05\x03\0\x02\x01\x01\x12\x037\n\x10\n\x0e\n\x07\x04\x05\x03\ \0\x02\x01\x03\x12\x037\x13\x14\n\x0b\n\x04\x04\x05\x02\0\x12\x03:\x02'\ \n\x0c\n\x05\x04\x05\x02\0\x06\x12\x03:\x02\x11\n\x0c\n\x05\x04\x05\x02\ \0\x01\x12\x03:\x12\"\n\x0c\n\x05\x04\x05\x02\0\x03\x12\x03:%&\n\x0b\n\ \x04\x04\x05\x02\x01\x12\x03;\x02\x16\n\x0c\n\x05\x04\x05\x02\x01\x05\ \x12\x03;\x02\x07\n\x0c\n\x05\x04\x05\x02\x01\x01\x12\x03;\x08\x11\n\x0c\ \n\x05\x04\x05\x02\x01\x03\x12\x03;\x14\x15\n<\n\x04\x04\x05\x02\x02\x12\ \x03<\x02A\"/\x20\x20BlockIdentifier\x20parent_block_identifier\x20=\x20\ 4;\n\n\x0c\n\x05\x04\x05\x02\x02\x04\x12\x03<\x02\n\n\x0c\n\x05\x04\x05\ \x02\x02\x06\x12\x03<\x0b\"\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03<#<\n\ \x0c\n\x05\x04\x05\x02\x02\x03\x12\x03 &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(1); deps.push(super::common::file_descriptor().clone()); let mut messages = ::std::vec::Vec::with_capacity(18); messages.push(FreezeBalanceContract::generated_message_descriptor_data()); messages.push(UnfreezeBalanceContract::generated_message_descriptor_data()); messages.push(WithdrawBalanceContract::generated_message_descriptor_data()); messages.push(TransferContract::generated_message_descriptor_data()); messages.push(TransactionBalanceTrace::generated_message_descriptor_data()); messages.push(BlockBalanceTrace::generated_message_descriptor_data()); messages.push(AccountTrace::generated_message_descriptor_data()); messages.push(AccountIdentifier::generated_message_descriptor_data()); messages.push(AccountBalanceRequest::generated_message_descriptor_data()); messages.push(AccountBalanceResponse::generated_message_descriptor_data()); messages.push(FreezeBalanceV2Contract::generated_message_descriptor_data()); messages.push(UnfreezeBalanceV2Contract::generated_message_descriptor_data()); messages.push(WithdrawExpireUnfreezeContract::generated_message_descriptor_data()); messages.push(DelegateResourceContract::generated_message_descriptor_data()); messages.push(UnDelegateResourceContract::generated_message_descriptor_data()); messages.push(CancelAllUnfreezeV2Contract::generated_message_descriptor_data()); messages.push(transaction_balance_trace::Operation::generated_message_descriptor_data()); messages.push(block_balance_trace::BlockIdentifier::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/common.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/common.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.ResourceCode) pub enum ResourceCode { // @@protoc_insertion_point(enum_value:protocol.ResourceCode.BANDWIDTH) BANDWIDTH = 0, // @@protoc_insertion_point(enum_value:protocol.ResourceCode.ENERGY) ENERGY = 1, // @@protoc_insertion_point(enum_value:protocol.ResourceCode.TRON_POWER) TRON_POWER = 2, } impl ::protobuf::Enum for ResourceCode { const NAME: &'static str = "ResourceCode"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(ResourceCode::BANDWIDTH), 1 => ::std::option::Option::Some(ResourceCode::ENERGY), 2 => ::std::option::Option::Some(ResourceCode::TRON_POWER), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "BANDWIDTH" => ::std::option::Option::Some(ResourceCode::BANDWIDTH), "ENERGY" => ::std::option::Option::Some(ResourceCode::ENERGY), "TRON_POWER" => ::std::option::Option::Some(ResourceCode::TRON_POWER), _ => ::std::option::Option::None } } const VALUES: &'static [ResourceCode] = &[ ResourceCode::BANDWIDTH, ResourceCode::ENERGY, ResourceCode::TRON_POWER, ]; } impl ::protobuf::EnumFull for ResourceCode { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().enum_by_package_relative_name("ResourceCode").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for ResourceCode { fn default() -> Self { ResourceCode::BANDWIDTH } } impl ResourceCode { fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("ResourceCode") } } static file_descriptor_proto_data: &'static [u8] = b"\ \n\x1acore/contract/common.proto\x12\x08protocol*9\n\x0cResourceCode\x12\ \r\n\tBANDWIDTH\x10\0\x12\n\n\x06ENERGY\x10\x01\x12\x0e\n\nTRON_POWER\ \x10\x02BE\n\x18org.tron.protos.contractZ)github.com/tronprotocol/grpc-g\ ateway/coreJ\xf6\x02\n\x06\x12\x04\0\0\x0c\x01\n\x08\n\x01\x0c\x12\x03\0\ \0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\ \nH\n\x02\x08\x01\x12\x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\ \x20package\x20that\x20generated\x20the\x20Java\x20file\n\n\x08\n\x01\ \x08\x12\x03\x06\0@\ng\n\x02\x08\x0b\x12\x03\x06\0@\x1a\\option\x20java_\ outer_classname\x20=\x20\"common\";\x20//Specify\x20the\x20class\x20name\ \x20of\x20the\x20generated\x20Java\x20file\n\n\n\n\x02\x05\0\x12\x04\x08\ \0\x0c\x01\n\n\n\x03\x05\0\x01\x12\x03\x08\x05\x11\n\x0b\n\x04\x05\0\x02\ \0\x12\x03\t\x02\x13\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\t\x02\x0b\n\x0c\ \n\x05\x05\0\x02\0\x02\x12\x03\t\x0e\x12\n\x0b\n\x04\x05\0\x02\x01\x12\ \x03\n\x02\x10\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\n\x02\x08\n\x0c\n\ \x05\x05\0\x02\x01\x02\x12\x03\n\x0b\x0f\n\x0b\n\x04\x05\0\x02\x02\x12\ \x03\x0b\x02\x14\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x0b\x02\x0c\n\x0c\ \n\x05\x05\0\x02\x02\x02\x12\x03\x0b\x0f\x13b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(0); let mut enums = ::std::vec::Vec::with_capacity(1); enums.push(ResourceCode::generated_enum_descriptor_data()); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/exchange_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/exchange_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.ExchangeCreateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ExchangeCreateContract { // message fields // @@protoc_insertion_point(field:protocol.ExchangeCreateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeCreateContract.first_token_id) pub first_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeCreateContract.first_token_balance) pub first_token_balance: i64, // @@protoc_insertion_point(field:protocol.ExchangeCreateContract.second_token_id) pub second_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeCreateContract.second_token_balance) pub second_token_balance: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ExchangeCreateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ExchangeCreateContract { fn default() -> &'a ExchangeCreateContract { ::default_instance() } } impl ExchangeCreateContract { pub fn new() -> ExchangeCreateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ExchangeCreateContract| { &m.owner_address }, |m: &mut ExchangeCreateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "first_token_id", |m: &ExchangeCreateContract| { &m.first_token_id }, |m: &mut ExchangeCreateContract| { &mut m.first_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "first_token_balance", |m: &ExchangeCreateContract| { &m.first_token_balance }, |m: &mut ExchangeCreateContract| { &mut m.first_token_balance }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "second_token_id", |m: &ExchangeCreateContract| { &m.second_token_id }, |m: &mut ExchangeCreateContract| { &mut m.second_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "second_token_balance", |m: &ExchangeCreateContract| { &m.second_token_balance }, |m: &mut ExchangeCreateContract| { &mut m.second_token_balance }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ExchangeCreateContract", fields, oneofs, ) } } impl ::protobuf::Message for ExchangeCreateContract { const NAME: &'static str = "ExchangeCreateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.first_token_id = is.read_bytes()?; }, 24 => { self.first_token_balance = is.read_int64()?; }, 34 => { self.second_token_id = is.read_bytes()?; }, 40 => { self.second_token_balance = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.first_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.first_token_id); } if self.first_token_balance != 0 { my_size += ::protobuf::rt::int64_size(3, self.first_token_balance); } if !self.second_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.second_token_id); } if self.second_token_balance != 0 { my_size += ::protobuf::rt::int64_size(5, self.second_token_balance); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.first_token_id.is_empty() { os.write_bytes(2, &self.first_token_id)?; } if self.first_token_balance != 0 { os.write_int64(3, self.first_token_balance)?; } if !self.second_token_id.is_empty() { os.write_bytes(4, &self.second_token_id)?; } if self.second_token_balance != 0 { os.write_int64(5, self.second_token_balance)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ExchangeCreateContract { ExchangeCreateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.first_token_id.clear(); self.first_token_balance = 0; self.second_token_id.clear(); self.second_token_balance = 0; self.special_fields.clear(); } fn default_instance() -> &'static ExchangeCreateContract { static instance: ExchangeCreateContract = ExchangeCreateContract { owner_address: ::std::vec::Vec::new(), first_token_id: ::std::vec::Vec::new(), first_token_balance: 0, second_token_id: ::std::vec::Vec::new(), second_token_balance: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ExchangeCreateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ExchangeCreateContract").unwrap()).clone() } } impl ::std::fmt::Display for ExchangeCreateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ExchangeCreateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ExchangeInjectContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ExchangeInjectContract { // message fields // @@protoc_insertion_point(field:protocol.ExchangeInjectContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeInjectContract.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.ExchangeInjectContract.token_id) pub token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeInjectContract.quant) pub quant: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ExchangeInjectContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ExchangeInjectContract { fn default() -> &'a ExchangeInjectContract { ::default_instance() } } impl ExchangeInjectContract { pub fn new() -> ExchangeInjectContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ExchangeInjectContract| { &m.owner_address }, |m: &mut ExchangeInjectContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &ExchangeInjectContract| { &m.exchange_id }, |m: &mut ExchangeInjectContract| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "token_id", |m: &ExchangeInjectContract| { &m.token_id }, |m: &mut ExchangeInjectContract| { &mut m.token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "quant", |m: &ExchangeInjectContract| { &m.quant }, |m: &mut ExchangeInjectContract| { &mut m.quant }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ExchangeInjectContract", fields, oneofs, ) } } impl ::protobuf::Message for ExchangeInjectContract { const NAME: &'static str = "ExchangeInjectContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.exchange_id = is.read_int64()?; }, 26 => { self.token_id = is.read_bytes()?; }, 32 => { self.quant = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(2, self.exchange_id); } if !self.token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.token_id); } if self.quant != 0 { my_size += ::protobuf::rt::int64_size(4, self.quant); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.exchange_id != 0 { os.write_int64(2, self.exchange_id)?; } if !self.token_id.is_empty() { os.write_bytes(3, &self.token_id)?; } if self.quant != 0 { os.write_int64(4, self.quant)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ExchangeInjectContract { ExchangeInjectContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.exchange_id = 0; self.token_id.clear(); self.quant = 0; self.special_fields.clear(); } fn default_instance() -> &'static ExchangeInjectContract { static instance: ExchangeInjectContract = ExchangeInjectContract { owner_address: ::std::vec::Vec::new(), exchange_id: 0, token_id: ::std::vec::Vec::new(), quant: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ExchangeInjectContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ExchangeInjectContract").unwrap()).clone() } } impl ::std::fmt::Display for ExchangeInjectContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ExchangeInjectContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ExchangeWithdrawContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ExchangeWithdrawContract { // message fields // @@protoc_insertion_point(field:protocol.ExchangeWithdrawContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeWithdrawContract.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.ExchangeWithdrawContract.token_id) pub token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeWithdrawContract.quant) pub quant: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ExchangeWithdrawContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ExchangeWithdrawContract { fn default() -> &'a ExchangeWithdrawContract { ::default_instance() } } impl ExchangeWithdrawContract { pub fn new() -> ExchangeWithdrawContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ExchangeWithdrawContract| { &m.owner_address }, |m: &mut ExchangeWithdrawContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &ExchangeWithdrawContract| { &m.exchange_id }, |m: &mut ExchangeWithdrawContract| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "token_id", |m: &ExchangeWithdrawContract| { &m.token_id }, |m: &mut ExchangeWithdrawContract| { &mut m.token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "quant", |m: &ExchangeWithdrawContract| { &m.quant }, |m: &mut ExchangeWithdrawContract| { &mut m.quant }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ExchangeWithdrawContract", fields, oneofs, ) } } impl ::protobuf::Message for ExchangeWithdrawContract { const NAME: &'static str = "ExchangeWithdrawContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.exchange_id = is.read_int64()?; }, 26 => { self.token_id = is.read_bytes()?; }, 32 => { self.quant = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(2, self.exchange_id); } if !self.token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.token_id); } if self.quant != 0 { my_size += ::protobuf::rt::int64_size(4, self.quant); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.exchange_id != 0 { os.write_int64(2, self.exchange_id)?; } if !self.token_id.is_empty() { os.write_bytes(3, &self.token_id)?; } if self.quant != 0 { os.write_int64(4, self.quant)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ExchangeWithdrawContract { ExchangeWithdrawContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.exchange_id = 0; self.token_id.clear(); self.quant = 0; self.special_fields.clear(); } fn default_instance() -> &'static ExchangeWithdrawContract { static instance: ExchangeWithdrawContract = ExchangeWithdrawContract { owner_address: ::std::vec::Vec::new(), exchange_id: 0, token_id: ::std::vec::Vec::new(), quant: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ExchangeWithdrawContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ExchangeWithdrawContract").unwrap()).clone() } } impl ::std::fmt::Display for ExchangeWithdrawContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ExchangeWithdrawContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ExchangeTransactionContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ExchangeTransactionContract { // message fields // @@protoc_insertion_point(field:protocol.ExchangeTransactionContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeTransactionContract.exchange_id) pub exchange_id: i64, // @@protoc_insertion_point(field:protocol.ExchangeTransactionContract.token_id) pub token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ExchangeTransactionContract.quant) pub quant: i64, // @@protoc_insertion_point(field:protocol.ExchangeTransactionContract.expected) pub expected: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ExchangeTransactionContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ExchangeTransactionContract { fn default() -> &'a ExchangeTransactionContract { ::default_instance() } } impl ExchangeTransactionContract { pub fn new() -> ExchangeTransactionContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ExchangeTransactionContract| { &m.owner_address }, |m: &mut ExchangeTransactionContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "exchange_id", |m: &ExchangeTransactionContract| { &m.exchange_id }, |m: &mut ExchangeTransactionContract| { &mut m.exchange_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "token_id", |m: &ExchangeTransactionContract| { &m.token_id }, |m: &mut ExchangeTransactionContract| { &mut m.token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "quant", |m: &ExchangeTransactionContract| { &m.quant }, |m: &mut ExchangeTransactionContract| { &mut m.quant }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "expected", |m: &ExchangeTransactionContract| { &m.expected }, |m: &mut ExchangeTransactionContract| { &mut m.expected }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ExchangeTransactionContract", fields, oneofs, ) } } impl ::protobuf::Message for ExchangeTransactionContract { const NAME: &'static str = "ExchangeTransactionContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.exchange_id = is.read_int64()?; }, 26 => { self.token_id = is.read_bytes()?; }, 32 => { self.quant = is.read_int64()?; }, 40 => { self.expected = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.exchange_id != 0 { my_size += ::protobuf::rt::int64_size(2, self.exchange_id); } if !self.token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.token_id); } if self.quant != 0 { my_size += ::protobuf::rt::int64_size(4, self.quant); } if self.expected != 0 { my_size += ::protobuf::rt::int64_size(5, self.expected); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.exchange_id != 0 { os.write_int64(2, self.exchange_id)?; } if !self.token_id.is_empty() { os.write_bytes(3, &self.token_id)?; } if self.quant != 0 { os.write_int64(4, self.quant)?; } if self.expected != 0 { os.write_int64(5, self.expected)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ExchangeTransactionContract { ExchangeTransactionContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.exchange_id = 0; self.token_id.clear(); self.quant = 0; self.expected = 0; self.special_fields.clear(); } fn default_instance() -> &'static ExchangeTransactionContract { static instance: ExchangeTransactionContract = ExchangeTransactionContract { owner_address: ::std::vec::Vec::new(), exchange_id: 0, token_id: ::std::vec::Vec::new(), quant: 0, expected: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ExchangeTransactionContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ExchangeTransactionContract").unwrap()).clone() } } impl ::std::fmt::Display for ExchangeTransactionContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ExchangeTransactionContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n%core/contract/exchange_contract.proto\x12\x08protocol\"\xed\x01\n\x16\ ExchangeCreateContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cow\ nerAddress\x12$\n\x0efirst_token_id\x18\x02\x20\x01(\x0cR\x0cfirstTokenI\ d\x12.\n\x13first_token_balance\x18\x03\x20\x01(\x03R\x11firstTokenBalan\ ce\x12&\n\x0fsecond_token_id\x18\x04\x20\x01(\x0cR\rsecondTokenId\x120\n\ \x14second_token_balance\x18\x05\x20\x01(\x03R\x12secondTokenBalance\"\ \x8f\x01\n\x16ExchangeInjectContract\x12#\n\rowner_address\x18\x01\x20\ \x01(\x0cR\x0cownerAddress\x12\x1f\n\x0bexchange_id\x18\x02\x20\x01(\x03\ R\nexchangeId\x12\x19\n\x08token_id\x18\x03\x20\x01(\x0cR\x07tokenId\x12\ \x14\n\x05quant\x18\x04\x20\x01(\x03R\x05quant\"\x91\x01\n\x18ExchangeWi\ thdrawContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddre\ ss\x12\x1f\n\x0bexchange_id\x18\x02\x20\x01(\x03R\nexchangeId\x12\x19\n\ \x08token_id\x18\x03\x20\x01(\x0cR\x07tokenId\x12\x14\n\x05quant\x18\x04\ \x20\x01(\x03R\x05quant\"\xb0\x01\n\x1bExchangeTransactionContract\x12#\ \n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x1f\n\x0bexc\ hange_id\x18\x02\x20\x01(\x03R\nexchangeId\x12\x19\n\x08token_id\x18\x03\ \x20\x01(\x0cR\x07tokenId\x12\x14\n\x05quant\x18\x04\x20\x01(\x03R\x05qu\ ant\x12\x1a\n\x08expected\x18\x05\x20\x01(\x03R\x08expectedBE\n\x18org.t\ ron.protos.contractZ)github.com/tronprotocol/grpc-gateway/coreJ\xb1\n\n\ \x06\x12\x04\0\0$\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ \x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\ \x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20that\x20\ generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nw\n\ \x02\x08\x0b\x12\x03\x06\0@\x1aloption\x20java_outer_classname\x20=\x20\ \"ExchangeCreateContract\";\x20//Specify\x20the\x20class\x20name\x20of\ \x20the\x20generated\x20Java\x20file\n\n\n\n\x02\x04\0\x12\x04\x08\0\x0e\ \x01\n\n\n\x03\x04\0\x01\x12\x03\x08\x08\x1e\n\x0b\n\x04\x04\0\x02\0\x12\ \x03\t\x02\x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\t\x02\x07\n\x0c\n\x05\ \x04\0\x02\0\x01\x12\x03\t\x08\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\ \x18\x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\n\x02\x1b\n\x0c\n\x05\x04\0\ \x02\x01\x05\x12\x03\n\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\n\ \x08\x16\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x19\x1a\n\x0b\n\x04\x04\ \0\x02\x02\x12\x03\x0b\x02\x20\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x0b\ \x02\x07\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0b\x08\x1b\n\x0c\n\x05\ \x04\0\x02\x02\x03\x12\x03\x0b\x1e\x1f\n\x0b\n\x04\x04\0\x02\x03\x12\x03\ \x0c\x02\x1c\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x0c\x02\x07\n\x0c\n\ \x05\x04\0\x02\x03\x01\x12\x03\x0c\x08\x17\n\x0c\n\x05\x04\0\x02\x03\x03\ \x12\x03\x0c\x1a\x1b\n\x0b\n\x04\x04\0\x02\x04\x12\x03\r\x02!\n\x0c\n\ \x05\x04\0\x02\x04\x05\x12\x03\r\x02\x07\n\x0c\n\x05\x04\0\x02\x04\x01\ \x12\x03\r\x08\x1c\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\r\x1f\x20\n\n\n\ \x02\x04\x01\x12\x04\x10\0\x15\x01\n\n\n\x03\x04\x01\x01\x12\x03\x10\x08\ \x1e\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x11\x02\x1a\n\x0c\n\x05\x04\x01\ \x02\0\x05\x12\x03\x11\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x11\ \x08\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x11\x18\x19\n\x0b\n\x04\ \x04\x01\x02\x01\x12\x03\x12\x02\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\ \x03\x12\x02\x07\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x12\x08\x13\n\ \x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x12\x16\x17\n\x0b\n\x04\x04\x01\ \x02\x02\x12\x03\x13\x02\x15\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03\x13\ \x02\x07\n\x0c\n\x05\x04\x01\x02\x02\x01\x12\x03\x13\x08\x10\n\x0c\n\x05\ \x04\x01\x02\x02\x03\x12\x03\x13\x13\x14\n\x0b\n\x04\x04\x01\x02\x03\x12\ \x03\x14\x02\x12\n\x0c\n\x05\x04\x01\x02\x03\x05\x12\x03\x14\x02\x07\n\ \x0c\n\x05\x04\x01\x02\x03\x01\x12\x03\x14\x08\r\n\x0c\n\x05\x04\x01\x02\ \x03\x03\x12\x03\x14\x10\x11\n\n\n\x02\x04\x02\x12\x04\x17\0\x1c\x01\n\n\ \n\x03\x04\x02\x01\x12\x03\x17\x08\x20\n\x0b\n\x04\x04\x02\x02\0\x12\x03\ \x18\x02\x1a\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x18\x02\x07\n\x0c\n\ \x05\x04\x02\x02\0\x01\x12\x03\x18\x08\x15\n\x0c\n\x05\x04\x02\x02\0\x03\ \x12\x03\x18\x18\x19\n\x0b\n\x04\x04\x02\x02\x01\x12\x03\x19\x02\x18\n\ \x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x19\x02\x07\n\x0c\n\x05\x04\x02\ \x02\x01\x01\x12\x03\x19\x08\x13\n\x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\ \x19\x16\x17\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x1a\x02\x15\n\x0c\n\x05\ \x04\x02\x02\x02\x05\x12\x03\x1a\x02\x07\n\x0c\n\x05\x04\x02\x02\x02\x01\ \x12\x03\x1a\x08\x10\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\x1a\x13\x14\ \n\x0b\n\x04\x04\x02\x02\x03\x12\x03\x1b\x02\x12\n\x0c\n\x05\x04\x02\x02\ \x03\x05\x12\x03\x1b\x02\x07\n\x0c\n\x05\x04\x02\x02\x03\x01\x12\x03\x1b\ \x08\r\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\x03\x1b\x10\x11\n\n\n\x02\x04\ \x03\x12\x04\x1e\0$\x01\n\n\n\x03\x04\x03\x01\x12\x03\x1e\x08#\n\x0b\n\ \x04\x04\x03\x02\0\x12\x03\x1f\x02\x1a\n\x0c\n\x05\x04\x03\x02\0\x05\x12\ \x03\x1f\x02\x07\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03\x1f\x08\x15\n\x0c\ \n\x05\x04\x03\x02\0\x03\x12\x03\x1f\x18\x19\n\x0b\n\x04\x04\x03\x02\x01\ \x12\x03\x20\x02\x18\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x20\x02\x07\ \n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x20\x08\x13\n\x0c\n\x05\x04\x03\ \x02\x01\x03\x12\x03\x20\x16\x17\n\x0b\n\x04\x04\x03\x02\x02\x12\x03!\ \x02\x15\n\x0c\n\x05\x04\x03\x02\x02\x05\x12\x03!\x02\x07\n\x0c\n\x05\ \x04\x03\x02\x02\x01\x12\x03!\x08\x10\n\x0c\n\x05\x04\x03\x02\x02\x03\ \x12\x03!\x13\x14\n\x0b\n\x04\x04\x03\x02\x03\x12\x03\"\x02\x12\n\x0c\n\ \x05\x04\x03\x02\x03\x05\x12\x03\"\x02\x07\n\x0c\n\x05\x04\x03\x02\x03\ \x01\x12\x03\"\x08\r\n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x03\"\x10\x11\n\ \x0b\n\x04\x04\x03\x02\x04\x12\x03#\x02\x15\n\x0c\n\x05\x04\x03\x02\x04\ \x05\x12\x03#\x02\x07\n\x0c\n\x05\x04\x03\x02\x04\x01\x12\x03#\x08\x10\n\ \x0c\n\x05\x04\x03\x02\x04\x03\x12\x03#\x13\x14b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(4); messages.push(ExchangeCreateContract::generated_message_descriptor_data()); messages.push(ExchangeInjectContract::generated_message_descriptor_data()); messages.push(ExchangeWithdrawContract::generated_message_descriptor_data()); messages.push(ExchangeTransactionContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/market_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/market_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.MarketSellAssetContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketSellAssetContract { // message fields // @@protoc_insertion_point(field:protocol.MarketSellAssetContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketSellAssetContract.sell_token_id) pub sell_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketSellAssetContract.sell_token_quantity) pub sell_token_quantity: i64, // @@protoc_insertion_point(field:protocol.MarketSellAssetContract.buy_token_id) pub buy_token_id: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketSellAssetContract.buy_token_quantity) pub buy_token_quantity: i64, // special fields // @@protoc_insertion_point(special_field:protocol.MarketSellAssetContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketSellAssetContract { fn default() -> &'a MarketSellAssetContract { ::default_instance() } } impl MarketSellAssetContract { pub fn new() -> MarketSellAssetContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(5); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &MarketSellAssetContract| { &m.owner_address }, |m: &mut MarketSellAssetContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_id", |m: &MarketSellAssetContract| { &m.sell_token_id }, |m: &mut MarketSellAssetContract| { &mut m.sell_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "sell_token_quantity", |m: &MarketSellAssetContract| { &m.sell_token_quantity }, |m: &mut MarketSellAssetContract| { &mut m.sell_token_quantity }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_id", |m: &MarketSellAssetContract| { &m.buy_token_id }, |m: &mut MarketSellAssetContract| { &mut m.buy_token_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "buy_token_quantity", |m: &MarketSellAssetContract| { &m.buy_token_quantity }, |m: &mut MarketSellAssetContract| { &mut m.buy_token_quantity }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketSellAssetContract", fields, oneofs, ) } } impl ::protobuf::Message for MarketSellAssetContract { const NAME: &'static str = "MarketSellAssetContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.sell_token_id = is.read_bytes()?; }, 24 => { self.sell_token_quantity = is.read_int64()?; }, 34 => { self.buy_token_id = is.read_bytes()?; }, 40 => { self.buy_token_quantity = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.sell_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.sell_token_id); } if self.sell_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(3, self.sell_token_quantity); } if !self.buy_token_id.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.buy_token_id); } if self.buy_token_quantity != 0 { my_size += ::protobuf::rt::int64_size(5, self.buy_token_quantity); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.sell_token_id.is_empty() { os.write_bytes(2, &self.sell_token_id)?; } if self.sell_token_quantity != 0 { os.write_int64(3, self.sell_token_quantity)?; } if !self.buy_token_id.is_empty() { os.write_bytes(4, &self.buy_token_id)?; } if self.buy_token_quantity != 0 { os.write_int64(5, self.buy_token_quantity)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketSellAssetContract { MarketSellAssetContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.sell_token_id.clear(); self.sell_token_quantity = 0; self.buy_token_id.clear(); self.buy_token_quantity = 0; self.special_fields.clear(); } fn default_instance() -> &'static MarketSellAssetContract { static instance: MarketSellAssetContract = MarketSellAssetContract { owner_address: ::std::vec::Vec::new(), sell_token_id: ::std::vec::Vec::new(), sell_token_quantity: 0, buy_token_id: ::std::vec::Vec::new(), buy_token_quantity: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketSellAssetContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketSellAssetContract").unwrap()).clone() } } impl ::std::fmt::Display for MarketSellAssetContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketSellAssetContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MarketCancelOrderContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct MarketCancelOrderContract { // message fields // @@protoc_insertion_point(field:protocol.MarketCancelOrderContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MarketCancelOrderContract.order_id) pub order_id: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MarketCancelOrderContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MarketCancelOrderContract { fn default() -> &'a MarketCancelOrderContract { ::default_instance() } } impl MarketCancelOrderContract { pub fn new() -> MarketCancelOrderContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &MarketCancelOrderContract| { &m.owner_address }, |m: &mut MarketCancelOrderContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "order_id", |m: &MarketCancelOrderContract| { &m.order_id }, |m: &mut MarketCancelOrderContract| { &mut m.order_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MarketCancelOrderContract", fields, oneofs, ) } } impl ::protobuf::Message for MarketCancelOrderContract { const NAME: &'static str = "MarketCancelOrderContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.order_id = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.order_id.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.order_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.order_id.is_empty() { os.write_bytes(2, &self.order_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MarketCancelOrderContract { MarketCancelOrderContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.order_id.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MarketCancelOrderContract { static instance: MarketCancelOrderContract = MarketCancelOrderContract { owner_address: ::std::vec::Vec::new(), order_id: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MarketCancelOrderContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MarketCancelOrderContract").unwrap()).clone() } } impl ::std::fmt::Display for MarketCancelOrderContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MarketCancelOrderContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n#core/contract/market_contract.proto\x12\x08protocol\"\xe2\x01\n\x17Ma\ rketSellAssetContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cown\ erAddress\x12\"\n\rsell_token_id\x18\x02\x20\x01(\x0cR\x0bsellTokenId\ \x12.\n\x13sell_token_quantity\x18\x03\x20\x01(\x03R\x11sellTokenQuantit\ y\x12\x20\n\x0cbuy_token_id\x18\x04\x20\x01(\x0cR\nbuyTokenId\x12,\n\x12\ buy_token_quantity\x18\x05\x20\x01(\x03R\x10buyTokenQuantity\"[\n\x19Mar\ ketCancelOrderContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cow\ nerAddress\x12\x19\n\x08order_id\x18\x02\x20\x01(\x0cR\x07orderIdBE\n\ \x18org.tron.protos.contractZ)github.com/tronprotocol/grpc-gateway/coreJ\ \xc8\x04\n\x06\x12\x04\0\0\x12\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\ \n\x01\x02\x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\ \x01\x12\x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20\ that\x20generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x05\0\ @\n\t\n\x02\x08\x0b\x12\x03\x05\0@\n\n\n\x02\x04\0\x12\x04\x07\0\r\x01\n\ \n\n\x03\x04\0\x01\x12\x03\x07\x08\x1f\n\x0b\n\x04\x04\0\x02\0\x12\x03\ \x08\x04\x1c\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x08\x04\t\n\x0c\n\x05\ \x04\0\x02\0\x01\x12\x03\x08\n\x17\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\ \x08\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\x03\t\x04\x1c\n\x0c\n\x05\x04\ \0\x02\x01\x05\x12\x03\t\x04\t\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\t\n\ \x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\t\x1a\x1b\n\x0b\n\x04\x04\0\ \x02\x02\x12\x03\n\x04\"\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\n\x04\t\n\ \x0c\n\x05\x04\0\x02\x02\x01\x12\x03\n\n\x1d\n\x0c\n\x05\x04\0\x02\x02\ \x03\x12\x03\n\x20!\n\x0b\n\x04\x04\0\x02\x03\x12\x03\x0b\x04\x1b\n\x0c\ \n\x05\x04\0\x02\x03\x05\x12\x03\x0b\x04\t\n\x0c\n\x05\x04\0\x02\x03\x01\ \x12\x03\x0b\n\x16\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x0b\x19\x1a\n\ \x1d\n\x04\x04\0\x02\x04\x12\x03\x0c\x04!\"\x10\x20min\x20to\x20receive\ \n\n\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x0c\x04\t\n\x0c\n\x05\x04\0\x02\ \x04\x01\x12\x03\x0c\n\x1c\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x0c\x1f\ \x20\n\n\n\x02\x04\x01\x12\x04\x0f\0\x12\x01\n\n\n\x03\x04\x01\x01\x12\ \x03\x0f\x08!\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x10\x04\x1c\n\x0c\n\x05\ \x04\x01\x02\0\x05\x12\x03\x10\x04\t\n\x0c\n\x05\x04\x01\x02\0\x01\x12\ \x03\x10\n\x17\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x10\x1a\x1b\n\x0b\n\ \x04\x04\x01\x02\x01\x12\x03\x11\x04\x17\n\x0c\n\x05\x04\x01\x02\x01\x05\ \x12\x03\x11\x04\t\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x11\n\x12\n\ \x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x11\x15\x16b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(2); messages.push(MarketSellAssetContract::generated_message_descriptor_data()); messages.push(MarketCancelOrderContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/mod.rs ================================================ // @generated pub mod Discover; pub mod Tron; pub mod account_contract; pub mod asset_issue_contract; pub mod balance_contract; pub mod common; pub mod exchange_contract; pub mod market_contract; pub mod proposal_contract; pub mod shield_contract; pub mod smart_contract; pub mod storage_contract; pub mod vote_asset_contract; pub mod witness_contract; ================================================ FILE: crates/anychain-tron/src/protocol/proposal_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/proposal_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.ProposalApproveContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ProposalApproveContract { // message fields // @@protoc_insertion_point(field:protocol.ProposalApproveContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ProposalApproveContract.proposal_id) pub proposal_id: i64, // @@protoc_insertion_point(field:protocol.ProposalApproveContract.is_add_approval) pub is_add_approval: bool, // special fields // @@protoc_insertion_point(special_field:protocol.ProposalApproveContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ProposalApproveContract { fn default() -> &'a ProposalApproveContract { ::default_instance() } } impl ProposalApproveContract { pub fn new() -> ProposalApproveContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ProposalApproveContract| { &m.owner_address }, |m: &mut ProposalApproveContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "proposal_id", |m: &ProposalApproveContract| { &m.proposal_id }, |m: &mut ProposalApproveContract| { &mut m.proposal_id }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "is_add_approval", |m: &ProposalApproveContract| { &m.is_add_approval }, |m: &mut ProposalApproveContract| { &mut m.is_add_approval }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ProposalApproveContract", fields, oneofs, ) } } impl ::protobuf::Message for ProposalApproveContract { const NAME: &'static str = "ProposalApproveContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.proposal_id = is.read_int64()?; }, 24 => { self.is_add_approval = is.read_bool()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.proposal_id != 0 { my_size += ::protobuf::rt::int64_size(2, self.proposal_id); } if self.is_add_approval != false { my_size += 1 + 1; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.proposal_id != 0 { os.write_int64(2, self.proposal_id)?; } if self.is_add_approval != false { os.write_bool(3, self.is_add_approval)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ProposalApproveContract { ProposalApproveContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.proposal_id = 0; self.is_add_approval = false; self.special_fields.clear(); } fn default_instance() -> &'static ProposalApproveContract { static instance: ProposalApproveContract = ProposalApproveContract { owner_address: ::std::vec::Vec::new(), proposal_id: 0, is_add_approval: false, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ProposalApproveContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ProposalApproveContract").unwrap()).clone() } } impl ::std::fmt::Display for ProposalApproveContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ProposalApproveContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ProposalCreateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ProposalCreateContract { // message fields // @@protoc_insertion_point(field:protocol.ProposalCreateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ProposalCreateContract.parameters) pub parameters: ::std::collections::HashMap, // special fields // @@protoc_insertion_point(special_field:protocol.ProposalCreateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ProposalCreateContract { fn default() -> &'a ProposalCreateContract { ::default_instance() } } impl ProposalCreateContract { pub fn new() -> ProposalCreateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ProposalCreateContract| { &m.owner_address }, |m: &mut ProposalCreateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_map_simpler_accessor::<_, _, _>( "parameters", |m: &ProposalCreateContract| { &m.parameters }, |m: &mut ProposalCreateContract| { &mut m.parameters }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ProposalCreateContract", fields, oneofs, ) } } impl ::protobuf::Message for ProposalCreateContract { const NAME: &'static str = "ProposalCreateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { let len = is.read_raw_varint32()?; let old_limit = is.push_limit(len as u64)?; let mut key = ::std::default::Default::default(); let mut value = ::std::default::Default::default(); while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => key = is.read_int64()?, 16 => value = is.read_int64()?, _ => ::protobuf::rt::skip_field_for_tag(tag, is)?, }; } is.pop_limit(old_limit); self.parameters.insert(key, value); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } for (k, v) in &self.parameters { let mut entry_size = 0; entry_size += ::protobuf::rt::int64_size(1, *k); entry_size += ::protobuf::rt::int64_size(2, *v); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(entry_size) + entry_size }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } for (k, v) in &self.parameters { let mut entry_size = 0; entry_size += ::protobuf::rt::int64_size(1, *k); entry_size += ::protobuf::rt::int64_size(2, *v); os.write_raw_varint32(18)?; // Tag. os.write_raw_varint32(entry_size as u32)?; os.write_int64(1, *k)?; os.write_int64(2, *v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ProposalCreateContract { ProposalCreateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.parameters.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ProposalCreateContract { static instance: ::protobuf::rt::Lazy = ::protobuf::rt::Lazy::new(); instance.get(ProposalCreateContract::new) } } impl ::protobuf::MessageFull for ProposalCreateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ProposalCreateContract").unwrap()).clone() } } impl ::std::fmt::Display for ProposalCreateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ProposalCreateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ProposalDeleteContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ProposalDeleteContract { // message fields // @@protoc_insertion_point(field:protocol.ProposalDeleteContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ProposalDeleteContract.proposal_id) pub proposal_id: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ProposalDeleteContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ProposalDeleteContract { fn default() -> &'a ProposalDeleteContract { ::default_instance() } } impl ProposalDeleteContract { pub fn new() -> ProposalDeleteContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ProposalDeleteContract| { &m.owner_address }, |m: &mut ProposalDeleteContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "proposal_id", |m: &ProposalDeleteContract| { &m.proposal_id }, |m: &mut ProposalDeleteContract| { &mut m.proposal_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ProposalDeleteContract", fields, oneofs, ) } } impl ::protobuf::Message for ProposalDeleteContract { const NAME: &'static str = "ProposalDeleteContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.proposal_id = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.proposal_id != 0 { my_size += ::protobuf::rt::int64_size(2, self.proposal_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.proposal_id != 0 { os.write_int64(2, self.proposal_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ProposalDeleteContract { ProposalDeleteContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.proposal_id = 0; self.special_fields.clear(); } fn default_instance() -> &'static ProposalDeleteContract { static instance: ProposalDeleteContract = ProposalDeleteContract { owner_address: ::std::vec::Vec::new(), proposal_id: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ProposalDeleteContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ProposalDeleteContract").unwrap()).clone() } } impl ::std::fmt::Display for ProposalDeleteContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ProposalDeleteContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n%core/contract/proposal_contract.proto\x12\x08protocol\"\x87\x01\n\x17\ ProposalApproveContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0co\ wnerAddress\x12\x1f\n\x0bproposal_id\x18\x02\x20\x01(\x03R\nproposalId\ \x12&\n\x0fis_add_approval\x18\x03\x20\x01(\x08R\risAddApproval\"\xce\ \x01\n\x16ProposalCreateContract\x12#\n\rowner_address\x18\x01\x20\x01(\ \x0cR\x0cownerAddress\x12P\n\nparameters\x18\x02\x20\x03(\x0b20.protocol\ .ProposalCreateContract.ParametersEntryR\nparameters\x1a=\n\x0fParameter\ sEntry\x12\x10\n\x03key\x18\x01\x20\x01(\x03R\x03key\x12\x14\n\x05value\ \x18\x02\x20\x01(\x03R\x05value:\x028\x01\"^\n\x16ProposalDeleteContract\ \x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\x1f\n\ \x0bproposal_id\x18\x02\x20\x01(\x03R\nproposalIdBE\n\x18org.tron.protos\ .contractZ)github.com/tronprotocol/grpc-gateway/coreJ\xd7\x05\n\x06\x12\ \x04\0\0\x16\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\ \x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\x03\x04\0\ 1\"=Specify\x20the\x20name\x20of\x20the\x20package\x20that\x20generated\ \x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nx\n\x02\x08\ \x0b\x12\x03\x06\0@\x1amoption\x20java_outer_classname\x20=\x20\"Proposa\ lApproveContract\";\x20//Specify\x20the\x20class\x20name\x20of\x20the\ \x20generated\x20Java\x20file\n\n\n\n\x02\x04\0\x12\x04\x08\0\x0c\x01\n\ \n\n\x03\x04\0\x01\x12\x03\x08\x08\x1f\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\ \x02\x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\t\x02\x07\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x03\t\x08\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x18\ \x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\n\x02\x18\n\x0c\n\x05\x04\0\x02\ \x01\x05\x12\x03\n\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\n\x08\ \x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x16\x17\n%\n\x04\x04\0\x02\ \x02\x12\x03\x0b\x02\x1b\"\x18\x20add\x20or\x20remove\x20approval\n\n\ \x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x0b\x02\x06\n\x0c\n\x05\x04\0\x02\ \x02\x01\x12\x03\x0b\x07\x16\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x0b\ \x19\x1a\n\n\n\x02\x04\x01\x12\x04\x0e\0\x11\x01\n\n\n\x03\x04\x01\x01\ \x12\x03\x0e\x08\x1e\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x0f\x02\x1a\n\x0c\ \n\x05\x04\x01\x02\0\x05\x12\x03\x0f\x02\x07\n\x0c\n\x05\x04\x01\x02\0\ \x01\x12\x03\x0f\x08\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0f\x18\ \x19\n\x0b\n\x04\x04\x01\x02\x01\x12\x03\x10\x02#\n\x0c\n\x05\x04\x01\ \x02\x01\x06\x12\x03\x10\x02\x13\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\ \x10\x14\x1e\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\x10!\"\n\n\n\x02\ \x04\x02\x12\x04\x13\0\x16\x01\n\n\n\x03\x04\x02\x01\x12\x03\x13\x08\x1e\ \n\x0b\n\x04\x04\x02\x02\0\x12\x03\x14\x02\x1a\n\x0c\n\x05\x04\x02\x02\0\ \x05\x12\x03\x14\x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x14\x08\ \x15\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x14\x18\x19\n\x0b\n\x04\x04\ \x02\x02\x01\x12\x03\x15\x02\x18\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\ \x15\x02\x07\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x15\x08\x13\n\x0c\n\ \x05\x04\x02\x02\x01\x03\x12\x03\x15\x16\x17b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(3); messages.push(ProposalApproveContract::generated_message_descriptor_data()); messages.push(ProposalCreateContract::generated_message_descriptor_data()); messages.push(ProposalDeleteContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/shield_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/shield_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.AuthenticationPath) #[derive(PartialEq,Clone,Default,Debug)] pub struct AuthenticationPath { // message fields // @@protoc_insertion_point(field:protocol.AuthenticationPath.value) pub value: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.AuthenticationPath.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AuthenticationPath { fn default() -> &'a AuthenticationPath { ::default_instance() } } impl AuthenticationPath { pub fn new() -> AuthenticationPath { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "value", |m: &AuthenticationPath| { &m.value }, |m: &mut AuthenticationPath| { &mut m.value }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "AuthenticationPath", fields, oneofs, ) } } impl ::protobuf::Message for AuthenticationPath { const NAME: &'static str = "AuthenticationPath"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { is.read_repeated_packed_bool_into(&mut self.value)?; }, 8 => { self.value.push(is.read_bool()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; my_size += 2 * self.value.len() as u64; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.value { os.write_bool(1, *v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> AuthenticationPath { AuthenticationPath::new() } fn clear(&mut self) { self.value.clear(); self.special_fields.clear(); } fn default_instance() -> &'static AuthenticationPath { static instance: AuthenticationPath = AuthenticationPath { value: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for AuthenticationPath { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("AuthenticationPath").unwrap()).clone() } } impl ::std::fmt::Display for AuthenticationPath { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for AuthenticationPath { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.MerklePath) #[derive(PartialEq,Clone,Default,Debug)] pub struct MerklePath { // message fields // @@protoc_insertion_point(field:protocol.MerklePath.authentication_paths) pub authentication_paths: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MerklePath.index) pub index: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.MerklePath.rt) pub rt: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.MerklePath.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a MerklePath { fn default() -> &'a MerklePath { ::default_instance() } } impl MerklePath { pub fn new() -> MerklePath { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "authentication_paths", |m: &MerklePath| { &m.authentication_paths }, |m: &mut MerklePath| { &mut m.authentication_paths }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "index", |m: &MerklePath| { &m.index }, |m: &mut MerklePath| { &mut m.index }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "rt", |m: &MerklePath| { &m.rt }, |m: &mut MerklePath| { &mut m.rt }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "MerklePath", fields, oneofs, ) } } impl ::protobuf::Message for MerklePath { const NAME: &'static str = "MerklePath"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.authentication_paths.push(is.read_message()?); }, 18 => { is.read_repeated_packed_bool_into(&mut self.index)?; }, 16 => { self.index.push(is.read_bool()?); }, 26 => { self.rt = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.authentication_paths { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += 2 * self.index.len() as u64; if !self.rt.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.rt); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.authentication_paths { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; for v in &self.index { os.write_bool(2, *v)?; }; if !self.rt.is_empty() { os.write_bytes(3, &self.rt)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> MerklePath { MerklePath::new() } fn clear(&mut self) { self.authentication_paths.clear(); self.index.clear(); self.rt.clear(); self.special_fields.clear(); } fn default_instance() -> &'static MerklePath { static instance: MerklePath = MerklePath { authentication_paths: ::std::vec::Vec::new(), index: ::std::vec::Vec::new(), rt: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for MerklePath { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("MerklePath").unwrap()).clone() } } impl ::std::fmt::Display for MerklePath { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for MerklePath { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.OutputPoint) #[derive(PartialEq,Clone,Default,Debug)] pub struct OutputPoint { // message fields // @@protoc_insertion_point(field:protocol.OutputPoint.hash) pub hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.OutputPoint.index) pub index: i32, // special fields // @@protoc_insertion_point(special_field:protocol.OutputPoint.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a OutputPoint { fn default() -> &'a OutputPoint { ::default_instance() } } impl OutputPoint { pub fn new() -> OutputPoint { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "hash", |m: &OutputPoint| { &m.hash }, |m: &mut OutputPoint| { &mut m.hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "index", |m: &OutputPoint| { &m.index }, |m: &mut OutputPoint| { &mut m.index }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "OutputPoint", fields, oneofs, ) } } impl ::protobuf::Message for OutputPoint { const NAME: &'static str = "OutputPoint"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.hash = is.read_bytes()?; }, 16 => { self.index = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.hash.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.hash); } if self.index != 0 { my_size += ::protobuf::rt::int32_size(2, self.index); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.hash.is_empty() { os.write_bytes(1, &self.hash)?; } if self.index != 0 { os.write_int32(2, self.index)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> OutputPoint { OutputPoint::new() } fn clear(&mut self) { self.hash.clear(); self.index = 0; self.special_fields.clear(); } fn default_instance() -> &'static OutputPoint { static instance: OutputPoint = OutputPoint { hash: ::std::vec::Vec::new(), index: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for OutputPoint { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("OutputPoint").unwrap()).clone() } } impl ::std::fmt::Display for OutputPoint { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for OutputPoint { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.OutputPointInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct OutputPointInfo { // message fields // @@protoc_insertion_point(field:protocol.OutputPointInfo.out_points) pub out_points: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.OutputPointInfo.block_num) pub block_num: i32, // special fields // @@protoc_insertion_point(special_field:protocol.OutputPointInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a OutputPointInfo { fn default() -> &'a OutputPointInfo { ::default_instance() } } impl OutputPointInfo { pub fn new() -> OutputPointInfo { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "out_points", |m: &OutputPointInfo| { &m.out_points }, |m: &mut OutputPointInfo| { &mut m.out_points }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "block_num", |m: &OutputPointInfo| { &m.block_num }, |m: &mut OutputPointInfo| { &mut m.block_num }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "OutputPointInfo", fields, oneofs, ) } } impl ::protobuf::Message for OutputPointInfo { const NAME: &'static str = "OutputPointInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.out_points.push(is.read_message()?); }, 16 => { self.block_num = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.out_points { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.block_num != 0 { my_size += ::protobuf::rt::int32_size(2, self.block_num); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.out_points { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; if self.block_num != 0 { os.write_int32(2, self.block_num)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> OutputPointInfo { OutputPointInfo::new() } fn clear(&mut self) { self.out_points.clear(); self.block_num = 0; self.special_fields.clear(); } fn default_instance() -> &'static OutputPointInfo { static instance: OutputPointInfo = OutputPointInfo { out_points: ::std::vec::Vec::new(), block_num: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for OutputPointInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("OutputPointInfo").unwrap()).clone() } } impl ::std::fmt::Display for OutputPointInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for OutputPointInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.PedersenHash) #[derive(PartialEq,Clone,Default,Debug)] pub struct PedersenHash { // message fields // @@protoc_insertion_point(field:protocol.PedersenHash.content) pub content: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.PedersenHash.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a PedersenHash { fn default() -> &'a PedersenHash { ::default_instance() } } impl PedersenHash { pub fn new() -> PedersenHash { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "content", |m: &PedersenHash| { &m.content }, |m: &mut PedersenHash| { &mut m.content }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "PedersenHash", fields, oneofs, ) } } impl ::protobuf::Message for PedersenHash { const NAME: &'static str = "PedersenHash"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.content = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.content.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.content); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.content.is_empty() { os.write_bytes(1, &self.content)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> PedersenHash { PedersenHash::new() } fn clear(&mut self) { self.content.clear(); self.special_fields.clear(); } fn default_instance() -> &'static PedersenHash { static instance: PedersenHash = PedersenHash { content: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for PedersenHash { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("PedersenHash").unwrap()).clone() } } impl ::std::fmt::Display for PedersenHash { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for PedersenHash { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.IncrementalMerkleTree) #[derive(PartialEq,Clone,Default,Debug)] pub struct IncrementalMerkleTree { // message fields // @@protoc_insertion_point(field:protocol.IncrementalMerkleTree.left) pub left: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.IncrementalMerkleTree.right) pub right: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.IncrementalMerkleTree.parents) pub parents: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.IncrementalMerkleTree.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a IncrementalMerkleTree { fn default() -> &'a IncrementalMerkleTree { ::default_instance() } } impl IncrementalMerkleTree { pub fn new() -> IncrementalMerkleTree { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, PedersenHash>( "left", |m: &IncrementalMerkleTree| { &m.left }, |m: &mut IncrementalMerkleTree| { &mut m.left }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, PedersenHash>( "right", |m: &IncrementalMerkleTree| { &m.right }, |m: &mut IncrementalMerkleTree| { &mut m.right }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "parents", |m: &IncrementalMerkleTree| { &m.parents }, |m: &mut IncrementalMerkleTree| { &mut m.parents }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "IncrementalMerkleTree", fields, oneofs, ) } } impl ::protobuf::Message for IncrementalMerkleTree { const NAME: &'static str = "IncrementalMerkleTree"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.left)?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.right)?; }, 26 => { self.parents.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.left.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if let Some(v) = self.right.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.parents { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.left.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if let Some(v) = self.right.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } for v in &self.parents { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> IncrementalMerkleTree { IncrementalMerkleTree::new() } fn clear(&mut self) { self.left.clear(); self.right.clear(); self.parents.clear(); self.special_fields.clear(); } fn default_instance() -> &'static IncrementalMerkleTree { static instance: IncrementalMerkleTree = IncrementalMerkleTree { left: ::protobuf::MessageField::none(), right: ::protobuf::MessageField::none(), parents: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for IncrementalMerkleTree { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("IncrementalMerkleTree").unwrap()).clone() } } impl ::std::fmt::Display for IncrementalMerkleTree { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for IncrementalMerkleTree { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.IncrementalMerkleVoucher) #[derive(PartialEq,Clone,Default,Debug)] pub struct IncrementalMerkleVoucher { // message fields // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.tree) pub tree: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.filled) pub filled: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.cursor) pub cursor: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.cursor_depth) pub cursor_depth: i64, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.rt) pub rt: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucher.output_point) pub output_point: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.IncrementalMerkleVoucher.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a IncrementalMerkleVoucher { fn default() -> &'a IncrementalMerkleVoucher { ::default_instance() } } impl IncrementalMerkleVoucher { pub fn new() -> IncrementalMerkleVoucher { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IncrementalMerkleTree>( "tree", |m: &IncrementalMerkleVoucher| { &m.tree }, |m: &mut IncrementalMerkleVoucher| { &mut m.tree }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "filled", |m: &IncrementalMerkleVoucher| { &m.filled }, |m: &mut IncrementalMerkleVoucher| { &mut m.filled }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, IncrementalMerkleTree>( "cursor", |m: &IncrementalMerkleVoucher| { &m.cursor }, |m: &mut IncrementalMerkleVoucher| { &mut m.cursor }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "cursor_depth", |m: &IncrementalMerkleVoucher| { &m.cursor_depth }, |m: &mut IncrementalMerkleVoucher| { &mut m.cursor_depth }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "rt", |m: &IncrementalMerkleVoucher| { &m.rt }, |m: &mut IncrementalMerkleVoucher| { &mut m.rt }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, OutputPoint>( "output_point", |m: &IncrementalMerkleVoucher| { &m.output_point }, |m: &mut IncrementalMerkleVoucher| { &mut m.output_point }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "IncrementalMerkleVoucher", fields, oneofs, ) } } impl ::protobuf::Message for IncrementalMerkleVoucher { const NAME: &'static str = "IncrementalMerkleVoucher"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.tree)?; }, 18 => { self.filled.push(is.read_message()?); }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.cursor)?; }, 32 => { self.cursor_depth = is.read_int64()?; }, 42 => { self.rt = is.read_bytes()?; }, 82 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.output_point)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.tree.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } for value in &self.filled { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if let Some(v) = self.cursor.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.cursor_depth != 0 { my_size += ::protobuf::rt::int64_size(4, self.cursor_depth); } if !self.rt.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.rt); } if let Some(v) = self.output_point.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.tree.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } for v in &self.filled { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; if let Some(v) = self.cursor.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } if self.cursor_depth != 0 { os.write_int64(4, self.cursor_depth)?; } if !self.rt.is_empty() { os.write_bytes(5, &self.rt)?; } if let Some(v) = self.output_point.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(10, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> IncrementalMerkleVoucher { IncrementalMerkleVoucher::new() } fn clear(&mut self) { self.tree.clear(); self.filled.clear(); self.cursor.clear(); self.cursor_depth = 0; self.rt.clear(); self.output_point.clear(); self.special_fields.clear(); } fn default_instance() -> &'static IncrementalMerkleVoucher { static instance: IncrementalMerkleVoucher = IncrementalMerkleVoucher { tree: ::protobuf::MessageField::none(), filled: ::std::vec::Vec::new(), cursor: ::protobuf::MessageField::none(), cursor_depth: 0, rt: ::std::vec::Vec::new(), output_point: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for IncrementalMerkleVoucher { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("IncrementalMerkleVoucher").unwrap()).clone() } } impl ::std::fmt::Display for IncrementalMerkleVoucher { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for IncrementalMerkleVoucher { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.IncrementalMerkleVoucherInfo) #[derive(PartialEq,Clone,Default,Debug)] pub struct IncrementalMerkleVoucherInfo { // message fields // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucherInfo.vouchers) pub vouchers: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.IncrementalMerkleVoucherInfo.paths) pub paths: ::std::vec::Vec<::std::vec::Vec>, // special fields // @@protoc_insertion_point(special_field:protocol.IncrementalMerkleVoucherInfo.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a IncrementalMerkleVoucherInfo { fn default() -> &'a IncrementalMerkleVoucherInfo { ::default_instance() } } impl IncrementalMerkleVoucherInfo { pub fn new() -> IncrementalMerkleVoucherInfo { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "vouchers", |m: &IncrementalMerkleVoucherInfo| { &m.vouchers }, |m: &mut IncrementalMerkleVoucherInfo| { &mut m.vouchers }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "paths", |m: &IncrementalMerkleVoucherInfo| { &m.paths }, |m: &mut IncrementalMerkleVoucherInfo| { &mut m.paths }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "IncrementalMerkleVoucherInfo", fields, oneofs, ) } } impl ::protobuf::Message for IncrementalMerkleVoucherInfo { const NAME: &'static str = "IncrementalMerkleVoucherInfo"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.vouchers.push(is.read_message()?); }, 18 => { self.paths.push(is.read_bytes()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.vouchers { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.paths { my_size += ::protobuf::rt::bytes_size(2, &value); }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.vouchers { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; for v in &self.paths { os.write_bytes(2, &v)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> IncrementalMerkleVoucherInfo { IncrementalMerkleVoucherInfo::new() } fn clear(&mut self) { self.vouchers.clear(); self.paths.clear(); self.special_fields.clear(); } fn default_instance() -> &'static IncrementalMerkleVoucherInfo { static instance: IncrementalMerkleVoucherInfo = IncrementalMerkleVoucherInfo { vouchers: ::std::vec::Vec::new(), paths: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for IncrementalMerkleVoucherInfo { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("IncrementalMerkleVoucherInfo").unwrap()).clone() } } impl ::std::fmt::Display for IncrementalMerkleVoucherInfo { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for IncrementalMerkleVoucherInfo { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.SpendDescription) #[derive(PartialEq,Clone,Default,Debug)] pub struct SpendDescription { // message fields // @@protoc_insertion_point(field:protocol.SpendDescription.value_commitment) pub value_commitment: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SpendDescription.anchor) pub anchor: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SpendDescription.nullifier) pub nullifier: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SpendDescription.rk) pub rk: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SpendDescription.zkproof) pub zkproof: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SpendDescription.spend_authority_signature) pub spend_authority_signature: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.SpendDescription.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SpendDescription { fn default() -> &'a SpendDescription { ::default_instance() } } impl SpendDescription { pub fn new() -> SpendDescription { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "value_commitment", |m: &SpendDescription| { &m.value_commitment }, |m: &mut SpendDescription| { &mut m.value_commitment }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "anchor", |m: &SpendDescription| { &m.anchor }, |m: &mut SpendDescription| { &mut m.anchor }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "nullifier", |m: &SpendDescription| { &m.nullifier }, |m: &mut SpendDescription| { &mut m.nullifier }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "rk", |m: &SpendDescription| { &m.rk }, |m: &mut SpendDescription| { &mut m.rk }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "zkproof", |m: &SpendDescription| { &m.zkproof }, |m: &mut SpendDescription| { &mut m.zkproof }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "spend_authority_signature", |m: &SpendDescription| { &m.spend_authority_signature }, |m: &mut SpendDescription| { &mut m.spend_authority_signature }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SpendDescription", fields, oneofs, ) } } impl ::protobuf::Message for SpendDescription { const NAME: &'static str = "SpendDescription"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.value_commitment = is.read_bytes()?; }, 18 => { self.anchor = is.read_bytes()?; }, 26 => { self.nullifier = is.read_bytes()?; }, 34 => { self.rk = is.read_bytes()?; }, 42 => { self.zkproof = is.read_bytes()?; }, 50 => { self.spend_authority_signature = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.value_commitment.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.value_commitment); } if !self.anchor.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.anchor); } if !self.nullifier.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.nullifier); } if !self.rk.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.rk); } if !self.zkproof.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.zkproof); } if !self.spend_authority_signature.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.spend_authority_signature); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.value_commitment.is_empty() { os.write_bytes(1, &self.value_commitment)?; } if !self.anchor.is_empty() { os.write_bytes(2, &self.anchor)?; } if !self.nullifier.is_empty() { os.write_bytes(3, &self.nullifier)?; } if !self.rk.is_empty() { os.write_bytes(4, &self.rk)?; } if !self.zkproof.is_empty() { os.write_bytes(5, &self.zkproof)?; } if !self.spend_authority_signature.is_empty() { os.write_bytes(6, &self.spend_authority_signature)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SpendDescription { SpendDescription::new() } fn clear(&mut self) { self.value_commitment.clear(); self.anchor.clear(); self.nullifier.clear(); self.rk.clear(); self.zkproof.clear(); self.spend_authority_signature.clear(); self.special_fields.clear(); } fn default_instance() -> &'static SpendDescription { static instance: SpendDescription = SpendDescription { value_commitment: ::std::vec::Vec::new(), anchor: ::std::vec::Vec::new(), nullifier: ::std::vec::Vec::new(), rk: ::std::vec::Vec::new(), zkproof: ::std::vec::Vec::new(), spend_authority_signature: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SpendDescription { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SpendDescription").unwrap()).clone() } } impl ::std::fmt::Display for SpendDescription { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SpendDescription { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ReceiveDescription) #[derive(PartialEq,Clone,Default,Debug)] pub struct ReceiveDescription { // message fields // @@protoc_insertion_point(field:protocol.ReceiveDescription.value_commitment) pub value_commitment: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ReceiveDescription.note_commitment) pub note_commitment: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ReceiveDescription.epk) pub epk: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ReceiveDescription.c_enc) pub c_enc: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ReceiveDescription.c_out) pub c_out: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ReceiveDescription.zkproof) pub zkproof: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.ReceiveDescription.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ReceiveDescription { fn default() -> &'a ReceiveDescription { ::default_instance() } } impl ReceiveDescription { pub fn new() -> ReceiveDescription { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "value_commitment", |m: &ReceiveDescription| { &m.value_commitment }, |m: &mut ReceiveDescription| { &mut m.value_commitment }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "note_commitment", |m: &ReceiveDescription| { &m.note_commitment }, |m: &mut ReceiveDescription| { &mut m.note_commitment }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "epk", |m: &ReceiveDescription| { &m.epk }, |m: &mut ReceiveDescription| { &mut m.epk }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "c_enc", |m: &ReceiveDescription| { &m.c_enc }, |m: &mut ReceiveDescription| { &mut m.c_enc }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "c_out", |m: &ReceiveDescription| { &m.c_out }, |m: &mut ReceiveDescription| { &mut m.c_out }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "zkproof", |m: &ReceiveDescription| { &m.zkproof }, |m: &mut ReceiveDescription| { &mut m.zkproof }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ReceiveDescription", fields, oneofs, ) } } impl ::protobuf::Message for ReceiveDescription { const NAME: &'static str = "ReceiveDescription"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.value_commitment = is.read_bytes()?; }, 18 => { self.note_commitment = is.read_bytes()?; }, 26 => { self.epk = is.read_bytes()?; }, 34 => { self.c_enc = is.read_bytes()?; }, 42 => { self.c_out = is.read_bytes()?; }, 50 => { self.zkproof = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.value_commitment.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.value_commitment); } if !self.note_commitment.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.note_commitment); } if !self.epk.is_empty() { my_size += ::protobuf::rt::bytes_size(3, &self.epk); } if !self.c_enc.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.c_enc); } if !self.c_out.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.c_out); } if !self.zkproof.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.zkproof); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.value_commitment.is_empty() { os.write_bytes(1, &self.value_commitment)?; } if !self.note_commitment.is_empty() { os.write_bytes(2, &self.note_commitment)?; } if !self.epk.is_empty() { os.write_bytes(3, &self.epk)?; } if !self.c_enc.is_empty() { os.write_bytes(4, &self.c_enc)?; } if !self.c_out.is_empty() { os.write_bytes(5, &self.c_out)?; } if !self.zkproof.is_empty() { os.write_bytes(6, &self.zkproof)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ReceiveDescription { ReceiveDescription::new() } fn clear(&mut self) { self.value_commitment.clear(); self.note_commitment.clear(); self.epk.clear(); self.c_enc.clear(); self.c_out.clear(); self.zkproof.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ReceiveDescription { static instance: ReceiveDescription = ReceiveDescription { value_commitment: ::std::vec::Vec::new(), note_commitment: ::std::vec::Vec::new(), epk: ::std::vec::Vec::new(), c_enc: ::std::vec::Vec::new(), c_out: ::std::vec::Vec::new(), zkproof: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ReceiveDescription { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ReceiveDescription").unwrap()).clone() } } impl ::std::fmt::Display for ReceiveDescription { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ReceiveDescription { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ShieldedTransferContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ShieldedTransferContract { // message fields // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.transparent_from_address) pub transparent_from_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.from_amount) pub from_amount: i64, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.spend_description) pub spend_description: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.receive_description) pub receive_description: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.binding_signature) pub binding_signature: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.transparent_to_address) pub transparent_to_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ShieldedTransferContract.to_amount) pub to_amount: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ShieldedTransferContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ShieldedTransferContract { fn default() -> &'a ShieldedTransferContract { ::default_instance() } } impl ShieldedTransferContract { pub fn new() -> ShieldedTransferContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(7); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "transparent_from_address", |m: &ShieldedTransferContract| { &m.transparent_from_address }, |m: &mut ShieldedTransferContract| { &mut m.transparent_from_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "from_amount", |m: &ShieldedTransferContract| { &m.from_amount }, |m: &mut ShieldedTransferContract| { &mut m.from_amount }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "spend_description", |m: &ShieldedTransferContract| { &m.spend_description }, |m: &mut ShieldedTransferContract| { &mut m.spend_description }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "receive_description", |m: &ShieldedTransferContract| { &m.receive_description }, |m: &mut ShieldedTransferContract| { &mut m.receive_description }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "binding_signature", |m: &ShieldedTransferContract| { &m.binding_signature }, |m: &mut ShieldedTransferContract| { &mut m.binding_signature }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "transparent_to_address", |m: &ShieldedTransferContract| { &m.transparent_to_address }, |m: &mut ShieldedTransferContract| { &mut m.transparent_to_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "to_amount", |m: &ShieldedTransferContract| { &m.to_amount }, |m: &mut ShieldedTransferContract| { &mut m.to_amount }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ShieldedTransferContract", fields, oneofs, ) } } impl ::protobuf::Message for ShieldedTransferContract { const NAME: &'static str = "ShieldedTransferContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.transparent_from_address = is.read_bytes()?; }, 16 => { self.from_amount = is.read_int64()?; }, 26 => { self.spend_description.push(is.read_message()?); }, 34 => { self.receive_description.push(is.read_message()?); }, 42 => { self.binding_signature = is.read_bytes()?; }, 50 => { self.transparent_to_address = is.read_bytes()?; }, 56 => { self.to_amount = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.transparent_from_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.transparent_from_address); } if self.from_amount != 0 { my_size += ::protobuf::rt::int64_size(2, self.from_amount); } for value in &self.spend_description { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.receive_description { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if !self.binding_signature.is_empty() { my_size += ::protobuf::rt::bytes_size(5, &self.binding_signature); } if !self.transparent_to_address.is_empty() { my_size += ::protobuf::rt::bytes_size(6, &self.transparent_to_address); } if self.to_amount != 0 { my_size += ::protobuf::rt::int64_size(7, self.to_amount); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.transparent_from_address.is_empty() { os.write_bytes(1, &self.transparent_from_address)?; } if self.from_amount != 0 { os.write_int64(2, self.from_amount)?; } for v in &self.spend_description { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; }; for v in &self.receive_description { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; if !self.binding_signature.is_empty() { os.write_bytes(5, &self.binding_signature)?; } if !self.transparent_to_address.is_empty() { os.write_bytes(6, &self.transparent_to_address)?; } if self.to_amount != 0 { os.write_int64(7, self.to_amount)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ShieldedTransferContract { ShieldedTransferContract::new() } fn clear(&mut self) { self.transparent_from_address.clear(); self.from_amount = 0; self.spend_description.clear(); self.receive_description.clear(); self.binding_signature.clear(); self.transparent_to_address.clear(); self.to_amount = 0; self.special_fields.clear(); } fn default_instance() -> &'static ShieldedTransferContract { static instance: ShieldedTransferContract = ShieldedTransferContract { transparent_from_address: ::std::vec::Vec::new(), from_amount: 0, spend_description: ::std::vec::Vec::new(), receive_description: ::std::vec::Vec::new(), binding_signature: ::std::vec::Vec::new(), transparent_to_address: ::std::vec::Vec::new(), to_amount: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ShieldedTransferContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ShieldedTransferContract").unwrap()).clone() } } impl ::std::fmt::Display for ShieldedTransferContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ShieldedTransferContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n#core/contract/shield_contract.proto\x12\x08protocol\"*\n\x12Authentic\ ationPath\x12\x14\n\x05value\x18\x01\x20\x03(\x08R\x05value\"\x83\x01\n\ \nMerklePath\x12O\n\x14authentication_paths\x18\x01\x20\x03(\x0b2\x1c.pr\ otocol.AuthenticationPathR\x13authenticationPaths\x12\x14\n\x05index\x18\ \x02\x20\x03(\x08R\x05index\x12\x0e\n\x02rt\x18\x03\x20\x01(\x0cR\x02rt\ \"7\n\x0bOutputPoint\x12\x12\n\x04hash\x18\x01\x20\x01(\x0cR\x04hash\x12\ \x14\n\x05index\x18\x02\x20\x01(\x05R\x05index\"d\n\x0fOutputPointInfo\ \x124\n\nout_points\x18\x01\x20\x03(\x0b2\x15.protocol.OutputPointR\tout\ Points\x12\x1b\n\tblock_num\x18\x02\x20\x01(\x05R\x08blockNum\"(\n\x0cPe\ dersenHash\x12\x18\n\x07content\x18\x01\x20\x01(\x0cR\x07content\"\xa3\ \x01\n\x15IncrementalMerkleTree\x12*\n\x04left\x18\x01\x20\x01(\x0b2\x16\ .protocol.PedersenHashR\x04left\x12,\n\x05right\x18\x02\x20\x01(\x0b2\ \x16.protocol.PedersenHashR\x05right\x120\n\x07parents\x18\x03\x20\x03(\ \x0b2\x16.protocol.PedersenHashR\x07parents\"\xa5\x02\n\x18IncrementalMe\ rkleVoucher\x123\n\x04tree\x18\x01\x20\x01(\x0b2\x1f.protocol.Incrementa\ lMerkleTreeR\x04tree\x12.\n\x06filled\x18\x02\x20\x03(\x0b2\x16.protocol\ .PedersenHashR\x06filled\x127\n\x06cursor\x18\x03\x20\x01(\x0b2\x1f.prot\ ocol.IncrementalMerkleTreeR\x06cursor\x12!\n\x0ccursor_depth\x18\x04\x20\ \x01(\x03R\x0bcursorDepth\x12\x0e\n\x02rt\x18\x05\x20\x01(\x0cR\x02rt\ \x128\n\x0coutput_point\x18\n\x20\x01(\x0b2\x15.protocol.OutputPointR\ \x0boutputPoint\"t\n\x1cIncrementalMerkleVoucherInfo\x12>\n\x08vouchers\ \x18\x01\x20\x03(\x0b2\".protocol.IncrementalMerkleVoucherR\x08vouchers\ \x12\x14\n\x05paths\x18\x02\x20\x03(\x0cR\x05paths\"\xd9\x01\n\x10SpendD\ escription\x12)\n\x10value_commitment\x18\x01\x20\x01(\x0cR\x0fvalueComm\ itment\x12\x16\n\x06anchor\x18\x02\x20\x01(\x0cR\x06anchor\x12\x1c\n\tnu\ llifier\x18\x03\x20\x01(\x0cR\tnullifier\x12\x0e\n\x02rk\x18\x04\x20\x01\ (\x0cR\x02rk\x12\x18\n\x07zkproof\x18\x05\x20\x01(\x0cR\x07zkproof\x12:\ \n\x19spend_authority_signature\x18\x06\x20\x01(\x0cR\x17spendAuthorityS\ ignature\"\xbe\x01\n\x12ReceiveDescription\x12)\n\x10value_commitment\ \x18\x01\x20\x01(\x0cR\x0fvalueCommitment\x12'\n\x0fnote_commitment\x18\ \x02\x20\x01(\x0cR\x0enoteCommitment\x12\x10\n\x03epk\x18\x03\x20\x01(\ \x0cR\x03epk\x12\x13\n\x05c_enc\x18\x04\x20\x01(\x0cR\x04cEnc\x12\x13\n\ \x05c_out\x18\x05\x20\x01(\x0cR\x04cOut\x12\x18\n\x07zkproof\x18\x06\x20\ \x01(\x0cR\x07zkproof\"\x8d\x03\n\x18ShieldedTransferContract\x128\n\x18\ transparent_from_address\x18\x01\x20\x01(\x0cR\x16transparentFromAddress\ \x12\x1f\n\x0bfrom_amount\x18\x02\x20\x01(\x03R\nfromAmount\x12G\n\x11sp\ end_description\x18\x03\x20\x03(\x0b2\x1a.protocol.SpendDescriptionR\x10\ spendDescription\x12M\n\x13receive_description\x18\x04\x20\x03(\x0b2\x1c\ .protocol.ReceiveDescriptionR\x12receiveDescription\x12+\n\x11binding_si\ gnature\x18\x05\x20\x01(\x0cR\x10bindingSignature\x124\n\x16transparent_\ to_address\x18\x06\x20\x01(\x0cR\x14transparentToAddress\x12\x1b\n\tto_a\ mount\x18\x07\x20\x01(\x03R\x08toAmountBE\n\x18org.tron.protos.contractZ\ )github.com/tronprotocol/grpc-gateway/coreJ\xa5\x18\n\x06\x12\x04\0\0P\ \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x11\n\ \x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\x03\x04\01\"=Specify\ \x20the\x20name\x20of\x20the\x20package\x20that\x20generated\x20the\x20J\ ava\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\ny\n\x02\x08\x0b\x12\x03\ \x06\0@\x1anoption\x20java_outer_classname\x20=\x20\"ShieldedTransferCon\ tract\";\x20//Specify\x20the\x20class\x20name\x20of\x20the\x20generated\ \x20Java\x20file\n\n&\n\x02\x04\0\x12\x04\n\0\x0c\x012\x1a\x20for\x20shi\ elded\x20transaction\n\n\n\n\x03\x04\0\x01\x12\x03\n\x08\x1a\n\x0b\n\x04\ \x04\0\x02\0\x12\x03\x0b\x02\x1a\n\x0c\n\x05\x04\0\x02\0\x04\x12\x03\x0b\ \x02\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0b\x0b\x0f\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x03\x0b\x10\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x0b\ \x18\x19\n\n\n\x02\x04\x01\x12\x04\x0e\0\x12\x01\n\n\n\x03\x04\x01\x01\ \x12\x03\x0e\x08\x12\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x0f\x027\n\x0c\n\ \x05\x04\x01\x02\0\x04\x12\x03\x0f\x02\n\n\x0c\n\x05\x04\x01\x02\0\x06\ \x12\x03\x0f\x0b\x1d\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x0f\x1e2\n\ \x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0f56\n\x0b\n\x04\x04\x01\x02\x01\ \x12\x03\x10\x02\x1a\n\x0c\n\x05\x04\x01\x02\x01\x04\x12\x03\x10\x02\n\n\ \x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x10\x0b\x0f\n\x0c\n\x05\x04\x01\ \x02\x01\x01\x12\x03\x10\x10\x15\n\x0c\n\x05\x04\x01\x02\x01\x03\x12\x03\ \x10\x18\x19\n\x0b\n\x04\x04\x01\x02\x02\x12\x03\x11\x02\x0f\n\x0c\n\x05\ \x04\x01\x02\x02\x05\x12\x03\x11\x02\x07\n\x0c\n\x05\x04\x01\x02\x02\x01\ \x12\x03\x11\x08\n\n\x0c\n\x05\x04\x01\x02\x02\x03\x12\x03\x11\r\x0e\n\n\ \n\x02\x04\x02\x12\x04\x14\0\x17\x01\n\n\n\x03\x04\x02\x01\x12\x03\x14\ \x08\x13\n\x0b\n\x04\x04\x02\x02\0\x12\x03\x15\x02\x11\n\x0c\n\x05\x04\ \x02\x02\0\x05\x12\x03\x15\x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\ \x15\x08\x0c\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x15\x0f\x10\n\x0b\n\ \x04\x04\x02\x02\x01\x12\x03\x16\x02\x12\n\x0c\n\x05\x04\x02\x02\x01\x05\ \x12\x03\x16\x02\x07\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x16\x08\r\n\ \x0c\n\x05\x04\x02\x02\x01\x03\x12\x03\x16\x10\x11\n\n\n\x02\x04\x03\x12\ \x04\x19\0\x1c\x01\n\n\n\x03\x04\x03\x01\x12\x03\x19\x08\x17\n\x0b\n\x04\ \x04\x03\x02\0\x12\x03\x1a\x02&\n\x0c\n\x05\x04\x03\x02\0\x04\x12\x03\ \x1a\x02\n\n\x0c\n\x05\x04\x03\x02\0\x06\x12\x03\x1a\x0b\x16\n\x0c\n\x05\ \x04\x03\x02\0\x01\x12\x03\x1a\x17!\n\x0c\n\x05\x04\x03\x02\0\x03\x12\ \x03\x1a$%\n\x0b\n\x04\x04\x03\x02\x01\x12\x03\x1b\x02\x16\n\x0c\n\x05\ \x04\x03\x02\x01\x05\x12\x03\x1b\x02\x07\n\x0c\n\x05\x04\x03\x02\x01\x01\ \x12\x03\x1b\x08\x11\n\x0c\n\x05\x04\x03\x02\x01\x03\x12\x03\x1b\x14\x15\ \n\n\n\x02\x04\x04\x12\x04\x1e\0\x20\x01\n\n\n\x03\x04\x04\x01\x12\x03\ \x1e\x08\x14\n\x0b\n\x04\x04\x04\x02\0\x12\x03\x1f\x02\x14\n\x0c\n\x05\ \x04\x04\x02\0\x05\x12\x03\x1f\x02\x07\n\x0c\n\x05\x04\x04\x02\0\x01\x12\ \x03\x1f\x08\x0f\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03\x1f\x12\x13\n\n\n\ \x02\x04\x05\x12\x04\"\0&\x01\n\n\n\x03\x04\x05\x01\x12\x03\"\x08\x1d\n\ \x0b\n\x04\x04\x05\x02\0\x12\x03#\x02\x18\n\x0c\n\x05\x04\x05\x02\0\x06\ \x12\x03#\x02\x0e\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x03#\x0f\x13\n\x0c\n\ \x05\x04\x05\x02\0\x03\x12\x03#\x16\x17\n\x0b\n\x04\x04\x05\x02\x01\x12\ \x03$\x02\x19\n\x0c\n\x05\x04\x05\x02\x01\x06\x12\x03$\x02\x0e\n\x0c\n\ \x05\x04\x05\x02\x01\x01\x12\x03$\x0f\x14\n\x0c\n\x05\x04\x05\x02\x01\ \x03\x12\x03$\x17\x18\n\x0b\n\x04\x04\x05\x02\x02\x12\x03%\x02$\n\x0c\n\ \x05\x04\x05\x02\x02\x04\x12\x03%\x02\n\n\x0c\n\x05\x04\x05\x02\x02\x06\ \x12\x03%\x0b\x17\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03%\x18\x1f\n\x0c\ \n\x05\x04\x05\x02\x02\x03\x12\x03%\"#\n\n\n\x02\x04\x06\x12\x04(\0/\x01\ \n\n\n\x03\x04\x06\x01\x12\x03(\x08\x20\n\x0b\n\x04\x04\x06\x02\0\x12\ \x03)\x02!\n\x0c\n\x05\x04\x06\x02\0\x06\x12\x03)\x02\x17\n\x0c\n\x05\ \x04\x06\x02\0\x01\x12\x03)\x18\x1c\n\x0c\n\x05\x04\x06\x02\0\x03\x12\ \x03)\x1f\x20\n\x0b\n\x04\x04\x06\x02\x01\x12\x03*\x02#\n\x0c\n\x05\x04\ \x06\x02\x01\x04\x12\x03*\x02\n\n\x0c\n\x05\x04\x06\x02\x01\x06\x12\x03*\ \x0b\x17\n\x0c\n\x05\x04\x06\x02\x01\x01\x12\x03*\x18\x1e\n\x0c\n\x05\ \x04\x06\x02\x01\x03\x12\x03*!\"\n\x0b\n\x04\x04\x06\x02\x02\x12\x03+\ \x02#\n\x0c\n\x05\x04\x06\x02\x02\x06\x12\x03+\x02\x17\n\x0c\n\x05\x04\ \x06\x02\x02\x01\x12\x03+\x18\x1e\n\x0c\n\x05\x04\x06\x02\x02\x03\x12\ \x03+!\"\n\x0b\n\x04\x04\x06\x02\x03\x12\x03,\x02\x19\n\x0c\n\x05\x04\ \x06\x02\x03\x05\x12\x03,\x02\x07\n\x0c\n\x05\x04\x06\x02\x03\x01\x12\ \x03,\x08\x14\n\x0c\n\x05\x04\x06\x02\x03\x03\x12\x03,\x17\x18\n\x0b\n\ \x04\x04\x06\x02\x04\x12\x03-\x02\x0f\n\x0c\n\x05\x04\x06\x02\x04\x05\ \x12\x03-\x02\x07\n\x0c\n\x05\x04\x06\x02\x04\x01\x12\x03-\x08\n\n\x0c\n\ \x05\x04\x06\x02\x04\x03\x12\x03-\r\x0e\n\x0b\n\x04\x04\x06\x02\x05\x12\ \x03.\x02\x20\n\x0c\n\x05\x04\x06\x02\x05\x06\x12\x03.\x02\r\n\x0c\n\x05\ \x04\x06\x02\x05\x01\x12\x03.\x0e\x1a\n\x0c\n\x05\x04\x06\x02\x05\x03\ \x12\x03.\x1d\x1f\n\n\n\x02\x04\x07\x12\x041\04\x01\n\n\n\x03\x04\x07\ \x01\x12\x031\x08$\n\x0b\n\x04\x04\x07\x02\0\x12\x032\x021\n\x0c\n\x05\ \x04\x07\x02\0\x04\x12\x032\x02\n\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x032\ \x0b#\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x032$,\n\x0c\n\x05\x04\x07\x02\0\ \x03\x12\x032/0\n\x0b\n\x04\x04\x07\x02\x01\x12\x033\x02\x1b\n\x0c\n\x05\ \x04\x07\x02\x01\x04\x12\x033\x02\n\n\x0c\n\x05\x04\x07\x02\x01\x05\x12\ \x033\x0b\x10\n\x0c\n\x05\x04\x07\x02\x01\x01\x12\x033\x11\x16\n\x0c\n\ \x05\x04\x07\x02\x01\x03\x12\x033\x19\x1a\n\n\n\x02\x04\x08\x12\x046\0=\ \x01\n\n\n\x03\x04\x08\x01\x12\x036\x08\x18\n\x0b\n\x04\x04\x08\x02\0\ \x12\x037\x02\x1d\n\x0c\n\x05\x04\x08\x02\0\x05\x12\x037\x02\x07\n\x0c\n\ \x05\x04\x08\x02\0\x01\x12\x037\x08\x18\n\x0c\n\x05\x04\x08\x02\0\x03\ \x12\x037\x1b\x1c\n\x1a\n\x04\x04\x08\x02\x01\x12\x038\x02\x13\"\r\x20me\ rkle\x20root\n\n\x0c\n\x05\x04\x08\x02\x01\x05\x12\x038\x02\x07\n\x0c\n\ \x05\x04\x08\x02\x01\x01\x12\x038\x08\x0e\n\x0c\n\x05\x04\x08\x02\x01\ \x03\x12\x038\x11\x12\n*\n\x04\x04\x08\x02\x02\x12\x039\x02\x16\"\x1d\ \x20used\x20for\x20check\x20double\x20spend\n\n\x0c\n\x05\x04\x08\x02\ \x02\x05\x12\x039\x02\x07\n\x0c\n\x05\x04\x08\x02\x02\x01\x12\x039\x08\ \x11\n\x0c\n\x05\x04\x08\x02\x02\x03\x12\x039\x14\x15\n7\n\x04\x04\x08\ \x02\x03\x12\x03:\x02\x0f\"*\x20used\x20for\x20check\x20spend\x20authori\ ty\x20signature\n\n\x0c\n\x05\x04\x08\x02\x03\x05\x12\x03:\x02\x07\n\x0c\ \n\x05\x04\x08\x02\x03\x01\x12\x03:\x08\n\n\x0c\n\x05\x04\x08\x02\x03\ \x03\x12\x03:\r\x0e\n\x0b\n\x04\x04\x08\x02\x04\x12\x03;\x02\x14\n\x0c\n\ \x05\x04\x08\x02\x04\x05\x12\x03;\x02\x07\n\x0c\n\x05\x04\x08\x02\x04\ \x01\x12\x03;\x08\x0f\n\x0c\n\x05\x04\x08\x02\x04\x03\x12\x03;\x12\x13\n\ \x0b\n\x04\x04\x08\x02\x05\x12\x03<\x02&\n\x0c\n\x05\x04\x08\x02\x05\x05\ \x12\x03<\x02\x07\n\x0c\n\x05\x04\x08\x02\x05\x01\x12\x03<\x08!\n\x0c\n\ \x05\x04\x08\x02\x05\x03\x12\x03<$%\n\n\n\x02\x04\t\x12\x04?\0F\x01\n\n\ \n\x03\x04\t\x01\x12\x03?\x08\x1a\n\x0b\n\x04\x04\t\x02\0\x12\x03@\x02\ \x1d\n\x0c\n\x05\x04\t\x02\0\x05\x12\x03@\x02\x07\n\x0c\n\x05\x04\t\x02\ \0\x01\x12\x03@\x08\x18\n\x0c\n\x05\x04\t\x02\0\x03\x12\x03@\x1b\x1c\n\ \x0b\n\x04\x04\t\x02\x01\x12\x03A\x02\x1c\n\x0c\n\x05\x04\t\x02\x01\x05\ \x12\x03A\x02\x07\n\x0c\n\x05\x04\t\x02\x01\x01\x12\x03A\x08\x17\n\x0c\n\ \x05\x04\t\x02\x01\x03\x12\x03A\x1a\x1b\n\x1d\n\x04\x04\t\x02\x02\x12\ \x03B\x02\x10\"\x10\x20for\x20Encryption\n\n\x0c\n\x05\x04\t\x02\x02\x05\ \x12\x03B\x02\x07\n\x0c\n\x05\x04\t\x02\x02\x01\x12\x03B\x08\x0b\n\x0c\n\ \x05\x04\t\x02\x02\x03\x12\x03B\x0e\x0f\n;\n\x04\x04\t\x02\x03\x12\x03C\ \x02\x12\".\x20Encryption\x20for\x20incoming,\x20decrypt\x20it\x20with\ \x20ivk\n\n\x0c\n\x05\x04\t\x02\x03\x05\x12\x03C\x02\x07\n\x0c\n\x05\x04\ \t\x02\x03\x01\x12\x03C\x08\r\n\x0c\n\x05\x04\t\x02\x03\x03\x12\x03C\x10\ \x11\n8\n\x04\x04\t\x02\x04\x12\x03D\x02\x12\"+\x20Encryption\x20for\x20\ audit,\x20decrypt\x20it\x20with\x20ovk\n\n\x0c\n\x05\x04\t\x02\x04\x05\ \x12\x03D\x02\x07\n\x0c\n\x05\x04\t\x02\x04\x01\x12\x03D\x08\r\n\x0c\n\ \x05\x04\t\x02\x04\x03\x12\x03D\x10\x11\n\x0b\n\x04\x04\t\x02\x05\x12\ \x03E\x02\x14\n\x0c\n\x05\x04\t\x02\x05\x05\x12\x03E\x02\x07\n\x0c\n\x05\ \x04\t\x02\x05\x01\x12\x03E\x08\x0f\n\x0c\n\x05\x04\t\x02\x05\x03\x12\ \x03E\x12\x13\n\n\n\x02\x04\n\x12\x04H\0P\x01\n\n\n\x03\x04\n\x01\x12\ \x03H\x08\x20\n\"\n\x04\x04\n\x02\0\x12\x03I\x02%\"\x15\x20transparent\ \x20address\n\n\x0c\n\x05\x04\n\x02\0\x05\x12\x03I\x02\x07\n\x0c\n\x05\ \x04\n\x02\0\x01\x12\x03I\x08\x20\n\x0c\n\x05\x04\n\x02\0\x03\x12\x03I#$\ \n\x0b\n\x04\x04\n\x02\x01\x12\x03J\x02\x18\n\x0c\n\x05\x04\n\x02\x01\ \x05\x12\x03J\x02\x07\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x03J\x08\x13\n\ \x0c\n\x05\x04\n\x02\x01\x03\x12\x03J\x16\x17\n\x0b\n\x04\x04\n\x02\x02\ \x12\x03K\x022\n\x0c\n\x05\x04\n\x02\x02\x04\x12\x03K\x02\n\n\x0c\n\x05\ \x04\n\x02\x02\x06\x12\x03K\x0b\x1b\n\x0c\n\x05\x04\n\x02\x02\x01\x12\ \x03K\x1c-\n\x0c\n\x05\x04\n\x02\x02\x03\x12\x03K01\n\x0b\n\x04\x04\n\ \x02\x03\x12\x03L\x026\n\x0c\n\x05\x04\n\x02\x03\x04\x12\x03L\x02\n\n\ \x0c\n\x05\x04\n\x02\x03\x06\x12\x03L\x0b\x1d\n\x0c\n\x05\x04\n\x02\x03\ \x01\x12\x03L\x1e1\n\x0c\n\x05\x04\n\x02\x03\x03\x12\x03L45\n\x0b\n\x04\ \x04\n\x02\x04\x12\x03M\x02\x1e\n\x0c\n\x05\x04\n\x02\x04\x05\x12\x03M\ \x02\x07\n\x0c\n\x05\x04\n\x02\x04\x01\x12\x03M\x08\x19\n\x0c\n\x05\x04\ \n\x02\x04\x03\x12\x03M\x1c\x1d\n\"\n\x04\x04\n\x02\x05\x12\x03N\x02#\"\ \x15\x20transparent\x20address\n\n\x0c\n\x05\x04\n\x02\x05\x05\x12\x03N\ \x02\x07\n\x0c\n\x05\x04\n\x02\x05\x01\x12\x03N\x08\x1e\n\x0c\n\x05\x04\ \n\x02\x05\x03\x12\x03N!\"\n3\n\x04\x04\n\x02\x06\x12\x03O\x02\x16\"&\ \x20the\x20amount\x20to\x20transparent\x20to_address\n\n\x0c\n\x05\x04\n\ \x02\x06\x05\x12\x03O\x02\x07\n\x0c\n\x05\x04\n\x02\x06\x01\x12\x03O\x08\ \x11\n\x0c\n\x05\x04\n\x02\x06\x03\x12\x03O\x14\x15b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(11); messages.push(AuthenticationPath::generated_message_descriptor_data()); messages.push(MerklePath::generated_message_descriptor_data()); messages.push(OutputPoint::generated_message_descriptor_data()); messages.push(OutputPointInfo::generated_message_descriptor_data()); messages.push(PedersenHash::generated_message_descriptor_data()); messages.push(IncrementalMerkleTree::generated_message_descriptor_data()); messages.push(IncrementalMerkleVoucher::generated_message_descriptor_data()); messages.push(IncrementalMerkleVoucherInfo::generated_message_descriptor_data()); messages.push(SpendDescription::generated_message_descriptor_data()); messages.push(ReceiveDescription::generated_message_descriptor_data()); messages.push(ShieldedTransferContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/smart_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/smart_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.SmartContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct SmartContract { // message fields // @@protoc_insertion_point(field:protocol.SmartContract.origin_address) pub origin_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.contract_address) pub contract_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.abi) pub abi: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.SmartContract.bytecode) pub bytecode: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.call_value) pub call_value: i64, // @@protoc_insertion_point(field:protocol.SmartContract.consume_user_resource_percent) pub consume_user_resource_percent: i64, // @@protoc_insertion_point(field:protocol.SmartContract.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.SmartContract.origin_energy_limit) pub origin_energy_limit: i64, // @@protoc_insertion_point(field:protocol.SmartContract.code_hash) pub code_hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.trx_hash) pub trx_hash: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.version) pub version: i32, // special fields // @@protoc_insertion_point(special_field:protocol.SmartContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SmartContract { fn default() -> &'a SmartContract { ::default_instance() } } impl SmartContract { pub fn new() -> SmartContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(11); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "origin_address", |m: &SmartContract| { &m.origin_address }, |m: &mut SmartContract| { &mut m.origin_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &SmartContract| { &m.contract_address }, |m: &mut SmartContract| { &mut m.contract_address }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, smart_contract::ABI>( "abi", |m: &SmartContract| { &m.abi }, |m: &mut SmartContract| { &mut m.abi }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "bytecode", |m: &SmartContract| { &m.bytecode }, |m: &mut SmartContract| { &mut m.bytecode }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "call_value", |m: &SmartContract| { &m.call_value }, |m: &mut SmartContract| { &mut m.call_value }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "consume_user_resource_percent", |m: &SmartContract| { &m.consume_user_resource_percent }, |m: &mut SmartContract| { &mut m.consume_user_resource_percent }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &SmartContract| { &m.name }, |m: &mut SmartContract| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "origin_energy_limit", |m: &SmartContract| { &m.origin_energy_limit }, |m: &mut SmartContract| { &mut m.origin_energy_limit }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "code_hash", |m: &SmartContract| { &m.code_hash }, |m: &mut SmartContract| { &mut m.code_hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "trx_hash", |m: &SmartContract| { &m.trx_hash }, |m: &mut SmartContract| { &mut m.trx_hash }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "version", |m: &SmartContract| { &m.version }, |m: &mut SmartContract| { &mut m.version }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SmartContract", fields, oneofs, ) } } impl ::protobuf::Message for SmartContract { const NAME: &'static str = "SmartContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.origin_address = is.read_bytes()?; }, 18 => { self.contract_address = is.read_bytes()?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.abi)?; }, 34 => { self.bytecode = is.read_bytes()?; }, 40 => { self.call_value = is.read_int64()?; }, 48 => { self.consume_user_resource_percent = is.read_int64()?; }, 58 => { self.name = is.read_string()?; }, 64 => { self.origin_energy_limit = is.read_int64()?; }, 74 => { self.code_hash = is.read_bytes()?; }, 82 => { self.trx_hash = is.read_bytes()?; }, 88 => { self.version = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.origin_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.origin_address); } if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.contract_address); } if let Some(v) = self.abi.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.bytecode.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.bytecode); } if self.call_value != 0 { my_size += ::protobuf::rt::int64_size(5, self.call_value); } if self.consume_user_resource_percent != 0 { my_size += ::protobuf::rt::int64_size(6, self.consume_user_resource_percent); } if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(7, &self.name); } if self.origin_energy_limit != 0 { my_size += ::protobuf::rt::int64_size(8, self.origin_energy_limit); } if !self.code_hash.is_empty() { my_size += ::protobuf::rt::bytes_size(9, &self.code_hash); } if !self.trx_hash.is_empty() { my_size += ::protobuf::rt::bytes_size(10, &self.trx_hash); } if self.version != 0 { my_size += ::protobuf::rt::int32_size(11, self.version); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.origin_address.is_empty() { os.write_bytes(1, &self.origin_address)?; } if !self.contract_address.is_empty() { os.write_bytes(2, &self.contract_address)?; } if let Some(v) = self.abi.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } if !self.bytecode.is_empty() { os.write_bytes(4, &self.bytecode)?; } if self.call_value != 0 { os.write_int64(5, self.call_value)?; } if self.consume_user_resource_percent != 0 { os.write_int64(6, self.consume_user_resource_percent)?; } if !self.name.is_empty() { os.write_string(7, &self.name)?; } if self.origin_energy_limit != 0 { os.write_int64(8, self.origin_energy_limit)?; } if !self.code_hash.is_empty() { os.write_bytes(9, &self.code_hash)?; } if !self.trx_hash.is_empty() { os.write_bytes(10, &self.trx_hash)?; } if self.version != 0 { os.write_int32(11, self.version)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SmartContract { SmartContract::new() } fn clear(&mut self) { self.origin_address.clear(); self.contract_address.clear(); self.abi.clear(); self.bytecode.clear(); self.call_value = 0; self.consume_user_resource_percent = 0; self.name.clear(); self.origin_energy_limit = 0; self.code_hash.clear(); self.trx_hash.clear(); self.version = 0; self.special_fields.clear(); } fn default_instance() -> &'static SmartContract { static instance: SmartContract = SmartContract { origin_address: ::std::vec::Vec::new(), contract_address: ::std::vec::Vec::new(), abi: ::protobuf::MessageField::none(), bytecode: ::std::vec::Vec::new(), call_value: 0, consume_user_resource_percent: 0, name: ::std::string::String::new(), origin_energy_limit: 0, code_hash: ::std::vec::Vec::new(), trx_hash: ::std::vec::Vec::new(), version: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SmartContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SmartContract").unwrap()).clone() } } impl ::std::fmt::Display for SmartContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SmartContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `SmartContract` pub mod smart_contract { // @@protoc_insertion_point(message:protocol.SmartContract.ABI) #[derive(PartialEq,Clone,Default,Debug)] pub struct ABI { // message fields // @@protoc_insertion_point(field:protocol.SmartContract.ABI.entrys) pub entrys: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.SmartContract.ABI.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ABI { fn default() -> &'a ABI { ::default_instance() } } impl ABI { pub fn new() -> ABI { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(1); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "entrys", |m: &ABI| { &m.entrys }, |m: &mut ABI| { &mut m.entrys }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SmartContract.ABI", fields, oneofs, ) } } impl ::protobuf::Message for ABI { const NAME: &'static str = "ABI"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.entrys.push(is.read_message()?); }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.entrys { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.entrys { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ABI { ABI::new() } fn clear(&mut self) { self.entrys.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ABI { static instance: ABI = ABI { entrys: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ABI { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("SmartContract.ABI").unwrap()).clone() } } impl ::std::fmt::Display for ABI { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ABI { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `ABI` pub mod abi { // @@protoc_insertion_point(message:protocol.SmartContract.ABI.Entry) #[derive(PartialEq,Clone,Default,Debug)] pub struct Entry { // message fields // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.anonymous) pub anonymous: bool, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.constant) pub constant: bool, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.inputs) pub inputs: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.outputs) pub outputs: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.type) pub type_: ::protobuf::EnumOrUnknown, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.payable) pub payable: bool, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.stateMutability) pub stateMutability: ::protobuf::EnumOrUnknown, // special fields // @@protoc_insertion_point(special_field:protocol.SmartContract.ABI.Entry.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Entry { fn default() -> &'a Entry { ::default_instance() } } impl Entry { pub fn new() -> Entry { ::std::default::Default::default() } pub(in super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(8); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "anonymous", |m: &Entry| { &m.anonymous }, |m: &mut Entry| { &mut m.anonymous }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "constant", |m: &Entry| { &m.constant }, |m: &mut Entry| { &mut m.constant }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &Entry| { &m.name }, |m: &mut Entry| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "inputs", |m: &Entry| { &m.inputs }, |m: &mut Entry| { &mut m.inputs }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "outputs", |m: &Entry| { &m.outputs }, |m: &mut Entry| { &mut m.outputs }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Entry| { &m.type_ }, |m: &mut Entry| { &mut m.type_ }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "payable", |m: &Entry| { &m.payable }, |m: &mut Entry| { &mut m.payable }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "stateMutability", |m: &Entry| { &m.stateMutability }, |m: &mut Entry| { &mut m.stateMutability }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SmartContract.ABI.Entry", fields, oneofs, ) } } impl ::protobuf::Message for Entry { const NAME: &'static str = "Entry"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.anonymous = is.read_bool()?; }, 16 => { self.constant = is.read_bool()?; }, 26 => { self.name = is.read_string()?; }, 34 => { self.inputs.push(is.read_message()?); }, 42 => { self.outputs.push(is.read_message()?); }, 48 => { self.type_ = is.read_enum_or_unknown()?; }, 56 => { self.payable = is.read_bool()?; }, 64 => { self.stateMutability = is.read_enum_or_unknown()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.anonymous != false { my_size += 1 + 1; } if self.constant != false { my_size += 1 + 1; } if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.name); } for value in &self.inputs { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; for value in &self.outputs { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.type_ != ::protobuf::EnumOrUnknown::new(entry::EntryType::UnknownEntryType) { my_size += ::protobuf::rt::int32_size(6, self.type_.value()); } if self.payable != false { my_size += 1 + 1; } if self.stateMutability != ::protobuf::EnumOrUnknown::new(entry::StateMutabilityType::UnknownMutabilityType) { my_size += ::protobuf::rt::int32_size(8, self.stateMutability.value()); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.anonymous != false { os.write_bool(1, self.anonymous)?; } if self.constant != false { os.write_bool(2, self.constant)?; } if !self.name.is_empty() { os.write_string(3, &self.name)?; } for v in &self.inputs { ::protobuf::rt::write_message_field_with_cached_size(4, v, os)?; }; for v in &self.outputs { ::protobuf::rt::write_message_field_with_cached_size(5, v, os)?; }; if self.type_ != ::protobuf::EnumOrUnknown::new(entry::EntryType::UnknownEntryType) { os.write_enum(6, ::protobuf::EnumOrUnknown::value(&self.type_))?; } if self.payable != false { os.write_bool(7, self.payable)?; } if self.stateMutability != ::protobuf::EnumOrUnknown::new(entry::StateMutabilityType::UnknownMutabilityType) { os.write_enum(8, ::protobuf::EnumOrUnknown::value(&self.stateMutability))?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Entry { Entry::new() } fn clear(&mut self) { self.anonymous = false; self.constant = false; self.name.clear(); self.inputs.clear(); self.outputs.clear(); self.type_ = ::protobuf::EnumOrUnknown::new(entry::EntryType::UnknownEntryType); self.payable = false; self.stateMutability = ::protobuf::EnumOrUnknown::new(entry::StateMutabilityType::UnknownMutabilityType); self.special_fields.clear(); } fn default_instance() -> &'static Entry { static instance: Entry = Entry { anonymous: false, constant: false, name: ::std::string::String::new(), inputs: ::std::vec::Vec::new(), outputs: ::std::vec::Vec::new(), type_: ::protobuf::EnumOrUnknown::from_i32(0), payable: false, stateMutability: ::protobuf::EnumOrUnknown::from_i32(0), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Entry { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::file_descriptor().message_by_package_relative_name("SmartContract.ABI.Entry").unwrap()).clone() } } impl ::std::fmt::Display for Entry { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Entry { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `Entry` pub mod entry { // @@protoc_insertion_point(message:protocol.SmartContract.ABI.Entry.Param) #[derive(PartialEq,Clone,Default,Debug)] pub struct Param { // message fields // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.Param.indexed) pub indexed: bool, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.Param.name) pub name: ::std::string::String, // @@protoc_insertion_point(field:protocol.SmartContract.ABI.Entry.Param.type) pub type_: ::std::string::String, // special fields // @@protoc_insertion_point(special_field:protocol.SmartContract.ABI.Entry.Param.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Param { fn default() -> &'a Param { ::default_instance() } } impl Param { pub fn new() -> Param { ::std::default::Default::default() } pub(in super::super::super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "indexed", |m: &Param| { &m.indexed }, |m: &mut Param| { &mut m.indexed }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "name", |m: &Param| { &m.name }, |m: &mut Param| { &mut m.name }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "type", |m: &Param| { &m.type_ }, |m: &mut Param| { &mut m.type_ }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SmartContract.ABI.Entry.Param", fields, oneofs, ) } } impl ::protobuf::Message for Param { const NAME: &'static str = "Param"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.indexed = is.read_bool()?; }, 18 => { self.name = is.read_string()?; }, 26 => { self.type_ = is.read_string()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.indexed != false { my_size += 1 + 1; } if !self.name.is_empty() { my_size += ::protobuf::rt::string_size(2, &self.name); } if !self.type_.is_empty() { my_size += ::protobuf::rt::string_size(3, &self.type_); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.indexed != false { os.write_bool(1, self.indexed)?; } if !self.name.is_empty() { os.write_string(2, &self.name)?; } if !self.type_.is_empty() { os.write_string(3, &self.type_)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Param { Param::new() } fn clear(&mut self) { self.indexed = false; self.name.clear(); self.type_.clear(); self.special_fields.clear(); } fn default_instance() -> &'static Param { static instance: Param = Param { indexed: false, name: ::std::string::String::new(), type_: ::std::string::String::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Param { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::super::file_descriptor().message_by_package_relative_name("SmartContract.ABI.Entry.Param").unwrap()).clone() } } impl ::std::fmt::Display for Param { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Param { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.SmartContract.ABI.Entry.EntryType) pub enum EntryType { // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.UnknownEntryType) UnknownEntryType = 0, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Constructor) Constructor = 1, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Function) Function = 2, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Event) Event = 3, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Fallback) Fallback = 4, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Receive) Receive = 5, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.EntryType.Error) Error = 6, } impl ::protobuf::Enum for EntryType { const NAME: &'static str = "EntryType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(EntryType::UnknownEntryType), 1 => ::std::option::Option::Some(EntryType::Constructor), 2 => ::std::option::Option::Some(EntryType::Function), 3 => ::std::option::Option::Some(EntryType::Event), 4 => ::std::option::Option::Some(EntryType::Fallback), 5 => ::std::option::Option::Some(EntryType::Receive), 6 => ::std::option::Option::Some(EntryType::Error), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "UnknownEntryType" => ::std::option::Option::Some(EntryType::UnknownEntryType), "Constructor" => ::std::option::Option::Some(EntryType::Constructor), "Function" => ::std::option::Option::Some(EntryType::Function), "Event" => ::std::option::Option::Some(EntryType::Event), "Fallback" => ::std::option::Option::Some(EntryType::Fallback), "Receive" => ::std::option::Option::Some(EntryType::Receive), "Error" => ::std::option::Option::Some(EntryType::Error), _ => ::std::option::Option::None } } const VALUES: &'static [EntryType] = &[ EntryType::UnknownEntryType, EntryType::Constructor, EntryType::Function, EntryType::Event, EntryType::Fallback, EntryType::Receive, EntryType::Error, ]; } impl ::protobuf::EnumFull for EntryType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("SmartContract.ABI.Entry.EntryType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for EntryType { fn default() -> Self { EntryType::UnknownEntryType } } impl EntryType { pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SmartContract.ABI.Entry.EntryType") } } #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] // @@protoc_insertion_point(enum:protocol.SmartContract.ABI.Entry.StateMutabilityType) pub enum StateMutabilityType { // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.StateMutabilityType.UnknownMutabilityType) UnknownMutabilityType = 0, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.StateMutabilityType.Pure) Pure = 1, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.StateMutabilityType.View) View = 2, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.StateMutabilityType.Nonpayable) Nonpayable = 3, // @@protoc_insertion_point(enum_value:protocol.SmartContract.ABI.Entry.StateMutabilityType.Payable) Payable = 4, } impl ::protobuf::Enum for StateMutabilityType { const NAME: &'static str = "StateMutabilityType"; fn value(&self) -> i32 { *self as i32 } fn from_i32(value: i32) -> ::std::option::Option { match value { 0 => ::std::option::Option::Some(StateMutabilityType::UnknownMutabilityType), 1 => ::std::option::Option::Some(StateMutabilityType::Pure), 2 => ::std::option::Option::Some(StateMutabilityType::View), 3 => ::std::option::Option::Some(StateMutabilityType::Nonpayable), 4 => ::std::option::Option::Some(StateMutabilityType::Payable), _ => ::std::option::Option::None } } fn from_str(str: &str) -> ::std::option::Option { match str { "UnknownMutabilityType" => ::std::option::Option::Some(StateMutabilityType::UnknownMutabilityType), "Pure" => ::std::option::Option::Some(StateMutabilityType::Pure), "View" => ::std::option::Option::Some(StateMutabilityType::View), "Nonpayable" => ::std::option::Option::Some(StateMutabilityType::Nonpayable), "Payable" => ::std::option::Option::Some(StateMutabilityType::Payable), _ => ::std::option::Option::None } } const VALUES: &'static [StateMutabilityType] = &[ StateMutabilityType::UnknownMutabilityType, StateMutabilityType::Pure, StateMutabilityType::View, StateMutabilityType::Nonpayable, StateMutabilityType::Payable, ]; } impl ::protobuf::EnumFull for StateMutabilityType { fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::super::super::file_descriptor().enum_by_package_relative_name("SmartContract.ABI.Entry.StateMutabilityType").unwrap()).clone() } fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor { let index = *self as usize; Self::enum_descriptor().value_by_index(index) } } impl ::std::default::Default for StateMutabilityType { fn default() -> Self { StateMutabilityType::UnknownMutabilityType } } impl StateMutabilityType { pub(in super::super::super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData { ::protobuf::reflect::GeneratedEnumDescriptorData::new::("SmartContract.ABI.Entry.StateMutabilityType") } } } } } // @@protoc_insertion_point(message:protocol.ContractState) #[derive(PartialEq,Clone,Default,Debug)] pub struct ContractState { // message fields // @@protoc_insertion_point(field:protocol.ContractState.energy_usage) pub energy_usage: i64, // @@protoc_insertion_point(field:protocol.ContractState.energy_factor) pub energy_factor: i64, // @@protoc_insertion_point(field:protocol.ContractState.update_cycle) pub update_cycle: i64, // special fields // @@protoc_insertion_point(special_field:protocol.ContractState.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ContractState { fn default() -> &'a ContractState { ::default_instance() } } impl ContractState { pub fn new() -> ContractState { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_usage", |m: &ContractState| { &m.energy_usage }, |m: &mut ContractState| { &mut m.energy_usage }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "energy_factor", |m: &ContractState| { &m.energy_factor }, |m: &mut ContractState| { &mut m.energy_factor }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "update_cycle", |m: &ContractState| { &m.update_cycle }, |m: &mut ContractState| { &mut m.update_cycle }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ContractState", fields, oneofs, ) } } impl ::protobuf::Message for ContractState { const NAME: &'static str = "ContractState"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 8 => { self.energy_usage = is.read_int64()?; }, 16 => { self.energy_factor = is.read_int64()?; }, 24 => { self.update_cycle = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if self.energy_usage != 0 { my_size += ::protobuf::rt::int64_size(1, self.energy_usage); } if self.energy_factor != 0 { my_size += ::protobuf::rt::int64_size(2, self.energy_factor); } if self.update_cycle != 0 { my_size += ::protobuf::rt::int64_size(3, self.update_cycle); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if self.energy_usage != 0 { os.write_int64(1, self.energy_usage)?; } if self.energy_factor != 0 { os.write_int64(2, self.energy_factor)?; } if self.update_cycle != 0 { os.write_int64(3, self.update_cycle)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ContractState { ContractState::new() } fn clear(&mut self) { self.energy_usage = 0; self.energy_factor = 0; self.update_cycle = 0; self.special_fields.clear(); } fn default_instance() -> &'static ContractState { static instance: ContractState = ContractState { energy_usage: 0, energy_factor: 0, update_cycle: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ContractState { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ContractState").unwrap()).clone() } } impl ::std::fmt::Display for ContractState { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ContractState { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.CreateSmartContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct CreateSmartContract { // message fields // @@protoc_insertion_point(field:protocol.CreateSmartContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.CreateSmartContract.new_contract) pub new_contract: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.CreateSmartContract.call_token_value) pub call_token_value: i64, // @@protoc_insertion_point(field:protocol.CreateSmartContract.token_id) pub token_id: i64, // special fields // @@protoc_insertion_point(special_field:protocol.CreateSmartContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a CreateSmartContract { fn default() -> &'a CreateSmartContract { ::default_instance() } } impl CreateSmartContract { pub fn new() -> CreateSmartContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &CreateSmartContract| { &m.owner_address }, |m: &mut CreateSmartContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, SmartContract>( "new_contract", |m: &CreateSmartContract| { &m.new_contract }, |m: &mut CreateSmartContract| { &mut m.new_contract }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "call_token_value", |m: &CreateSmartContract| { &m.call_token_value }, |m: &mut CreateSmartContract| { &mut m.call_token_value }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "token_id", |m: &CreateSmartContract| { &m.token_id }, |m: &mut CreateSmartContract| { &mut m.token_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "CreateSmartContract", fields, oneofs, ) } } impl ::protobuf::Message for CreateSmartContract { const NAME: &'static str = "CreateSmartContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.new_contract)?; }, 24 => { self.call_token_value = is.read_int64()?; }, 32 => { self.token_id = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if let Some(v) = self.new_contract.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if self.call_token_value != 0 { my_size += ::protobuf::rt::int64_size(3, self.call_token_value); } if self.token_id != 0 { my_size += ::protobuf::rt::int64_size(4, self.token_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if let Some(v) = self.new_contract.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } if self.call_token_value != 0 { os.write_int64(3, self.call_token_value)?; } if self.token_id != 0 { os.write_int64(4, self.token_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> CreateSmartContract { CreateSmartContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.new_contract.clear(); self.call_token_value = 0; self.token_id = 0; self.special_fields.clear(); } fn default_instance() -> &'static CreateSmartContract { static instance: CreateSmartContract = CreateSmartContract { owner_address: ::std::vec::Vec::new(), new_contract: ::protobuf::MessageField::none(), call_token_value: 0, token_id: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for CreateSmartContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("CreateSmartContract").unwrap()).clone() } } impl ::std::fmt::Display for CreateSmartContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for CreateSmartContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.TriggerSmartContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct TriggerSmartContract { // message fields // @@protoc_insertion_point(field:protocol.TriggerSmartContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TriggerSmartContract.contract_address) pub contract_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TriggerSmartContract.call_value) pub call_value: i64, // @@protoc_insertion_point(field:protocol.TriggerSmartContract.data) pub data: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.TriggerSmartContract.call_token_value) pub call_token_value: i64, // @@protoc_insertion_point(field:protocol.TriggerSmartContract.token_id) pub token_id: i64, // special fields // @@protoc_insertion_point(special_field:protocol.TriggerSmartContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a TriggerSmartContract { fn default() -> &'a TriggerSmartContract { ::default_instance() } } impl TriggerSmartContract { pub fn new() -> TriggerSmartContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(6); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &TriggerSmartContract| { &m.owner_address }, |m: &mut TriggerSmartContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &TriggerSmartContract| { &m.contract_address }, |m: &mut TriggerSmartContract| { &mut m.contract_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "call_value", |m: &TriggerSmartContract| { &m.call_value }, |m: &mut TriggerSmartContract| { &mut m.call_value }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "data", |m: &TriggerSmartContract| { &m.data }, |m: &mut TriggerSmartContract| { &mut m.data }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "call_token_value", |m: &TriggerSmartContract| { &m.call_token_value }, |m: &mut TriggerSmartContract| { &mut m.call_token_value }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "token_id", |m: &TriggerSmartContract| { &m.token_id }, |m: &mut TriggerSmartContract| { &mut m.token_id }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "TriggerSmartContract", fields, oneofs, ) } } impl ::protobuf::Message for TriggerSmartContract { const NAME: &'static str = "TriggerSmartContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.contract_address = is.read_bytes()?; }, 24 => { self.call_value = is.read_int64()?; }, 34 => { self.data = is.read_bytes()?; }, 40 => { self.call_token_value = is.read_int64()?; }, 48 => { self.token_id = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.contract_address); } if self.call_value != 0 { my_size += ::protobuf::rt::int64_size(3, self.call_value); } if !self.data.is_empty() { my_size += ::protobuf::rt::bytes_size(4, &self.data); } if self.call_token_value != 0 { my_size += ::protobuf::rt::int64_size(5, self.call_token_value); } if self.token_id != 0 { my_size += ::protobuf::rt::int64_size(6, self.token_id); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.contract_address.is_empty() { os.write_bytes(2, &self.contract_address)?; } if self.call_value != 0 { os.write_int64(3, self.call_value)?; } if !self.data.is_empty() { os.write_bytes(4, &self.data)?; } if self.call_token_value != 0 { os.write_int64(5, self.call_token_value)?; } if self.token_id != 0 { os.write_int64(6, self.token_id)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> TriggerSmartContract { TriggerSmartContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.contract_address.clear(); self.call_value = 0; self.data.clear(); self.call_token_value = 0; self.token_id = 0; self.special_fields.clear(); } fn default_instance() -> &'static TriggerSmartContract { static instance: TriggerSmartContract = TriggerSmartContract { owner_address: ::std::vec::Vec::new(), contract_address: ::std::vec::Vec::new(), call_value: 0, data: ::std::vec::Vec::new(), call_token_value: 0, token_id: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for TriggerSmartContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("TriggerSmartContract").unwrap()).clone() } } impl ::std::fmt::Display for TriggerSmartContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for TriggerSmartContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.ClearABIContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct ClearABIContract { // message fields // @@protoc_insertion_point(field:protocol.ClearABIContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.ClearABIContract.contract_address) pub contract_address: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.ClearABIContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a ClearABIContract { fn default() -> &'a ClearABIContract { ::default_instance() } } impl ClearABIContract { pub fn new() -> ClearABIContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &ClearABIContract| { &m.owner_address }, |m: &mut ClearABIContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &ClearABIContract| { &m.contract_address }, |m: &mut ClearABIContract| { &mut m.contract_address }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "ClearABIContract", fields, oneofs, ) } } impl ::protobuf::Message for ClearABIContract { const NAME: &'static str = "ClearABIContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.contract_address = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.contract_address); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.contract_address.is_empty() { os.write_bytes(2, &self.contract_address)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> ClearABIContract { ClearABIContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.contract_address.clear(); self.special_fields.clear(); } fn default_instance() -> &'static ClearABIContract { static instance: ClearABIContract = ClearABIContract { owner_address: ::std::vec::Vec::new(), contract_address: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for ClearABIContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("ClearABIContract").unwrap()).clone() } } impl ::std::fmt::Display for ClearABIContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for ClearABIContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UpdateSettingContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UpdateSettingContract { // message fields // @@protoc_insertion_point(field:protocol.UpdateSettingContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateSettingContract.contract_address) pub contract_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateSettingContract.consume_user_resource_percent) pub consume_user_resource_percent: i64, // special fields // @@protoc_insertion_point(special_field:protocol.UpdateSettingContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UpdateSettingContract { fn default() -> &'a UpdateSettingContract { ::default_instance() } } impl UpdateSettingContract { pub fn new() -> UpdateSettingContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UpdateSettingContract| { &m.owner_address }, |m: &mut UpdateSettingContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &UpdateSettingContract| { &m.contract_address }, |m: &mut UpdateSettingContract| { &mut m.contract_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "consume_user_resource_percent", |m: &UpdateSettingContract| { &m.consume_user_resource_percent }, |m: &mut UpdateSettingContract| { &mut m.consume_user_resource_percent }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UpdateSettingContract", fields, oneofs, ) } } impl ::protobuf::Message for UpdateSettingContract { const NAME: &'static str = "UpdateSettingContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.contract_address = is.read_bytes()?; }, 24 => { self.consume_user_resource_percent = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.contract_address); } if self.consume_user_resource_percent != 0 { my_size += ::protobuf::rt::int64_size(3, self.consume_user_resource_percent); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.contract_address.is_empty() { os.write_bytes(2, &self.contract_address)?; } if self.consume_user_resource_percent != 0 { os.write_int64(3, self.consume_user_resource_percent)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UpdateSettingContract { UpdateSettingContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.contract_address.clear(); self.consume_user_resource_percent = 0; self.special_fields.clear(); } fn default_instance() -> &'static UpdateSettingContract { static instance: UpdateSettingContract = UpdateSettingContract { owner_address: ::std::vec::Vec::new(), contract_address: ::std::vec::Vec::new(), consume_user_resource_percent: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UpdateSettingContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UpdateSettingContract").unwrap()).clone() } } impl ::std::fmt::Display for UpdateSettingContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UpdateSettingContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UpdateEnergyLimitContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UpdateEnergyLimitContract { // message fields // @@protoc_insertion_point(field:protocol.UpdateEnergyLimitContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateEnergyLimitContract.contract_address) pub contract_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateEnergyLimitContract.origin_energy_limit) pub origin_energy_limit: i64, // special fields // @@protoc_insertion_point(special_field:protocol.UpdateEnergyLimitContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UpdateEnergyLimitContract { fn default() -> &'a UpdateEnergyLimitContract { ::default_instance() } } impl UpdateEnergyLimitContract { pub fn new() -> UpdateEnergyLimitContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UpdateEnergyLimitContract| { &m.owner_address }, |m: &mut UpdateEnergyLimitContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "contract_address", |m: &UpdateEnergyLimitContract| { &m.contract_address }, |m: &mut UpdateEnergyLimitContract| { &mut m.contract_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "origin_energy_limit", |m: &UpdateEnergyLimitContract| { &m.origin_energy_limit }, |m: &mut UpdateEnergyLimitContract| { &mut m.origin_energy_limit }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UpdateEnergyLimitContract", fields, oneofs, ) } } impl ::protobuf::Message for UpdateEnergyLimitContract { const NAME: &'static str = "UpdateEnergyLimitContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.contract_address = is.read_bytes()?; }, 24 => { self.origin_energy_limit = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.contract_address.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.contract_address); } if self.origin_energy_limit != 0 { my_size += ::protobuf::rt::int64_size(3, self.origin_energy_limit); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.contract_address.is_empty() { os.write_bytes(2, &self.contract_address)?; } if self.origin_energy_limit != 0 { os.write_int64(3, self.origin_energy_limit)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UpdateEnergyLimitContract { UpdateEnergyLimitContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.contract_address.clear(); self.origin_energy_limit = 0; self.special_fields.clear(); } fn default_instance() -> &'static UpdateEnergyLimitContract { static instance: UpdateEnergyLimitContract = UpdateEnergyLimitContract { owner_address: ::std::vec::Vec::new(), contract_address: ::std::vec::Vec::new(), origin_energy_limit: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UpdateEnergyLimitContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UpdateEnergyLimitContract").unwrap()).clone() } } impl ::std::fmt::Display for UpdateEnergyLimitContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UpdateEnergyLimitContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.SmartContractDataWrapper) #[derive(PartialEq,Clone,Default,Debug)] pub struct SmartContractDataWrapper { // message fields // @@protoc_insertion_point(field:protocol.SmartContractDataWrapper.smart_contract) pub smart_contract: ::protobuf::MessageField, // @@protoc_insertion_point(field:protocol.SmartContractDataWrapper.runtimecode) pub runtimecode: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SmartContractDataWrapper.contract_state) pub contract_state: ::protobuf::MessageField, // special fields // @@protoc_insertion_point(special_field:protocol.SmartContractDataWrapper.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SmartContractDataWrapper { fn default() -> &'a SmartContractDataWrapper { ::default_instance() } } impl SmartContractDataWrapper { pub fn new() -> SmartContractDataWrapper { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, SmartContract>( "smart_contract", |m: &SmartContractDataWrapper| { &m.smart_contract }, |m: &mut SmartContractDataWrapper| { &mut m.smart_contract }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "runtimecode", |m: &SmartContractDataWrapper| { &m.runtimecode }, |m: &mut SmartContractDataWrapper| { &mut m.runtimecode }, )); fields.push(::protobuf::reflect::rt::v2::make_message_field_accessor::<_, ContractState>( "contract_state", |m: &SmartContractDataWrapper| { &m.contract_state }, |m: &mut SmartContractDataWrapper| { &mut m.contract_state }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SmartContractDataWrapper", fields, oneofs, ) } } impl ::protobuf::Message for SmartContractDataWrapper { const NAME: &'static str = "SmartContractDataWrapper"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.smart_contract)?; }, 18 => { self.runtimecode = is.read_bytes()?; }, 26 => { ::protobuf::rt::read_singular_message_into_field(is, &mut self.contract_state)?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.smart_contract.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } if !self.runtimecode.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.runtimecode); } if let Some(v) = self.contract_state.as_ref() { let len = v.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.smart_contract.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } if !self.runtimecode.is_empty() { os.write_bytes(2, &self.runtimecode)?; } if let Some(v) = self.contract_state.as_ref() { ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SmartContractDataWrapper { SmartContractDataWrapper::new() } fn clear(&mut self) { self.smart_contract.clear(); self.runtimecode.clear(); self.contract_state.clear(); self.special_fields.clear(); } fn default_instance() -> &'static SmartContractDataWrapper { static instance: SmartContractDataWrapper = SmartContractDataWrapper { smart_contract: ::protobuf::MessageField::none(), runtimecode: ::std::vec::Vec::new(), contract_state: ::protobuf::MessageField::none(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SmartContractDataWrapper { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SmartContractDataWrapper").unwrap()).clone() } } impl ::std::fmt::Display for SmartContractDataWrapper { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SmartContractDataWrapper { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n\"core/contract/smart_contract.proto\x12\x08protocol\x1a\x0fcore/Tron.\ proto\"\xa0\t\n\rSmartContract\x12%\n\x0eorigin_address\x18\x01\x20\x01(\ \x0cR\roriginAddress\x12)\n\x10contract_address\x18\x02\x20\x01(\x0cR\ \x0fcontractAddress\x12-\n\x03abi\x18\x03\x20\x01(\x0b2\x1b.protocol.Sma\ rtContract.ABIR\x03abi\x12\x1a\n\x08bytecode\x18\x04\x20\x01(\x0cR\x08by\ tecode\x12\x1d\n\ncall_value\x18\x05\x20\x01(\x03R\tcallValue\x12A\n\x1d\ consume_user_resource_percent\x18\x06\x20\x01(\x03R\x1aconsumeUserResour\ cePercent\x12\x12\n\x04name\x18\x07\x20\x01(\tR\x04name\x12.\n\x13origin\ _energy_limit\x18\x08\x20\x01(\x03R\x11originEnergyLimit\x12\x1b\n\tcode\ _hash\x18\t\x20\x01(\x0cR\x08codeHash\x12\x19\n\x08trx_hash\x18\n\x20\ \x01(\x0cR\x07trxHash\x12\x18\n\x07version\x18\x0b\x20\x01(\x05R\x07vers\ ion\x1a\xf9\x05\n\x03ABI\x129\n\x06entrys\x18\x01\x20\x03(\x0b2!.protoco\ l.SmartContract.ABI.EntryR\x06entrys\x1a\xb6\x05\n\x05Entry\x12\x1c\n\ta\ nonymous\x18\x01\x20\x01(\x08R\tanonymous\x12\x1a\n\x08constant\x18\x02\ \x20\x01(\x08R\x08constant\x12\x12\n\x04name\x18\x03\x20\x01(\tR\x04name\ \x12?\n\x06inputs\x18\x04\x20\x03(\x0b2'.protocol.SmartContract.ABI.Entr\ y.ParamR\x06inputs\x12A\n\x07outputs\x18\x05\x20\x03(\x0b2'.protocol.Sma\ rtContract.ABI.Entry.ParamR\x07outputs\x12?\n\x04type\x18\x06\x20\x01(\ \x0e2+.protocol.SmartContract.ABI.Entry.EntryTypeR\x04type\x12\x18\n\x07\ payable\x18\x07\x20\x01(\x08R\x07payable\x12_\n\x0fstateMutability\x18\ \x08\x20\x01(\x0e25.protocol.SmartContract.ABI.Entry.StateMutabilityType\ R\x0fstateMutability\x1aI\n\x05Param\x12\x18\n\x07indexed\x18\x01\x20\ \x01(\x08R\x07indexed\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\ \x12\n\x04type\x18\x03\x20\x01(\tR\x04type\"q\n\tEntryType\x12\x14\n\x10\ UnknownEntryType\x10\0\x12\x0f\n\x0bConstructor\x10\x01\x12\x0c\n\x08Fun\ ction\x10\x02\x12\t\n\x05Event\x10\x03\x12\x0c\n\x08Fallback\x10\x04\x12\ \x0b\n\x07Receive\x10\x05\x12\t\n\x05Error\x10\x06\"a\n\x13StateMutabili\ tyType\x12\x19\n\x15UnknownMutabilityType\x10\0\x12\x08\n\x04Pure\x10\ \x01\x12\x08\n\x04View\x10\x02\x12\x0e\n\nNonpayable\x10\x03\x12\x0b\n\ \x07Payable\x10\x04\"z\n\rContractState\x12!\n\x0cenergy_usage\x18\x01\ \x20\x01(\x03R\x0benergyUsage\x12#\n\renergy_factor\x18\x02\x20\x01(\x03\ R\x0cenergyFactor\x12!\n\x0cupdate_cycle\x18\x03\x20\x01(\x03R\x0bupdate\ Cycle\"\xbb\x01\n\x13CreateSmartContract\x12#\n\rowner_address\x18\x01\ \x20\x01(\x0cR\x0cownerAddress\x12:\n\x0cnew_contract\x18\x02\x20\x01(\ \x0b2\x17.protocol.SmartContractR\x0bnewContract\x12(\n\x10call_token_va\ lue\x18\x03\x20\x01(\x03R\x0ecallTokenValue\x12\x19\n\x08token_id\x18\ \x04\x20\x01(\x03R\x07tokenId\"\xde\x01\n\x14TriggerSmartContract\x12#\n\ \rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12)\n\x10contract\ _address\x18\x02\x20\x01(\x0cR\x0fcontractAddress\x12\x1d\n\ncall_value\ \x18\x03\x20\x01(\x03R\tcallValue\x12\x12\n\x04data\x18\x04\x20\x01(\x0c\ R\x04data\x12(\n\x10call_token_value\x18\x05\x20\x01(\x03R\x0ecallTokenV\ alue\x12\x19\n\x08token_id\x18\x06\x20\x01(\x03R\x07tokenId\"b\n\x10Clea\ rABIContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\ \x12)\n\x10contract_address\x18\x02\x20\x01(\x0cR\x0fcontractAddress\"\ \xaa\x01\n\x15UpdateSettingContract\x12#\n\rowner_address\x18\x01\x20\ \x01(\x0cR\x0cownerAddress\x12)\n\x10contract_address\x18\x02\x20\x01(\ \x0cR\x0fcontractAddress\x12A\n\x1dconsume_user_resource_percent\x18\x03\ \x20\x01(\x03R\x1aconsumeUserResourcePercent\"\x9b\x01\n\x19UpdateEnergy\ LimitContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddres\ s\x12)\n\x10contract_address\x18\x02\x20\x01(\x0cR\x0fcontractAddress\ \x12.\n\x13origin_energy_limit\x18\x03\x20\x01(\x03R\x11originEnergyLimi\ t\"\xbc\x01\n\x18SmartContractDataWrapper\x12>\n\x0esmart_contract\x18\ \x01\x20\x01(\x0b2\x17.protocol.SmartContractR\rsmartContract\x12\x20\n\ \x0bruntimecode\x18\x02\x20\x01(\x0cR\x0bruntimecode\x12>\n\x0econtract_\ state\x18\x03\x20\x01(\x0b2\x17.protocol.ContractStateR\rcontractStateBE\ \n\x18org.tron.protos.contractZ)github.com/tronprotocol/grpc-gateway/cor\ eJ\xde\x20\n\x06\x12\x04\0\0g\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\ \n\x01\x02\x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\ \x01\x12\x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20\ that\x20generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0\ @\nt\n\x02\x08\x0b\x12\x03\x06\0@\x1aioption\x20java_outer_classname\x20\ =\x20\"CreateSmartContract\";\x20//Specify\x20the\x20class\x20name\x20of\ \x20the\x20generated\x20Java\x20file\n\n\t\n\x02\x03\0\x12\x03\x08\0\x19\ \n\n\n\x02\x04\0\x12\x04\n\0:\x01\n\n\n\x03\x04\0\x01\x12\x03\n\x08\x15\ \n\x0c\n\x04\x04\0\x03\0\x12\x04\x0b\x02.\x03\n\x0c\n\x05\x04\0\x03\0\ \x01\x12\x03\x0b\n\r\n\x0e\n\x06\x04\0\x03\0\x03\0\x12\x04\x0c\x04,\x05\ \n\x0e\n\x07\x04\0\x03\0\x03\0\x01\x12\x03\x0c\x0c\x11\n\x10\n\x08\x04\0\ \x03\0\x03\0\x04\0\x12\x04\r\x06\x15\x07\n\x10\n\t\x04\0\x03\0\x03\0\x04\ \0\x01\x12\x03\r\x0b\x14\n\x11\n\n\x04\0\x03\0\x03\0\x04\0\x02\0\x12\x03\ \x0e\x08\x1d\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\0\x01\x12\x03\x0e\ \x08\x18\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\0\x02\x12\x03\x0e\x1b\ \x1c\n\x11\n\n\x04\0\x03\0\x03\0\x04\0\x02\x01\x12\x03\x0f\x08\x18\n\x12\ \n\x0b\x04\0\x03\0\x03\0\x04\0\x02\x01\x01\x12\x03\x0f\x08\x13\n\x12\n\ \x0b\x04\0\x03\0\x03\0\x04\0\x02\x01\x02\x12\x03\x0f\x16\x17\n\x11\n\n\ \x04\0\x03\0\x03\0\x04\0\x02\x02\x12\x03\x10\x08\x15\n\x12\n\x0b\x04\0\ \x03\0\x03\0\x04\0\x02\x02\x01\x12\x03\x10\x08\x10\n\x12\n\x0b\x04\0\x03\ \0\x03\0\x04\0\x02\x02\x02\x12\x03\x10\x13\x14\n\x11\n\n\x04\0\x03\0\x03\ \0\x04\0\x02\x03\x12\x03\x11\x08\x12\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\ \x02\x03\x01\x12\x03\x11\x08\r\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\ \x03\x02\x12\x03\x11\x10\x11\n\x11\n\n\x04\0\x03\0\x03\0\x04\0\x02\x04\ \x12\x03\x12\x08\x15\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\x04\x01\x12\ \x03\x12\x08\x10\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\x04\x02\x12\x03\ \x12\x13\x14\n\x11\n\n\x04\0\x03\0\x03\0\x04\0\x02\x05\x12\x03\x13\x08\ \x14\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\x05\x01\x12\x03\x13\x08\x0f\ \n\x12\n\x0b\x04\0\x03\0\x03\0\x04\0\x02\x05\x02\x12\x03\x13\x12\x13\n\ \x11\n\n\x04\0\x03\0\x03\0\x04\0\x02\x06\x12\x03\x14\x08\x12\n\x12\n\x0b\ \x04\0\x03\0\x03\0\x04\0\x02\x06\x01\x12\x03\x14\x08\r\n\x12\n\x0b\x04\0\ \x03\0\x03\0\x04\0\x02\x06\x02\x12\x03\x14\x10\x11\n\x10\n\x08\x04\0\x03\ \0\x03\0\x03\0\x12\x04\x16\x06\x1b\x07\n\x10\n\t\x04\0\x03\0\x03\0\x03\0\ \x01\x12\x03\x16\x0e\x13\n\x11\n\n\x04\0\x03\0\x03\0\x03\0\x02\0\x12\x03\ \x17\x08\x19\n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\0\x05\x12\x03\x17\ \x08\x0c\n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\0\x01\x12\x03\x17\r\x14\ \n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\0\x03\x12\x03\x17\x17\x18\n\x11\ \n\n\x04\0\x03\0\x03\0\x03\0\x02\x01\x12\x03\x18\x08\x18\n\x12\n\x0b\x04\ \0\x03\0\x03\0\x03\0\x02\x01\x05\x12\x03\x18\x08\x0e\n\x12\n\x0b\x04\0\ \x03\0\x03\0\x03\0\x02\x01\x01\x12\x03\x18\x0f\x13\n\x12\n\x0b\x04\0\x03\ \0\x03\0\x03\0\x02\x01\x03\x12\x03\x18\x16\x17\n+\n\n\x04\0\x03\0\x03\0\ \x03\0\x02\x02\x12\x03\x19\x08\x18\"\x18\x20SolidityType\x20type\x20=\ \x203;\n\n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\x02\x05\x12\x03\x19\x08\ \x0e\n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\x02\x01\x12\x03\x19\x0f\x13\ \n\x12\n\x0b\x04\0\x03\0\x03\0\x03\0\x02\x02\x03\x12\x03\x19\x16\x17\n\ \x10\n\x08\x04\0\x03\0\x03\0\x04\x01\x12\x04\x1c\x06\"\x07\n\x10\n\t\x04\ \0\x03\0\x03\0\x04\x01\x01\x12\x03\x1c\x0b\x1e\n\x11\n\n\x04\0\x03\0\x03\ \0\x04\x01\x02\0\x12\x03\x1d\x08\"\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\ \x02\0\x01\x12\x03\x1d\x08\x1d\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\ \0\x02\x12\x03\x1d\x20!\n\x11\n\n\x04\0\x03\0\x03\0\x04\x01\x02\x01\x12\ \x03\x1e\x08\x11\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x01\x01\x12\ \x03\x1e\x08\x0c\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x01\x02\x12\ \x03\x1e\x0f\x10\n\x11\n\n\x04\0\x03\0\x03\0\x04\x01\x02\x02\x12\x03\x1f\ \x08\x11\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x02\x01\x12\x03\x1f\ \x08\x0c\n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x02\x02\x12\x03\x1f\ \x0f\x10\n\x11\n\n\x04\0\x03\0\x03\0\x04\x01\x02\x03\x12\x03\x20\x08\x17\ \n\x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x03\x01\x12\x03\x20\x08\x12\n\ \x12\n\x0b\x04\0\x03\0\x03\0\x04\x01\x02\x03\x02\x12\x03\x20\x15\x16\n\ \x11\n\n\x04\0\x03\0\x03\0\x04\x01\x02\x04\x12\x03!\x08\x14\n\x12\n\x0b\ \x04\0\x03\0\x03\0\x04\x01\x02\x04\x01\x12\x03!\x08\x0f\n\x12\n\x0b\x04\ \0\x03\0\x03\0\x04\x01\x02\x04\x02\x12\x03!\x12\x13\n\x0f\n\x08\x04\0\ \x03\0\x03\0\x02\0\x12\x03$\x06\x19\n\x10\n\t\x04\0\x03\0\x03\0\x02\0\ \x05\x12\x03$\x06\n\n\x10\n\t\x04\0\x03\0\x03\0\x02\0\x01\x12\x03$\x0b\ \x14\n\x10\n\t\x04\0\x03\0\x03\0\x02\0\x03\x12\x03$\x17\x18\n\x0f\n\x08\ \x04\0\x03\0\x03\0\x02\x01\x12\x03%\x06\x18\n\x10\n\t\x04\0\x03\0\x03\0\ \x02\x01\x05\x12\x03%\x06\n\n\x10\n\t\x04\0\x03\0\x03\0\x02\x01\x01\x12\ \x03%\x0b\x13\n\x10\n\t\x04\0\x03\0\x03\0\x02\x01\x03\x12\x03%\x16\x17\n\ \x0f\n\x08\x04\0\x03\0\x03\0\x02\x02\x12\x03&\x06\x16\n\x10\n\t\x04\0\ \x03\0\x03\0\x02\x02\x05\x12\x03&\x06\x0c\n\x10\n\t\x04\0\x03\0\x03\0\ \x02\x02\x01\x12\x03&\r\x11\n\x10\n\t\x04\0\x03\0\x03\0\x02\x02\x03\x12\ \x03&\x14\x15\n\x0f\n\x08\x04\0\x03\0\x03\0\x02\x03\x12\x03'\x06\x20\n\ \x10\n\t\x04\0\x03\0\x03\0\x02\x03\x04\x12\x03'\x06\x0e\n\x10\n\t\x04\0\ \x03\0\x03\0\x02\x03\x06\x12\x03'\x0f\x14\n\x10\n\t\x04\0\x03\0\x03\0\ \x02\x03\x01\x12\x03'\x15\x1b\n\x10\n\t\x04\0\x03\0\x03\0\x02\x03\x03\ \x12\x03'\x1e\x1f\n\x0f\n\x08\x04\0\x03\0\x03\0\x02\x04\x12\x03(\x06!\n\ \x10\n\t\x04\0\x03\0\x03\0\x02\x04\x04\x12\x03(\x06\x0e\n\x10\n\t\x04\0\ \x03\0\x03\0\x02\x04\x06\x12\x03(\x0f\x14\n\x10\n\t\x04\0\x03\0\x03\0\ \x02\x04\x01\x12\x03(\x15\x1c\n\x10\n\t\x04\0\x03\0\x03\0\x02\x04\x03\ \x12\x03(\x1f\x20\n\x0f\n\x08\x04\0\x03\0\x03\0\x02\x05\x12\x03)\x06\x19\ \n\x10\n\t\x04\0\x03\0\x03\0\x02\x05\x06\x12\x03)\x06\x0f\n\x10\n\t\x04\ \0\x03\0\x03\0\x02\x05\x01\x12\x03)\x10\x14\n\x10\n\t\x04\0\x03\0\x03\0\ \x02\x05\x03\x12\x03)\x17\x18\n\x0f\n\x08\x04\0\x03\0\x03\0\x02\x06\x12\ \x03*\x06\x17\n\x10\n\t\x04\0\x03\0\x03\0\x02\x06\x05\x12\x03*\x06\n\n\ \x10\n\t\x04\0\x03\0\x03\0\x02\x06\x01\x12\x03*\x0b\x12\n\x10\n\t\x04\0\ \x03\0\x03\0\x02\x06\x03\x12\x03*\x15\x16\n\x0f\n\x08\x04\0\x03\0\x03\0\ \x02\x07\x12\x03+\x06.\n\x10\n\t\x04\0\x03\0\x03\0\x02\x07\x06\x12\x03+\ \x06\x19\n\x10\n\t\x04\0\x03\0\x03\0\x02\x07\x01\x12\x03+\x1a)\n\x10\n\t\ \x04\0\x03\0\x03\0\x02\x07\x03\x12\x03+,-\n\r\n\x06\x04\0\x03\0\x02\0\ \x12\x03-\x04\x1e\n\x0e\n\x07\x04\0\x03\0\x02\0\x04\x12\x03-\x04\x0c\n\ \x0e\n\x07\x04\0\x03\0\x02\0\x06\x12\x03-\r\x12\n\x0e\n\x07\x04\0\x03\0\ \x02\0\x01\x12\x03-\x13\x19\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03-\ \x1c\x1d\n\x0b\n\x04\x04\0\x02\0\x12\x03/\x02\x1b\n\x0c\n\x05\x04\0\x02\ \0\x05\x12\x03/\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03/\x08\x16\n\ \x0c\n\x05\x04\0\x02\0\x03\x12\x03/\x19\x1a\n\x0b\n\x04\x04\0\x02\x01\ \x12\x030\x02\x1d\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x030\x02\x07\n\x0c\n\ \x05\x04\0\x02\x01\x01\x12\x030\x08\x18\n\x0c\n\x05\x04\0\x02\x01\x03\ \x12\x030\x1b\x1c\n\x0b\n\x04\x04\0\x02\x02\x12\x031\x02\x0e\n\x0c\n\x05\ \x04\0\x02\x02\x06\x12\x031\x02\x05\n\x0c\n\x05\x04\0\x02\x02\x01\x12\ \x031\x06\t\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x031\x0c\r\n\x0b\n\x04\x04\ \0\x02\x03\x12\x032\x02\x15\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x032\x02\ \x07\n\x0c\n\x05\x04\0\x02\x03\x01\x12\x032\x08\x10\n\x0c\n\x05\x04\0\ \x02\x03\x03\x12\x032\x13\x14\n\x0b\n\x04\x04\0\x02\x04\x12\x033\x02\x17\ \n\x0c\n\x05\x04\0\x02\x04\x05\x12\x033\x02\x07\n\x0c\n\x05\x04\0\x02\ \x04\x01\x12\x033\x08\x12\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x033\x15\x16\ \n\x0b\n\x04\x04\0\x02\x05\x12\x034\x02*\n\x0c\n\x05\x04\0\x02\x05\x05\ \x12\x034\x02\x07\n\x0c\n\x05\x04\0\x02\x05\x01\x12\x034\x08%\n\x0c\n\ \x05\x04\0\x02\x05\x03\x12\x034()\n\x0b\n\x04\x04\0\x02\x06\x12\x035\x02\ \x12\n\x0c\n\x05\x04\0\x02\x06\x05\x12\x035\x02\x08\n\x0c\n\x05\x04\0\ \x02\x06\x01\x12\x035\t\r\n\x0c\n\x05\x04\0\x02\x06\x03\x12\x035\x10\x11\ \n\x0b\n\x04\x04\0\x02\x07\x12\x036\x02\x20\n\x0c\n\x05\x04\0\x02\x07\ \x05\x12\x036\x02\x07\n\x0c\n\x05\x04\0\x02\x07\x01\x12\x036\x08\x1b\n\ \x0c\n\x05\x04\0\x02\x07\x03\x12\x036\x1e\x1f\n\x0b\n\x04\x04\0\x02\x08\ \x12\x037\x02\x16\n\x0c\n\x05\x04\0\x02\x08\x05\x12\x037\x02\x07\n\x0c\n\ \x05\x04\0\x02\x08\x01\x12\x037\x08\x11\n\x0c\n\x05\x04\0\x02\x08\x03\ \x12\x037\x14\x15\n\x0b\n\x04\x04\0\x02\t\x12\x038\x02\x16\n\x0c\n\x05\ \x04\0\x02\t\x05\x12\x038\x02\x07\n\x0c\n\x05\x04\0\x02\t\x01\x12\x038\ \x08\x10\n\x0c\n\x05\x04\0\x02\t\x03\x12\x038\x13\x15\n\x0b\n\x04\x04\0\ \x02\n\x12\x039\x02\x15\n\x0c\n\x05\x04\0\x02\n\x05\x12\x039\x02\x07\n\ \x0c\n\x05\x04\0\x02\n\x01\x12\x039\x08\x0f\n\x0c\n\x05\x04\0\x02\n\x03\ \x12\x039\x12\x14\n\n\n\x02\x04\x01\x12\x04<\0@\x01\n\n\n\x03\x04\x01\ \x01\x12\x03<\x08\x15\n\x0b\n\x04\x04\x01\x02\0\x12\x03=\x02\x19\n\x0c\n\ \x05\x04\x01\x02\0\x05\x12\x03=\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\ \x12\x03=\x08\x14\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03=\x17\x18\n\x0b\n\ \x04\x04\x01\x02\x01\x12\x03>\x02\x1a\n\x0c\n\x05\x04\x01\x02\x01\x05\ \x12\x03>\x02\x07\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03>\x08\x15\n\x0c\ \n\x05\x04\x01\x02\x01\x03\x12\x03>\x18\x19\n\x0b\n\x04\x04\x01\x02\x02\ \x12\x03?\x02\x19\n\x0c\n\x05\x04\x01\x02\x02\x05\x12\x03?\x02\x07\n\x0c\ \n\x05\x04\x01\x02\x02\x01\x12\x03?\x08\x14\n\x0c\n\x05\x04\x01\x02\x02\ \x03\x12\x03?\x17\x18\n\n\n\x02\x04\x02\x12\x04B\0G\x01\n\n\n\x03\x04\ \x02\x01\x12\x03B\x08\x1b\n\x0b\n\x04\x04\x02\x02\0\x12\x03C\x02\x1a\n\ \x0c\n\x05\x04\x02\x02\0\x05\x12\x03C\x02\x07\n\x0c\n\x05\x04\x02\x02\0\ \x01\x12\x03C\x08\x15\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03C\x18\x19\n\ \x0b\n\x04\x04\x02\x02\x01\x12\x03D\x02!\n\x0c\n\x05\x04\x02\x02\x01\x06\ \x12\x03D\x02\x0f\n\x0c\n\x05\x04\x02\x02\x01\x01\x12\x03D\x10\x1c\n\x0c\ \n\x05\x04\x02\x02\x01\x03\x12\x03D\x1f\x20\n\x0b\n\x04\x04\x02\x02\x02\ \x12\x03E\x02\x1d\n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03E\x02\x07\n\x0c\ \n\x05\x04\x02\x02\x02\x01\x12\x03E\x08\x18\n\x0c\n\x05\x04\x02\x02\x02\ \x03\x12\x03E\x1b\x1c\n\x0b\n\x04\x04\x02\x02\x03\x12\x03F\x02\x15\n\x0c\ \n\x05\x04\x02\x02\x03\x05\x12\x03F\x02\x07\n\x0c\n\x05\x04\x02\x02\x03\ \x01\x12\x03F\x08\x10\n\x0c\n\x05\x04\x02\x02\x03\x03\x12\x03F\x13\x14\n\ \n\n\x02\x04\x03\x12\x04I\0P\x01\n\n\n\x03\x04\x03\x01\x12\x03I\x08\x1c\ \n\x0b\n\x04\x04\x03\x02\0\x12\x03J\x02\x1a\n\x0c\n\x05\x04\x03\x02\0\ \x05\x12\x03J\x02\x07\n\x0c\n\x05\x04\x03\x02\0\x01\x12\x03J\x08\x15\n\ \x0c\n\x05\x04\x03\x02\0\x03\x12\x03J\x18\x19\n\x0b\n\x04\x04\x03\x02\ \x01\x12\x03K\x02\x1d\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03K\x02\x07\n\ \x0c\n\x05\x04\x03\x02\x01\x01\x12\x03K\x08\x18\n\x0c\n\x05\x04\x03\x02\ \x01\x03\x12\x03K\x1b\x1c\n\x0b\n\x04\x04\x03\x02\x02\x12\x03L\x02\x17\n\ \x0c\n\x05\x04\x03\x02\x02\x05\x12\x03L\x02\x07\n\x0c\n\x05\x04\x03\x02\ \x02\x01\x12\x03L\x08\x12\n\x0c\n\x05\x04\x03\x02\x02\x03\x12\x03L\x15\ \x16\n\x0b\n\x04\x04\x03\x02\x03\x12\x03M\x02\x11\n\x0c\n\x05\x04\x03\ \x02\x03\x05\x12\x03M\x02\x07\n\x0c\n\x05\x04\x03\x02\x03\x01\x12\x03M\ \x08\x0c\n\x0c\n\x05\x04\x03\x02\x03\x03\x12\x03M\x0f\x10\n\x0b\n\x04\ \x04\x03\x02\x04\x12\x03N\x02\x1d\n\x0c\n\x05\x04\x03\x02\x04\x05\x12\ \x03N\x02\x07\n\x0c\n\x05\x04\x03\x02\x04\x01\x12\x03N\x08\x18\n\x0c\n\ \x05\x04\x03\x02\x04\x03\x12\x03N\x1b\x1c\n\x0b\n\x04\x04\x03\x02\x05\ \x12\x03O\x02\x15\n\x0c\n\x05\x04\x03\x02\x05\x05\x12\x03O\x02\x07\n\x0c\ \n\x05\x04\x03\x02\x05\x01\x12\x03O\x08\x10\n\x0c\n\x05\x04\x03\x02\x05\ \x03\x12\x03O\x13\x14\n\n\n\x02\x04\x04\x12\x04R\0U\x01\n\n\n\x03\x04\ \x04\x01\x12\x03R\x08\x18\n\x0b\n\x04\x04\x04\x02\0\x12\x03S\x02\x1a\n\ \x0c\n\x05\x04\x04\x02\0\x05\x12\x03S\x02\x07\n\x0c\n\x05\x04\x04\x02\0\ \x01\x12\x03S\x08\x15\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03S\x18\x19\n\ \x0b\n\x04\x04\x04\x02\x01\x12\x03T\x02\x1d\n\x0c\n\x05\x04\x04\x02\x01\ \x05\x12\x03T\x02\x07\n\x0c\n\x05\x04\x04\x02\x01\x01\x12\x03T\x08\x18\n\ \x0c\n\x05\x04\x04\x02\x01\x03\x12\x03T\x1b\x1c\n\n\n\x02\x04\x05\x12\ \x04W\0[\x01\n\n\n\x03\x04\x05\x01\x12\x03W\x08\x1d\n\x0b\n\x04\x04\x05\ \x02\0\x12\x03X\x02\x1a\n\x0c\n\x05\x04\x05\x02\0\x05\x12\x03X\x02\x07\n\ \x0c\n\x05\x04\x05\x02\0\x01\x12\x03X\x08\x15\n\x0c\n\x05\x04\x05\x02\0\ \x03\x12\x03X\x18\x19\n\x0b\n\x04\x04\x05\x02\x01\x12\x03Y\x02\x1d\n\x0c\ \n\x05\x04\x05\x02\x01\x05\x12\x03Y\x02\x07\n\x0c\n\x05\x04\x05\x02\x01\ \x01\x12\x03Y\x08\x18\n\x0c\n\x05\x04\x05\x02\x01\x03\x12\x03Y\x1b\x1c\n\ \x0b\n\x04\x04\x05\x02\x02\x12\x03Z\x02*\n\x0c\n\x05\x04\x05\x02\x02\x05\ \x12\x03Z\x02\x07\n\x0c\n\x05\x04\x05\x02\x02\x01\x12\x03Z\x08%\n\x0c\n\ \x05\x04\x05\x02\x02\x03\x12\x03Z()\n\n\n\x02\x04\x06\x12\x04]\0a\x01\n\ \n\n\x03\x04\x06\x01\x12\x03]\x08!\n\x0b\n\x04\x04\x06\x02\0\x12\x03^\ \x02\x1a\n\x0c\n\x05\x04\x06\x02\0\x05\x12\x03^\x02\x07\n\x0c\n\x05\x04\ \x06\x02\0\x01\x12\x03^\x08\x15\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x03^\ \x18\x19\n\x0b\n\x04\x04\x06\x02\x01\x12\x03_\x02\x1d\n\x0c\n\x05\x04\ \x06\x02\x01\x05\x12\x03_\x02\x07\n\x0c\n\x05\x04\x06\x02\x01\x01\x12\ \x03_\x08\x18\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x03_\x1b\x1c\n\x0b\n\ \x04\x04\x06\x02\x02\x12\x03`\x02\x20\n\x0c\n\x05\x04\x06\x02\x02\x05\ \x12\x03`\x02\x07\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x03`\x08\x1b\n\x0c\ \n\x05\x04\x06\x02\x02\x03\x12\x03`\x1e\x1f\n\n\n\x02\x04\x07\x12\x04c\0\ g\x01\n\n\n\x03\x04\x07\x01\x12\x03c\x08\x20\n\x0b\n\x04\x04\x07\x02\0\ \x12\x03d\x02#\n\x0c\n\x05\x04\x07\x02\0\x06\x12\x03d\x02\x0f\n\x0c\n\ \x05\x04\x07\x02\0\x01\x12\x03d\x10\x1e\n\x0c\n\x05\x04\x07\x02\0\x03\ \x12\x03d!\"\n\x0b\n\x04\x04\x07\x02\x01\x12\x03e\x02\x18\n\x0c\n\x05\ \x04\x07\x02\x01\x05\x12\x03e\x02\x07\n\x0c\n\x05\x04\x07\x02\x01\x01\ \x12\x03e\x08\x13\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03e\x16\x17\n\x0b\ \n\x04\x04\x07\x02\x02\x12\x03f\x02#\n\x0c\n\x05\x04\x07\x02\x02\x06\x12\ \x03f\x02\x0f\n\x0c\n\x05\x04\x07\x02\x02\x01\x12\x03f\x10\x1e\n\x0c\n\ \x05\x04\x07\x02\x02\x03\x12\x03f!\"b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(1); deps.push(super::Tron::file_descriptor().clone()); let mut messages = ::std::vec::Vec::with_capacity(11); messages.push(SmartContract::generated_message_descriptor_data()); messages.push(ContractState::generated_message_descriptor_data()); messages.push(CreateSmartContract::generated_message_descriptor_data()); messages.push(TriggerSmartContract::generated_message_descriptor_data()); messages.push(ClearABIContract::generated_message_descriptor_data()); messages.push(UpdateSettingContract::generated_message_descriptor_data()); messages.push(UpdateEnergyLimitContract::generated_message_descriptor_data()); messages.push(SmartContractDataWrapper::generated_message_descriptor_data()); messages.push(smart_contract::ABI::generated_message_descriptor_data()); messages.push(smart_contract::abi::Entry::generated_message_descriptor_data()); messages.push(smart_contract::abi::entry::Param::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(2); enums.push(smart_contract::abi::entry::EntryType::generated_enum_descriptor_data()); enums.push(smart_contract::abi::entry::StateMutabilityType::generated_enum_descriptor_data()); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/storage_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/storage_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.BuyStorageBytesContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct BuyStorageBytesContract { // message fields // @@protoc_insertion_point(field:protocol.BuyStorageBytesContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BuyStorageBytesContract.bytes) pub bytes: i64, // special fields // @@protoc_insertion_point(special_field:protocol.BuyStorageBytesContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BuyStorageBytesContract { fn default() -> &'a BuyStorageBytesContract { ::default_instance() } } impl BuyStorageBytesContract { pub fn new() -> BuyStorageBytesContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &BuyStorageBytesContract| { &m.owner_address }, |m: &mut BuyStorageBytesContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "bytes", |m: &BuyStorageBytesContract| { &m.bytes }, |m: &mut BuyStorageBytesContract| { &mut m.bytes }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BuyStorageBytesContract", fields, oneofs, ) } } impl ::protobuf::Message for BuyStorageBytesContract { const NAME: &'static str = "BuyStorageBytesContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.bytes = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.bytes != 0 { my_size += ::protobuf::rt::int64_size(2, self.bytes); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.bytes != 0 { os.write_int64(2, self.bytes)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BuyStorageBytesContract { BuyStorageBytesContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.bytes = 0; self.special_fields.clear(); } fn default_instance() -> &'static BuyStorageBytesContract { static instance: BuyStorageBytesContract = BuyStorageBytesContract { owner_address: ::std::vec::Vec::new(), bytes: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BuyStorageBytesContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BuyStorageBytesContract").unwrap()).clone() } } impl ::std::fmt::Display for BuyStorageBytesContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BuyStorageBytesContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.BuyStorageContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct BuyStorageContract { // message fields // @@protoc_insertion_point(field:protocol.BuyStorageContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.BuyStorageContract.quant) pub quant: i64, // special fields // @@protoc_insertion_point(special_field:protocol.BuyStorageContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a BuyStorageContract { fn default() -> &'a BuyStorageContract { ::default_instance() } } impl BuyStorageContract { pub fn new() -> BuyStorageContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &BuyStorageContract| { &m.owner_address }, |m: &mut BuyStorageContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "quant", |m: &BuyStorageContract| { &m.quant }, |m: &mut BuyStorageContract| { &mut m.quant }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "BuyStorageContract", fields, oneofs, ) } } impl ::protobuf::Message for BuyStorageContract { const NAME: &'static str = "BuyStorageContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.quant = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.quant != 0 { my_size += ::protobuf::rt::int64_size(2, self.quant); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.quant != 0 { os.write_int64(2, self.quant)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> BuyStorageContract { BuyStorageContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.quant = 0; self.special_fields.clear(); } fn default_instance() -> &'static BuyStorageContract { static instance: BuyStorageContract = BuyStorageContract { owner_address: ::std::vec::Vec::new(), quant: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for BuyStorageContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("BuyStorageContract").unwrap()).clone() } } impl ::std::fmt::Display for BuyStorageContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for BuyStorageContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.SellStorageContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct SellStorageContract { // message fields // @@protoc_insertion_point(field:protocol.SellStorageContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.SellStorageContract.storage_bytes) pub storage_bytes: i64, // special fields // @@protoc_insertion_point(special_field:protocol.SellStorageContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a SellStorageContract { fn default() -> &'a SellStorageContract { ::default_instance() } } impl SellStorageContract { pub fn new() -> SellStorageContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &SellStorageContract| { &m.owner_address }, |m: &mut SellStorageContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "storage_bytes", |m: &SellStorageContract| { &m.storage_bytes }, |m: &mut SellStorageContract| { &mut m.storage_bytes }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "SellStorageContract", fields, oneofs, ) } } impl ::protobuf::Message for SellStorageContract { const NAME: &'static str = "SellStorageContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.storage_bytes = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.storage_bytes != 0 { my_size += ::protobuf::rt::int64_size(2, self.storage_bytes); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.storage_bytes != 0 { os.write_int64(2, self.storage_bytes)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> SellStorageContract { SellStorageContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.storage_bytes = 0; self.special_fields.clear(); } fn default_instance() -> &'static SellStorageContract { static instance: SellStorageContract = SellStorageContract { owner_address: ::std::vec::Vec::new(), storage_bytes: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for SellStorageContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("SellStorageContract").unwrap()).clone() } } impl ::std::fmt::Display for SellStorageContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for SellStorageContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.UpdateBrokerageContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct UpdateBrokerageContract { // message fields // @@protoc_insertion_point(field:protocol.UpdateBrokerageContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.UpdateBrokerageContract.brokerage) pub brokerage: i32, // special fields // @@protoc_insertion_point(special_field:protocol.UpdateBrokerageContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a UpdateBrokerageContract { fn default() -> &'a UpdateBrokerageContract { ::default_instance() } } impl UpdateBrokerageContract { pub fn new() -> UpdateBrokerageContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &UpdateBrokerageContract| { &m.owner_address }, |m: &mut UpdateBrokerageContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "brokerage", |m: &UpdateBrokerageContract| { &m.brokerage }, |m: &mut UpdateBrokerageContract| { &mut m.brokerage }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "UpdateBrokerageContract", fields, oneofs, ) } } impl ::protobuf::Message for UpdateBrokerageContract { const NAME: &'static str = "UpdateBrokerageContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 16 => { self.brokerage = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if self.brokerage != 0 { my_size += ::protobuf::rt::int32_size(2, self.brokerage); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if self.brokerage != 0 { os.write_int32(2, self.brokerage)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> UpdateBrokerageContract { UpdateBrokerageContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.brokerage = 0; self.special_fields.clear(); } fn default_instance() -> &'static UpdateBrokerageContract { static instance: UpdateBrokerageContract = UpdateBrokerageContract { owner_address: ::std::vec::Vec::new(), brokerage: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for UpdateBrokerageContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("UpdateBrokerageContract").unwrap()).clone() } } impl ::std::fmt::Display for UpdateBrokerageContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for UpdateBrokerageContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n$core/contract/storage_contract.proto\x12\x08protocol\"T\n\x17BuyStora\ geBytesContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddr\ ess\x12\x14\n\x05bytes\x18\x02\x20\x01(\x03R\x05bytes\"O\n\x12BuyStorage\ Contract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\ \x14\n\x05quant\x18\x02\x20\x01(\x03R\x05quant\"_\n\x13SellStorageContra\ ct\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12#\n\rs\ torage_bytes\x18\x02\x20\x01(\x03R\x0cstorageBytes\"\\\n\x17UpdateBroker\ ageContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\ \x12\x1c\n\tbrokerage\x18\x02\x20\x01(\x05R\tbrokerageBE\n\x18org.tron.p\ rotos.contractZ)github.com/tronprotocol/grpc-gateway/coreJ\xd8\x06\n\x06\ \x12\x04\0\0\x1a\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\ \x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\x03\ \x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20that\x20gene\ rated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nx\n\x02\ \x08\x0b\x12\x03\x06\0@\x1amoption\x20java_outer_classname\x20=\x20\"Buy\ StorageBytesContract\";\x20//Specify\x20the\x20class\x20name\x20of\x20th\ e\x20generated\x20Java\x20file\n\n\n\n\x02\x04\0\x12\x04\x08\0\x0b\x01\n\ \n\n\x03\x04\0\x01\x12\x03\x08\x08\x1f\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\ \x02\x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\t\x02\x07\n\x0c\n\x05\x04\0\ \x02\0\x01\x12\x03\t\x08\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x18\ \x19\n$\n\x04\x04\0\x02\x01\x12\x03\n\x02\x12\"\x17\x20storage\x20bytes\ \x20for\x20buy\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\n\x02\x07\n\x0c\n\ \x05\x04\0\x02\x01\x01\x12\x03\n\x08\r\n\x0c\n\x05\x04\0\x02\x01\x03\x12\ \x03\n\x10\x11\n\n\n\x02\x04\x01\x12\x04\r\0\x10\x01\n\n\n\x03\x04\x01\ \x01\x12\x03\r\x08\x1a\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x0e\x02\x1a\n\ \x0c\n\x05\x04\x01\x02\0\x05\x12\x03\x0e\x02\x07\n\x0c\n\x05\x04\x01\x02\ \0\x01\x12\x03\x0e\x08\x15\n\x0c\n\x05\x04\x01\x02\0\x03\x12\x03\x0e\x18\ \x19\n1\n\x04\x04\x01\x02\x01\x12\x03\x0f\x02\x12\"$\x20trx\x20quantity\ \x20for\x20buy\x20storage\x20(sun)\n\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\ \x03\x0f\x02\x07\n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0f\x08\r\n\x0c\ \n\x05\x04\x01\x02\x01\x03\x12\x03\x0f\x10\x11\n\n\n\x02\x04\x02\x12\x04\ \x12\0\x15\x01\n\n\n\x03\x04\x02\x01\x12\x03\x12\x08\x1b\n\x0b\n\x04\x04\ \x02\x02\0\x12\x03\x13\x02\x1a\n\x0c\n\x05\x04\x02\x02\0\x05\x12\x03\x13\ \x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x13\x08\x15\n\x0c\n\x05\ \x04\x02\x02\0\x03\x12\x03\x13\x18\x19\n\x0b\n\x04\x04\x02\x02\x01\x12\ \x03\x14\x02\x1a\n\x0c\n\x05\x04\x02\x02\x01\x05\x12\x03\x14\x02\x07\n\ \x0c\n\x05\x04\x02\x02\x01\x01\x12\x03\x14\x08\x15\n\x0c\n\x05\x04\x02\ \x02\x01\x03\x12\x03\x14\x18\x19\n\n\n\x02\x04\x03\x12\x04\x17\0\x1a\x01\ \n\n\n\x03\x04\x03\x01\x12\x03\x17\x08\x1f\n\x0b\n\x04\x04\x03\x02\0\x12\ \x03\x18\x02\x1a\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03\x18\x02\x07\n\x0c\ \n\x05\x04\x03\x02\0\x01\x12\x03\x18\x08\x15\n\x0c\n\x05\x04\x03\x02\0\ \x03\x12\x03\x18\x18\x19\n\x18\n\x04\x04\x03\x02\x01\x12\x03\x19\x02\x16\ \"\x0b\x201\x20mean\x201%\n\n\x0c\n\x05\x04\x03\x02\x01\x05\x12\x03\x19\ \x02\x07\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03\x19\x08\x11\n\x0c\n\x05\ \x04\x03\x02\x01\x03\x12\x03\x19\x14\x15b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(4); messages.push(BuyStorageBytesContract::generated_message_descriptor_data()); messages.push(BuyStorageContract::generated_message_descriptor_data()); messages.push(SellStorageContract::generated_message_descriptor_data()); messages.push(UpdateBrokerageContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/vote_asset_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/vote_asset_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.VoteAssetContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct VoteAssetContract { // message fields // @@protoc_insertion_point(field:protocol.VoteAssetContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.VoteAssetContract.vote_address) pub vote_address: ::std::vec::Vec<::std::vec::Vec>, // @@protoc_insertion_point(field:protocol.VoteAssetContract.support) pub support: bool, // @@protoc_insertion_point(field:protocol.VoteAssetContract.count) pub count: i32, // special fields // @@protoc_insertion_point(special_field:protocol.VoteAssetContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a VoteAssetContract { fn default() -> &'a VoteAssetContract { ::default_instance() } } impl VoteAssetContract { pub fn new() -> VoteAssetContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(4); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &VoteAssetContract| { &m.owner_address }, |m: &mut VoteAssetContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "vote_address", |m: &VoteAssetContract| { &m.vote_address }, |m: &mut VoteAssetContract| { &mut m.vote_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "support", |m: &VoteAssetContract| { &m.support }, |m: &mut VoteAssetContract| { &mut m.support }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "count", |m: &VoteAssetContract| { &m.count }, |m: &mut VoteAssetContract| { &mut m.count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "VoteAssetContract", fields, oneofs, ) } } impl ::protobuf::Message for VoteAssetContract { const NAME: &'static str = "VoteAssetContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.vote_address.push(is.read_bytes()?); }, 24 => { self.support = is.read_bool()?; }, 40 => { self.count = is.read_int32()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } for value in &self.vote_address { my_size += ::protobuf::rt::bytes_size(2, &value); }; if self.support != false { my_size += 1 + 1; } if self.count != 0 { my_size += ::protobuf::rt::int32_size(5, self.count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } for v in &self.vote_address { os.write_bytes(2, &v)?; }; if self.support != false { os.write_bool(3, self.support)?; } if self.count != 0 { os.write_int32(5, self.count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> VoteAssetContract { VoteAssetContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.vote_address.clear(); self.support = false; self.count = 0; self.special_fields.clear(); } fn default_instance() -> &'static VoteAssetContract { static instance: VoteAssetContract = VoteAssetContract { owner_address: ::std::vec::Vec::new(), vote_address: ::std::vec::Vec::new(), support: false, count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for VoteAssetContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("VoteAssetContract").unwrap()).clone() } } impl ::std::fmt::Display for VoteAssetContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for VoteAssetContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } static file_descriptor_proto_data: &'static [u8] = b"\ \n'core/contract/vote_asset_contract.proto\x12\x08protocol\"\x8b\x01\n\ \x11VoteAssetContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cown\ erAddress\x12!\n\x0cvote_address\x18\x02\x20\x03(\x0cR\x0bvoteAddress\ \x12\x18\n\x07support\x18\x03\x20\x01(\x08R\x07support\x12\x14\n\x05coun\ t\x18\x05\x20\x01(\x05R\x05countBE\n\x18org.tron.protos.contractZ)github\ .com/tronprotocol/grpc-gateway/coreJ\xf0\x03\n\x06\x12\x04\0\0\r\x01\n\ \x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x11\n\x08\n\ \x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\x03\x04\01\"=Specify\x20the\ \x20name\x20of\x20the\x20package\x20that\x20generated\x20the\x20Java\x20\ file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nr\n\x02\x08\x0b\x12\x03\x06\0@\ \x1agoption\x20java_outer_classname\x20=\x20\"VoteAssetContract\";\x20//\ Specify\x20the\x20class\x20name\x20of\x20the\x20generated\x20Java\x20fil\ e\n\n\n\n\x02\x04\0\x12\x04\x08\0\r\x01\n\n\n\x03\x04\0\x01\x12\x03\x08\ \x08\x19\n\x0b\n\x04\x04\0\x02\0\x12\x03\t\x02\x1a\n\x0c\n\x05\x04\0\x02\ \0\x05\x12\x03\t\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\t\x08\x15\n\ \x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\x18\x19\n\x0b\n\x04\x04\0\x02\x01\ \x12\x03\n\x02\"\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\n\x02\n\n\x0c\n\ \x05\x04\0\x02\x01\x05\x12\x03\n\x0b\x10\n\x0c\n\x05\x04\0\x02\x01\x01\ \x12\x03\n\x11\x1d\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x20!\n\x0b\n\ \x04\x04\0\x02\x02\x12\x03\x0b\x02\x13\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ \x03\x0b\x02\x06\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x0b\x07\x0e\n\x0c\ \n\x05\x04\0\x02\x02\x03\x12\x03\x0b\x11\x12\n\x0b\n\x04\x04\0\x02\x03\ \x12\x03\x0c\x02\x12\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03\x0c\x02\x07\n\ \x0c\n\x05\x04\0\x02\x03\x01\x12\x03\x0c\x08\r\n\x0c\n\x05\x04\0\x02\x03\ \x03\x12\x03\x0c\x10\x11b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(1); messages.push(VoteAssetContract::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/protocol/witness_contract.rs ================================================ // This file is generated by rust-protobuf 3.3.0. Do not edit // .proto file is parsed by protoc --rust-out=... // @generated // https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] #![allow(clippy::all)] #![allow(unused_attributes)] #![cfg_attr(rustfmt, rustfmt::skip)] #![allow(dead_code)] #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] #![allow(unused_results)] #![allow(unused_mut)] //! Generated file from `core/contract/witness_contract.proto` /// Generated files are compatible only with the same version /// of protobuf runtime. const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_7_2; // @@protoc_insertion_point(message:protocol.WitnessCreateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct WitnessCreateContract { // message fields // @@protoc_insertion_point(field:protocol.WitnessCreateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.WitnessCreateContract.url) pub url: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.WitnessCreateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a WitnessCreateContract { fn default() -> &'a WitnessCreateContract { ::default_instance() } } impl WitnessCreateContract { pub fn new() -> WitnessCreateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &WitnessCreateContract| { &m.owner_address }, |m: &mut WitnessCreateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "url", |m: &WitnessCreateContract| { &m.url }, |m: &mut WitnessCreateContract| { &mut m.url }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "WitnessCreateContract", fields, oneofs, ) } } impl ::protobuf::Message for WitnessCreateContract { const NAME: &'static str = "WitnessCreateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.url = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.url.is_empty() { my_size += ::protobuf::rt::bytes_size(2, &self.url); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.url.is_empty() { os.write_bytes(2, &self.url)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> WitnessCreateContract { WitnessCreateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.url.clear(); self.special_fields.clear(); } fn default_instance() -> &'static WitnessCreateContract { static instance: WitnessCreateContract = WitnessCreateContract { owner_address: ::std::vec::Vec::new(), url: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for WitnessCreateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("WitnessCreateContract").unwrap()).clone() } } impl ::std::fmt::Display for WitnessCreateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for WitnessCreateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.WitnessUpdateContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct WitnessUpdateContract { // message fields // @@protoc_insertion_point(field:protocol.WitnessUpdateContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.WitnessUpdateContract.update_url) pub update_url: ::std::vec::Vec, // special fields // @@protoc_insertion_point(special_field:protocol.WitnessUpdateContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a WitnessUpdateContract { fn default() -> &'a WitnessUpdateContract { ::default_instance() } } impl WitnessUpdateContract { pub fn new() -> WitnessUpdateContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &WitnessUpdateContract| { &m.owner_address }, |m: &mut WitnessUpdateContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "update_url", |m: &WitnessUpdateContract| { &m.update_url }, |m: &mut WitnessUpdateContract| { &mut m.update_url }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "WitnessUpdateContract", fields, oneofs, ) } } impl ::protobuf::Message for WitnessUpdateContract { const NAME: &'static str = "WitnessUpdateContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 98 => { self.update_url = is.read_bytes()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } if !self.update_url.is_empty() { my_size += ::protobuf::rt::bytes_size(12, &self.update_url); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } if !self.update_url.is_empty() { os.write_bytes(12, &self.update_url)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> WitnessUpdateContract { WitnessUpdateContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.update_url.clear(); self.special_fields.clear(); } fn default_instance() -> &'static WitnessUpdateContract { static instance: WitnessUpdateContract = WitnessUpdateContract { owner_address: ::std::vec::Vec::new(), update_url: ::std::vec::Vec::new(), special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for WitnessUpdateContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("WitnessUpdateContract").unwrap()).clone() } } impl ::std::fmt::Display for WitnessUpdateContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for WitnessUpdateContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } // @@protoc_insertion_point(message:protocol.VoteWitnessContract) #[derive(PartialEq,Clone,Default,Debug)] pub struct VoteWitnessContract { // message fields // @@protoc_insertion_point(field:protocol.VoteWitnessContract.owner_address) pub owner_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.VoteWitnessContract.votes) pub votes: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.VoteWitnessContract.support) pub support: bool, // special fields // @@protoc_insertion_point(special_field:protocol.VoteWitnessContract.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a VoteWitnessContract { fn default() -> &'a VoteWitnessContract { ::default_instance() } } impl VoteWitnessContract { pub fn new() -> VoteWitnessContract { ::std::default::Default::default() } fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(3); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "owner_address", |m: &VoteWitnessContract| { &m.owner_address }, |m: &mut VoteWitnessContract| { &mut m.owner_address }, )); fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( "votes", |m: &VoteWitnessContract| { &m.votes }, |m: &mut VoteWitnessContract| { &mut m.votes }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "support", |m: &VoteWitnessContract| { &m.support }, |m: &mut VoteWitnessContract| { &mut m.support }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "VoteWitnessContract", fields, oneofs, ) } } impl ::protobuf::Message for VoteWitnessContract { const NAME: &'static str = "VoteWitnessContract"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.owner_address = is.read_bytes()?; }, 18 => { self.votes.push(is.read_message()?); }, 24 => { self.support = is.read_bool()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.owner_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.owner_address); } for value in &self.votes { let len = value.compute_size(); my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; if self.support != false { my_size += 1 + 1; } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.owner_address.is_empty() { os.write_bytes(1, &self.owner_address)?; } for v in &self.votes { ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; }; if self.support != false { os.write_bool(3, self.support)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> VoteWitnessContract { VoteWitnessContract::new() } fn clear(&mut self) { self.owner_address.clear(); self.votes.clear(); self.support = false; self.special_fields.clear(); } fn default_instance() -> &'static VoteWitnessContract { static instance: VoteWitnessContract = VoteWitnessContract { owner_address: ::std::vec::Vec::new(), votes: ::std::vec::Vec::new(), support: false, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for VoteWitnessContract { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| file_descriptor().message_by_package_relative_name("VoteWitnessContract").unwrap()).clone() } } impl ::std::fmt::Display for VoteWitnessContract { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for VoteWitnessContract { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } /// Nested message and enums of message `VoteWitnessContract` pub mod vote_witness_contract { // @@protoc_insertion_point(message:protocol.VoteWitnessContract.Vote) #[derive(PartialEq,Clone,Default,Debug)] pub struct Vote { // message fields // @@protoc_insertion_point(field:protocol.VoteWitnessContract.Vote.vote_address) pub vote_address: ::std::vec::Vec, // @@protoc_insertion_point(field:protocol.VoteWitnessContract.Vote.vote_count) pub vote_count: i64, // special fields // @@protoc_insertion_point(special_field:protocol.VoteWitnessContract.Vote.special_fields) pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a Vote { fn default() -> &'a Vote { ::default_instance() } } impl Vote { pub fn new() -> Vote { ::std::default::Default::default() } pub(in super) fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { let mut fields = ::std::vec::Vec::with_capacity(2); let mut oneofs = ::std::vec::Vec::with_capacity(0); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vote_address", |m: &Vote| { &m.vote_address }, |m: &mut Vote| { &mut m.vote_address }, )); fields.push(::protobuf::reflect::rt::v2::make_simpler_field_accessor::<_, _>( "vote_count", |m: &Vote| { &m.vote_count }, |m: &mut Vote| { &mut m.vote_count }, )); ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( "VoteWitnessContract.Vote", fields, oneofs, ) } } impl ::protobuf::Message for Vote { const NAME: &'static str = "Vote"; fn is_initialized(&self) -> bool { true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { while let Some(tag) = is.read_raw_tag_or_eof()? { match tag { 10 => { self.vote_address = is.read_bytes()?; }, 16 => { self.vote_count = is.read_int64()?; }, tag => { ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } ::std::result::Result::Ok(()) } // Compute sizes of nested messages #[allow(unused_variables)] fn compute_size(&self) -> u64 { let mut my_size = 0; if !self.vote_address.is_empty() { my_size += ::protobuf::rt::bytes_size(1, &self.vote_address); } if self.vote_count != 0 { my_size += ::protobuf::rt::int64_size(2, self.vote_count); } my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); self.special_fields.cached_size().set(my_size as u32); my_size } fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if !self.vote_address.is_empty() { os.write_bytes(1, &self.vote_address)?; } if self.vote_count != 0 { os.write_int64(2, self.vote_count)?; } os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } fn special_fields(&self) -> &::protobuf::SpecialFields { &self.special_fields } fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { &mut self.special_fields } fn new() -> Vote { Vote::new() } fn clear(&mut self) { self.vote_address.clear(); self.vote_count = 0; self.special_fields.clear(); } fn default_instance() -> &'static Vote { static instance: Vote = Vote { vote_address: ::std::vec::Vec::new(), vote_count: 0, special_fields: ::protobuf::SpecialFields::new(), }; &instance } } impl ::protobuf::MessageFull for Vote { fn descriptor() -> ::protobuf::reflect::MessageDescriptor { static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); descriptor.get(|| super::file_descriptor().message_by_package_relative_name("VoteWitnessContract.Vote").unwrap()).clone() } } impl ::std::fmt::Display for Vote { fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for Vote { type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; } } static file_descriptor_proto_data: &'static [u8] = b"\ \n$core/contract/witness_contract.proto\x12\x08protocol\"N\n\x15WitnessC\ reateContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddres\ s\x12\x10\n\x03url\x18\x02\x20\x01(\x0cR\x03url\"[\n\x15WitnessUpdateCon\ tract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddress\x12\ \x1d\n\nupdate_url\x18\x0c\x20\x01(\x0cR\tupdateUrl\"\xd8\x01\n\x13VoteW\ itnessContract\x12#\n\rowner_address\x18\x01\x20\x01(\x0cR\x0cownerAddre\ ss\x128\n\x05votes\x18\x02\x20\x03(\x0b2\".protocol.VoteWitnessContract.\ VoteR\x05votes\x12\x18\n\x07support\x18\x03\x20\x01(\x08R\x07support\x1a\ H\n\x04Vote\x12!\n\x0cvote_address\x18\x01\x20\x01(\x0cR\x0bvoteAddress\ \x12\x1d\n\nvote_count\x18\x02\x20\x01(\x03R\tvoteCountBE\n\x18org.tron.\ protos.contractZ)github.com/tronprotocol/grpc-gateway/coreJ\xe3\x06\n\ \x06\x12\x04\0\0\x1a\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\ \x12\x03\x02\0\x11\n\x08\n\x01\x08\x12\x03\x04\01\nH\n\x02\x08\x01\x12\ \x03\x04\01\"=Specify\x20the\x20name\x20of\x20the\x20package\x20that\x20\ generated\x20the\x20Java\x20file\n\n\x08\n\x01\x08\x12\x03\x06\0@\nv\n\ \x02\x08\x0b\x12\x03\x06\0@\x1akoption\x20java_outer_classname\x20=\x20\ \"WitnessCreateContract\";\x20//Specify\x20the\x20class\x20name\x20of\ \x20the\x20generated\x20Java\x20file\n\n\n\n\x02\x04\0\x12\x04\x08\0\x0b\ \x01\n\n\n\x03\x04\0\x01\x12\x03\x08\x08\x1d\n\x0b\n\x04\x04\0\x02\0\x12\ \x03\t\x02\x1a\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\t\x02\x07\n\x0c\n\x05\ \x04\0\x02\0\x01\x12\x03\t\x08\x15\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\t\ \x18\x19\n\x0b\n\x04\x04\0\x02\x01\x12\x03\n\x02\x10\n\x0c\n\x05\x04\0\ \x02\x01\x05\x12\x03\n\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\n\ \x08\x0b\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\n\x0e\x0f\n\n\n\x02\x04\ \x01\x12\x04\r\0\x10\x01\n\n\n\x03\x04\x01\x01\x12\x03\r\x08\x1d\n\x0b\n\ \x04\x04\x01\x02\0\x12\x03\x0e\x02\x1a\n\x0c\n\x05\x04\x01\x02\0\x05\x12\ \x03\x0e\x02\x07\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x0e\x08\x15\n\x0c\ \n\x05\x04\x01\x02\0\x03\x12\x03\x0e\x18\x19\n\x0b\n\x04\x04\x01\x02\x01\ \x12\x03\x0f\x02\x18\n\x0c\n\x05\x04\x01\x02\x01\x05\x12\x03\x0f\x02\x07\ \n\x0c\n\x05\x04\x01\x02\x01\x01\x12\x03\x0f\x08\x12\n\x0c\n\x05\x04\x01\ \x02\x01\x03\x12\x03\x0f\x15\x17\n\n\n\x02\x04\x02\x12\x04\x12\0\x1a\x01\ \n\n\n\x03\x04\x02\x01\x12\x03\x12\x08\x1b\n\x0c\n\x04\x04\x02\x03\0\x12\ \x04\x13\x02\x16\x03\n\x0c\n\x05\x04\x02\x03\0\x01\x12\x03\x13\n\x0e\n\r\ \n\x06\x04\x02\x03\0\x02\0\x12\x03\x14\x04\x1b\n\x0e\n\x07\x04\x02\x03\0\ \x02\0\x05\x12\x03\x14\x04\t\n\x0e\n\x07\x04\x02\x03\0\x02\0\x01\x12\x03\ \x14\n\x16\n\x0e\n\x07\x04\x02\x03\0\x02\0\x03\x12\x03\x14\x19\x1a\n\r\n\ \x06\x04\x02\x03\0\x02\x01\x12\x03\x15\x04\x19\n\x0e\n\x07\x04\x02\x03\0\ \x02\x01\x05\x12\x03\x15\x04\t\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x01\x12\ \x03\x15\n\x14\n\x0e\n\x07\x04\x02\x03\0\x02\x01\x03\x12\x03\x15\x17\x18\ \n\x0b\n\x04\x04\x02\x02\0\x12\x03\x17\x02\x1a\n\x0c\n\x05\x04\x02\x02\0\ \x05\x12\x03\x17\x02\x07\n\x0c\n\x05\x04\x02\x02\0\x01\x12\x03\x17\x08\ \x15\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03\x17\x18\x19\n\x0b\n\x04\x04\ \x02\x02\x01\x12\x03\x18\x02\x1a\n\x0c\n\x05\x04\x02\x02\x01\x04\x12\x03\ \x18\x02\n\n\x0c\n\x05\x04\x02\x02\x01\x06\x12\x03\x18\x0b\x0f\n\x0c\n\ \x05\x04\x02\x02\x01\x01\x12\x03\x18\x10\x15\n\x0c\n\x05\x04\x02\x02\x01\ \x03\x12\x03\x18\x18\x19\n\x0b\n\x04\x04\x02\x02\x02\x12\x03\x19\x02\x13\ \n\x0c\n\x05\x04\x02\x02\x02\x05\x12\x03\x19\x02\x06\n\x0c\n\x05\x04\x02\ \x02\x02\x01\x12\x03\x19\x07\x0e\n\x0c\n\x05\x04\x02\x02\x02\x03\x12\x03\ \x19\x11\x12b\x06proto3\ "; /// `FileDescriptorProto` object which was a source for this generated file fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); file_descriptor_proto_lazy.get(|| { ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() }) } /// `FileDescriptor` object which allows dynamic access to files pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); file_descriptor.get(|| { let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { let mut deps = ::std::vec::Vec::with_capacity(0); let mut messages = ::std::vec::Vec::with_capacity(4); messages.push(WitnessCreateContract::generated_message_descriptor_data()); messages.push(WitnessUpdateContract::generated_message_descriptor_data()); messages.push(VoteWitnessContract::generated_message_descriptor_data()); messages.push(vote_witness_contract::Vote::generated_message_descriptor_data()); let mut enums = ::std::vec::Vec::with_capacity(0); ::protobuf::reflect::GeneratedFileDescriptor::new_generated( file_descriptor_proto(), deps, messages, enums, ) }); ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) }) } ================================================ FILE: crates/anychain-tron/src/public_key.rs ================================================ use crate::{TronAddress, TronFormat}; use anychain_core::{Address, AddressError, PublicKey, PublicKeyError}; use core::{fmt, fmt::Display, str::FromStr}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct TronPublicKey(libsecp256k1::PublicKey); impl PublicKey for TronPublicKey { type SecretKey = libsecp256k1::SecretKey; type Address = TronAddress; type Format = TronFormat; fn from_secret_key(secret_key: &Self::SecretKey) -> Self { Self(libsecp256k1::PublicKey::from_secret_key(secret_key)) } fn to_address(&self, format: &Self::Format) -> Result { TronAddress::from_public_key(self, format) } } impl TronPublicKey { /// Returns a public key given a secp256k1 public key. pub fn from_secp256k1_public_key(public_key: libsecp256k1::PublicKey) -> Self { Self(public_key) } /// Returns the secp256k1 public key of the public key pub fn to_secp256k1_public_key(&self) -> libsecp256k1::PublicKey { self.0 } } impl FromStr for TronPublicKey { type Err = PublicKeyError; fn from_str(public_key: &str) -> Result { Ok(Self( libsecp256k1::PublicKey::parse_slice(hex::decode(public_key)?.as_slice(), None) .map_err(|error| PublicKeyError::Crate("libsecp256k1", format!("{:?}", error)))?, )) } } impl Display for TronPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for s in &self.0.serialize() { write!(f, "{:02X}", s)?; } Ok(()) } } #[cfg(test)] mod tests { use crate::TronPublicKey; #[test] pub fn test_from_private() {} #[test] pub fn test_from_str() { let uncompressed_key = "0404B604296010A55D40000B798EE8454ECCC1F8900E70B1ADF47C9887625D8BAE3866351A6FA0B5370623268410D33D345F63344121455849C9C28F9389ED9731"; let pubkey: TronPublicKey = uncompressed_key.parse().unwrap(); assert_eq!(uncompressed_key, pubkey.to_string()); } } ================================================ FILE: crates/anychain-tron/src/transaction.rs ================================================ use crate::protocol::Tron::transaction::{Contract, Raw as TransactionRaw}; use crate::protocol::Tron::Transaction as TransactionProto; use crate::trx; use crate::{TronAddress, TronFormat, TronPublicKey}; use anychain_core::utilities::crypto; use anychain_core::Transaction; use anychain_core::TransactionError; use anychain_core::TransactionId; use protobuf::Message; use std::fmt; use std::str::FromStr; /// Represents the parameters for a Tron transaction #[derive(Debug, Clone, PartialEq)] pub struct TronTransactionParameters { pub ref_block_hash: Vec, pub ref_block_bytes: Vec, pub fee_limit: i64, pub expiration: i64, pub timestamp: i64, pub memo: String, pub contract: Contract, } impl TronTransactionParameters { pub fn set_ref_block(&mut self, number: i64, hash: &str) { self.ref_block_bytes = vec![((number & 0xff00) >> 8) as u8, (number & 0xff) as u8]; hex::decode(hash).unwrap()[8..16].clone_into(&mut self.ref_block_hash) } pub fn set_contract(&mut self, ct: Contract) { self.contract = ct; } pub fn set_timestamp(&mut self, time: i64) { self.timestamp = time; } pub fn set_expiration(&mut self, time: i64) { self.expiration = time; } pub fn set_fee_limit(&mut self, fee: i64) { self.fee_limit = fee; } pub fn to_transaction_raw(&self) -> Result { let mut raw = TransactionRaw::new(); let mut timestamp = self.timestamp; // if timestamp equals 0, means the tx is new if self.timestamp == 0 { timestamp = trx::timestamp_millis(); } raw.contract = vec![self.contract.clone()]; if !self.memo.is_empty() { self.memo.as_bytes().clone_into(&mut raw.data) } if self.fee_limit != 0 { raw.fee_limit = self.fee_limit; } raw.timestamp = timestamp; raw.expiration = timestamp + self.expiration; raw.ref_block_bytes.clone_from(&self.ref_block_bytes); raw.ref_block_hash.clone_from(&self.ref_block_hash); Ok(raw) } } impl Default for TronTransactionParameters { fn default() -> Self { Self { ref_block_hash: Default::default(), ref_block_bytes: Default::default(), fee_limit: 0, timestamp: 0, expiration: 1000 * 60 * 5_i64, memo: "".to_string(), contract: Default::default(), } } } /// Represents an Ethereum transaction signature #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct TronTransactionSignature(Vec); impl TronTransactionSignature { pub fn new(rs: &[u8], recid: u8) -> Self { let mut vec = rs.to_owned(); vec.push(recid); TronTransactionSignature(vec) } pub fn to_bytes(&self) -> Vec { self.0.clone() } } /// Represents an Ethereum transaction id #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct TronTransactionId { pub txid: Vec, } impl TransactionId for TronTransactionId {} impl fmt::Display for TronTransactionId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", &hex::encode(&self.txid)) } } #[derive(Debug, Clone, PartialEq)] pub struct TronTransaction { pub data: TronTransactionParameters, pub signature: Option, } impl FromStr for TronTransaction { type Err = TransactionError; fn from_str(tx: &str) -> Result { Self::from_bytes(&hex::decode(tx)?) } } impl Transaction for TronTransaction { type Address = TronAddress; type Format = TronFormat; type PublicKey = TronPublicKey; type TransactionId = TronTransactionId; type TransactionParameters = TronTransactionParameters; fn new(params: &Self::TransactionParameters) -> Result { Ok(Self { data: params.clone(), signature: None, }) } fn sign(&mut self, signature: Vec, recid: u8) -> Result, TransactionError> { self.signature = Some(TronTransactionSignature::new(&signature, recid)); self.to_bytes() } fn from_bytes(stream: &[u8]) -> Result { let (raw, sig) = if let Ok(tx) = TransactionProto::parse_from_bytes(stream) { if !tx.signature.is_empty() { let raw = tx.raw_data.unwrap(); let sig = tx.signature[0].clone(); match sig.len() == 65 { true => (raw, Some(TronTransactionSignature(sig))), false => (raw, None), } } else if let Ok(raw) = TransactionRaw::parse_from_bytes(stream) { (raw, None) } else { return Err(TransactionError::Message( "illegal tron transaction stream".to_string(), )); } } else if let Ok(raw) = TransactionRaw::parse_from_bytes(stream) { (raw, None) } else { return Err(TransactionError::Message( "illegal tron transaction stream".to_string(), )); }; let param = TronTransactionParameters { timestamp: raw.timestamp, expiration: raw.expiration - raw.timestamp, ref_block_bytes: raw.ref_block_bytes.clone(), ref_block_hash: raw.ref_block_hash.clone(), memo: String::from_utf8(raw.data.clone()) .map_err(|e| TransactionError::Crate("protobuf", e.to_string()))?, fee_limit: raw.fee_limit, contract: raw.contract[0].clone(), }; Ok(Self { data: param, signature: sig, }) } fn to_bytes(&self) -> Result, TransactionError> { let raw = self.data.to_transaction_raw()?; match &self.signature { Some(sign) => { let mut signed_tx = TransactionProto::new(); signed_tx.raw_data = ::protobuf::MessageField::some(raw); signed_tx.signature = vec![sign.to_bytes()]; signed_tx .write_to_bytes() .map_err(|e| TransactionError::Crate("protobuf", e.to_string())) } None => raw .write_to_bytes() .map_err(|e| TransactionError::Crate("protobuf", e.to_string())), } } fn to_transaction_id(&self) -> Result { Ok(Self::TransactionId { txid: crypto::sha256(&self.to_bytes()?).to_vec(), }) } } #[cfg(test)] mod tests { use super::*; pub fn build_trx_transaction() -> TronTransaction { let addr_from = "TG7jQ7eGsns6nmQNfcKNgZKyKBFkx7CvXr"; let addr_to = "TFk5LfscQv8hYM11mZYmi3ZcnRfFc4LLap"; let amount = "10000000"; let ct = trx::build_transfer_contract(addr_from, addr_to, amount).unwrap(); let mut param = TronTransactionParameters::default(); param.set_timestamp(trx::timestamp_millis()); param.set_ref_block( 26661399, "000000000196d21784deb05dee04c69ed112b8e078e74019f9a0b1df6adc414e", ); param.set_contract(ct); TronTransaction::new(¶m).unwrap() } #[test] pub fn test_txid() { let transaction = build_trx_transaction(); dbg!("{}", transaction.to_transaction_id().unwrap()); let raw = transaction.data.to_transaction_raw().unwrap(); let raw_bytes = crypto::sha256(&raw.write_to_bytes().unwrap()); dbg!("{}", hex::encode(raw_bytes)); assert_eq!(transaction.to_transaction_id().unwrap().txid, raw_bytes); } #[test] fn test_build_tx2() { let from_addr = "TYn6xn1aY3hrsDfLzpyPQtDiKjHEU8Hsxm"; let to_addr = "TG7jQ7eGsns6nmQNfcKNgZKyKBFkx7CvXr"; let amount = "1000000"; // 以Sun为单位 let block_height = 27007120; let block_hash = "00000000019c1890f87d110a81d815b9a38a3e62d44a00a7c8fd50a7b322a2df"; let ct = trx::build_transfer_contract(from_addr, to_addr, amount).unwrap(); let mut param = TronTransactionParameters::default(); param.set_timestamp(trx::timestamp_millis()); param.set_ref_block(block_height, block_hash); param.set_contract(ct); let transaction = TronTransaction::new(¶m).unwrap(); let bytes = transaction.to_bytes().unwrap(); dbg!("{}", hex::encode(bytes)); dbg!("{}", transaction.to_transaction_id().unwrap()); dbg!("{:?}", transaction.data); } #[test] pub fn test_from_bytes() { let raw = "0a0218902208f87d110a81d815b9409994dbfaac305a67080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541fa3146ab779ce02392d11209f524ee75d4088a45121541436d74fc1577266b7290b85801145d9c5287e19418c0843d70b9bfd7faac30900180ade204"; let txid = "519f9d0bdc17d4a083b2676a4e9dce5679045107e7c9a9dad848891ee845235d"; let transaction = TronTransaction::from_bytes(&hex::decode(raw).unwrap()).unwrap(); let bytes = transaction.to_bytes().unwrap(); //println!("{}",transaction.to_transaction_id().unwrap()); //println!("{:?}",transaction.data); assert_eq!(raw, hex::encode(bytes)); assert_eq!(txid, transaction.to_transaction_id().unwrap().to_string()); } #[test] pub fn test_raw() { let raw = "0a025aa722088cb23bfcb18ea03c40facee394ad305a67080112630a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412320a1541fa3146ab779ce02392d11209f524ee75d4088a45121541436d74fc1577266b7290b85801145d9c5287e19418c0843d709afadf94ad30900180ade204"; let transaction = TronTransaction::from_bytes(&hex::decode(raw).unwrap()); assert!(transaction.is_ok()); dbg!("{:?}", transaction.unwrap().data); } } ================================================ FILE: crates/anychain-tron/src/trx.rs ================================================ use crate::{ abi, protocol::{ account_contract::AccountCreateContract, balance_contract::{ CancelAllUnfreezeV2Contract, DelegateResourceContract, FreezeBalanceV2Contract, TransferContract, UnDelegateResourceContract, UnfreezeBalanceV2Contract, WithdrawBalanceContract, WithdrawExpireUnfreezeContract, }, common::ResourceCode, smart_contract::TriggerSmartContract, witness_contract::{vote_witness_contract::Vote, VoteWitnessContract}, Tron::{ transaction::{contract::ContractType, Contract}, AccountType, }, }, TronAddress, }; use anychain_core::Error; use chrono::Utc; use core::panic; use protobuf::{well_known_types::any::Any, EnumOrUnknown, Message}; use std::str::FromStr; pub trait ContractPbExt: Message { fn contract_type(&self) -> ContractType; /// Convert Pb to protobuf::well_known_types::Any fn as_google_any(&self) -> Result { Ok(Any { type_url: format!("type.googleapis.com/protocol.{:?}", self.contract_type()), value: self.write_to_bytes()?, ..Default::default() }) } } macro_rules! impl_contract_pb_ext_for { ($contract_ty:ident) => { impl ContractPbExt for $contract_ty { fn contract_type(&self) -> ContractType { ContractType::$contract_ty } } }; } impl_contract_pb_ext_for!(TransferContract); impl_contract_pb_ext_for!(TriggerSmartContract); impl_contract_pb_ext_for!(AccountCreateContract); impl_contract_pb_ext_for!(FreezeBalanceV2Contract); impl_contract_pb_ext_for!(UnfreezeBalanceV2Contract); impl_contract_pb_ext_for!(DelegateResourceContract); impl_contract_pb_ext_for!(UnDelegateResourceContract); impl_contract_pb_ext_for!(CancelAllUnfreezeV2Contract); impl_contract_pb_ext_for!(WithdrawExpireUnfreezeContract); impl_contract_pb_ext_for!(VoteWitnessContract); impl_contract_pb_ext_for!(WithdrawBalanceContract); fn to_resource_code(r: u8) -> ResourceCode { match r { 0 => ResourceCode::BANDWIDTH, 1 => ResourceCode::ENERGY, _ => panic!("Undefined resource"), } } pub fn timestamp_millis() -> i64 { Utc::now().timestamp_millis() } pub fn build_contract(ct: &impl ContractPbExt) -> Result { let mut contract = Contract::new(); contract.type_ = ::protobuf::EnumOrUnknown::new(ct.contract_type()); contract.parameter = ::protobuf::MessageField::some( ct.as_google_any() .map_err(|e| Error::RuntimeError(e.to_string()))?, ); Ok(contract) } pub fn build_trigger_contract( owner: &str, contract: &str, data: Vec, ) -> Result { let mut ts_contract = TriggerSmartContract::new(); ts_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); ts_contract.contract_address = TronAddress::from_str(contract)?.as_bytes().to_vec(); ts_contract.data = data; build_contract(&ts_contract) } pub fn build_trc20_transfer_contract( owner: &str, contract: &str, recipient: &str, amount: &str, ) -> Result { build_trigger_contract(owner, contract, abi::trc20_transfer(recipient, amount)) } pub fn build_trc20_approve_contract( owner: &str, contract: &str, recipient: &str, amount: &str, ) -> Result { build_trigger_contract(owner, contract, abi::trc20_approve(recipient, amount)) } pub fn build_transfer_contract( owner: &str, recipient: &str, amount: &str, ) -> Result { let sender: TronAddress = owner.parse()?; let recipient: TronAddress = recipient.parse()?; let mut transfer_contract = TransferContract::new(); sender .as_bytes() .clone_into(&mut transfer_contract.owner_address); recipient .as_bytes() .clone_into(&mut transfer_contract.to_address); transfer_contract.amount = amount.parse::()?; build_contract(&transfer_contract) } pub fn build_account_create(owner_addr: &str, create_addr: &str) -> Result { let mut ac_contract = AccountCreateContract::new(); ac_contract.owner_address = TronAddress::from_str(owner_addr)?.as_bytes().to_vec(); ac_contract.account_address = TronAddress::from_str(create_addr)?.as_bytes().to_vec(); ac_contract.type_ = EnumOrUnknown::::new(AccountType::Normal); build_contract(&ac_contract) } pub fn build_freeze_balance_v2_contract( owner: &str, freeze_balance: &str, resource: u8, ) -> Result { let mut fb_v2_contract = FreezeBalanceV2Contract::new(); fb_v2_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); fb_v2_contract.frozen_balance = freeze_balance.parse::()?; fb_v2_contract.resource = EnumOrUnknown::::new(to_resource_code(resource)); build_contract(&fb_v2_contract) } pub fn build_unfreeze_balance_v2_contract( owner: &str, unfreeze_balance: &str, resource: u8, ) -> Result { let mut ub_v2_contract = UnfreezeBalanceV2Contract::new(); ub_v2_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); ub_v2_contract.unfreeze_balance = unfreeze_balance.parse::()?; ub_v2_contract.resource = EnumOrUnknown::::new(to_resource_code(resource)); build_contract(&ub_v2_contract) } pub fn build_delegate_resource_contract( owner: &str, recipient: &str, resource: u8, amount: &str, lock: bool, ) -> Result { let mut dr_contract = DelegateResourceContract::new(); dr_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); dr_contract.receiver_address = TronAddress::from_str(recipient)?.as_bytes().to_vec(); dr_contract.balance = amount.parse::()?; dr_contract.resource = EnumOrUnknown::::new(to_resource_code(resource)); dr_contract.lock = lock; build_contract(&dr_contract) } pub fn build_undelegate_resource_contract( owner: &str, recipient: &str, resource: u8, amount: &str, ) -> Result { let mut ur_contract = UnDelegateResourceContract::new(); ur_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); ur_contract.receiver_address = TronAddress::from_str(recipient)?.as_bytes().to_vec(); ur_contract.balance = amount.parse::()?; ur_contract.resource = EnumOrUnknown::::new(to_resource_code(resource)); build_contract(&ur_contract) } pub fn build_cancel_unfreeze_contract(owner: &str) -> Result { let mut cu_contract = CancelAllUnfreezeV2Contract::new(); cu_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); build_contract(&cu_contract) } pub fn build_withdraw_unfreeze_contract(owner: &str) -> Result { let mut wu_contract = WithdrawExpireUnfreezeContract::new(); wu_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); build_contract(&wu_contract) } pub fn build_vote_witness_contract( owner: &str, votes: Vec<(&str, i64)>, support: bool, ) -> Result { let mut vw_contract = VoteWitnessContract::new(); vw_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); vw_contract.support = support; vw_contract.votes = votes .iter() .map(|&(addr, vote_count)| { let mut vote = Vote::new(); let addr = TronAddress::from_str(addr).unwrap().as_bytes().to_vec(); vote.vote_address = addr; vote.vote_count = vote_count; vote }) .collect::>(); build_contract(&vw_contract) } pub fn build_withdraw_vote_contract(owner: &str) -> Result { let mut wb_contract = WithdrawBalanceContract::new(); wb_contract.owner_address = TronAddress::from_str(owner)?.as_bytes().to_vec(); build_contract(&wb_contract) } ================================================ FILE: docs/design-cn.md ================================================ # 设计 AnyChain Wallet SDK 的出发点 1. 支持市值 TVL Top100 Token 的转账交易,包括:BTC、ETH、USDT、BNB、SOL、USDC、TON 等。相应地,需要接入的区块链包括:比特币、以太坊、索拉纳,以及各条链上的 L2 网络。 2. 实现跨平台编译,确保跨平台兼容性。考虑到源代码兼容性和工具链兼容性,编程语言选择限定为 C/C++/Rust。 ## 公链的特性抽象 ### 大多数公链需要支持的核心特性 - PublicKey(公钥) - PrivateKey(私钥) - Address(地址) - Amount(金额) - Transaction(交易) - Network(网络) - Format(格式) anychain-core 作为一个全面的抽象 Trait,定义了以下通用方法: ```rust pub trait PublicKey { fn from_private_key(private_key: &Self::PrivateKey) -> Self; fn to_address(&self, format: &Self::Format) -> Result; } pub trait Address { fn from_private_key(private_key: &Self::PrivateKey, format: &Self::Format) -> Result; fn from_public_key(public_key: &Self::PublicKey, format: &Self::Format) -> Result; } pub trait Amount {} pub trait Format {} pub trait Transaction { fn new(parameters: &Self::TransactionParameters) -> Result; fn sign(); fn from_bytes(); fn to_bytes(&self); fn to_transaction_id(&self); } ``` ### 各条链实现 Trait 的具体方法 以 anychain-tron 的 TronAddress 为例: ```rust pub struct TronAddress([u8; 21]); impl Address for TronAddress { type Format = TronFormat; type PrivateKey = TronPrivateKey; type PublicKey = TronPublicKey; fn from_private_key( private_key: &Self::PrivateKey, format: &Self::Format ) -> Result { todo!() } fn from_public_key( public_key: &Self::PublicKey, format: &Self::Format ) -> Result { todo!() } } ``` 通过引入 anychain-core 的抽象层和 anychain-bitcoin、anychain-tron 等链的具体实现,上层应用可以使用统一的代码和接口来调用 anychain SDK。 ## 跨平台编译和技术栈 | 平台 | 目标文件格式 | | --- | --- | | iOS | .a(静态库) | | Android | .so(共享对象) | | Web/Wasm | .wasm(WebAssembly) | | Windows | .dll(动态链接库) | | macOS | .dylib(动态库) | | 嵌入式设备 | ELF(可执行与可链接格式) | | 可信执行环境(TEE) | .eif(加密镜像文件) | ### 以 iOS 平台为例,其调用层级结构 ``` +-------------------+ | iOS Application | +-------------------+ | | Link v +-------------------+ | C Library (.dylib)| +-------------------+ | | FFI v +-------------------+ | Rust Library | +-------------------+ | | Compile v +-------------------+ | Rust Source Code | +-------------------+ ``` ### 以 iOS 平台编译为例,其实现步骤包括: 1. 创建 Rust 库 2. 在 Rust 中使用 FFI(外部函数接口) 3. 定义 C-ABI 函数 4. 编译库文件 5. 将库文件链接到 iOS 应用 6. 处理数据类型 7. 测试和调试 ### 最终编译目标的存储空间占用 | **平台/格式** | **文件名** | **大小** | | --- | --- | --- | | Docker 镜像 | enclave-server | < 17M | | WebAssembly 包 | anychain_wasm_bg.wasm | 81K | | STM32 | ROM | < 10M | | iOS | anychain-ethereum-cli | 7.4M | 相比之下,web3.js/node_modules 需要引入高达 29M 的第三方包 ## Anychain-KMS ### Anychain 基于 BIP32/BIP39 标准提供的工具函数集合 - 私钥(Private Key) - 公钥(Public Key) - 助记词(Mnemonic) - 种子(Seed) - 扩展密钥(Extended Key) - 扩展私钥(Extended Private Key) - 扩展公钥(Extended Public Key) - 派生路径(Derivation Path) 这些工具函数用于支持各条区块链的钱包生成。 ================================================ FILE: docs/design-en.md ================================================ # Design Principles for AnyChain Wallet SDK 1. Support transfer transactions for the top 100 tokens by market cap and TVL, including: BTC, ETH, USDT, BNB, SOL, USDC, TON, etc. Correspondingly, the blockchains to be integrated include: Bitcoin, Ethereum, Solana, as well as L2 networks on various chains. 2. Implement cross-platform compilation for wide compatibility. Language choice limited to C/C++/Rust due to source code and toolchain considerations. ## Abstraction of Public Chain Features ### Core Features Most Public Chains Need to Support - PublicKey - PrivateKey - Address - Amount - Transaction - Network - Format anychain-core, as a comprehensive abstract Trait, defines the following common methods: ```rust pub trait PublicKey { fn from_private_key(private_key: &Self::PrivateKey) -> Self; fn to_address(&self, format: &Self::Format) -> Result; } pub trait Address { fn from_private_key(private_key: &Self::PrivateKey, format: &Self::Format) -> Result; fn from_public_key(public_key: &Self::PublicKey, format: &Self::Format) -> Result; } pub trait Amount {} pub trait Format {} pub trait Transaction { fn new(parameters: &Self::TransactionParameters) -> Result; fn sign(); fn from_bytes(); fn to_bytes(&self); fn to_transaction_id(&self); } ``` ### Trait Implementation for Various Chains Let's take TronAddress from anychain-tron as an example: ```rust pub struct TronAddress([u8; 21]); impl Address for TronAddress { type Format = TronFormat; type PrivateKey = TronPrivateKey; type PublicKey = TronPublicKey; fn from_private_key( private_key: &Self::PrivateKey, format: &Self::Format ) -> Result { todo!() } fn from_public_key( public_key: &Self::PublicKey, format: &Self::Format ) -> Result { todo!() } } ``` By introducing the abstraction layer of anychain-core and the specific implementations of chains such as anychain-bitcoin and anychain-tron, upper-level applications can use unified code and interfaces to call the anychain SDK. ## Cross-Platform Compilation | Platform | Target File Format | | --- | --- | | iOS | .a (Static Library) | | Android | .so (Shared Object) | | Web/Wasm | .wasm (WebAssembly) | | Windows | .dll (Dynamic-Link Library) | | macOS | .dylib (Dynamic Library) | | Embedded Devices | ELF (Executable and Linkable Format) | | Trusted Execution Environment (TEE) | .eif (Encrypted Image File) | ### iOS platform calling hierarchy ``` +-------------------+ | iOS Application | +-------------------+ | | Link v +-------------------+ | C Library (.dylib)| +-------------------+ | | FFI v +-------------------+ | Rust Library | +-------------------+ | | Compile v +-------------------+ | Rust Source Code | +-------------------+ ``` ### iOS Platform Compilation Steps: 1. Creating a Rust library 2. Using FFI (Foreign Function Interface) in Rust 3. Defining C-ABI functions 4. Compiling the library file 5. Linking the library file to the iOS application 6. Handling data types 7. Testing and debugging ### Compiled Target Sizes | **Platform/Format** | **File Name** | **Size** | | --- | --- | --- | | Docker image | enclave-server | < 17M | | WebAssembly package | anychain_wasm_bg.wasm | 81K | | STM32 | ROM | < 10M | | iOS | anychain-ethereum-cli | 7.4M | In comparison, web3.js/node_modules requires the inclusion of third-party packages up to 29M ## Anychain-KMS ### Anychain's BIP32/BIP39-based utility functions - Private Key - Public Key - Mnemonic - Seed - Extended Key - Extended Private Key - Extended Public Key - Derivation Path These utility functions are used to support wallet generation for various blockchains. ================================================ FILE: examples/anychain-bitcoin-cli/Cargo.toml ================================================ [package] name = "anychain-bitcoin-cli" version = "0.1.0" edition = "2021" publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../../crates/anychain-core" } anychain-bitcoin = { path = "../../crates/anychain-bitcoin" } clap = { workspace = true } serde_json = { workspace = true } libsecp256k1 = { workspace = true } [lints] workspace = true ================================================ FILE: examples/anychain-bitcoin-cli/README.md ================================================ # anychain-bitcoin-cli A command line program for the generation and/or validation of addresses and transactions of utxo compatible blockchains ### Build cd anychain/anychain-bitcoin-cli cargo build --release ### Run ``` cd ../target/release ``` #### Address Generation * we can generate addresses by providing a corresponding private key: ``` ./anychain-bitcoin-cli address-gen -n [network] --priv [private_key] ``` e.g. ``` ./anychain-bitcoin-cli address-gen -n bitcoin --priv cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564 ``` (the private key being a 64-byte hex string) * we can also generate addresses by providing a corresponding public key: ``` ./anychain-bitcoin-cli address-gen -n [network] --pub [public_key] ``` e.g. ``` ./anychain-bitcoin-cli address-gen -n dogecoin --pub 02d215a89dc4aab5191d9480535aba2db9994c3c8fa068102fdb71fba676179e39 ``` (the public key being a 66-byte hex string) [network] could be any item following: ``` bitcoin bitcoin_testnet bitcoincash bitcoincash_testnet litecoin litecoin_testnet dogecoin dogecoin_testnet ``` #### Address Validation * we can check if a provided address is a valid one for a specified blockchain network: ``` ./anychain-bitcoin-cli address-validate -n [network] [address] ``` e.g. ``` ./anychain-bitcoin-cli address-validate -n bitcoin 15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg ``` [network] could be any item following: ``` bitcoin bitcoin_testnet bitcoincash bitcoincash_testnet litecoin litecoin_testnet dogecoin dogecoin_testnet ``` #### Transaction Generation * we can generate a transaction for a specified blockchain network by providing several inputs and several outputs: ``` ./anychain-bitcoin-cli tx-gen -n [network] -i [input] [input] ... -o [output] [output] ... ``` ##### Generate a P2PKH Transaction e.g. ``` ./anychain-bitcoin-cli tx-gen -n bitcoin -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 0, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\"}" -o "{\"to\": \"15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg\", \"amount\": 3300000}" ``` ##### Generate a P2SH_P2WPKH Transaction e.g. ``` ./anychain-bitcoin-cli tx-gen -n bitcoin -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 0, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\", \"format\": \"p2sh_p2wpkh\", \"balance\": 8800000}" -o "{\"to\": \"15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg\", \"amount\": 3300000}" ``` ##### Generate a Bech32 Transaction e.g. ``` ./anychain-bitcoin-cli tx-gen -n bitcoin -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 0, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\", \"format\": \"bech32\", \"balance\": 8800000}" -o "{\"to\": \"15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg\", \"amount\": 3300000}" ``` ##### Generate a CashAddr Transaction (Bitcoin Cash Only) e.g. ``` ./anychain-bitcoin-cli tx-gen -n bitcoincash -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 0, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\", \"format\": \"cash_addr\", \"balance\": 8800000}" -o "{\"to\": \"bitcoincash:qp20yqd2260z7rqvm29ntst8vljw5zge352yqrlsql\", \"amount\": 3300000}" ``` ##### Generate a Transaction with multiple inputs in multiple formats e.g. ``` ./anychain-bitcoin-cli tx-gen -n bitcoin -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 3, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\"}" "{\"txid\": \"36d3815b142fc9a93c1fff1ef7994fe6f3919ccc54a51c891e8418ca95a51020\", \"index\": 1, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\", \"format\": \"p2sh_p2wpkh\", \"balance\": 8090000}" "{\"txid\": \"ba2bcfed866d89c59110901ee513ffaba1ab6c8e3b99ab8d386c0f8fc0f8a38b\", \"index\": 2, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\", \"format\": \"bech32\", \"balance\": 31370000}" -o "{\"to\": \"15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg\", \"amount\": 3300000}" "{\"to\": \"1AWccoPWBihK9kHi1UkZnqpreW55PCugYR\", \"amount\": 9000000}" ``` ================================================ FILE: examples/anychain-bitcoin-cli/src/main.rs ================================================ use clap::{Arg, Command}; use serde_json::Value; use std::str::FromStr; use anychain_bitcoin::{ Bitcoin, BitcoinAddress, BitcoinAmount, BitcoinCash, BitcoinCashTestnet, BitcoinFormat, BitcoinNetwork, BitcoinPublicKey, BitcoinTestnet, BitcoinTransaction, BitcoinTransactionInput, BitcoinTransactionOutput, BitcoinTransactionParameters, Dogecoin, DogecoinTestnet, Litecoin, LitecoinTestnet, SignatureHash, }; use anychain_core::{hex, Address, PublicKey, Transaction}; fn address_from_public_key( public_key: libsecp256k1::PublicKey, ) -> Vec<(BitcoinFormat, String)> { let public_key = BitcoinPublicKey::::from_secp256k1_public_key(public_key, true); let converter = |addr: BitcoinAddress| Ok(addr.to_string()); let addresses: Vec<(BitcoinFormat, String)> = [ ( BitcoinFormat::P2PKH, public_key .to_address(&BitcoinFormat::P2PKH) .and_then(converter), ), ( BitcoinFormat::P2SH_P2WPKH, public_key .to_address(&BitcoinFormat::P2SH_P2WPKH) .and_then(converter), ), ( BitcoinFormat::Bech32, public_key .to_address(&BitcoinFormat::Bech32) .and_then(converter), ), ( BitcoinFormat::CashAddr, public_key .to_address(&BitcoinFormat::CashAddr) .and_then(converter), ), ] .iter() .map(|tuple| { if let Ok(item) = &tuple.1 { (tuple.0.clone(), item.to_string()) } else { (tuple.0.clone(), "null".to_string()) } }) .collect(); addresses } fn address_validation(address: &str) { if BitcoinAddress::::is_valid(address) { println!("{} is a valid {} address", address, N::NAME); } else { println!("{} is not a valid {} address", address, N::NAME); } } fn tx_gen( inputs: Vec<&String>, outputs: Vec<&String>, is_fork_id: bool, ) -> String { let inputs: Vec<(BitcoinTransactionInput, Option)> = inputs .iter() .map(|&input| { let input = serde_json::from_str::(input).unwrap(); let txid = input["txid"].clone(); let index = input["index"].clone(); let format = input["format"].clone(); let balance = input["balance"].clone(); let private_key = input["private_key"].clone(); let public_key = input["public_key"].clone(); let signature = input["signature"].clone(); if txid.is_null() { panic!("Txid not provided"); } if index.is_null() { panic!("Index not provided"); } let txid = txid.as_str().unwrap(); let txid = hex::decode(txid).unwrap(); let index = index.as_u64().unwrap() as u32; let sighash = if is_fork_id { SignatureHash::SIGHASH_ALL_SIGHASH_FORKID } else { SignatureHash::SIGHASH_ALL }; let format = if !format.is_null() { let f = format.as_str().unwrap(); BitcoinFormat::from_str(f).unwrap() } else { BitcoinFormat::P2PKH }; let balance = if format != BitcoinFormat::P2PKH { if balance.is_null() { panic!("Balance not provided"); } let balance = BitcoinAmount(balance.as_i64().unwrap()); Some(balance) } else { None }; let mut input = BitcoinTransactionInput::::new( txid, index, None, Some(format), None, balance, sighash, ) .unwrap(); let secret_key = if !signature.is_null() { let signature = signature.as_str().unwrap(); if signature.len() != 128 { panic!("Invalid signature length"); } let signature = hex::decode(signature).unwrap(); if !public_key.is_null() { let k = public_key.as_str().unwrap(); if k.len() != 66 { panic!("Invalid public key length"); } let k = hex::decode(k).unwrap(); input.sign(signature, k).unwrap(); None } else if !private_key.is_null() { let k = private_key.as_str().unwrap(); if k.len() != 64 { panic!("Invalid private key length"); } let k = hex::decode(k).unwrap(); let k = libsecp256k1::SecretKey::parse_slice(&k).unwrap(); let pk = libsecp256k1::PublicKey::from_secret_key(&k); let pk = pk.serialize_compressed().to_vec(); input.sign(signature, pk).unwrap(); None } else { panic!("Neither a private key nor a public key is provided"); } } else if !private_key.is_null() { let k = private_key.as_str().unwrap(); let k = hex::decode(k).unwrap(); let k = libsecp256k1::SecretKey::parse_slice(&k).unwrap(); Some(k) } else { panic!("Private key not provided"); }; (input, secret_key) }) .collect(); let outputs: Vec = outputs .iter() .map(|&output| { let output = serde_json::from_str::(output).unwrap(); let to = output["to"].clone(); let amount = output["amount"].clone(); let to = to.as_str().unwrap(); let amount = amount.as_i64().unwrap(); BitcoinTransactionOutput::new( BitcoinAddress::::from_str(to).unwrap(), BitcoinAmount::from_satoshi(amount).unwrap(), ) .unwrap() }) .collect(); let mut tx = BitcoinTransaction::::new( &BitcoinTransactionParameters::::new( inputs.iter().map(|input| input.0.clone()).collect(), outputs, ) .unwrap(), ) .unwrap(); for i in 0..inputs.len() { let i = i as u32; let input = tx.input(i).unwrap(); let secret_key = &inputs[i as usize].1; if !input.is_signed { match secret_key { Some(k) => { let pk = BitcoinPublicKey::::from_secret_key(k); let format = input.get_format().unwrap(); input.set_public_key(pk.clone(), format).unwrap(); let hash = tx.digest(i).unwrap(); let msg = libsecp256k1::Message::parse_slice(&hash).unwrap(); let sig = libsecp256k1::sign(&msg, k).0; let sig = sig.serialize().to_vec(); let pk = pk.serialize(); tx.input(i).unwrap().sign(sig, pk).unwrap(); } None => panic!("Private key missing"), } } } tx.set_segwit().unwrap(); hex::encode(tx.to_bytes().unwrap()) } fn main() { let matches = Command::new("anychain") .subcommands(vec![ Command::new("address-gen") .about("Generate an address of a utxo-typed blockchain") .arg( Arg::new("network") .long("network") .short('n') .num_args(1) .help("Specify the network of the address to be generated"), ) .arg( Arg::new("private_key") .long("priv") .num_args(1..) .help("Generate an address from a private key in hex format"), ) .arg( Arg::new("public_key") .long("pub") .num_args(1..) .help("Generate an address from a compressed public key in hex format"), ), Command::new("address-validate") .about("Check if an address of a utxo-typed blockchain is valid") .arg( Arg::new("network") .long("network") .short('n') .num_args(1) .help("Specify the network of the address to be validated"), ) .arg( Arg::new("address") .num_args(1..) .help("Specify the address to be validated"), ), Command::new("tx-gen") .about("Generate a transaction of a utxo-typed blockchain") .arg( Arg::new("network") .long("network") .short('n') .num_args(1) .help("Specify the network of the transaction to be generated"), ) .arg( Arg::new("inputs") .num_args(1..) .long("input") .short('i') .help("Specify the input of the transaction to be generated"), ) .arg( Arg::new("outputs") .num_args(1..) .long("output") .short('o') .help("Specify the output of the transaction to be generated"), ), ]) .get_matches(); match matches.subcommand() { Some(("address-gen", sub_matches)) => { let network = sub_matches.get_one::("network"); if network.is_none() { println!("Network not specified"); return; } let private_keys = sub_matches.get_many::("private_key"); let public_keys = sub_matches.get_many::("public_key"); let public_keys = if let Some(private_keys) = private_keys { if public_keys.is_some() { println!("Public keys are needless in presence of private keys"); return; } let private_keys: Vec<&String> = private_keys.collect(); let public_keys: Vec = private_keys .iter() .map(|&private_key| { if private_key.len() != 64 { panic!("Invalid private key"); } let private_key = hex::decode(private_key).unwrap(); let private_key = libsecp256k1::SecretKey::parse_slice(&private_key).unwrap(); libsecp256k1::PublicKey::from_secret_key(&private_key) }) .collect(); public_keys } else if let Some(public_keys) = public_keys { let public_keys: Vec<&String> = public_keys.collect(); let public_keys: Vec = public_keys .iter() .map(|&public_key| { if public_key.len() != 66 { panic!("Invalid compressed public key"); } let public_key = hex::decode(public_key).unwrap(); libsecp256k1::PublicKey::parse_slice(&public_key, None).unwrap() }) .collect(); public_keys } else { println!("Neither a private key nor a public key is provided"); return; }; let network = network.unwrap().clone(); for public_key in public_keys { let addresses = match network.as_str() { "bitcoin" => address_from_public_key::(public_key), "bitcoin_testnet" => address_from_public_key::(public_key), "bitcoincash" => address_from_public_key::(public_key), "bitcoincash_testnet" => { address_from_public_key::(public_key) } "litecoin" => address_from_public_key::(public_key), "litecoin_testnet" => address_from_public_key::(public_key), "dogecoin" => address_from_public_key::(public_key), "dogecoin_testnet" => address_from_public_key::(public_key), _ => { println!("Unsupported network"); return; } }; for (format, address) in addresses { println!("{} ({})", address, format,); } println!(); } } Some(("address-validate", sub_matches)) => { let network = sub_matches.get_one::("network"); let address = sub_matches.get_one::("address"); if network.is_none() { println!("Network not provided"); return; } if address.is_none() { println!("Address not provided"); return; } let address = address.unwrap().clone(); let network = network.unwrap().clone(); match network.as_str() { "bitcoin" => address_validation::(&address), "bitcoin_testnet" => address_validation::(&address), "bitcoincash" => address_validation::(&address), "bitcoincash_testnet" => address_validation::(&address), "litecoin" => address_validation::(&address), "litecoin_testnet" => address_validation::(&address), "dogecoin" => address_validation::(&address), "dogecoin_testnet" => address_validation::(&address), _ => println!("Unsupported network"), }; } Some(("tx-gen", sub_matches)) => { let network = sub_matches.get_one::("network"); let inputs = sub_matches.get_many::("inputs"); let outputs = sub_matches.get_many::("outputs"); if network.is_none() { println!("Network not provided"); return; } if inputs.is_none() { println!("No input is provided"); return; } if outputs.is_none() { println!("No output is provided"); return; } let network = network.unwrap().clone(); let inputs: Vec<&String> = inputs.unwrap().collect(); let outputs: Vec<&String> = outputs.unwrap().collect(); let tx = match network.as_str() { "bitcoin" => tx_gen::(inputs, outputs, false), "bitcoin_testnet" => tx_gen::(inputs, outputs, false), "bitcoincash" => tx_gen::(inputs, outputs, true), "bitcoincash_testnet" => tx_gen::(inputs, outputs, true), "litecoin" => tx_gen::(inputs, outputs, false), "litecoin_testnet" => tx_gen::(inputs, outputs, false), "dogecoin" => tx_gen::(inputs, outputs, false), "dogecoin_testnet" => tx_gen::(inputs, outputs, false), _ => { println!("Unsupported network"); return; } }; println!("tx = {}", tx); } _ => {} }; } ================================================ FILE: examples/anychain-bitcoin-client/Cargo.toml ================================================ [package] name = "anychain-bitcoin-client" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../../crates/anychain-core" } anychain-bitcoin = { path = "../../crates/anychain-bitcoin" } libsecp256k1 = { workspace = true } [lints] workspace = true ================================================ FILE: examples/anychain-bitcoin-client/src/main.rs ================================================ use std::str::FromStr; use anychain_bitcoin::{ BitcoinAddress, BitcoinAmount, BitcoinFormat, BitcoinPublicKey, BitcoinTestnet as Testnet, BitcoinTransaction, BitcoinTransactionInput, BitcoinTransactionOutput, BitcoinTransactionParameters, SignatureHash, }; use anychain_core::{hex, Address, PublicKey, Transaction}; fn address_from_secret_key() { // Generates Bitcoin addresses from a secret key. // It generates three types of addresses: P2PKH, P2SH_P2WPKH, and Bech32. let secret_key = [ 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 71, 1, 1, 1, 1, 8, 1, 1, 1, 111, 1, 1, 103, 1, 1, 57, 1, 1, 1, 1, ]; let secret_key = libsecp256k1::SecretKey::parse(&secret_key).unwrap(); let addr_p2pkh = BitcoinAddress::::from_secret_key(&secret_key, &BitcoinFormat::P2PKH).unwrap(); let addr_p2sh_p2wpkh = BitcoinAddress::::from_secret_key(&secret_key, &BitcoinFormat::P2SH_P2WPKH) .unwrap(); let addr_bech32 = BitcoinAddress::::from_secret_key(&secret_key, &BitcoinFormat::Bech32).unwrap(); println!("address p2pkh = {}", addr_p2pkh); println!("address p2sh_p2wpkh = {}", addr_p2sh_p2wpkh); println!("address bech32 = {}", addr_bech32); } fn address_from_public_key() { // Generates Bitcoin addresses from a public key. // Generates three types of addresses: P2PKH, P2SH_P2WPKH, and Bech32. let public_key = [ 3, 27, 132, 197, 86, 123, 18, 100, 64, 153, 93, 62, 213, 170, 186, 5, 101, 215, 30, 24, 52, 96, 72, 25, 255, 156, 23, 245, 233, 213, 221, 7, 143, ]; let public_key = libsecp256k1::PublicKey::parse_compressed(&public_key).unwrap(); let public_key = BitcoinPublicKey::::from_secp256k1_public_key(public_key, true); let addr_p2pkh = public_key.to_address(&BitcoinFormat::P2PKH).unwrap(); let addr_p2sh_p2wpkh = public_key.to_address(&BitcoinFormat::P2SH_P2WPKH).unwrap(); let addr_bech32 = public_key.to_address(&BitcoinFormat::Bech32).unwrap(); println!("\naddress p2pkh = {}", addr_p2pkh); println!("address p2sh_p2wpkh = {}", addr_p2sh_p2wpkh); println!("address bech32 = {}", addr_bech32); } fn address_from_str() { // Parses a Bitcoin address from a string. // It takes a string representation of a Bitcoin address and converts it into a BitcoinAddress object. let addr = "mm21MpCm2cVYBxZvxk6DaQC7C4o5Ukq2Wf"; let addr = BitcoinAddress::::from_str(addr).unwrap(); println!("\naddress = {}", addr); } fn address_validation() { // Validates a Bitcoin address. // It checks whether a given string is a valid Bitcoin address. let addr = "mm21MpCm2cVYBxZvxk6DaQC7C4o5Ukq2Wf"; let status = BitcoinAddress::::is_valid(addr); println!("status = {}", status); } fn amount_gen() { // Generates Bitcoin amounts in satoshi from BTC and satoshi values. // It demonstrates how to create BitcoinAmount objects from BTC and satoshi values. let amount1 = BitcoinAmount::from_btc(1).unwrap(); let amount2 = BitcoinAmount::from_satoshi(1000).unwrap(); println!("amount1 = {} satoshi", amount1); println!("amount2 = {} satoshi", amount2); } fn transaction_gen() { // Generates a Bitcoin transaction. // It creates a transaction with multiple inputs and outputs, signs it with a secret key, and prints the transaction. let secret_key = [ 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 71, 1, 1, 1, 1, 8, 1, 1, 1, 111, 1, 1, 103, 1, 1, 57, 1, 1, 1, 1, ]; let secret_key = libsecp256k1::SecretKey::parse(&secret_key).unwrap(); let public_key = libsecp256k1::PublicKey::from_secret_key(&secret_key); let public_key = BitcoinPublicKey::::from_secp256k1_public_key(public_key, true); let recipient = "2MsRNMaKe8YWcdUaRi8jwa2aHG85kzsbUHe"; let amount = 500000; let fee = 1000; let inputs = [ ( "39f420dc156f4ac1ad753a9fae1206973d9eede39a004c04496b7f9f525c77b8", 0, "mm21MpCm2cVYBxZvxk6DaQC7C4o5Ukq2Wf", 1378890, ), ( "dc163eb31a9cdd5a8bb49066477375f9a0068791176e7b4a61e54751581449ae", 1, "tb1q83t5qrd4yzrd477eskjp5f8ujtrf6enwgw87rn", 1481548, ), ]; for item in inputs.iter() { let input = BitcoinTransactionInput::new( hex::decode(item.0).unwrap(), item.1, None, None, Some(BitcoinAddress::::from_str(item.2).unwrap()), Some(BitcoinAmount::from_satoshi(item.3).unwrap()), SignatureHash::SIGHASH_ALL, ) .unwrap(); let output1 = BitcoinTransactionOutput::new( BitcoinAddress::::from_str(recipient).unwrap(), BitcoinAmount::from_satoshi(amount).unwrap(), ) .unwrap(); let output2 = BitcoinTransactionOutput::new( BitcoinAddress::::from_str(item.2).unwrap(), BitcoinAmount::from_satoshi(item.3 - amount - fee).unwrap(), ) .unwrap(); let mut tx = BitcoinTransaction::new( &BitcoinTransactionParameters::new(vec![input], vec![output1, output2]).unwrap(), ) .unwrap(); let hash = tx.digest(0).unwrap(); let msg = libsecp256k1::Message::parse_slice(&hash).unwrap(); let sig = libsecp256k1::sign(&msg, &secret_key).0.serialize().to_vec(); let _ = tx.input(0).unwrap().sign(sig, public_key.serialize()); println!("tx = {}\n", tx); } } fn main() { // Generates Bitcoin addresses from a secret key address_from_secret_key(); // Generates Bitcoin addresses from a public key address_from_public_key(); // Parses a Bitcoin address from a string address_from_str(); // Validates a Bitcoin address address_validation(); // Generates Bitcoin amounts in satoshi from BTC and satoshi values amount_gen(); // Generates a Bitcoin transaction transaction_gen(); } ================================================ FILE: examples/anychain-ethereum-cli/Cargo.toml ================================================ [package] name = "anychain-ethereum-cli" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../../crates/anychain-core" } anychain-ethereum = { path = "../../crates/anychain-ethereum" } clap = { workspace = true } rlp = { workspace = true } primitive-types = { workspace = true } libsecp256k1 = { workspace = true } [lints] workspace = true ================================================ FILE: examples/anychain-ethereum-cli/README.md ================================================ # anychain-ethereum-cli A command line program for the generation and/or validation of addresses and transactions of evm compatible blockchains ### Build cd anychain/anychain-ethereum-cli cargo build --release ### Run ``` cd ../target/release ``` #### 0. Generate Address ##### from public key ```bash ./anychain-ethereum-cli address-gen --pub 0x0299bb27e93fba02d13d78b1d7807cc811266e31e7b6feae3e09d42d49482fda95 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ./anychain-ethereum-cli address-gen --pub 0299bb27e93fba02d13d78b1d7807cc811266e31e7b6feae3e09d42d49482fda95 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ./anychain-ethereum-cli address-gen --pub 0499bb27e93fba02d13d78b1d7807cc811266e31e7b6feae3e09d42d49482fda9519127e684ded784c50d4559d87e0723c801635f6c387bb36cb4bf72e33201934 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ./anychain-ethereum-cli address-gen --pub 0x0499bb27e93fba02d13d78b1d7807cc811266e31e7b6feae3e09d42d49482fda9519127e684ded784c50d4559d87e0723c801635f6c387bb36cb4bf72e33201934 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ``` ##### from private key ```bash ./anychain-ethereum-cli address-gen --prv 0xb2ab8cfd1de774907de3fb12c8f3bafb76a575e1004f9f33309f1c570be18baf 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ./anychain-ethereum-cli address-gen --prv b2ab8cfd1de774907de3fb12c8f3bafb76a575e1004f9f33309f1c570be18baf 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 ``` #### 1. Parse Address from String & Validate Address ```bash ./anychain-ethereum-cli address-validate E0709D3C521fe51CA7E65E00929D7EEFCF0b1814 Valid ./anychain-ethereum-cli address-validate 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1814 Valid ./anychain-ethereum-cli address-validate 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b1815 Valid # anychain does not check the checksum ./anychain-ethereum-cli address-validate 0xE0709D3C521fe51CA7E65E00929D7EEFCF0b18145 Invalid ``` #### 2. Generate wei from ether and vice versa ```bash ./anychain-ethereum-cli towei 0.12345678ether 123456780000000000 ./anychain-ethereum-cli towei 1gwei 1000000000 ./anychain-ethereum-cli towei 1.1Gwei 1100000000 ``` #### 3. Make Transaction This is a "Do What I Mean" (DWIM) style command, which will generate a transaction from the given parameters. The parameters are: | your intent | mode | to | token | value | data | rsv | | ----------- | ---- | -- | ----- | ----- | ---- | --- | | unsigned ether transfer | main | recepient | leave empty | amount in wei | leave empty | leave empty | | unsigned token transfer | erc20 | recepient | token contract | amount of token | leave empty | leave empty | | unsigned any transaction | any | to | leave empty | value | data | leave empty | | signed ether transfer | main | recepient | leave empty | amount in wei | leave empty | rsv | | signed token transfer | erc20 | recepient | token contract | amount of token | leave empty | rsv | | signed any transaction | any | to | leave empty | value | data | rsv | ##### Make an ether transaction's preimage ```bash ./anychain-ethereum-cli maketx --mode main --network sepolia --nonce 4 --gasprice 2gwei --gaslimit 21000 --to 0x717648D7d50fF001cc1088E8dc416Dfa26c32CB9 --value 1145141919810893 ``` which outputs: ``` tx = 0xed04847735940082520894717648d7d50ff001cc1088e8dc416dfa26c32cb9870411802159054d8083aa36a78080 ``` ##### Make a signed ether transaction ```bash ./anychain-ethereum-cli maketx --mode main --network sepolia --nonce 4 --gasprice 2gwei --gaslimit 21000 --to 0x717648D7d50fF001cc1088E8dc416Dfa26c32CB9 --value 1145141919810893 -r 371efe039d17f0bf74b732c94a5d7c4a04f4bf747bde94a779dd8fd7b180d106 -s 0eacd1b265ddfea09f4c20400429dba2224af8eed462a732358f7da8f1848e18 -v 0 ``` which outputs: ``` tx = 0xf86e04847735940082520894717648d7d50ff001cc1088e8dc416dfa26c32cb9870411802159054d808401546d71a0371efe039d17f0bf74b732c94a5d7c4a04f4bf747bde94a779dd8fd7b180d106a00eacd1b265ddfea09f4c20400429dba2224af8eed462a732358f7da8f1848e18 ``` this tx can successfully broadcast: https://sepolia.etherscan.io/tx/0x9abef6656c8c246af1e68d5bca943507727b10597fd2b1cf84d14a868e7da3fb ##### make an erc-20 transaction's preimage ```bash ./anychain-ethereum-cli maketx --mode erc20 --network sepolia --nonce 5 --gasprice 2gwei --gaslimit 51000 --to 0x717648D7d50fF001cc1088E8dc416Dfa26c32CB9 --token 0x779877A7B0D9E8603169DdbD7836e478b4624789 --value 1145141919810893 ``` which outputs ``` tx = 0xf86b05847735940082c73894779877a7b0d9e8603169ddbd7836e478b462478980b844a9059cbb000000000000000000000000717648d7d50ff001cc1088e8dc416dfa26c32cb9000000000000000000000000000000000000000000000000000411802159054d83aa36a78080 ``` ##### make a signed erc-20 transaction ```bash ./anychain-ethereum-cli maketx --mode erc20 --network sepolia --nonce 5 --gasprice 2gwei --gaslimit 51000 --to 0x717648D7d50fF001cc1088E8dc416Dfa26c32CB9 --token 0x779877A7B0D9E8603169DdbD7836e478b4624789 --value 1145141919810893 -r 2fe49c0b946b77bb2c95a60a57c2ec9e5cb25504d0e549eb3a3cbfed8bc9cc54 -s 0x0e050e046dec65c1505653fe6147eb1fa20c63f6b8c7b78c7138b74f48a260a1 -v 0 ``` which outputs ``` tx = 0xf8ac05847735940082c73894779877a7b0d9e8603169ddbd7836e478b462478980b844a9059cbb000000000000000000000000717648d7d50ff001cc1088e8dc416dfa26c32cb9000000000000000000000000000000000000000000000000000411802159054d8401546d71a02fe49c0b946b77bb2c95a60a57c2ec9e5cb25504d0e549eb3a3cbfed8bc9cc54a00e050e046dec65c1505653fe6147eb1fa20c63f6b8c7b78c7138b74f48a260a1 ``` this tx can successfully broadcast: https://sepolia.etherscan.io/tx/0x9646b0732437f7f004798fb6ce923c61030934796e8f77db748d9ef32e68b597 ================================================ FILE: examples/anychain-ethereum-cli/src/main.rs ================================================ use clap::value_parser; use clap::{Arg, Command}; use primitive_types::H160; use primitive_types::U256; use rlp::Encodable; use std::fmt::Display; use std::fmt::Error; use std::fmt::Formatter; use std::str::FromStr; use anychain_ethereum::{erc20_transfer, EthereumAddress, EthereumFormat, EthereumPublicKey}; use anychain_core::{hex, Address, PublicKey}; fn trim0x(s: &str) -> String { // str to lower case let s = s.to_lowercase(); // remove 0x prefix let s = s.trim_start_matches("0x"); s.to_string() } struct EIP155Transaction { nonce: u64, gas_price: U256, gas_limit: u64, to: H160, value: U256, data: Vec, v: u64, // {0, 1} + chain_id * 2 + 35, since EIP-155 r: U256, s: U256, } impl Encodable for EIP155Transaction { fn rlp_append(&self, s: &mut rlp::RlpStream) { s.begin_list(9); s.append(&self.nonce); s.append(&self.gas_price); s.append(&self.gas_limit); s.append(&self.to); s.append(&self.value); s.append(&self.data); s.append(&self.v); s.append(&self.r); s.append(&self.s); } } impl Display for EIP155Transaction { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { let encoded = rlp::encode(self); let hex = hex::encode(&encoded); write!(f, "0x{}", hex) } } fn main() { let matches = Command::new("anychain") .subcommands(vec![ Command::new("address-gen") .about("Generate an address ethereum-compatible blockchain") .arg( Arg::new("private_key") .long("prv") .num_args(1) .help("Generate an address from a private key in hex format"), ) .arg( Arg::new("public_key") .long("pub") .num_args(1) .help("Generate an address from a public key in hex format"), ), Command::new("address-validate") .about("Check if an address is valid") .arg( Arg::new("address") .num_args(1) .help("Specify the address to validate"), ), Command::new("towei") .about("Convert ether/gwei/wei to wei") .arg( Arg::new("value") .num_args(1) .help("Specify the ether to be converted"), ), Command::new("maketx") .about("Generate an EIP-155 transaction") .arg( Arg::new("mode") .long("mode") .num_args(1) .help("transaction mode: main / erc20 / any"), ) .arg( Arg::new("network") .long("network") .num_args(1) .help("Specify the network, according to https://chainid.network/"), ) .arg( Arg::new("nonce") .long("nonce") .num_args(1) .value_parser(value_parser!(u64)) .help("nonce of the sender"), ) .arg( Arg::new("gas_price") .long("gasprice") .num_args(1) .help("gas price of the transaction"), ) .arg( Arg::new("gas_limit") .long("gaslimit") .num_args(1) .value_parser(value_parser!(u64)) .help("gas limit of the transaction"), ) .arg( Arg::new("to") .long("to") .num_args(1) .help("address of the receiver"), ) .arg( Arg::new("token") .long("token") .num_args(1) .help("address of the token contract (erc20)"), ) .arg( Arg::new("value") .long("value") .num_args(1) .value_parser(value_parser!(u64)) .help("value of the transaction"), ) .arg( Arg::new("data") .long("data") .num_args(1) .help("data of the transaction"), ) .arg( Arg::new("r") .long("r") .short('r') .num_args(1) .default_value("0") .help("r of the signature"), ) .arg( Arg::new("s") .long("s") .short('s') .num_args(1) .default_value("0") .help("s of the signature"), ) .arg( Arg::new("v") .long("v") .short('v') .num_args(1) .default_value("0") .value_parser(value_parser!(u64)) .help("v of the signature"), ), ]) .get_matches(); match matches.subcommand() { Some(("address-gen", sub_matches)) => { let private_key = sub_matches.get_one::("private_key"); let public_key = sub_matches.get_one::("public_key"); let public_key = match (private_key, public_key) { (Some(_), Some(_)) => { println!("Both private key and public key are provided"); return; } (Some(private_key), None) => { let private_key = trim0x(private_key); if private_key.len() != 64 { println!("Invalid private key"); return; } let private_key = hex::decode(private_key).unwrap(); let private_key = libsecp256k1::SecretKey::parse_slice(&private_key).unwrap(); libsecp256k1::PublicKey::from_secret_key(&private_key) } (None, Some(public_key)) => { let public_key = trim0x(public_key); let public_key = hex::decode(public_key).unwrap(); // parse_slice can handle both compressed and uncompressed public key // therefore we don't need to check the length and prefix of the public key libsecp256k1::PublicKey::parse_slice(&public_key, None).unwrap() } (None, None) => { println!("No private key or public key is provided"); return; } }; println!("{}", address_from_public_key(public_key)) } Some(("address-validate", sub_matches)) => { let address = sub_matches.get_one::("address"); if address.is_none() { println!("Address not provided"); return; } let address = address.unwrap(); if EthereumAddress::is_valid(address) { println!("Valid"); } else { println!("Invalid"); } } Some(("towei", sub_matches)) => { let value = sub_matches.get_one::("value"); if value.is_none() { println!("Value not provided"); return; } let value = towei(value.unwrap()); match value { Some(value) => println!("{}", value), None => println!("Invalid value"), } } Some(("maketx", sub_matches)) => { let network = sub_matches.get_one::("network").unwrap(); let chainid = network_to_chainid(network); let nonce = *sub_matches.get_one::("nonce").unwrap(); let gas_price = sub_matches.get_one::("gas_price").unwrap(); let gas_price = towei(gas_price).unwrap(); let gas_limit = *sub_matches.get_one::("gas_limit").unwrap(); let mut r = U256::from_str(sub_matches.get_one::("r").unwrap()).unwrap(); let mut s = U256::from_str(sub_matches.get_one::("s").unwrap()).unwrap(); let mut v = *sub_matches.get_one::("v").unwrap(); if r == U256::from(0) || s == U256::from(0) { // unsigned r = U256::from(0); s = U256::from(0); v = chainid; } else { // signed v = v + chainid * 2 + 35; // according to EIP155, https://eips.ethereum.org/EIPS/eip-155 } let to; let value; let data; let mode = sub_matches.get_one::("mode").unwrap(); match mode.as_str() { "main" => { to = H160::from_str(sub_matches.get_one::("to").unwrap()).unwrap(); // to is to value = U256::from(*sub_matches.get_one::("value").unwrap()); // value is value data = Vec::::new(); // data is empty } "erc20" => { to = H160::from_str(sub_matches.get_one::("token").unwrap()).unwrap(); // to is token value = U256::from(0); // value is 0 let recepient = sub_matches.get_one::("to").unwrap(); let recepient = EthereumAddress::from_str(recepient).unwrap(); let amount = U256::from(*sub_matches.get_one::("value").unwrap()); data = erc20_transfer(&recepient, amount); // data is encoded transfer(recepient, amount) } "any" => { to = H160::from_str(sub_matches.get_one::("to").unwrap()).unwrap(); // as is value = U256::from(*sub_matches.get_one::("value").unwrap()); // as is data = hex::decode(sub_matches.get_one::("data").unwrap()).unwrap(); // as is } _ => { println!("Invalid mode"); return; } } let tx = EIP155Transaction { nonce, gas_price, gas_limit, to, value, data, v, r, s, }; println!("tx = {}", tx); } _ => {} }; } fn address_from_public_key(public_key: libsecp256k1::PublicKey) -> EthereumAddress { let public_key = EthereumPublicKey::from_secp256k1_public_key(public_key); public_key.to_address(&EthereumFormat::Standard).unwrap() } fn network_to_chainid(network: &str) -> u64 { // to lower let network = network.to_lowercase(); match network.as_str() { "eth" => 1, "ethereum" => 1, "etc" => 61, "ethereum_classic" => 61, "goerli" => 5, "sepolia" => 11155111, _ => panic!("Invalid network"), } } fn towei(value: &str) -> Option { let value = value.to_lowercase(); // println!("{}", value); if value.ends_with("ether") { let value = value.trim_end_matches("ether"); let value = value.parse::().unwrap(); let value = value * 1e18; Some(U256::from(value as u128)) } else if value.ends_with("gwei") { let value = value.trim_end_matches("gwei"); let value = value.parse::().unwrap(); let value = value * 1e9; Some(U256::from(value as u128)) } else if value.ends_with("wei") { let value = value.trim_end_matches("wei"); let value = value.parse::().unwrap(); Some(U256::from(value as u128)) } else { None } } ================================================ FILE: examples/anychain-neo-cli/Cargo.toml ================================================ [package] name = "anychain-neo-cli" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anychain-core = { path = "../../crates/anychain-core" } anychain-neo = { path = "../../crates/anychain-neo" } clap = { workspace = true } ================================================ FILE: examples/anychain-neo-cli/README.md ================================================ # anychain-neo-cli A command line program for the generation and/or validation of addresses and transactions of utxo compatible blockchains ### Build cd anychain/anychain-neo-cli cargo build --release ### Run ``` cd ../target/release ``` #### Address Generation * we can generate addresses by providing a corresponding private key: ``` ./anychain-neo-cli address-gen --priv [private_key] ``` e.g. ``` ./anychain-neo-cli address-gen --priv cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564 ``` (the private key being a 64-byte hex string) * we can also generate addresses by providing a corresponding public key: ``` ./anychain-neo-cli address-gen --pub [public_key] ``` e.g. ``` ./anychain-neo-cli address-gen --pub 02d215a89dc4aab5191d9480535aba2db9994c3c8fa068102fdb71fba676179e39 ``` (the public key being a 66-byte hex string) #### Address Validation * we can check if a provided address is a valid one for a specified blockchain network: ``` ./anychain-neo-cli address-validate [address] ``` e.g. ``` ./anychain-neo-cli address-validate NVEqR4e73afGKpVBzBXLEnY5F5uZSmSKZZ ``` #### Transaction Generation * we can generate a transaction for a specified blockchain network by providing several inputs and several outputs: ``` ./anychain-neo-cli tx-gen -i [input] [input] ... -o [output] [output] ... ``` ##### Generate a Transfer Transaction e.g. ``` ./anychain-neo-cli tx-gen -i "{\"txid\": \"9975deeace71258149e8b0d02ed83d59335a658dd348d8cae7bf4ff9ed9db2d0\", \"index\": 0, \"private_key\": \"cd483a289c081698fc5a5a47291550962f1de7c98a7d5fcd77be765335e4f564\"}" -o "{\"to\": \"15dcrsqEnb7uAsqByxbrUbigpHjPTarbqg\", \"amount\": 3300000}" ``` ================================================ FILE: examples/anychain-neo-cli/src/main.rs ================================================ use clap::{Arg, Command}; fn main() { let matches = Command::new("anychain-neo-cli") .subcommands(vec![ Command::new("address-gen") .about("Generate an address of a utxo-typed blockchain") .arg( Arg::new("private_key") .long("priv") .num_args(1..) .help("Generate an address from a private key in hex format"), ) .arg( Arg::new("public_key") .long("pub") .num_args(1..) .help("Generate an address from a compressed public key in hex format"), ), Command::new("address-validate") .about("Check if an address of a utxo-typed blockchain is valid") .arg( Arg::new("address") .num_args(1..) .help("Specify the address to be validated"), ), Command::new("tx-gen") .about("Generate a transaction of a utxo-typed blockchain") .arg( Arg::new("inputs") .num_args(1..) .long("input") .short('i') .help("Specify the input of the transaction to be generated"), ) .arg( Arg::new("outputs") .num_args(1..) .long("output") .short('o') .help("Specify the output of the transaction to be generated"), ), ]) .get_matches(); match matches.subcommand() { Some(("address-gen", sub_matches)) => { let _private_key = sub_matches.get_one::("private_key"); let _public_key = sub_matches.get_one::("public_key"); } Some(("address-validate", sub_matches)) => { let _address = sub_matches.get_one::("address"); if _address.is_none() { println!("Address not provided"); } } Some(("tx-gen", sub_matches)) => { let inputs = sub_matches.get_many::("inputs"); let outputs = sub_matches.get_many::("outputs"); if inputs.is_none() { println!("No input is provided"); return; } if outputs.is_none() { println!("No output is provided"); return; } let _inputs: Vec<&String> = inputs.unwrap().collect(); let _outputs: Vec<&String> = outputs.unwrap().collect(); } _ => {} }; } ================================================ FILE: lib.rs ================================================ pub extern crate anychain_bitcoin as bitcoin; pub extern crate anychain_bitcoin_cli as bitcoin_cli; pub extern crate anychain_core as core; pub extern crate anychain_ethereum as ethereum; pub extern crate anychain_ethereum_cli as ethereum_cli; pub extern crate anychain_filecoin as filecoin; pub extern crate anychain_polkadot as polkadot; pub extern crate anychain_tron as tron; pub extern crate anychain_ripple as ripple; pub extern crate anychain_neo as neo; ================================================ FILE: rust-toolchain.toml ================================================ [toolchain] channel = "1.95.0" components = ["clippy", "rustfmt"] targets = [] profile = "minimal"