From 8a1732f8924b4ce53af2f4a6a2d53314980f8df1 Mon Sep 17 00:00:00 2001
From: Roman Khlopkov <roman.khlopkov@demlabs.net>
Date: Thu, 16 Dec 2021 13:53:27 +0000
Subject: [PATCH] bugfix-5311

---
 .../chain/src/wrapping_dap_chain_ledger.c              | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/cellframe-sdk/chain/src/wrapping_dap_chain_ledger.c b/modules/cellframe-sdk/chain/src/wrapping_dap_chain_ledger.c
index b7c9dbd8..372ed760 100644
--- a/modules/cellframe-sdk/chain/src/wrapping_dap_chain_ledger.c
+++ b/modules/cellframe-sdk/chain/src/wrapping_dap_chain_ledger.c
@@ -178,7 +178,10 @@ PyObject *dap_chain_ledger_calc_balance_py(PyObject *self, PyObject *args){
     const char *token_ticker;
     if (!PyArg_ParseTuple(args, "O|s", &addr, &token_ticker))
         return NULL;
-    uint64_t res = dap_chain_ledger_calc_balance(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)addr)->addr, token_ticker);
+    uint64_t res = dap_chain_uint128_to(
+                        dap_chain_ledger_calc_balance(
+                            ((PyDapChainLedgerObject*)self)->ledger,
+                            ((PyDapChainAddrObject*)addr)->addr, token_ticker));
     return Py_BuildValue("k", res);
 }
 PyObject *dap_chain_ledger_calc_balance_full_py(PyObject *self, PyObject *args){
@@ -186,7 +189,10 @@ PyObject *dap_chain_ledger_calc_balance_full_py(PyObject *self, PyObject *args){
     const char *token_ticker;
     if (!PyArg_ParseTuple(args, "O|s", &addr, &token_ticker))
         return NULL;
-    uint64_t res = dap_chain_ledger_calc_balance_full(((PyDapChainLedgerObject*)self)->ledger, ((PyDapChainAddrObject*)addr)->addr, token_ticker);
+    uint64_t res = dap_chain_uint128_to(
+                        dap_chain_ledger_calc_balance_full(
+                            ((PyDapChainLedgerObject*)self)->ledger,
+                            ((PyDapChainAddrObject*)addr)->addr, token_ticker));
     return Py_BuildValue("k", res);
 }
 PyObject *dap_chain_ledger_tx_find_by_hash_py(PyObject *self, PyObject *args){
-- 
GitLab