chore: fix examples
This commit is contained in:
parent
7dbc2d4f25
commit
9cad87a879
|
@ -13,7 +13,7 @@ pub(crate) fn imports() -> TokenStream {
|
||||||
abi::{Abi, Token, Detokenize, InvalidOutputType, Tokenizable},
|
abi::{Abi, Token, Detokenize, InvalidOutputType, Tokenizable},
|
||||||
types::*, // import all the types so that we can codegen for everything
|
types::*, // import all the types so that we can codegen for everything
|
||||||
},
|
},
|
||||||
contract::{Contract, ContractCall, Event, Lazy},
|
contract::{Contract, builders::{ContractCall, Event}, Lazy},
|
||||||
signers::{Client, Signer},
|
signers::{Client, Signer},
|
||||||
providers::JsonRpcClient,
|
providers::JsonRpcClient,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{
|
use ethers::{
|
||||||
prelude::*,
|
prelude::*,
|
||||||
utils::{GanacheBuilder, Solc},
|
utils::{Ganache, Solc},
|
||||||
};
|
};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ async fn main() -> Result<()> {
|
||||||
// 2. launch ganache
|
// 2. launch ganache
|
||||||
let port = 8546u64;
|
let port = 8546u64;
|
||||||
let url = format!("http://localhost:{}", port).to_string();
|
let url = format!("http://localhost:{}", port).to_string();
|
||||||
let _ganache = GanacheBuilder::new().port(port)
|
let _ganache = Ganache::new().port(port)
|
||||||
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
|
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
|
||||||
.spawn();
|
.spawn();
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ async fn main() -> Result<()> {
|
||||||
let client = wallet.connect(provider);
|
let client = wallet.connect(provider);
|
||||||
|
|
||||||
// 6. create a factory which will be used to deploy instances of the contract
|
// 6. create a factory which will be used to deploy instances of the contract
|
||||||
let factory = ContractFactory::new(&client, &contract.abi, &contract.bytecode);
|
let factory = ContractFactory::new(&contract.abi, &contract.bytecode, &client);
|
||||||
|
|
||||||
// 7. deploy it with the constructor arguments
|
// 7. deploy it with the constructor arguments
|
||||||
let contract = factory.deploy("initial value".to_string())?.send().await?;
|
let contract = factory.deploy("initial value".to_string())?.send().await?;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{prelude::*, utils::GanacheBuilder};
|
use ethers::{prelude::*, utils::Ganache};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let port = 8545u64;
|
let port = 8545u64;
|
||||||
let url = format!("http://localhost:{}", port).to_string();
|
let url = format!("http://localhost:{}", port).to_string();
|
||||||
let _ganache = GanacheBuilder::new()
|
let _ganache = Ganache::new()
|
||||||
.port(port)
|
.port(port)
|
||||||
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
|
.mnemonic("abstract vacuum mammal awkward pudding scene penalty purchase dinner depart evoke puzzle")
|
||||||
.spawn();
|
.spawn();
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ethers::{prelude::*, utils::GanacheBuilder};
|
use ethers::{prelude::*, utils::Ganache};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let port = 8546u64;
|
let port = 8546u64;
|
||||||
let url = format!("http://localhost:{}", port).to_string();
|
let url = format!("http://localhost:{}", port).to_string();
|
||||||
let _ganache = GanacheBuilder::new().port(port).spawn();
|
let _ganache = Ganache::new().port(port).spawn();
|
||||||
|
|
||||||
// connect to the network
|
// connect to the network
|
||||||
let provider = Provider::<Http>::try_from(url.as_str())?;
|
let provider = Provider::<Http>::try_from(url.as_str())?;
|
||||||
|
|
Loading…
Reference in New Issue