Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: align message formats with latest walrus version #349

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading