25 lines
1.2 KiB
Python
25 lines
1.2 KiB
Python
|
|
from pbc_client.crypto import sign_transaction, SenderAuthentication
|
|
|
|
def test_sign():
|
|
sender_authentication = SenderAuthentication("01")
|
|
chain_id = "SpecificChainIDLocatable"
|
|
contract_address = '000000000000000000000000000000000000000001'
|
|
signed = sign_transaction(
|
|
sender_authentication = sender_authentication,
|
|
nonce = 2,
|
|
valid_to_time = 3,
|
|
gas_cost = 2,
|
|
chain_id = chain_id,
|
|
contract_address = contract_address,
|
|
transaction_rpc = bytes([0 for i in range(99)]),
|
|
)
|
|
print(signed)
|
|
assert str(signed.inner.rpc_serialize().hex()) == '00000000000000020000000000000003000000000000000200000000000000000000000000000000000000000100000063000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
|
assert str(signed.hash(chain_id)) == '1be2895a85862e8dd3cc75b290cc28a22e960ae02dd5c07a73b93716f9adbee8'
|
|
|
|
|
|
assert str(signed.signature) == '01f0f7d8f44919466eedbebc76bcb369bbb4c6f4f076e25c0ffe8ec9285890e53b4e39098540d088878a019c345ad73963543ce813fb9ccf4b84b0c25770452bd1'
|
|
|
|
|