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
c5b75eed
Commit
c5b75eed
authored
6 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[mod]
#72
: rename `amount` variable to `tx_amount` to avoid confusion.
parent
0b8168c6
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.py
+10
-10
10 additions, 10 deletions
silkaj/tx.py
with
10 additions
and
10 deletions
silkaj/tx.py
+
10
−
10
View file @
c5b75eed
...
@@ -17,18 +17,18 @@ def send_transaction(cli_args):
...
@@ -17,18 +17,18 @@ def send_transaction(cli_args):
"""
"""
Main function
Main function
"""
"""
amount
,
output
,
comment
,
allSources
,
outputBackChange
=
cmd_transaction
(
cli_args
)
tx_
amount
,
output
,
comment
,
allSources
,
outputBackChange
=
cmd_transaction
(
cli_args
)
seed
=
auth_method
(
cli_args
)
seed
=
auth_method
(
cli_args
)
issuer_pubkey
=
get_publickey_from_seed
(
seed
)
issuer_pubkey
=
get_publickey_from_seed
(
seed
)
pubkey_amount
=
get_amount_from_pubkey
(
issuer_pubkey
)[
0
]
pubkey_amount
=
get_amount_from_pubkey
(
issuer_pubkey
)[
0
]
outputAddresses
=
output
.
split
(
'
:
'
)
outputAddresses
=
output
.
split
(
'
:
'
)
check_transaction_values
(
comment
,
outputAddresses
,
outputBackChange
,
pubkey_amount
<
amount
*
len
(
outputAddresses
),
issuer_pubkey
)
check_transaction_values
(
comment
,
outputAddresses
,
outputBackChange
,
pubkey_amount
<
tx_
amount
*
len
(
outputAddresses
),
issuer_pubkey
)
if
cli_args
.
contains_switches
(
'
yes
'
)
or
cli_args
.
contains_switches
(
'
y
'
)
or
\
if
cli_args
.
contains_switches
(
'
yes
'
)
or
cli_args
.
contains_switches
(
'
y
'
)
or
\
input
(
tabulate
(
transaction_confirmation
(
issuer_pubkey
,
amount
,
outputAddresses
,
comment
),
input
(
tabulate
(
transaction_confirmation
(
issuer_pubkey
,
tx_
amount
,
outputAddresses
,
comment
),
tablefmt
=
"
fancy_grid
"
)
+
"
\n
Do you confirm sending this transaction? [yes/no]:
"
)
==
"
yes
"
:
tablefmt
=
"
fancy_grid
"
)
+
"
\n
Do you confirm sending this transaction? [yes/no]:
"
)
==
"
yes
"
:
generate_and_send_transaction
(
seed
,
issuer_pubkey
,
amount
,
outputAddresses
,
comment
,
allSources
,
outputBackChange
)
generate_and_send_transaction
(
seed
,
issuer_pubkey
,
tx_
amount
,
outputAddresses
,
comment
,
allSources
,
outputBackChange
)
def
cmd_transaction
(
cli_args
):
def
cmd_transaction
(
cli_args
):
...
@@ -41,9 +41,9 @@ def cmd_transaction(cli_args):
...
@@ -41,9 +41,9 @@ def cmd_transaction(cli_args):
message_exit
(
"
--output is not set
"
)
message_exit
(
"
--output is not set
"
)
if
cli_args
.
contains_definitions
(
'
amount
'
):
if
cli_args
.
contains_definitions
(
'
amount
'
):
amount
=
float
(
cli_args
.
get_definition
(
'
amount
'
))
*
100
tx_
amount
=
float
(
cli_args
.
get_definition
(
'
amount
'
))
*
100
if
cli_args
.
contains_definitions
(
'
amountUD
'
):
if
cli_args
.
contains_definitions
(
'
amountUD
'
):
amount
=
float
(
cli_args
.
get_definition
(
'
amountUD
'
))
*
UDValue
().
ud_value
tx_
amount
=
float
(
cli_args
.
get_definition
(
'
amountUD
'
))
*
UDValue
().
ud_value
output
=
cli_args
.
get_definition
(
'
output
'
)
output
=
cli_args
.
get_definition
(
'
output
'
)
comment
=
cli_args
.
get_definition
(
'
comment
'
)
if
cli_args
.
contains_definitions
(
'
comment
'
)
else
""
comment
=
cli_args
.
get_definition
(
'
comment
'
)
if
cli_args
.
contains_definitions
(
'
comment
'
)
else
""
...
@@ -53,7 +53,7 @@ def cmd_transaction(cli_args):
...
@@ -53,7 +53,7 @@ def cmd_transaction(cli_args):
outputBackChange
=
cli_args
.
get_definition
(
'
outputBackChange
'
)
outputBackChange
=
cli_args
.
get_definition
(
'
outputBackChange
'
)
else
:
else
:
outputBackChange
=
None
outputBackChange
=
None
return
amount
,
output
,
comment
,
allSources
,
outputBackChange
return
tx_
amount
,
output
,
comment
,
allSources
,
outputBackChange
def
check_transaction_values
(
comment
,
outputAddresses
,
outputBackChange
,
enough_source
,
issuer_pubkey
):
def
check_transaction_values
(
comment
,
outputAddresses
,
outputBackChange
,
enough_source
,
issuer_pubkey
):
...
@@ -69,15 +69,15 @@ def check_transaction_values(comment, outputAddresses, outputBackChange, enough_
...
@@ -69,15 +69,15 @@ def check_transaction_values(comment, outputAddresses, outputBackChange, enough_
message_exit
(
issuer_pubkey
+
"
pubkey doesn’t have enough money for this transaction.
"
)
message_exit
(
issuer_pubkey
+
"
pubkey doesn’t have enough money for this transaction.
"
)
def
transaction_confirmation
(
issuer_pubkey
,
amount
,
outputAddresses
,
comment
):
def
transaction_confirmation
(
issuer_pubkey
,
tx_
amount
,
outputAddresses
,
comment
):
"""
"""
Generate transaction confirmation
Generate transaction confirmation
"""
"""
currency_symbol
=
CurrencySymbol
().
symbol
currency_symbol
=
CurrencySymbol
().
symbol
tx
=
list
()
tx
=
list
()
tx
.
append
([
"
amount (
"
+
currency_symbol
+
"
)
"
,
amount
/
100
*
len
(
outputAddresses
)])
tx
.
append
([
"
amount (
"
+
currency_symbol
+
"
)
"
,
tx_
amount
/
100
*
len
(
outputAddresses
)])
tx
.
append
([
"
amount (UD
"
+
currency_symbol
+
"
)
"
,
round
(
amount
/
UDValue
().
ud_value
,
4
)])
tx
.
append
([
"
amount (UD
"
+
currency_symbol
+
"
)
"
,
round
(
tx_
amount
/
UDValue
().
ud_value
,
4
)])
tx
.
append
([
"
from
"
,
issuer_pubkey
])
tx
.
append
([
"
from
"
,
issuer_pubkey
])
id_from
=
get_uid_from_pubkey
(
issuer_pubkey
)
id_from
=
get_uid_from_pubkey
(
issuer_pubkey
)
if
id_from
is
not
NO_MATCHING_ID
:
if
id_from
is
not
NO_MATCHING_ID
:
...
...
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