예제 #1
0
 def test_high_fee_account_delete_unauthorized(self):
     # We expect an XRPLException to be raised
     with self.assertRaises(XRPLException):
         # GIVEN a new AccountDelete transaction
         account_delete = AccountDelete(
             account=ACCOUNT,
             # WITH fee higher than 5 XRP
             fee=FEE,
             sequence=WALLET.sequence,
             destination=DESTINATION,
             destination_tag=DESTINATION_TAG,
         )
         submit_transaction(account_delete, WALLET)
예제 #2
0
 def test_high_fee_account_set_unauthorized(self):
     # GIVEN a new AccountSet transaction
     account_set = AccountSet(
         account=ACCOUNT,
         sequence=WALLET.sequence,
         clear_flag=CLEAR_FLAG,
         domain=DOMAIN,
         email_hash=EMAIL_HASH,
         message_key=MESSAGE_KEY,
         transfer_rate=TRANSFER_RATE,
         tick_size=TICK_SIZE,
         # WITH fee higher than 2 XRP
         fee=FEE,
     )
     # We expect an XRPLException to be raised
     with self.assertRaises(XRPLException):
         submit_transaction(account_set, WALLET)
예제 #3
0
 def test_authorize(self):
     deposit_preauth = DepositPreauth(
         account=ACCOUNT,
         fee=FEE,
         sequence=WALLET.next_sequence_num,
         authorize=ADDRESS,
     )
     response = submit_transaction(deposit_preauth, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
예제 #4
0
 def test_unauthorize(self):
     deposit_preauth = DepositPreauth(
         account=ACCOUNT,
         sequence=WALLET.sequence,
         unauthorize=ADDRESS,
     )
     response = submit_transaction(deposit_preauth, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     WALLET.sequence += 1
예제 #5
0
 def test_required_fields_and_set_flag(self):
     account_set = AccountSet(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         set_flag=SET_FLAG,
     )
     response = submit_transaction(account_set, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     self.assertEqual(response.result["engine_result"], "tesSUCCESS")
     WALLET.next_sequence_num += 1
예제 #6
0
 def test_all_fields(self):
     escrow_cancel = EscrowCancel(
         account=ACCOUNT,
         sequence=WALLET.sequence,
         owner=OWNER,
         offer_sequence=OFFER_SEQUENCE,
     )
     response = submit_transaction(escrow_cancel, WALLET)
     # Actual engine_result is `tecNO_TARGET since OWNER account doesn't exist
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
예제 #7
0
 def test_all_fields(self):
     account_delete = AccountDelete(
         account=ACCOUNT,
         fee=FEE,
         sequence=WALLET.next_sequence_num,
         destination=DESTINATION.classic_address,
         destination_tag=DESTINATION_TAG,
     )
     response = submit_transaction(account_delete, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
예제 #8
0
 def test_all_fields(self):
     response = submit_transaction(
         OfferCancel(
             account=WALLET.classic_address,
             fee=FEE,
             sequence=WALLET.next_sequence_num,
             offer_sequence=OFFER.result["Sequence"],
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
예제 #9
0
 def test_generate_faucet_wallet_dev(self):
     wallet = generate_faucet_wallet(DEV_JSON_RPC_CLIENT)
     account_set = AccountSet(
         account=wallet.classic_address,
         fee="10",
         sequence=wallet.sequence,
         set_flag=3,
     )
     response = submit_transaction(account_set, wallet, client=DEV_JSON_RPC_CLIENT)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     self.assertEqual(response.result["engine_result"], "tesSUCCESS")
예제 #10
0
 def test_required_fields_with_deliver_min(self):
     check_cash = CheckCash(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         check_id=CHECK_ID,
         deliver_min=DELIVER_MIN,
     )
     response = submit_transaction(check_cash, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     self.assertEqual(response.result["engine_result"], "tecNO_ENTRY")
     WALLET.next_sequence_num += 1
예제 #11
0
 def test_receiver_claim(self):
     response = submit_transaction(
         PaymentChannelClaim(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             channel=PAYMENT_CHANNEL.result["hash"],
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.sequence += 1
예제 #12
0
 def test_basic_functionality(self):
     response = submit_transaction(
         PaymentChannelFund(
             account=WALLET.classic_address,
             sequence=WALLET.next_sequence_num,
             channel=PAYMENT_CHANNEL.result["hash"],
             amount="1",
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
예제 #13
0
 def test_required_fields_with_amount(self):
     check_cash = CheckCash(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         check_id=CHECK_ID,
         amount=AMOUNT,
     )
     response = submit_transaction(check_cash, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     # Getting `tecNO_ENTRY` codes because using a non-existent check ID
     self.assertEqual(response.result["engine_result"], "tecNO_ENTRY")
     WALLET.next_sequence_num += 1
예제 #14
0
 def test_all_fields(self):
     regular_key = Wallet.create().classic_address
     response = submit_transaction(
         SetRegularKey(
             account=WALLET.classic_address,
             sequence=WALLET.next_sequence_num,
             regular_key=regular_key,
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.next_sequence_num += 1
예제 #15
0
 def test_basic_functionality(self):
     response = submit_transaction(
         Payment(
             account=WALLET.classic_address,
             sequence=WALLET.next_sequence_num,
             amount="1",
             destination=DESTINATION.classic_address,
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.next_sequence_num += 1
예제 #16
0
 def test_all_fields(self):
     escrow_finish = EscrowFinish(
         account=ACCOUNT,
         sequence=WALLET.sequence,
         owner=OWNER,
         offer_sequence=OFFER_SEQUENCE,
         condition=CONDITION,
         fulfillment=FULFILLMENT,
     )
     response = submit_transaction(escrow_finish, WALLET)
     # Actual engine_result will be 'tecNO_TARGET' since using non-extant
     # account for OWNER
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
예제 #17
0
 def test_all_fields(self):
     check_create = CheckCreate(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         destination=DESTINATION.classic_address,
         destination_tag=DESTINATION_TAG,
         send_max=SENDMAX,
         expiration=EXPIRATION,
         invoice_id=INVOICE_ID,
     )
     response = submit_transaction(check_create, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     self.assertEqual(response.result["engine_result"], "tesSUCCESS")
     WALLET.next_sequence_num += 1
예제 #18
0
 def test_generate_faucet_wallet_rel_sub(self):
     destination = generate_faucet_wallet(DEV_JSON_RPC_CLIENT)
     wallet = generate_faucet_wallet(DEV_JSON_RPC_CLIENT)
     response = submit_transaction(
         Payment(
             account=wallet.classic_address,
             sequence=wallet.next_sequence_num,
             fee="10",
             amount="1",
             destination=destination.classic_address,
         ),
         wallet,
         client=DEV_JSON_RPC_CLIENT,
     )
     self.assertTrue(response.is_successful())
예제 #19
0
 def test_all_fields(self):
     escrow_create = EscrowCreate(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         amount=AMOUNT,
         destination=DESTINATION,
         destination_tag=DESTINATION_TAG,
         cancel_after=CANCEL_AFTER,
         finish_after=FINISH_AFTER,
         source_tag=SOURCE_TAG,
     )
     response = submit_transaction(escrow_create, WALLET)
     # Actual engine_result will be `tecNO_PERMISSION`...
     # maybe due to CONDITION or something
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
예제 #20
0
 def test_all_fields_minus_set_flag(self):
     account_set = AccountSet(
         account=ACCOUNT,
         sequence=WALLET.next_sequence_num,
         clear_flag=CLEAR_FLAG,
         domain=DOMAIN,
         email_hash=EMAIL_HASH,
         message_key=MESSAGE_KEY,
         transfer_rate=TRANSFER_RATE,
         tick_size=TICK_SIZE,
     )
     response = submit_transaction(account_set, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     self.assertEqual(response.result["engine_result"], "tesSUCCESS")
     WALLET.next_sequence_num += 1
예제 #21
0
 def test_all_fields(self):
     response = submit_transaction(
         OfferCancel(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             offer_sequence=OFFER.result["Sequence"],
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     # NOTE: offer cancellations are difficult to test because not
     # specifying an offer ID to cancel is not considered an error.
     #
     # This TX will result in a success essentially as long as it is
     # correctly formatted.
     WALLET.sequence += 1
예제 #22
0
 def test_all_fields(self):
     check_cancel = CheckCancel(
         account=ACCOUNT,
         sequence=WALLET.sequence,
         check_id=CHECK_ID,
     )
     response = submit_transaction(check_cancel, WALLET)
     self.assertEqual(response.status, ResponseStatus.SUCCESS)
     # This transaction shouldn't actually succeed, because this isn't a real check:
     # Docs for tecNO_ENTRY read:
     # "The transaction tried to modify a ledger object, such as a Check,
     # Payment Channel, or Deposit Preauthorization, but the specified object
     # does not exist. It may have already been deleted by a previous
     # transaction or the transaction may have an incorrect value in an
     # ID field such as CheckID, Channel, Unauthorize."
     self.assertEqual(response.result["engine_result"], "tecNO_ENTRY")
     WALLET.sequence += 1
예제 #23
0
 def test_basic_functionality(self):
     issuer_wallet = Wallet.create()
     response = submit_transaction(
         TrustSet(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             flags=TrustSetFlag.TF_SET_NO_RIPPLE,
             limit_amount=IssuedCurrencyAmount(
                 issuer=issuer_wallet.classic_address,
                 currency="USD",
                 value="100",
             ),
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.sequence += 1
예제 #24
0
 def test_payment_high_fee_authorized(self):
     # GIVEN a new Payment transaction
     response = submit_transaction(
         Payment(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             amount="1",
             # WITH the fee higher than 2 XRP
             fee=FEE,
             destination=DESTINATION,
         ),
         WALLET,
         # WITHOUT checking the fee value
         check_fee=False,
     )
     # THEN we expect the transaction to be successful
     self.assertTrue(response.is_successful())
     WALLET.sequence += 1
예제 #25
0
 def test_add_signer(self):
     # sets up another signer for this account
     other_signer = Wallet.create()
     response = submit_transaction(
         SignerListSet(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             signer_quorum=1,
             signer_entries=[
                 SignerEntry(
                     account=other_signer.classic_address,
                     signer_weight=1,
                 ),
             ],
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
     WALLET.sequence += 1