|
| 1 | +from tests.integration.integration_test_case import IntegrationTestCase |
| 2 | +from tests.integration.it_utils import ( |
| 3 | + sign_and_reliable_submission_async, |
| 4 | + test_async_and_sync, |
| 5 | +) |
| 6 | +from tests.integration.reusable_values import DESTINATION, WALLET |
| 7 | +from xrpl.asyncio.transaction import autofill |
| 8 | +from xrpl.models import Batch, BatchFlag, Payment |
| 9 | +from xrpl.models.response import ResponseStatus |
| 10 | +from xrpl.transaction.batch_signers import sign_multiaccount_batch |
| 11 | + |
| 12 | + |
| 13 | +class TestBatch(IntegrationTestCase): |
| 14 | + @test_async_and_sync(globals()) |
| 15 | + async def test_basic_functionality(self, client): |
| 16 | + payment = Payment( |
| 17 | + account=WALLET.address, |
| 18 | + amount="1", |
| 19 | + destination=DESTINATION.address, |
| 20 | + ) |
| 21 | + batch = Batch( |
| 22 | + account=WALLET.address, |
| 23 | + flags=BatchFlag.TF_ALL_OR_NOTHING, |
| 24 | + raw_transactions=[payment, payment], |
| 25 | + ) |
| 26 | + response = await sign_and_reliable_submission_async(batch, WALLET, client) |
| 27 | + self.assertEqual(response.status, ResponseStatus.SUCCESS) |
| 28 | + self.assertEqual(response.result["engine_result"], "tesSUCCESS") |
| 29 | + |
| 30 | + @test_async_and_sync(globals(), ["xrpl.transaction.autofill"]) |
| 31 | + async def test_multisign(self, client): |
| 32 | + payment = Payment( |
| 33 | + account=WALLET.address, |
| 34 | + amount="1", |
| 35 | + destination=DESTINATION.address, |
| 36 | + ) |
| 37 | + payment2 = Payment( |
| 38 | + account=DESTINATION.address, |
| 39 | + amount="1", |
| 40 | + destination=WALLET.address, |
| 41 | + ) |
| 42 | + batch = Batch( |
| 43 | + account=WALLET.address, |
| 44 | + flags=BatchFlag.TF_ALL_OR_NOTHING, |
| 45 | + raw_transactions=[payment, payment2], |
| 46 | + ) |
| 47 | + autofilled = await autofill(batch, client, 1) |
| 48 | + signed = sign_multiaccount_batch(DESTINATION, autofilled) |
| 49 | + response = await sign_and_reliable_submission_async(signed, WALLET, client) |
| 50 | + self.assertEqual(response.status, ResponseStatus.SUCCESS) |
| 51 | + self.assertEqual(response.result["engine_result"], "tesSUCCESS") |
0 commit comments