Exemplo n.º 1
0
 async def test_basic_functionality(self, client):
     issuer_wallet = Wallet.create()
     response = await submit_transaction_async(
         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
Exemplo n.º 2
0
 def test_basic_functionality(self):
     issuer_wallet = Wallet.create()
     response = submit_transaction(
         TrustSet(
             account=WALLET.classic_address,
             sequence=WALLET.next_sequence_num,
             fee=FEE,
             flags=TrustSetFlag.TF_SET_NO_RIPPLE,
             limit_amount=IssuedCurrencyAmount(
                 issuer=issuer_wallet.classic_address,
                 currency="USD",
                 value="100",
             ),
         ),
         WALLET,
     )
     self.assertTrue(response.is_successful())
Exemplo n.º 3
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
Exemplo n.º 4
0
    test_async_and_sync,
)
from tests.integration.reusable_values import DESTINATION, WALLET
from xrpl.asyncio.account import (
    does_account_exist,
    get_account_info,
    get_account_transactions,
    get_balance,
    get_latest_transaction,
)
from xrpl.core.addresscodec import classic_address_to_xaddress
from xrpl.models.transactions import Payment
from xrpl.wallet import Wallet, generate_faucet_wallet

NEW_WALLET = generate_faucet_wallet(JSON_RPC_CLIENT)
EMPTY_WALLET = Wallet.create()


class TestAccount(IntegrationTestCase):
    @test_async_and_sync(globals(), ["xrpl.account.does_account_exist"])
    async def test_does_account_exist_true(self, client):
        self.assertTrue(await does_account_exist(WALLET.classic_address,
                                                 client))

    @test_async_and_sync(globals(), ["xrpl.account.does_account_exist"])
    async def test_does_account_exist_false(self, client):
        address = "rG1QQv2nh2gr7RCZ1P8YYcBUcCCN633jCn"
        self.assertFalse(await does_account_exist(address, client))

    @test_async_and_sync(globals(), ["xrpl.account.does_account_exist"])
    async def test_does_account_exist_xaddress(self, client):
Exemplo n.º 5
0
    def test_basic_functionality(self):
        #
        # Perform multisign
        #
        # NOTE: If you need to use xrpl-py for multisigning, please create an issue on
        # the repo. We'd like to gauge interest in higher level multisigning
        # functionality.
        issuer = Wallet.create()
        tx = TrustSet(
            account=WALLET.classic_address,
            sequence=WALLET.next_sequence_num,
            fee=FEE,
            flags=TrustSetFlag.TF_SET_NO_RIPPLE,
            limit_amount=IssuedCurrencyAmount(
                issuer=issuer.classic_address,
                currency="USD",
                value="10",
            ),
        )
        tx_json = transaction_json_to_binary_codec_form(tx.to_dict())
        first_sig = sign(
            bytes.fromhex(
                encode_for_multisigning(
                    tx_json,
                    FIRST_SIGNER.classic_address,
                )),
            FIRST_SIGNER.private_key,
        )
        second_sig = sign(
            bytes.fromhex(
                encode_for_multisigning(
                    tx_json,
                    SECOND_SIGNER.classic_address,
                )),
            SECOND_SIGNER.private_key,
        )
        multisigned_tx = TrustSet(
            account=WALLET.classic_address,
            sequence=WALLET.next_sequence_num,
            fee=FEE,
            flags=TrustSetFlag.TF_SET_NO_RIPPLE,
            limit_amount=IssuedCurrencyAmount(
                issuer=issuer.classic_address,
                currency="USD",
                value="10",
            ),
            signers=[
                Signer(
                    account=FIRST_SIGNER.classic_address,
                    txn_signature=first_sig,
                    signing_pub_key=FIRST_SIGNER.public_key,
                ),
                Signer(
                    account=SECOND_SIGNER.classic_address,
                    txn_signature=second_sig,
                    signing_pub_key=SECOND_SIGNER.public_key,
                ),
            ],
        )

        # submit tx
        response = JSON_RPC_CLIENT.request(
            SubmitMultisigned(tx_json=transaction_json_to_binary_codec_form(
                multisigned_tx.to_dict()), ))
        self.assertTrue(response.is_successful())
Exemplo n.º 6
0
from xrpl.models.requests import SubmitMultisigned
from xrpl.models.transactions import (
    Signer,
    SignerEntry,
    SignerListSet,
    TrustSet,
    TrustSetFlag,
)
from xrpl.transaction import transaction_json_to_binary_codec_form
from xrpl.wallet import Wallet

FEE = get_fee(JSON_RPC_CLIENT)

#
# Set up signer list
FIRST_SIGNER = Wallet.create()
SECOND_SIGNER = Wallet.create()
LIST_SET_TX = sign_and_reliable_submission(
    SignerListSet(
        account=WALLET.classic_address,
        sequence=WALLET.next_sequence_num,
        last_ledger_sequence=WALLET.next_sequence_num + 10,
        fee=FEE,
        signer_quorum=2,
        signer_entries=[
            SignerEntry(
                account=FIRST_SIGNER.classic_address,
                signer_weight=1,
            ),
            SignerEntry(
                account=SECOND_SIGNER.classic_address,