MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / create

Method create

fendermint/testing/materializer/src/materials/defaults.rs:163–178  ·  view source on GitHub ↗

Create (or overwrite) an account with a given secret key.

(
        root: impl AsRef<Path>,
        name: &AccountName,
        sk: SecretKey,
    )

Source from the content-addressed store, hash-verified

161
162 /// Create (or overwrite) an account with a given secret key.
163 pub fn create(
164 root: impl AsRef<Path>,
165 name: &AccountName,
166 sk: SecretKey,
167 ) -> anyhow::Result<Self> {
168 let pk = sk.public_key();
169 let dir = root.as_ref().join(name.path());
170 let acc = Self {
171 name: name.clone(),
172 secret_key: sk,
173 public_key: pk,
174 path: dir,
175 };
176 acc.export()?;
177 Ok(acc)
178 }
179
180 /// Write the keys to files.
181 fn export(&self) -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls 5

public_keyMethod · 0.45
joinMethod · 0.45
as_refMethod · 0.45
pathMethod · 0.45
exportMethod · 0.45

Tested by

no test coverage detected