|
13 | 13 | XRPLReliableSubmissionException, |
14 | 14 | autofill, |
15 | 15 | autofill_and_sign, |
16 | | - get_transaction_from_hash, |
17 | 16 | send_reliable_submission, |
18 | 17 | sign, |
19 | 18 | ) |
|
48 | 47 |
|
49 | 48 |
|
50 | 49 | class TestTransaction(IntegrationTestCase): |
51 | | - @test_async_and_sync( |
52 | | - globals(), |
53 | | - [ |
54 | | - "xrpl.transaction.autofill_and_sign", |
55 | | - "xrpl.transaction.send_reliable_submission", |
56 | | - "xrpl.transaction.get_transaction_from_hash", |
57 | | - ], |
58 | | - ) |
59 | | - async def test_get_transaction_from_hash(self, client): |
60 | | - # GIVEN a new transaction (payment) |
61 | | - payment_transaction = Payment( |
62 | | - account=WALLET.classic_address, |
63 | | - amount="100", |
64 | | - destination=DESTINATION, |
65 | | - sequence=WALLET.sequence, |
66 | | - ) |
67 | | - |
68 | | - # WHEN we sign locally, autofill, and submit the transaction |
69 | | - response = await sign_and_reliable_submission_async(payment_transaction, WALLET) |
70 | | - |
71 | | - # THEN we expect to retrieve this transaction from its hash |
72 | | - payment = await get_transaction_from_hash( |
73 | | - response.result["tx_json"]["hash"], client |
74 | | - ) |
75 | | - |
76 | | - # AND we expect the result Account to be the same as the original payment Acct |
77 | | - self.assertEqual(payment.result["Account"], ACCOUNT) |
78 | | - # AND we expect the response to be successful (200) |
79 | | - self.assertTrue(payment.is_successful()) |
80 | | - |
81 | | - WALLET.sequence += 1 |
82 | | - |
83 | | - @test_async_and_sync( |
84 | | - globals(), |
85 | | - [ |
86 | | - "xrpl.transaction.autofill_and_sign", |
87 | | - "xrpl.transaction.send_reliable_submission", |
88 | | - "xrpl.transaction.get_transaction_from_hash", |
89 | | - ], |
90 | | - ) |
91 | | - async def test_get_transaction_from_hash_with_binary(self, client): |
92 | | - # GIVEN a new transaction (payment) |
93 | | - payment_transaction = Payment( |
94 | | - account=WALLET.classic_address, |
95 | | - amount="100", |
96 | | - destination=DESTINATION, |
97 | | - sequence=WALLET.sequence, |
98 | | - ) |
99 | | - |
100 | | - # WHEN we sign locally, autofill, and submit the transaction |
101 | | - response = await sign_and_reliable_submission_async(payment_transaction, WALLET) |
102 | | - payment_hash = response.result["tx_json"]["hash"] |
103 | | - |
104 | | - # THEN we expect to retrieve this transaction from its hash with the |
105 | | - # binary parameter set to true |
106 | | - payment = await get_transaction_from_hash(payment_hash, client, True) |
107 | | - |
108 | | - # AND we expect the result hash to be the same as the original payment hash |
109 | | - self.assertEqual(payment.result["hash"], payment_hash) |
110 | | - # AND we expect the response to be successful (200) |
111 | | - self.assertTrue(payment.is_successful()) |
112 | | - |
113 | | - WALLET.sequence += 1 |
114 | | - |
115 | | - @test_async_and_sync( |
116 | | - globals(), |
117 | | - [ |
118 | | - "xrpl.transaction.autofill_and_sign", |
119 | | - "xrpl.transaction.send_reliable_submission", |
120 | | - "xrpl.transaction.get_transaction_from_hash", |
121 | | - ], |
122 | | - ) |
123 | | - async def test_get_transaction_from_hash_with_min_max_ledgers(self, client): |
124 | | - # GIVEN a new transaction (payment) |
125 | | - payment_transaction = Payment( |
126 | | - account=WALLET.classic_address, |
127 | | - amount="100", |
128 | | - destination=DESTINATION, |
129 | | - sequence=WALLET.sequence, |
130 | | - ) |
131 | | - |
132 | | - # WHEN we sign locally, autofill, and submit the transaction |
133 | | - response = await sign_and_reliable_submission_async(payment_transaction, WALLET) |
134 | | - payment_hash = response.result["tx_json"]["hash"] |
135 | | - payment_ledger_index = response.result["validated_ledger_index"] |
136 | | - |
137 | | - # THEN we expect to retrieve this transaction from its hash with |
138 | | - # min_ledger and max_ledger parameters |
139 | | - payment = await get_transaction_from_hash( |
140 | | - payment_hash, |
141 | | - client, |
142 | | - False, |
143 | | - payment_ledger_index - 5, |
144 | | - payment_ledger_index + 5, |
145 | | - ) |
146 | | - |
147 | | - # AND we expect the result Account to be the same as the original payment Acct |
148 | | - self.assertEqual(payment.result["Account"], ACCOUNT) |
149 | | - # AND we expect the response to be successful (200) |
150 | | - self.assertTrue(payment.is_successful()) |
151 | | - |
152 | | - WALLET.sequence += 1 |
153 | | - |
154 | 50 | @test_async_and_sync( |
155 | 51 | globals(), |
156 | 52 | ) |
|
0 commit comments