Skip to content
Merged
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
25 changes: 20 additions & 5 deletions src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,10 @@ impl ToriiClient {
.collect::<Result<Vec<_>, _>>()
.map_err(|e| JsValue::from(format!("failed to parse contract addresses: {e}")))?;

let token_ids = token_ids.into_iter().map(|t| U256::from_be_hex(&t)).collect::<Vec<_>>();
let token_ids = token_ids
.into_iter()
.map(|t| U256::from_be_hex(t.trim_start_matches("0x")))
.collect::<Vec<_>>();

let tokens = self
.inner
Expand Down Expand Up @@ -673,7 +676,10 @@ impl ToriiClient {
})
.collect::<Result<Vec<_>, _>>()?;

let token_ids = token_ids.into_iter().map(|t| U256::from_be_hex(&t)).collect::<Vec<_>>();
let token_ids = token_ids
.into_iter()
.map(|t| U256::from_be_hex(t.trim_start_matches("0x")))
.collect::<Vec<_>>();

let subscription_id = Arc::new(AtomicU64::new(0));
let (trigger, tripwire) = Tripwire::new();
Expand Down Expand Up @@ -746,7 +752,10 @@ impl ToriiClient {
.collect::<Result<Vec<_>, _>>()
.map_err(|e| JsValue::from(format!("failed to parse contract addresses: {e}")))?;

let token_ids = token_ids.into_iter().map(|t| U256::from_be_hex(&t)).collect::<Vec<_>>();
let token_ids = token_ids
.into_iter()
.map(|t| U256::from_be_hex(t.trim_start_matches("0x")))
.collect::<Vec<_>>();

let token_balances = self
.inner
Expand Down Expand Up @@ -1166,7 +1175,10 @@ impl ToriiClient {
})
.collect::<Result<Vec<_>, _>>()?;

let token_ids = token_ids.into_iter().map(|t| U256::from_be_hex(&t)).collect::<Vec<_>>();
let token_ids = token_ids
.into_iter()
.map(|t| U256::from_be_hex(t.trim_start_matches("0x")))
.collect::<Vec<_>>();

let subscription_id = Arc::new(AtomicU64::new(0));
let (trigger, tripwire) = Tripwire::new();
Expand Down Expand Up @@ -1251,7 +1263,10 @@ impl ToriiClient {
})
.collect::<Result<Vec<_>, _>>()?;

let token_ids = token_ids.into_iter().map(|t| U256::from_be_hex(&t)).collect::<Vec<_>>();
let token_ids = token_ids
.into_iter()
.map(|t| U256::from_be_hex(t.trim_start_matches("0x")))
.collect::<Vec<_>>();

self.inner
.update_token_balance_subscription(
Expand Down