def test_last_ledger_expiration(self): WALLET.next_sequence_num = get_next_valid_seq_number(ACCOUNT, JSON_RPC_CLIENT) payment_dict = { "account": ACCOUNT, "sequence": WALLET.next_sequence_num, "last_ledger_sequence": WALLET.next_sequence_num + 1, "fee": "10000", "amount": "100", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) with self.assertRaises(LastLedgerSequenceExpiredException): send_reliable_submission(payment_transaction, WALLET, JSON_RPC_CLIENT)
def test_reliable_submission_bad_transaction(self): WALLET.next_sequence_num = get_next_valid_seq_number(ACCOUNT, JSON_RPC_CLIENT) payment_dict = { "account": ACCOUNT, "last_ledger_sequence": WALLET.next_sequence_num + 20, "fee": "10", "amount": "100", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) signed_payment_transaction = safe_sign_transaction(payment_transaction, WALLET) with self.assertRaises(XRPLRequestFailureException): send_reliable_submission(signed_payment_transaction, JSON_RPC_CLIENT) WALLET.next_sequence_num -= 1
async def test_reliable_submission_bad_transaction(self, client): WALLET.sequence = await get_next_valid_seq_number(ACCOUNT, client) payment_dict = { "account": ACCOUNT, "last_ledger_sequence": WALLET.sequence + 20, "fee": "10", "amount": "100", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) signed_payment_transaction = await safe_sign_transaction( payment_transaction, WALLET) with self.assertRaises(XRPLRequestFailureException): await send_reliable_submission(signed_payment_transaction, client)
def test_reliable_submission_last_ledger_expiration(self): WALLET.sequence = get_next_valid_seq_number(ACCOUNT, JSON_RPC_CLIENT) payment_dict = { "account": ACCOUNT, "sequence": WALLET.sequence, "last_ledger_sequence": WALLET.sequence + 1, "fee": "10000", "amount": "100", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) signed_payment_transaction = safe_sign_and_autofill_transaction( payment_transaction, WALLET, JSON_RPC_CLIENT) with self.assertRaises(XRPLReliableSubmissionException): send_reliable_submission(signed_payment_transaction, JSON_RPC_CLIENT) WALLET.sequence -= 1
def test_payment(self): WALLET.next_sequence_num = get_next_valid_seq_number(ACCOUNT, JSON_RPC_CLIENT) payment_dict = { "account": ACCOUNT, "sequence": WALLET.next_sequence_num, "last_ledger_sequence": WALLET.next_sequence_num + 10, "fee": "10000", "amount": "10", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) response = send_reliable_submission( payment_transaction, WALLET, JSON_RPC_CLIENT ) self.assertTrue(response.result["validated"]) self.assertEqual(response.result["meta"]["TransactionResult"], "tesSUCCESS") self.assertTrue(response.is_successful())
def test_reliable_submission_payment(self): WALLET.sequence = get_next_valid_seq_number(ACCOUNT, JSON_RPC_CLIENT) payment_dict = { "account": ACCOUNT, "sequence": WALLET.sequence, "amount": "10", "destination": DESTINATION, } payment_transaction = Payment.from_dict(payment_dict) signed_payment_transaction = safe_sign_and_autofill_transaction( payment_transaction, WALLET, JSON_RPC_CLIENT) response = send_reliable_submission(signed_payment_transaction, JSON_RPC_CLIENT) self.assertTrue(response.result["validated"]) self.assertEqual(response.result["meta"]["TransactionResult"], "tesSUCCESS") self.assertTrue(response.is_successful()) self.assertEqual(response.result["Fee"], get_fee(JSON_RPC_CLIENT)) WALLET.sequence += 1