Skip to content

Commit

Permalink
Cast timestamp to an int when signing
Browse files Browse the repository at this point in the history
  • Loading branch information
sambarnes committed Oct 7, 2019
1 parent 1fc28c7 commit 819edbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions examples/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fat_py.fat2 as fat2
import fat_py.fat2.consts as consts
from factom_keys.fct import FactoidPrivateKey
from factom_keys.fct import FactoidPrivateKey, FactoidAddress

from fat_py import FATd

Expand All @@ -9,11 +9,17 @@
private_key = FactoidPrivateKey(key_string="Fs3E9gV6DXsYzf7Fqx1fVBQPQXV695eP3k5XbmHEZVRLkMdD9qCK")
address = private_key.get_factoid_address()

output_addresses = [
FactoidAddress(address_string="FA2ybgFNYQiZFgTjkwQwp74uGsEUHJc6hGEh4YA3ai7FcssemapP"),
FactoidAddress(address_string="FA34L6m7rQypr5PVmKGJ1Y4FQ6gDWbVaA49kFTGn1sSVZj6D8pFJ"),
]

print(fatd.get_pegnet_balances(address))

tx = fat2.Transaction()
tx.set_input(address, "pFCT", 10000)
tx.conversion = "pUSD"
tx.set_input(address, "PEG", 1000)
tx.add_transfer(output_addresses[0], 500)
tx.add_transfer(output_addresses[1], 500)

tx_batch = fat2.TransactionBatch()
tx_batch.add_transaction(tx)
Expand Down
2 changes: 1 addition & 1 deletion fat_py/fat2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def is_valid(self) -> bool:

@dataclass
class TransactionBatch:
timestamp: str = str(datetime.datetime.utcnow().timestamp())
timestamp: str = str(int(datetime.datetime.utcnow().timestamp()))

_txs: List[Transaction] = dataclasses.field(init=False, default_factory=list)
_signer_keys: List[FactoidPrivateKey] = dataclasses.field(init=False, default_factory=list)
Expand Down

0 comments on commit 819edbb

Please sign in to comment.