Skip to content

Commit

Permalink
fix: linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Aug 19, 2024
1 parent 482851d commit 9bc266b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 3 additions & 9 deletions examples/example_key_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
import secrets

from pactus.crypto import CryptoConfig
from pactus.crypto.address import AddressType, Address
from pactus.crypto.address import AddressType
from pactus.crypto.bls.private_key import PrivateKey, PublicKey


def dump(sec: PrivateKey, pub: PublicKey, addr: Address):
print(f"Your secret key: {sec.string()}")
print(f"Your public key: {pub.string()}")
print(f"Your address key: {addr.string()}")


def main() -> None:
parser = argparse.ArgumentParser(description="Create a Key Pair")

Expand Down Expand Up @@ -42,13 +36,13 @@ def main() -> None:
ikm = secrets.token_bytes(32)
sec = PrivateKey.key_gen(ikm)
pub = sec.public_key()
dump(sec, pub, pub.validator_address())
pub.validator_address()

case AddressType.BLS_ACCOUNT:
ikm = secrets.token_bytes(32)
sec = PrivateKey.key_gen(ikm)
pub = sec.public_key()
dump(sec, pub, pub.account_address())
pub.account_address()

case _:
return
Expand Down
18 changes: 12 additions & 6 deletions examples/example_transfer_transaction.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pactus.transaction.transaction import Transaction
from pactus.crypto import CryptoConfig
from pactus.crypto.address import Address
from pactus.crypto.bls.private_key import PrivateKey, PublicKey
from pactus.crypto.bls.private_key import PrivateKey
from pactus.transaction.transaction import Transaction
from pactus.types.amount import Amount
from pactus.crypto import CryptoConfig


def main() -> None:
Expand All @@ -20,9 +20,15 @@ def main() -> None:
)

tx = Transaction.create_transfer_tx(lock_time, sender, receiver, amount, fee, memo)
signed_tx = tx.sign(sec)

print(f"Signed transaction: {signed_tx}")
tx.sign(sec)
# 0001b8791a0080ade2041a5468697320697320612074657374207472616e7
# 3616374696f6e0102a8fe2600ff61558985f68eed49246f7da5313c0c02b5
# 7225b9914c35f2a3ded612eb2392bf77e2dc6380dea0cb05b8f2408955432
# 25d79b919396bab6b5cbe195e844ace823f6f798292840a6182a04c501ffa
# 67a2a9062ba248b4b81771ab5390b7c5771f1c7c8bc2040374423ad46c23e
# 2ad54754a43fbc9661a51b29a2b4e844b31de5e81ecd3f124562526e90367
# 935ee2e663449603b53745766863856ffd9477b18013ce06950d2c56e00fb
# 00b78eeb6c737ea0960060a1c63eb67


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion pactus/types/amount.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def from_nano_pac(cls, f: float) -> "Amount":
@classmethod
def from_string(cls, s: str) -> "Amount":
"""
Parses a string representing a value in PAC, converts it to NanoPAC,
Parse a string representing a value in PAC, converts it to NanoPAC,
and updates the Amount object.
If the string cannot be parsed as a float, a ValueError is raised.
Expand Down

0 comments on commit 9bc266b

Please sign in to comment.