浏览代码

feat(bindings): wallet total balance

thesimplekid 11 月之前
父节点
当前提交
2671c92c00
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      bindings/cdk-js/src/wallet.rs

+ 5 - 0
bindings/cdk-js/src/wallet.rs

@@ -44,6 +44,11 @@ impl JsWallet {
         Wallet::new(client, Arc::new(db), None).await.into()
     }
 
+    #[wasm_bindgen(js_name = totalBalance)]
+    pub async fn total_balance(&self) -> Result<JsAmount> {
+        Ok(self.inner.total_balance().await.map_err(into_err)?.into())
+    }
+
     #[wasm_bindgen(js_name = mintBalances)]
     pub async fn mint_balances(&self) -> Result<JsValue> {
         let mint_balances = self.inner.mint_balances().await.map_err(into_err)?;