Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove old transaction types #131

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions crypto/constants.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
from enum import Enum

TRANSACTION_TRANSFER = 0
TRANSACTION_SECOND_SIGNATURE_REGISTRATION = 1
TRANSACTION_DELEGATE_REGISTRATION = 2
TRANSACTION_VOTE = 3
TRANSACTION_MULTI_SIGNATURE_REGISTRATION = 4
TRANSACTION_IPFS = 5
TRANSACTION_MULTI_PAYMENT = 6
TRANSACTION_DELEGATE_RESIGNATION = 7
TRANSACTION_HTLC_LOCK = 8
TRANSACTION_HTLC_CLAIM = 9
TRANSACTION_HTLC_REFUND = 10

TRANSACTION_TYPES = {
TRANSACTION_TRANSFER: 'transfer',
TRANSACTION_SECOND_SIGNATURE_REGISTRATION: 'second_signature_registration',
TRANSACTION_DELEGATE_REGISTRATION: 'delegate_registration',
TRANSACTION_VOTE: 'vote',
TRANSACTION_MULTI_SIGNATURE_REGISTRATION: 'multi_signature_registration',
TRANSACTION_IPFS: 'ipfs',
TRANSACTION_MULTI_PAYMENT: 'multi_payment',
TRANSACTION_DELEGATE_RESIGNATION: 'delegate_resignation',
TRANSACTION_HTLC_LOCK: 'htlc_lock',
TRANSACTION_HTLC_CLAIM: 'htlc_claim',
TRANSACTION_HTLC_REFUND: 'htlc_refund',
}

TRANSACTION_FEES = {
TRANSACTION_TRANSFER: 10000000,
TRANSACTION_SECOND_SIGNATURE_REGISTRATION: 500000000,
TRANSACTION_DELEGATE_REGISTRATION: 2500000000,
TRANSACTION_VOTE: 100000000,
TRANSACTION_MULTI_SIGNATURE_REGISTRATION: 500000000,
TRANSACTION_IPFS: 500000000,
TRANSACTION_MULTI_PAYMENT: 10000000,
TRANSACTION_DELEGATE_RESIGNATION: 2500000000,
TRANSACTION_HTLC_LOCK: 10000000,
TRANSACTION_HTLC_CLAIM: 0,
TRANSACTION_HTLC_REFUND: 0,
}


Expand All @@ -48,11 +33,3 @@ def __int__(self):
TEST = 0
CORE = 1
RESERVED = 1000 # Everything above is available to anyone


class HTLC_LOCK_EXPIRATION_TYPE(Enum):
def __str__(self):
return int(self.value)

EPOCH_TIMESTAMP = 1
BLOCK_HEIGHT = 2
10 changes: 3 additions & 7 deletions crypto/transactions/builder/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from binascii import hexlify, unhexlify

from crypto.configuration.fee import get_fee
from crypto.constants import HTLC_LOCK_EXPIRATION_TYPE, TRANSACTION_TYPE_GROUP
from crypto.constants import TRANSACTION_TYPE_GROUP
from crypto.identity.private_key import PrivateKey
from crypto.identity.public_key import PublicKey
from crypto.transactions.signature import Signature
Expand Down Expand Up @@ -82,12 +82,8 @@ def set_amount(self, amount):
def set_sender_public_key(self, public_key):
self.transaction.senderPublicKey = public_key

def set_expiration(self, expiration):
if type(expiration) == int:
self.transaction.expiration = expiration
else:
types = {HTLC_LOCK_EXPIRATION_TYPE.EPOCH_TIMESTAMP: 1, HTLC_LOCK_EXPIRATION_TYPE.BLOCK_HEIGHT: 2}
self.transaction.expiration = types[expiration]
def set_expiration(self, expiration: int):
self.transaction.expiration = expiration

def set_type_group(self, type_group):
if type(type_group) == int:
Expand Down
31 changes: 0 additions & 31 deletions crypto/transactions/builder/htlc_claim.py

This file was deleted.

46 changes: 0 additions & 46 deletions crypto/transactions/builder/htlc_lock.py

This file was deleted.

28 changes: 0 additions & 28 deletions crypto/transactions/builder/htlc_refund.py

This file was deleted.

25 changes: 0 additions & 25 deletions crypto/transactions/builder/ipfs.py

This file was deleted.

23 changes: 0 additions & 23 deletions crypto/transactions/builder/second_signature_registration.py

This file was deleted.

24 changes: 0 additions & 24 deletions crypto/transactions/deserializers/htlc_claim.py

This file was deleted.

41 changes: 0 additions & 41 deletions crypto/transactions/deserializers/htlc_lock.py

This file was deleted.

22 changes: 0 additions & 22 deletions crypto/transactions/deserializers/htlc_refund.py

This file was deleted.

38 changes: 0 additions & 38 deletions crypto/transactions/deserializers/ipfs.py

This file was deleted.

This file was deleted.

Loading
Loading