Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
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
DuniterPy
Commits
4a17d70b
Commit
4a17d70b
authored
11 years ago
by
Caner Candan
Browse files
Options
Downloads
Plain Diff
Merge pull request #7 from Insoleet/master
Transfer wrapper bug fixes
parents
aefb76a8
1915d919
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
wrappers/transactions.py
+30
-5
30 additions, 5 deletions
wrappers/transactions.py
with
30 additions
and
5 deletions
wrappers/transactions.py
+
30
−
5
View file @
4a17d70b
...
...
@@ -34,7 +34,7 @@ class Transaction(Wrapper):
def
__call__
(
self
):
try
:
last_tx
=
hdc
.
transactions
.
sender
.
Last
(
self
.
pgp_fingerprint
,
self
.
server
,
self
.
port
).
get
()
last_tx
=
hdc
.
transactions
.
sender
.
Last
(
self
.
pgp_fingerprint
,
server
=
self
.
server
,
port
=
self
.
port
).
get
()
except
ValueError
:
last_tx
=
None
...
...
@@ -118,7 +118,7 @@ Comment:
class
Transfer
(
Transaction
):
def
__init__
(
self
,
pgp_fingerprint
,
recipient
,
coins
,
message
=
''
,
keyid
=
None
,
server
=
None
,
port
=
None
):
super
().
__init__
(
'
TRANSFER
'
,
pgp_fingerprint
,
message
,
keyid
,
server
,
port
)
super
().
__init__
(
'
TRANSFER
'
,
pgp_fingerprint
,
message
,
keyid
=
keyid
,
server
=
server
,
port
=
port
)
self
.
recipient
=
recipient
self
.
coins
=
coins
...
...
@@ -135,12 +135,37 @@ Coins:
for
coin
in
self
.
coins
.
split
(
'
,
'
):
data
=
coin
.
split
(
'
:
'
)
issuer
=
data
[
0
]
for
number
in
data
[
1
:]:
context_data
.
update
(
hdc
.
coins
.
View
(
issuer
,
int
(
number
),
self
.
server
,
self
.
port
).
get
())
tx
+=
'
%(id)s, %(transaction)s
\n
'
%
context_data
return
tx
class
RawTransfer
(
Transaction
):
def
__init__
(
self
,
pgp_fingerprint
,
recipient
,
coins
,
message
=
''
,
keyid
=
None
,
server
=
None
,
port
=
None
):
super
().
__init__
(
'
TRANSFER
'
,
pgp_fingerprint
,
message
,
keyid
=
keyid
,
server
=
server
,
port
=
port
)
self
.
recipient
=
recipient
self
.
coins
=
coins
def
get_message
(
self
,
context_data
,
tx
=
''
):
context_data
[
'
recipient
'
]
=
self
.
recipient
tx
+=
"""
\
Recipient: %(recipient)s
Type: %(type)s
Coins:
"""
%
context_data
for
coin
in
self
.
coins
:
data
=
coin
.
split
(
'
-
'
)
context_data
.
update
(
hdc
.
coins
.
View
(
data
[
0
],
int
(
data
[
1
]),
self
.
server
,
self
.
port
).
get
())
tx
+=
'
%(id)s, %(transaction)s
\n
'
%
context_data
return
tx
class
MonoTransaction
(
Transaction
):
def
get_next_coin_number
(
self
,
coins
):
number
=
0
...
...
@@ -172,7 +197,7 @@ Coins:
class
Issue
(
MonoTransaction
):
def
__init__
(
self
,
pgp_fingerprint
,
amendment
,
coins
,
message
=
''
,
keyid
=
None
,
server
=
None
,
port
=
None
):
super
().
__init__
(
'
ISSUANCE
'
,
pgp_fingerprint
,
message
,
keyid
,
server
,
port
)
super
().
__init__
(
'
ISSUANCE
'
,
pgp_fingerprint
,
message
,
keyid
=
keyid
,
server
=
server
,
port
=
port
)
self
.
amendment
=
amendment
self
.
coins
=
coins
...
...
@@ -189,7 +214,7 @@ class Issue(MonoTransaction):
class
Fusion
(
MonoTransaction
):
def
__init__
(
self
,
pgp_fingerprint
,
coins
,
message
=
''
,
keyid
=
None
,
server
=
None
,
port
=
None
):
super
().
__init__
(
'
FUSION
'
,
pgp_fingerprint
,
message
,
keyid
,
server
,
port
)
super
().
__init__
(
'
FUSION
'
,
pgp_fingerprint
,
message
,
keyid
=
keyid
,
server
=
server
,
port
=
port
)
self
.
coins
=
coins
...
...
@@ -206,7 +231,7 @@ class Fusion(MonoTransaction):
class
Divide
(
MonoTransaction
):
def
__init__
(
self
,
pgp_fingerprint
,
old_coins
,
new_coins
,
message
=
''
,
keyid
=
None
,
server
=
None
,
port
=
None
):
super
().
__init__
(
'
DIVISION
'
,
pgp_fingerprint
,
message
,
keyid
,
server
,
port
)
super
().
__init__
(
'
DIVISION
'
,
pgp_fingerprint
,
message
,
keyid
=
keyid
,
server
=
server
,
port
=
port
)
self
.
old_coins
=
old_coins
self
.
new_coins
=
new_coins
...
...
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