flow-rust-sdk utilizes the Flow gRPC AccessAPI to make requests on the flow blockchain.

Overview

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.

Versioning

  • This project uses Semantic Versioning 2. Please keep this in mind when making public contributions to the project and bump the version appropriately.

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!

You might also like...
mirrorworld-sdk-rust

Usage Clone project code. git clone [email protected]:mirrorworld-universe/mirrorworld-sdk-rust.git cd mirrorworld-sdk-rust run. cargo run test. cargo te

Rust SDK for interacting with the Nile.

Nile API Rust Client This is a POC Rust client for the Nile API. Usage Source the Nile environment variables into your environment. export NILE_DEVELO

Rust for the DirectStorage SDK (unofficial)

Rust for the DirectStorage SDK (unofficial) This crate lets you call any DirectStorage SDK API using code generated from the metadata describing the A

🦀 Hop server side SDK for Rust

hop-rs (wip) Hop's Rust library. Requires Rust 1.61+ Installation [dependencies] hop = "0.0.0" Usage Create a project token or personal access token.

Minimal flashloan borrower contracts with an extensible rust sdk to abstract wrapping generic onchain calls (similar to multicall3) with flashloans.
Minimal flashloan borrower contracts with an extensible rust sdk to abstract wrapping generic onchain calls (similar to multicall3) with flashloans.

flashloan-rs • Minimal flashloan borrower contracts with an extensible rust sdk. Getting Started Flashloan-rs is published to crates.io as flashloan-r

An unofficial Rust SDK for Clerk.dev

An unofficial clerk.dev SDK for rust Note: This SDK is updated frequently to keep up with any changes to the actual Clerk API. If you see anything tha

Kryptokrona SDK in Rust for building decentralized private communication and payment systems.

Kryptokrona Rust SDK Kryptokrona is a decentralized blockchain from the Nordic based on CryptoNote, which forms the basis for Monero, among others. Cr

Unofficial Rust SDK library for Uniswap smart contracts.

uniswap-rs Unofficial Rust SDK library for Uniswap smart contracts. Quickstart Add this to your Cargo.toml: [dependencies] uniswap-rs = { git = "https

Avalanche APIs/VM SDK in Rust

avalanche-rs ⚠️ avalanche-rs is alpha-level software and is not ready for production use. Do not use avalanche-rs to run production workloads. See the

Comments
  • Question about Idiomatic Rust.

    Question about Idiomatic Rust.

    Hello, as someone new to Rust, I have a query about borrowing and method calling syntax for a function that takes a string.

    Should the calling syntax of SDK methods that take strings be simplified from, for example:

    check_availability(&"grpc://access.devnet.nodes.onflow.org:9000".to_string()).await?;
    

    to

    check_availability(&"grpc://access.devnet.nodes.onflow.org:9000").await?;
    

    If the function definition is modified as such (change the network_address parameter from &String to &str and use to_owned method instead of clone):

    pub async fn check_availability(network_address: &str) -> Result<(), Box<dyn error::Error>> {
        let mut client = AccessApiClient::connect(network_address.to_owned()).await?;
    
        let request = tonic::Request::new(PingRequest {});
    
        client.ping(request).await?;
    
        Ok(())
    }
    

    Thought about posting on SO, but thought I would come here first, because it's easier to ask when there is some code for context.

    opened by 10thfloor 4
  • Cadence breaking changes

    Cadence breaking changes

    Overview A new version of Cadence will cause some breaking changes in this SDK. It's important that those changes are addressed in a timely manner (by the end of the month) or else it will break the software using the SDK.

    Breaking Change This SDK is using a deprecated API for adding keys to the account. DEPRECATED

    account.addPublicKey()
    

    NEW

    account.keys.add()
    

    Refactor The cadence templates should be changed according to the account key documentation found here. We have already prepared those templates for you and they can be found here.

    If you need any help implementing the changes you can always reach out to me directly on discord or here (both places with sideninja nick).

    opened by sideninja 2
  • Clippy warnings

    Clippy warnings

    When I run the cargo clippy linter program on your repo, the current project has 29 warnings and one error. Clippy detects code style issues, correctness issues and complexity issues. The cargo clippy output as of https://github.com/MarshallBelles/flow-rust-sdk/commit/208d0d0e3a14826cfc3ee3441903c2c79d91e29c is below:

        Checking flow-rust-sdk v3.9.1 (/home/beef/develop/flow-rust-sdk)
    warning: redundant field names in struct initialization
       --> src/lib.rs:665:9
        |
    665 |         arguments: arguments,
        |         ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `arguments`
        |
        = note: `#[warn(clippy::redundant_field_names)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    
    warning: redundant field names in struct initialization
       --> src/lib.rs:666:9
        |
    666 |         reference_block_id: reference_block_id,
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `reference_block_id`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    
    warning: redundant field names in struct initialization
       --> src/lib.rs:667:9
        |
    667 |         gas_limit: gas_limit,
        |         ^^^^^^^^^^^^^^^^^^^^ help: replace it with: `gas_limit`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    
    warning: unneeded `return` statement
       --> src/lib.rs:292:9
        |
    292 |         return Err("Could not produce result")?;
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `Err("Could not produce result")?`
        |
        = note: `#[warn(clippy::needless_return)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: manual implementation of an assign operation
       --> src/lib.rs:252:13
        |
    252 |             i = i + 1;
        |             ^^^^^^^^^ help: replace it with: `i += 1`
        |
        = note: `#[warn(clippy::assign_op_pattern)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
    
    warning: manual implementation of an assign operation
       --> src/lib.rs:257:21
        |
    257 |                     time = time + 200;
        |                     ^^^^^^^^^^^^^^^^^ help: replace it with: `time += 200`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
    
    error: identical args used in this `assert_ne!` macro call
       --> src/lib.rs:262:36
        |
    262 |                         assert_ne!(res.error_message, res.error_message);
        |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `#[deny(clippy::eq_op)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#eq_op
    
    warning: returning an `Err(_)` with the `?` operator
       --> src/lib.rs:288:28
        |
    288 |                     return Err("Cadence Runtime Error")?;
        |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err("Cadence Runtime Error".into())`
        |
        = note: `#[warn(clippy::try_err)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err
    
    warning: returning an `Err(_)` with the `?` operator
       --> src/lib.rs:292:16
        |
    292 |         return Err("Could not produce result")?;
        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Err("Could not produce result".into())`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#try_err
    
    warning: unneeded `return` statement
       --> src/lib.rs:544:9
        |
    544 | /         return Argument {
    545 | |             r#type: "Array",
    546 | |             value: values,
    547 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    544 ~         Argument {
    545 +             r#type: "Array",
    546 +             value: values,
    547 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:551:9
        |
    551 | /         return Argument {
    552 | |             r#type: "Dictionary",
    553 | |             value: values
    554 | |                 .into_iter()
    555 | |                 .map(|(x, y)| json!({"Key":x, "Value":y}))
    556 | |                 .collect(),
    557 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    551 ~         Argument {
    552 +             r#type: "Dictionary",
    553 +             value: values
    554 +                 .into_iter()
    555 +                 .map(|(x, y)| json!({"Key":x, "Value":y}))
    556 +                 .collect(),
      ...
    
    warning: unneeded `return` statement
       --> src/lib.rs:561:9
        |
    561 |         return to_vec(&json!(self)).unwrap();
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `to_vec(&json!(self)).unwrap()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: unneeded `return` statement
       --> src/lib.rs:567:9
        |
    567 | /         return Argument {
    568 | |             r#type: "Bool",
    569 | |             value,
    570 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    567 ~         Argument {
    568 +             r#type: "Bool",
    569 +             value,
    570 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:576:9
        |
    576 | /         return Argument {
    577 | |             r#type: "String",
    578 | |             value,
    579 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    576 ~         Argument {
    577 +             r#type: "String",
    578 +             value,
    579 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:583:9
        |
    583 |         return to_vec(&json!(self)).unwrap();
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `to_vec(&json!(self)).unwrap()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: unneeded `return` statement
       --> src/lib.rs:590:9
        |
    590 | /         return Argument {
    591 | |             r#type: "String",
    592 | |             value,
    593 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    590 ~         Argument {
    591 +             r#type: "String",
    592 +             value,
    593 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:598:9
        |
    598 | /         return Argument {
    599 | |             r#type: "UFix64",
    600 | |             value: value.to_string(),
    601 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    598 ~         Argument {
    599 +             r#type: "UFix64",
    600 +             value: value.to_string(),
    601 +         }
        |
    
    warning: used `assert_eq!` with a literal bool
       --> src/lib.rs:597:9
        |
    597 |         assert_eq!(value >= 0.0, true); // cannot have a negative ufix
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `assert!(..)`
        |
        = note: `#[warn(clippy::bool_assert_comparison)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
    
    warning: unneeded `return` statement
       --> src/lib.rs:605:9
        |
    605 | /         return Argument {
    606 | |             r#type: "Fix64",
    607 | |             value: value.to_string(),
    608 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    605 ~         Argument {
    606 +             r#type: "Fix64",
    607 +             value: value.to_string(),
    608 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:612:9
        |
    612 | /         return Argument {
    613 | |             r#type: "UInt64",
    614 | |             value: value.to_string(),
    615 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    612 ~         Argument {
    613 +             r#type: "UInt64",
    614 +             value: value.to_string(),
    615 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:619:9
        |
    619 | /         return Argument {
    620 | |             r#type: "Int64",
    621 | |             value: value.to_string(),
    622 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    619 ~         Argument {
    620 +             r#type: "Int64",
    621 +             value: value.to_string(),
    622 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:626:9
        |
    626 | /         return Argument {
    627 | |             r#type: "Address",
    628 | |             value,
    629 | |         };
        | |__________^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    626 ~         Argument {
    627 +             r#type: "Address",
    628 +             value,
    629 +         }
        |
    
    warning: unneeded `return` statement
       --> src/lib.rs:633:9
        |
    633 |         return to_vec(&json!(self)).unwrap();
        |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `to_vec(&json!(self)).unwrap()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: manual implementation of an assign operation
       --> src/lib.rs:639:5
        |
    639 |     i = i - vec.len();
        |     ^^^^^^^^^^^^^^^^^ help: replace it with: `i -= vec.len()`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
    
    warning: manual implementation of an assign operation
       --> src/lib.rs:642:9
        |
    642 |         i = i - 1;
        |         ^^^^^^^^^ help: replace it with: `i -= 1`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
    
    warning: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
       --> src/lib.rs:681:25
        |
    681 |     payload_signatures: &Vec<TransactionSignature>,
        |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `&[TransactionSignature]`
        |
        = note: `#[warn(clippy::ptr_arg)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
    
    warning: unneeded `return` statement
       --> src/lib.rs:720:5
        |
    720 |     return out;
        |     ^^^^^^^^^^^ help: remove `return`: `out`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec`
       --> src/lib.rs:710:40
        |
    710 |     for (i, sig) in payload_signatures.into_iter().enumerate() {
        |                                        ^^^^^^^^^ help: call directly: `iter`
        |
        = note: `#[warn(clippy::into_iter_on_ref)]` on by default
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
    
    warning: unneeded `return` statement
       --> src/lib.rs:751:5
        |
    751 |     return out;
        |     ^^^^^^^^^^^ help: remove `return`: `out`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    
    warning: unneeded `return` statement
       --> src/lib.rs:766:5
        |
    766 | /     return Argument::array(
    767 | |         account_keys
    768 | |             .into_iter()
    769 | |             .map(|x| json!(Argument::string(format!("f847b840{}02038203e8", x))))
    770 | |             .collect::<Vec<Value>>(),
    771 | |     );
        | |______^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
    help: remove `return`
        |
    766 ~     Argument::array(
    767 +         account_keys
    768 +             .into_iter()
    769 +             .map(|x| json!(Argument::string(format!("f847b840{}02038203e8", x))))
    770 +             .collect::<Vec<Value>>(),
    771 +     )
        |
    
    warning: `flow-rust-sdk` (lib) generated 29 warnings
    error: could not compile `flow-rust-sdk` due to previous error; 29 warnings emitted
    

    I suggest running clippy and rustfmt in the CI to avoid issues like these from occurring.

    opened by fee1-dead 1
  • Breaking changes in Cadence

    Breaking changes in Cadence

    Hello Flow SDK maintainer! We need your help updating this repository ASAP. Please check the last changein this post about breaking changes coming along with the release of Secure Cadence and read the documentation about this specific change.

    opened by brunogonzales 0
Owner
null
gRPC client/server for zero-knowledge proof authentication Chaum Pederson Zero-Knowledge Proof in Rust

gRPC client/server for zero-knowledge proof authentication Chaum Pederson Zero-Knowledge Proof in Rust. Chaum Pederson is a zero-knowledge proof proto

Advaita Saha 4 Jun 12, 2023
A gRPC-based scripting library for interacting with CosmWasm smart-contracts.

Cosmos Rust Script Smart contract scripting library to ease CosmWasm smart contract development and deployment. cosm-script is inspired by terra-rust-

null 11 Nov 3, 2022
An HTTP proxy for assets (mainly images) to route requests through an always-encrypted connection.

camo-rs camo-rs is a frontend-compatible Rust-re-implementation of the now archived NodeJS-based atmos/camo - an HTTP proxy for assets (mainly images)

Dennis Schubert 7 Dec 8, 2022
An EVM low-level language that gives full control over the control flow of the smart contract.

Meplang - An EVM low-level language Meplang is a low-level programming language that produces EVM bytecode. It is designed for developers who need ful

MEP 19 Jan 31, 2023
Pokémon TCG SDK - Rust

Pokémon TCG SDK - Rust This is the Pokémon TCG SDK Rust implementation. It is a wrapper around the Pokémon TCG API of pokemontcg.io. Usage Configurati

Pokémon TCG Developers 2 Dec 14, 2022
A template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it.

CosmWasm Starter Pack This is a template to build smart contracts in Rust to run inside a Cosmos SDK module on all chains that enable it. To understan

null 1 Mar 7, 2022
Smart Contract built in Rust to run inside Cosmos SDK module on all chains that enable it

CoinSwap is a Smart Contract that is built on the terra blockchain and can be used to swap cryptocurrencies such as LUNA, UST, TerraUSD, Anchor, Mirror Protocol, LUNI and other CW20 tokens. The Project also contains a smart contract which works as a analysis tool for the gas fees on the Terra Blockchain.

Prajjwal Chittori 9 Oct 11, 2022
Lazerpay SDK for Rust 🦀

?? Lazerpay Rust SDK This crate integrates the Lazerpay payment gateway for accepting cryptocurrency payments. Usage Add the following to your cargo d

Lord_Sarcastic 15 Sep 21, 2022
This crate reimplements Gelato's Relay SDK in Rust

Gelato Relay SDK This crate reimplements Gelato's Relay SDK in Rust. It simply wraps Gelato Relay requests and responses to/from Gelato endpoints with

Nomad 30 Oct 20, 2022
A universal SDK for FDU. Powered by Rust.

libfdu A universal SDK for FDU. Building You need Rust Nightly installed: $ rustup default nightly Build the library by running: $ cargo build or $ ca

旦夕开发组 6 Sep 11, 2022