mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 03:35:51 +00:00
var naming
This commit is contained in:
@@ -34,18 +34,18 @@ def create_wallet(silent: False):
|
|||||||
pub, priv = keypairs.derive_keypair(seed)
|
pub, priv = keypairs.derive_keypair(seed)
|
||||||
address = keypairs.derive_classic_address(pub)
|
address = keypairs.derive_classic_address(pub)
|
||||||
private = keypairs.derive_classic_address(priv)
|
private = keypairs.derive_classic_address(priv)
|
||||||
|
|
||||||
return address, private, seed
|
return address, private, seed
|
||||||
|
|
||||||
|
|
||||||
def sign_transaction(_xrp_amount, _destination, _ledger_seq, _wallet_seq, password):
|
def sign_transaction(xrp_amount, destination, ledger_seq, wallet_seq, password):
|
||||||
"""
|
"""
|
||||||
Signs transaction and returns signed transaction blob in QR code
|
Signs transaction and returns signed transaction blob in QR code
|
||||||
"""
|
"""
|
||||||
print("1. Retrieving encrypted private key and salt...")
|
print("1. Retrieving encrypted private key and salt...")
|
||||||
with open(get_path("/WalletTEST/private.txt"), "r") as f:
|
with open(get_path("/WalletTEST/private.txt"), "r") as f:
|
||||||
_seed = f.read()
|
seed = f.read()
|
||||||
_seed = bytes.fromhex(_seed)
|
seed = bytes.fromhex(seed)
|
||||||
|
|
||||||
with open(get_path("/WalletTEST/salt.txt"), "rb") as f:
|
with open(get_path("/WalletTEST/salt.txt"), "rb") as f:
|
||||||
salt = f.read()
|
salt = f.read()
|
||||||
@@ -62,19 +62,19 @@ def sign_transaction(_xrp_amount, _destination, _ledger_seq, _wallet_seq, passwo
|
|||||||
crypt = Fernet(key)
|
crypt = Fernet(key)
|
||||||
|
|
||||||
print("3. Decrypting wallet's private key using password")
|
print("3. Decrypting wallet's private key using password")
|
||||||
_seed = crypt.decrypt(_seed)
|
seed = crypt.decrypt(seed)
|
||||||
|
|
||||||
print("4. Initializing wallet using decrypted private key")
|
print("4. Initializing wallet using decrypted private key")
|
||||||
_wallet = wallet.Wallet(seed=_seed.decode(), sequence=0)
|
_wallet = wallet.Wallet(seed=seed.decode(), sequence=0)
|
||||||
|
|
||||||
validated_seq = _ledger_seq
|
validated_seq = ledger_seq
|
||||||
_wallet.sequence = _wallet_seq
|
_wallet.sequence = wallet_seq
|
||||||
|
|
||||||
print("5. Constructing payment transaction...")
|
print("5. Constructing payment transaction...")
|
||||||
my_tx_payment = Payment(
|
my_tx_payment = Payment(
|
||||||
account=_wallet.classic_address,
|
account=_wallet.classic_address,
|
||||||
amount=xrp_to_drops(xrp=_xrp_amount),
|
amount=xrp_to_drops(xrp=xrp_amount),
|
||||||
destination=_destination,
|
destination=destination,
|
||||||
last_ledger_sequence=validated_seq + 100,
|
last_ledger_sequence=validated_seq + 100,
|
||||||
# +100 to catch up with the ledger when we transmit the signed tx blob to Machine 2
|
# +100 to catch up with the ledger when we transmit the signed tx blob to Machine 2
|
||||||
sequence=_wallet.sequence,
|
sequence=_wallet.sequence,
|
||||||
@@ -217,11 +217,11 @@ if __name__ == '__main__':
|
|||||||
f"END RESULT: Successful")
|
f"END RESULT: Successful")
|
||||||
|
|
||||||
print("\nUNIT TEST 5. sign_transaction():")
|
print("\nUNIT TEST 5. sign_transaction():")
|
||||||
print("Parameters: _xrp_amount, _destination, _ledger_seq, _wallet_seq, password")
|
print("Parameters: xrp_amount, destination, ledger_seq, wallet_seq, password")
|
||||||
sign_transaction(
|
sign_transaction(
|
||||||
_xrp_amount=10,
|
xrp_amount=10,
|
||||||
_destination="rPEpirdT9UCNbnaZMJ4ENwKAwJqrTpvgMQ",
|
destination="rPEpirdT9UCNbnaZMJ4ENwKAwJqrTpvgMQ",
|
||||||
_ledger_seq=32602000,
|
ledger_seq=32602000,
|
||||||
_wallet_seq=32600100,
|
wallet_seq=32600100,
|
||||||
password="This is a unit test password 123 !@# -+= }{/"
|
password="This is a unit test password 123 !@# -+= }{/"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user