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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
fc30ac27
Commit
fc30ac27
authored
6 years ago
by
Moul
Browse files
Options
Downloads
Patches
Plain Diff
[enh] Transaction: add 'time' variable for read and write but not for doc generation
parent
8ea505a1
No related branches found
No related tags found
2 merge requests
!64
Release 0.54.3
,
!58
Transaction equality implementation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniterpy/documents/transaction.py
+11
-7
11 additions, 7 deletions
duniterpy/documents/transaction.py
with
11 additions
and
7 deletions
duniterpy/documents/transaction.py
+
11
−
7
View file @
fc30ac27
...
@@ -448,7 +448,7 @@ class Transaction(Document):
...
@@ -448,7 +448,7 @@ class Transaction(Document):
def
__init__
(
self
,
version
:
int
,
currency
:
str
,
blockstamp
:
Optional
[
BlockUID
],
locktime
:
int
,
issuers
:
List
[
str
],
def
__init__
(
self
,
version
:
int
,
currency
:
str
,
blockstamp
:
Optional
[
BlockUID
],
locktime
:
int
,
issuers
:
List
[
str
],
inputs
:
List
[
InputSource
],
unlocks
:
List
[
Unlock
],
outputs
:
List
[
OutputSource
],
inputs
:
List
[
InputSource
],
unlocks
:
List
[
Unlock
],
outputs
:
List
[
OutputSource
],
comment
:
str
,
signatures
:
List
[
str
])
->
None
:
comment
:
str
,
time
:
int
,
signatures
:
List
[
str
])
->
None
:
"""
"""
Init Transaction instance
Init Transaction instance
...
@@ -461,6 +461,7 @@ class Transaction(Document):
...
@@ -461,6 +461,7 @@ class Transaction(Document):
:param unlocks: List of Unlock instances
:param unlocks: List of Unlock instances
:param outputs: List of OutputSource instances
:param outputs: List of OutputSource instances
:param comment: Comment field
:param comment: Comment field
:param time: time when the transaction enters the blockchain
:param signatures: List of signatures
:param signatures: List of signatures
"""
"""
super
().
__init__
(
version
,
currency
,
signatures
)
super
().
__init__
(
version
,
currency
,
signatures
)
...
@@ -471,6 +472,8 @@ class Transaction(Document):
...
@@ -471,6 +472,8 @@ class Transaction(Document):
self
.
unlocks
=
unlocks
self
.
unlocks
=
unlocks
self
.
outputs
=
outputs
self
.
outputs
=
outputs
self
.
comment
=
comment
self
.
comment
=
comment
self
.
time
=
time
@classmethod
@classmethod
def
from_bma_history
(
cls
:
Type
[
TransactionType
],
currency
:
str
,
tx_data
:
Dict
)
->
TransactionType
:
def
from_bma_history
(
cls
:
Type
[
TransactionType
],
currency
:
str
,
tx_data
:
Dict
)
->
TransactionType
:
...
@@ -501,7 +504,7 @@ Outputs:
...
@@ -501,7 +504,7 @@ Outputs:
{multiline_outputs}
{multiline_outputs}
Comment: {comment}
Comment: {comment}
{multiline_signatures}
{multiline_signatures}
"""
.
format
(
**
tx_data
))
"""
.
format
(
**
tx_data
)
,
tx_data
[
"
time
"
]
)
@classmethod
@classmethod
def
from_compact
(
cls
:
Type
[
TransactionType
],
currency
:
str
,
compact
:
str
)
->
TransactionType
:
def
from_compact
(
cls
:
Type
[
TransactionType
],
currency
:
str
,
compact
:
str
)
->
TransactionType
:
...
@@ -572,10 +575,10 @@ Comment: {comment}
...
@@ -572,10 +575,10 @@ Comment: {comment}
else
:
else
:
raise
MalformedDocumentError
(
"
Compact TX Signatures
"
)
raise
MalformedDocumentError
(
"
Compact TX Signatures
"
)
return
cls
(
version
,
currency
,
blockstamp
,
locktime
,
issuers
,
inputs
,
unlocks
,
outputs
,
comment
,
signatures
)
return
cls
(
version
,
currency
,
blockstamp
,
locktime
,
issuers
,
inputs
,
unlocks
,
outputs
,
comment
,
0
,
signatures
)
@classmethod
@classmethod
def
from_signed_raw
(
cls
:
Type
[
TransactionType
],
raw
:
str
)
->
TransactionType
:
def
from_signed_raw
(
cls
:
Type
[
TransactionType
],
raw
:
str
,
time
:
int
=
0
)
->
TransactionType
:
"""
"""
Return a Transaction instance from a raw string format
Return a Transaction instance from a raw string format
...
@@ -645,7 +648,7 @@ Comment: {comment}
...
@@ -645,7 +648,7 @@ Comment: {comment}
n
+=
1
n
+=
1
return
cls
(
version
,
currency
,
blockstamp
,
locktime
,
issuers
,
inputs
,
unlocks
,
outputs
,
return
cls
(
version
,
currency
,
blockstamp
,
locktime
,
issuers
,
inputs
,
unlocks
,
outputs
,
comment
,
signatures
)
comment
,
time
,
signatures
)
def
raw
(
self
)
->
str
:
def
raw
(
self
)
->
str
:
"""
"""
...
@@ -732,7 +735,7 @@ class SimpleTransaction(Transaction):
...
@@ -732,7 +735,7 @@ class SimpleTransaction(Transaction):
def
__init__
(
self
,
version
:
int
,
currency
:
str
,
blockstamp
:
BlockUID
,
locktime
:
int
,
issuer
:
str
,
def
__init__
(
self
,
version
:
int
,
currency
:
str
,
blockstamp
:
BlockUID
,
locktime
:
int
,
issuer
:
str
,
single_input
:
InputSource
,
unlocks
:
List
[
Unlock
],
outputs
:
List
[
OutputSource
],
comment
:
str
,
single_input
:
InputSource
,
unlocks
:
List
[
Unlock
],
outputs
:
List
[
OutputSource
],
comment
:
str
,
signature
:
str
)
->
None
:
time
:
int
,
signature
:
str
)
->
None
:
"""
"""
Init instance
Init instance
...
@@ -745,10 +748,11 @@ class SimpleTransaction(Transaction):
...
@@ -745,10 +748,11 @@ class SimpleTransaction(Transaction):
:param unlocks: List of Unlock instances
:param unlocks: List of Unlock instances
:param outputs: List of OutputSource instances
:param outputs: List of OutputSource instances
:param comment: Comment field
:param comment: Comment field
:param time: time when the transaction enters the blockchain
:param signature: Signature
:param signature: Signature
"""
"""
super
().
__init__
(
version
,
currency
,
blockstamp
,
locktime
,
[
issuer
],
[
single_input
],
unlocks
,
super
().
__init__
(
version
,
currency
,
blockstamp
,
locktime
,
[
issuer
],
[
single_input
],
unlocks
,
outputs
,
comment
,
[
signature
])
outputs
,
comment
,
time
,
[
signature
])
@staticmethod
@staticmethod
def
is_simple
(
tx
:
Transaction
)
->
bool
:
def
is_simple
(
tx
:
Transaction
)
->
bool
:
...
...
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