Exemple #1
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())
Exemple #2
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")
Exemple #3
0
from tests.integration.it_utils import JSON_RPC_CLIENT, sign_and_reliable_submission
from xrpl.models.amounts import IssuedCurrencyAmount
from xrpl.models.transactions import OfferCreate, PaymentChannelCreate
from xrpl.wallet import generate_faucet_wallet

WALLET = generate_faucet_wallet(JSON_RPC_CLIENT)
DESTINATION = generate_faucet_wallet(JSON_RPC_CLIENT)

OFFER = sign_and_reliable_submission(
    OfferCreate(
        account=WALLET.classic_address,
        sequence=WALLET.sequence,
        taker_gets="13100000",
        taker_pays=IssuedCurrencyAmount(
            currency="USD",
            issuer=WALLET.classic_address,
            value="10",
        ),
    ),
    WALLET,
)
WALLET.sequence += 1

PAYMENT_CHANNEL = sign_and_reliable_submission(
    PaymentChannelCreate(
        account=WALLET.classic_address,
        sequence=WALLET.sequence,
        amount="1",
        destination=DESTINATION.classic_address,
        settle_delay=86400,
        public_key=WALLET.public_key,
# Define the network client
from xrpl.clients import JsonRpcClient
JSON_RPC_URL = "https://s.altnet.rippletest.net:51234/"
client = JsonRpcClient(JSON_RPC_URL)

# Create a wallet using the testnet faucet:
# https://xrpl.org/xrp-testnet-faucet.html
from xrpl.wallet import generate_faucet_wallet
test_wallet = generate_faucet_wallet(client, debug=True)

# Create an account str from the wallet
test_account = test_wallet.classic_address

# Derive an x-address from the classic address:
# https://xrpaddress.info/
from xrpl.core import addresscodec
test_xaddress = addresscodec.classic_address_to_xaddress(test_account,
                                                         tag=12345,
                                                         is_test_network=True)
print("\nClassic address:\n\n", test_account)
print("X-address:\n\n", test_xaddress)

# Prepare payment
from xrpl.models.transactions import Payment
from xrpl.utils import xrp_to_drops
my_tx_payment = Payment(
    account=test_account,
    amount=xrp_to_drops(22),
    destination="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
)
Exemple #5
0
    sign_and_reliable_submission_async,
    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"])
Exemple #6
0
    def new_wallet(self) -> dict:

        test_wallet = generate_faucet_wallet(self.client, debug=False)
        return {'private_key':test_wallet.private_key,'classic_address':test_wallet.classic_address,'public_key':test_wallet.public_key ,\
               'sequence':test_wallet.sequence,'seed':test_wallet.seed }
# Stand-alone code sample for the "issue a token" tutorial:
# https://xrpl.org/issue-a-fungible-token.html
# License: https://github.com/XRPLF/xrpl-dev-portal/blob/master/LICENSE

# Connect ----------------------------------------------------------------------
import xrpl
testnet_url = "https://s.altnet.rippletest.net:51234"
client = xrpl.clients.JsonRpcClient(testnet_url)

# Get credentials from the Testnet Faucet --------------------------------------
# For production, instead create a Wallet instance
faucet_url = "https://faucet.altnet.rippletest.net/accounts"
print("Getting 2 new accounts from the Testnet faucet...")
from xrpl.wallet import generate_faucet_wallet
cold_wallet = generate_faucet_wallet(client, debug=True)
hot_wallet = generate_faucet_wallet(client, debug=True)

# Configure issuer (cold address) settings -------------------------------------
cold_settings_tx = xrpl.models.transactions.AccountSet(
    account=cold_wallet.classic_address,
    transfer_rate=0,
    tick_size=5,
    domain=bytes.hex("example.com".encode("ASCII")),
    set_flag=xrpl.models.transactions.AccountSetFlag.ASF_DEFAULT_RIPPLE,
)
cst_prepared = xrpl.transaction.safe_sign_and_autofill_transaction(
    transaction=cold_settings_tx,
    wallet=cold_wallet,
    client=client,
)
print("Sending cold address AccountSet transaction...")