Skip to content

Commit

Permalink
refactor: Move blockstore interface close to extern
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Feb 15, 2024
1 parent 32e3528 commit adc7823
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
9 changes: 9 additions & 0 deletions wnfs-wasm/src/fs/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ use wnfs::common::BlockStore as WnfsBlockStore;
// Externs
//--------------------------------------------------------------------------------------------------

#[wasm_bindgen(typescript_custom_section)]
const TS_BLOCKSTORE: &'static str = r#"
export interface BlockStore {
putBlockKeyed(cid: Uint8Array, bytes: Uint8Array): Promise<void>;
getBlock(cid: Uint8Array): Promise<Uint8Array | undefined>;
hasBlock(cid: Uint8Array): Promise<boolean>;
}
"#;

#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(typescript_type = "BlockStore")]
Expand Down
1 change: 0 additions & 1 deletion wnfs-wasm/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod blockstore;
mod metadata;
mod private;
mod public;
mod types;
mod utils;

pub use blockstore::*;
Expand Down
10 changes: 0 additions & 10 deletions wnfs-wasm/src/fs/types.rs

This file was deleted.

0 comments on commit adc7823

Please sign in to comment.