Crate ethers_fireblocks[−][src]
Expand description
ethers-fireblocks
Provides ethers-compatible Signer and Middleware implementations for the Fireblocks API.
use ethers_providers::{Middleware, Provider};
use ethers_core::types::Address;
use ethers_fireblocks::{FireblocksSigner, FireblocksMiddleware, Config};
use std::convert::TryFrom;
let cfg = Config::new(
"~/.fireblocks/fireblocks.key",
&std::env::var("FIREBLOCKS_API_KEY").expect("fireblocks api key not set"),
"1",
3,
)?;
// The signer can be used with Ethers' Wallet.
let mut signer = FireblocksSigner::new(cfg).await;
// You must add each address you will be calling to the Address map.
// example below uses the Greeter contract deployed by the Fireblocks team on
// Ropsten.
let address: Address = "cbe74e21b070a979b9d6426b11e876d4cb618daf".parse()?;
let address_id = std::env::var("EXTERNAL_WALLET_ID").expect("external wallet id not set");
signer.add_account(address_id, address);
let provider = Provider::try_from("http://localhost:8545")?;
let provider = FireblocksMiddleware::new(provider, signer);
Structs
Configuration options for instantiating a FireblocksSigner
The FireblocksMiddleware
is an ethers-compatible middleware which sends transactions
and signs messages using Fireblocks’ API. Sending transactions utilizes the CONTRACT_CALL
mode and signing messages utilizes the RAW
mode.
Enums
Fireblocks API related errors