Skip to content

Commit

Permalink
fix: change SubDir's return attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
joemonem committed Jan 9, 2025
1 parent 106b2fc commit 0fb47d0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
5 changes: 2 additions & 3 deletions contracts/os/andromeda-vfs/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use andromeda_std::os::vfs::{validate_path_name, SubDirBound};
use andromeda_std::os::vfs::{validate_path_name, PathInfo, SubDirBound};
use andromeda_std::{amp::AndrAddr, error::ContractError};
use cosmwasm_std::{Addr, Deps};

use crate::state::{
get_paths, get_subdir, resolve_pathname, resolve_symlink, PathInfo, ADDRESS_LIBRARY,
ADDRESS_USERNAME,
get_paths, get_subdir, resolve_pathname, resolve_symlink, ADDRESS_LIBRARY, ADDRESS_USERNAME,
};

pub fn resolve_path(deps: Deps, path: AndrAddr) -> Result<Addr, ContractError> {
Expand Down
11 changes: 1 addition & 10 deletions contracts/os/andromeda-vfs/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
use andromeda_std::{
amp::AndrAddr,
error::ContractError,
os::vfs::{validate_path_name, SubDirBound},
os::vfs::{validate_path_name, PathInfo, SubDirBound},
};
use cosmwasm_std::{ensure, Addr, Api, Storage};
use cw_storage_plus::{Bound, Index, IndexList, IndexedMap, Map, MultiIndex};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)]
pub struct PathInfo {
pub name: String,
pub address: Addr,
pub parent_address: Addr,
pub symlink: Option<AndrAddr>,
}

pub struct PathIndices<'a> {
/// PK: parent_address + component_name
Expand Down
4 changes: 2 additions & 2 deletions contracts/os/andromeda-vfs/src/testing/tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::{
contract::{execute, instantiate, query},
state::{add_pathname, resolve_pathname, PathInfo, ADDRESS_LIBRARY, ADDRESS_USERNAME, USERS},
state::{add_pathname, resolve_pathname, ADDRESS_LIBRARY, ADDRESS_USERNAME, USERS},
};

use andromeda_std::{
amp::AndrAddr,
os::{
kernel::{ExecuteMsg as KernelExecuteMsg, InternalMsg},
vfs::{ExecuteMsg, InstantiateMsg},
vfs::{ExecuteMsg, InstantiateMsg, PathInfo},
},
testing::mock_querier::{
mock_dependencies_custom, MOCK_APP_CONTRACT, MOCK_FAKE_KERNEL_CONTRACT,
Expand Down
10 changes: 9 additions & 1 deletion packages/std/src/os/vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,20 @@ impl From<SubDirBound> for (Addr, String) {
}
}

#[cw_serde]
pub struct PathInfo {
pub name: String,
pub address: Addr,
pub parent_address: Addr,
pub symlink: Option<AndrAddr>,
}

#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(Addr)]
ResolvePath { path: AndrAddr },
#[returns(Vec<PathDetails>)]
#[returns(Vec<PathInfo>)]
SubDir {
path: AndrAddr,
min: Option<SubDirBound>,
Expand Down

0 comments on commit 0fb47d0

Please sign in to comment.