Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
rad-ens: Update local identity in setup
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Sellier <self@cloudhead.io>
  • Loading branch information
cloudhead committed Feb 13, 2022
1 parent 98cb41c commit 563d319
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub fn run(options: Options) -> anyhow::Result<()> {
let provider = ethereum::provider(options.provider)?;
let signer_opts = options.signer;
let (wallet, provider) = rt.block_on(get_wallet(signer_opts, provider))?;
rt.block_on(setup(&name, id, provider, wallet))?;
rt.block_on(setup(&name, id, provider, wallet, &storage))?;
}
Operation::SetLocal(name) => set_ens_payload(&name, &storage)?,
}
Expand Down Expand Up @@ -211,6 +211,7 @@ async fn setup(
id: LocalIdentity,
provider: Provider<Http>,
signer: ethereum::Wallet,
storage: &Storage,
) -> anyhow::Result<()> {
let urn = id.urn();
let signer = SignerMiddleware::new(provider, signer);
Expand Down Expand Up @@ -313,6 +314,18 @@ async fn setup(
let call = resolver.multicall(calls)?;
ethereum::transaction(call).await?;

let spinner = term::spinner("Updating local identity...");
match person::set_ens_payload(name, storage) {
Ok(doc) => {
spinner.finish();
term::blob(serde_json::to_string(&doc.payload())?);
}
Err(err) => {
spinner.failed();
return Err(err);
}
}

term::info!(
"Successfully associated local 🌱 identity with {}",
term::format::highlight(name)
Expand Down

0 comments on commit 563d319

Please sign in to comment.