Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
silkaj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
silkaj
Commits
cf22c4eb
Commit
cf22c4eb
authored
3 years ago
by
matograine
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#344
use pendulum in tx_history
parent
627262ef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silkaj/tx_history.py
+6
-4
6 additions, 4 deletions
silkaj/tx_history.py
with
6 additions
and
4 deletions
silkaj/tx_history.py
+
6
−
4
View file @
cf22c4eb
...
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
...
@@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
"""
"""
from
pendulum
import
from_timestamp
from
click
import
command
,
argument
,
option
,
echo_via_pager
,
get_terminal_size
from
click
import
command
,
argument
,
option
,
echo_via_pager
,
get_terminal_size
from
texttable
import
Texttable
from
texttable
import
Texttable
from
operator
import
itemgetter
,
neg
,
eq
,
ne
from
operator
import
itemgetter
,
neg
,
eq
,
ne
...
@@ -25,11 +26,12 @@ from duniterpy.documents.transaction import Transaction
...
@@ -25,11 +26,12 @@ from duniterpy.documents.transaction import Transaction
from
silkaj.network_tools
import
ClientInstance
from
silkaj.network_tools
import
ClientInstance
from
silkaj.tools
import
coroutine
from
silkaj.tools
import
coroutine
from
silkaj.tui
import
convert_time
,
display_pubkey_and_checksum
from
silkaj.tui
import
display_pubkey_and_checksum
from
silkaj.crypto_tools
import
validate_checksum
,
check_pubkey_format
from
silkaj.crypto_tools
import
validate_checksum
,
check_pubkey_format
from
silkaj
import
wot
from
silkaj
import
wot
from
silkaj.money
import
get_amount_from_pubkey
,
amount_in_current_base
,
UDValue
from
silkaj.money
import
get_amount_from_pubkey
,
amount_in_current_base
,
UDValue
from
silkaj.tools
import
CurrencySymbol
from
silkaj.tools
import
CurrencySymbol
from
silkaj.constants
import
ALL_DIGITAL
@command
(
"
history
"
,
help
=
"
Display transaction history
"
)
@command
(
"
history
"
,
help
=
"
Display transaction history
"
)
...
@@ -72,7 +74,7 @@ Current balance: {balance} {currency}, {balance_ud} UD {currency} on the {date}\
...
@@ -72,7 +74,7 @@ Current balance: {balance} {currency}, {balance_ud} UD {currency} on the {date}\
currency
=
currency_symbol
,
currency
=
currency_symbol
,
balance
=
balance
[
1
]
/
100
,
balance
=
balance
[
1
]
/
100
,
balance_ud
=
round
(
balance
[
1
]
/
ud_value
,
2
),
balance_ud
=
round
(
balance
[
1
]
/
ud_value
,
2
),
date
=
convert_time
(
time
(),
"
all
"
),
date
=
from_timestamp
(
time
()).
format
(
ALL_DIGITAL
),
)
)
...
@@ -150,7 +152,7 @@ async def parse_received_tx(
...
@@ -150,7 +152,7 @@ async def parse_received_tx(
identities
=
await
wot
.
identities_from_pubkeys
(
issuers
,
uids
)
identities
=
await
wot
.
identities_from_pubkeys
(
issuers
,
uids
)
for
received_tx
in
received_txs
:
for
received_tx
in
received_txs
:
tx_list
=
list
()
tx_list
=
list
()
tx_list
.
append
(
convert_time
(
received_tx
.
time
,
"
all
"
))
tx_list
.
append
(
from_timestamp
(
received_tx
.
time
).
format
(
ALL_DIGITAL
))
tx_list
.
append
(
str
())
tx_list
.
append
(
str
())
for
i
,
issuer
in
enumerate
(
received_tx
.
issuers
):
for
i
,
issuer
in
enumerate
(
received_tx
.
issuers
):
tx_list
[
1
]
+=
prefix
(
None
,
None
,
i
)
+
assign_idty_from_pubkey
(
tx_list
[
1
]
+=
prefix
(
None
,
None
,
i
)
+
assign_idty_from_pubkey
(
...
@@ -182,7 +184,7 @@ async def parse_sent_tx(sent_txs_table, sent_txs, pubkey, ud_value, uids, full_p
...
@@ -182,7 +184,7 @@ async def parse_sent_tx(sent_txs_table, sent_txs, pubkey, ud_value, uids, full_p
identities
=
await
wot
.
identities_from_pubkeys
(
pubkeys
,
uids
)
identities
=
await
wot
.
identities_from_pubkeys
(
pubkeys
,
uids
)
for
sent_tx
in
sent_txs
:
for
sent_tx
in
sent_txs
:
tx_list
=
list
()
tx_list
=
list
()
tx_list
.
append
(
convert_time
(
sent_tx
.
time
,
"
all
"
))
tx_list
.
append
(
from_timestamp
(
sent_tx
.
time
).
format
(
ALL_DIGITAL
))
total_amount
,
outputs
=
tx_amount
(
sent_tx
,
pubkey
,
sent_func
)
total_amount
,
outputs
=
tx_amount
(
sent_tx
,
pubkey
,
sent_func
)
if
len
(
outputs
)
>
1
:
if
len
(
outputs
)
>
1
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment