|
7 | 7 | from hiero_sdk_python.file.file_append_transaction import FileAppendTransaction |
8 | 8 | from hiero_sdk_python.file.file_contents_query import FileContentsQuery |
9 | 9 | from hiero_sdk_python.file.file_create_transaction import FileCreateTransaction |
| 10 | +from hiero_sdk_python.hbar import Hbar |
10 | 11 | from hiero_sdk_python.response_code import ResponseCode |
| 12 | +from hiero_sdk_python.transaction.transaction import Transaction |
11 | 13 | from hiero_sdk_python.transaction.transaction_id import TransactionId |
12 | 14 |
|
13 | 15 |
|
@@ -324,3 +326,42 @@ def test_file_append_chunk_transaction_can_execute_with_manual_freeze(env): |
324 | 326 |
|
325 | 327 | file_contents = FileContentsQuery().set_file_id(file_id).execute(env.client) |
326 | 328 | assert file_contents == bytes(content, "utf-8") |
| 329 | + |
| 330 | + |
| 331 | +@pytest.mark.integration |
| 332 | +def test(env): |
| 333 | + create_receipt = ( |
| 334 | + FileCreateTransaction() |
| 335 | + .set_keys(env.client.operator_private_key.public_key()) |
| 336 | + .set_contents(b"") |
| 337 | + .execute(env.client) |
| 338 | + ) |
| 339 | + |
| 340 | + assert create_receipt.status == ResponseCode.SUCCESS |
| 341 | + file_id = create_receipt.file_id |
| 342 | + |
| 343 | + file_contents = FileContentsQuery().set_file_id(file_id).execute(env.client) |
| 344 | + assert file_contents == b"" |
| 345 | + |
| 346 | + content = "A" * (8192) # content with (4000/1024) bytes ie approx 4 chunks |
| 347 | + |
| 348 | + tx = ( |
| 349 | + FileAppendTransaction() |
| 350 | + .set_file_id(file_id) |
| 351 | + .set_contents(content) |
| 352 | + .set_transaction_id(TransactionId.generate(AccountId(0, 0, 101))) |
| 353 | + .set_node_account_ids([AccountId(0, 0, 3), AccountId(0, 0, 4)]) |
| 354 | + ) |
| 355 | + |
| 356 | + tx._default_transaction_fee = Hbar.from_hbars(10).to_tinybars() |
| 357 | + |
| 358 | + print(tx.get_required_chunks()) |
| 359 | + print(tx.transaction_id) |
| 360 | + print(tx.node_account_ids) |
| 361 | + |
| 362 | + bytestx = tx.to_bytes() |
| 363 | + ntx = Transaction.from_bytes(bytestx) |
| 364 | + |
| 365 | + print(ntx.get_required_chunks()) |
| 366 | + print(ntx.transaction_id) |
| 367 | + print(ntx.node_account_ids) |
0 commit comments