Ejemplo n.º 1
0
async def _set_up_reusable_values():
    WALLET = await generate_faucet_wallet(ASYNC_JSON_RPC_CLIENT)
    DESTINATION = await generate_faucet_wallet(ASYNC_JSON_RPC_CLIENT)

    OFFER = await sign_and_reliable_submission_async(
        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 = await sign_and_reliable_submission_async(
        PaymentChannelCreate(
            account=WALLET.classic_address,
            sequence=WALLET.sequence,
            amount="1",
            destination=DESTINATION.classic_address,
            settle_delay=86400,
            public_key=WALLET.public_key,
        ),
        WALLET,
    )
    WALLET.sequence += 1

    return WALLET, DESTINATION, OFFER, PAYMENT_CHANNEL
Ejemplo n.º 2
0
    def test_get_hash(self):
        offer_create_dict = {
            "Account":
            "rLyttXLh7Ttca9CMUaD3exVoXY2fn2zwj3",
            "Fee":
            "10",
            "Flags":
            0,
            "LastLedgerSequence":
            16409087,
            "Sequence":
            16409064,
            "SigningPubKey":
            ("ED93BFA583E83331E9DC498DE4558CE4861ACFAB9385EBBC43BC56A0D9845A1DF2"
             ),
            "TakerGets":
            "13100000",
            "TakerPays": {
                "currency": "USD",
                "issuer": "rLyttXLh7Ttca9CMUaD3exVoXY2fn2zwj3",
                "value": "10",
            },
            "TransactionType":
            "OfferCreate",
            "TxnSignature":
            ("71135999783658A0CB4EBCF02E59ACD94C4D06D5BF909E05E6B97588155482BBA5985"
             "35AD4728ACA1F90C4DE73FFC741B0A6AB87141BDA8BCC2F2DF9CD8C3703"),
        }

        offer_create = OfferCreate.from_xrpl(offer_create_dict)
        expected_hash = (
            "66F3D6158CAB6E53405F8C264DB39F07D8D0454433A63DDFB98218ED1BC99B60")
        self.assertEqual(offer_create.get_hash(), expected_hash)
Ejemplo n.º 3
0
 async def test_basic_functionality(self, client):
     offer = await submit_transaction_async(
         OfferCreate(
             account=WALLET.classic_address,
             sequence=WALLET.sequence,
             taker_gets="13100000",
             taker_pays=IssuedCurrencyAmount(
                 currency="USD",
                 issuer=WALLET.classic_address,
                 value="10",
             ),
         ),
         WALLET,
     )
     self.assertTrue(offer.is_successful())
     WALLET.sequence += 1
Ejemplo n.º 4
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,
Ejemplo n.º 5
0
from xrpl.ledger import get_fee
from xrpl.models.amounts import IssuedCurrencyAmount
from xrpl.models.transactions import OfferCreate, PaymentChannelCreate
from xrpl.transaction import send_reliable_submission
from xrpl.wallet import generate_faucet_wallet

WALLET = generate_faucet_wallet(JSON_RPC_CLIENT)
DESTINATION = generate_faucet_wallet(JSON_RPC_CLIENT)
FEE = get_fee(JSON_RPC_CLIENT)
OFFER = send_reliable_submission(
    OfferCreate(
        account=WALLET.classic_address,
        fee=FEE,
        sequence=WALLET.next_sequence_num,
        last_ledger_sequence=WALLET.next_sequence_num + 10,
        taker_gets="13100000",
        taker_pays=IssuedCurrencyAmount(
            currency="USD",
            issuer=WALLET.classic_address,
            value="10",
        ),
    ),
    WALLET,
    JSON_RPC_CLIENT,
)
PAYMENT_CHANNEL = send_reliable_submission(
    PaymentChannelCreate(
        account=WALLET.classic_address,
        fee=FEE,
        sequence=WALLET.next_sequence_num,
        last_ledger_sequence=WALLET.next_sequence_num + 10,
        amount="1",