Crate flow_rust_sdk[][src]

Expand description

Welcome to the Flow-Rust-SDK! We’re glad to have you here. There are a few important items that we should cover real quick before you dive in.

Signing Algorithms

  • Only ECDSA_P256 is supported at this time

Hashing

  • Only SHA3_256 is supported at this time

Security

  • The cryptography in this SDK is sourced from the public RustCrypto repositories. This is a very mature and widely used library, but the elliptic curve arithmetic contained in these crates has never been independently audited. Use at your own risk.
  • Remember that you will be dealing with private keys, which can be more powerful and dangerous than passwords. Please treat them as such.
  • Consider reading this whitepaper by Google

Documentation

See the docs.rs for full documentation. Please open an issue in the GitHub repository if you find any bugs. For general questions, please join the Flow Discord. There is a flow-rust channel which is an excellent place for discussion!

Basic Usage

In your Cargo.toml

flow-rust-sdk = "1.0.0"

You may also wish to add

tokio = { version = "1.11.0", features = ["full"] }

Re-exports

pub extern crate hex;
pub extern crate rlp;

Modules

flow is an exported module from the flow_rust_sdk. It’s types are generated directly from the gRPC API Protobufs https://github.com/onflow/flow/tree/master/protobuf

Structs

Construct a signature object. Pass this into the payload or envelope signatures when signing a transaction.

Functions

build_transaction will construct a flow::Transaction with the provided script and arguments. See the Argument struct for details on how to construct arguments.

Checks the availability of the node at network_address if this fails, it’s probably because the endpoint is not available.

execute_script will attempt to run the provided script (as bytes) and return the flow::ExecuteScriptResponse or Error

get_account will return the flow::AccountResponse of network_address, else an error if it could not be accessed.

get_block accepts either the block_id or block_height. If neither are defined it returns the latest block.

retrieve the specified collections

retrieve the specified events by type for the given blocks

retrieve the specified events by type for the given height range

get transaction result

get transaction result

Sends the transaction to the blockchain. Make sure you signed the transactionsign_transaction first.

Sign the provided transaction. You will first need to build_transaction.