Skip to content

Commit

Permalink
JSON stringify types over the ffi (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe authored Oct 7, 2024
1 parent 40445ac commit 15d44c4
Show file tree
Hide file tree
Showing 57 changed files with 873 additions and 4,913 deletions.
46 changes: 0 additions & 46 deletions bindings/tbdex_wasm/src/http/balances.rs

This file was deleted.

230 changes: 0 additions & 230 deletions bindings/tbdex_wasm/src/http/exchanges.rs

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/tbdex_wasm/src/http/mod.rs

This file was deleted.

46 changes: 0 additions & 46 deletions bindings/tbdex_wasm/src/http/offerings.rs

This file was deleted.

19 changes: 6 additions & 13 deletions bindings/tbdex_wasm/src/http_client/balances.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
use crate::{
errors::{map_err, Result},
resources::balance::WasmBalance,
web5::bearer_did::WasmBearerDid,
};
use tbdex::json::ToJson;
use wasm_bindgen::prelude::wasm_bindgen;

#[wasm_bindgen]
pub async fn get_balances(
pfi_did_uri: &str,
bearer_did: WasmBearerDid,
) -> Result<Vec<WasmBalance>> {
Ok(
tbdex::http_client::balances::get_balances(pfi_did_uri, &bearer_did.into())
.await
.map_err(map_err)?
.into_iter()
.map(|balance| balance.into())
.collect(),
)
pub async fn get_balances(pfi_did_uri: &str, bearer_did: WasmBearerDid) -> Result<String> {
let balances = tbdex::http_client::balances::get_balances(pfi_did_uri, &bearer_did.into())
.await
.map_err(map_err)?;
balances.to_json_string().map_err(map_err)
}
Loading

0 comments on commit 15d44c4

Please sign in to comment.