This repository has been archived by the owner on Nov 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:CityOfZion/neo-python into n…
…eocore-imports * 'development' of github.com:CityOfZion/neo-python: Add reference typo Resolve pycodestyle Document /neo/Core/TX/
- Loading branch information
Showing
9 changed files
with
633 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,74 @@ | ||
|
||
|
||
from neo.Core.TX.Transaction import Transaction, TransactionType | ||
import sys | ||
import binascii | ||
from neo.Cryptography.ECCurve import EllipticCurve, ECDSA | ||
from neo.Cryptography.ECCurve import ECDSA | ||
from neo.Settings import settings | ||
from neocore.Fixed8 import Fixed8 | ||
|
||
|
||
class EnrollmentTransaction(Transaction): | ||
|
||
PublicKey = None | ||
_script_hash = None | ||
|
||
def __init__(self, *args, **kwargs): | ||
""" | ||
Create an instance. | ||
Args: | ||
*args: | ||
**kwargs: | ||
""" | ||
super(EnrollmentTransaction, self).__init__(*args, **kwargs) | ||
self.Type = TransactionType.EnrollmentTransaction | ||
|
||
def Size(self): | ||
""" | ||
Get the total size in bytes of the object. | ||
Returns: | ||
int: size. | ||
""" | ||
return self.Size() + sys.getsizeof(int) | ||
|
||
def SystemFee(self): | ||
""" | ||
Get the enrollment fee. | ||
Returns: | ||
Fixed8: | ||
""" | ||
return Fixed8(int(settings.ENROLLMENT_TX_FEE)) | ||
|
||
def DeserializeExclusiveData(self, reader): | ||
""" | ||
Deserialize full object. | ||
Args: | ||
reader (neo.IO.BinaryReader): | ||
Raises: | ||
Exception: If the version read is incorrect. | ||
""" | ||
if self.Version is not 0: | ||
raise Exception('Invalid format') | ||
|
||
self.PublicKey = ECDSA.Deserialize_Secp256r1(reader) | ||
|
||
def SerializeExclusiveData(self, writer): | ||
""" | ||
Serialize object. | ||
Args: | ||
writer (neo.IO.BinaryWriter): | ||
""" | ||
self.PublicKey.Serialize(writer, True) | ||
|
||
def ToJson(self): | ||
""" | ||
Convert object members to a dictionary that can be parsed as JSON. | ||
Returns: | ||
dict: | ||
""" | ||
jsn = super(EnrollmentTransaction, self).ToJson() | ||
jsn['pubkey'] = self.PublicKey.ToString() | ||
return jsn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.