Skip to content

Commit

Permalink
fix: align message formats with latest walrus version
Browse files Browse the repository at this point in the history
  • Loading branch information
mlegner committed Jan 10, 2025
1 parent 5227cf2 commit eb8f4a2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion site-builder/src/walrus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Walrus {
// NOTE: takes a mutable reference to ensure that only one store command is executed at every
// time. The issue is that the inner wallet may lock coins if called in parallel.
pub async fn store(&mut self, file: PathBuf, epochs: u64, force: bool) -> Result<StoreOutput> {
create_command!(self, store, file, epochs, force)
create_command!(self, store, vec![file], epochs, force)
}

/// Issues a `read` JSON command to the Walrus CLI, returning the parsed output.
Expand Down
6 changes: 3 additions & 3 deletions site-builder/src/walrus/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum Command {
/// Stores a blob to Walrus.
Store {
/// The path to the file to be stored.
file: PathBuf,
files: Vec<PathBuf>,
/// The number of epochs for which to store the file.
#[serde(default = "default::epochs")]
epochs: u64,
Expand Down Expand Up @@ -155,9 +155,9 @@ impl WalrusCmdBuilder {
}

/// Adds a [`Command::Store`] command to the builder.
pub fn store(self, file: PathBuf, epochs: u64, force: bool) -> WalrusCmdBuilder<Command> {
pub fn store(self, files: Vec<PathBuf>, epochs: u64, force: bool) -> WalrusCmdBuilder<Command> {
let command = Command::Store {
file,
files,
epochs,
force,
};
Expand Down
11 changes: 10 additions & 1 deletion site-builder/src/walrus/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ impl BlobStoreResult {
}
}
}
/// Blob store result with its file path.
#[derive(Deserialize, Debug, Clone)]
#[allow(unused)]
pub struct BlobStoreResultWithPath {
/// The result of the store operation.
pub blob_store_result: BlobStoreResult,
/// The file path to the blob.
pub path: PathBuf,
}

/// Supported Walrus encoding types.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Deserialize)]
Expand Down Expand Up @@ -148,7 +157,7 @@ pub struct Blob {
/// The output of the `store` command.
#[derive(Debug, Clone, Deserialize)]
#[allow(unused)]
pub struct StoreOutput(pub BlobStoreResult);
pub struct StoreOutput(pub Vec<BlobStoreResultWithPath>);

/// The output of the `read` command.
#[serde_as]
Expand Down

0 comments on commit eb8f4a2

Please sign in to comment.