Skip to content

Commit dc12bcf

Browse files
committed
sdk: utils
1 parent cfb1940 commit dc12bcf

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

sdk/utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'''
2+
* @file utils.py
3+
* @author Krisna Pranav
4+
* @brief utils
5+
* @version 1.0
6+
* @date 2024-11-25
7+
*
8+
* @copyright Copyright (c) 2024 ThunderPayment Developers, Krisna Pranav
9+
'''
10+
11+
import inspect
12+
import json
13+
import traceback
14+
15+
from collections.abc import Callable
16+
from decimal import Decimal
17+
from typing import Any
18+
19+
from .logger import logger
20+
21+
CONVERT_RATE = 100000000
22+
23+
def convert_amount_type(amount: str | Decimal) -> Decimal:
24+
if amount == "None":
25+
return Decimal("Nan")
26+
27+
return Decimal(amount)
28+
29+
def satoshis(amount: str | Decimal) -> int:
30+
return int(convert_amount_type(amount) * CONVERT_RATE)

0 commit comments

Comments
 (0)