Esempio n. 1
0
def test_parse_value_bytes_text_final_key():
    from xdrparser.parser import parse_value
    assert parse_value(b'1-kik', '.0.txSet.txs.0.tx.memo.text') == '1-kik'
Esempio n. 2
0
def test_parse_value_regular_bytes_hash():
    from xdrparser.parser import parse_value
    bytes_value = b'\x1cM\xa7~\xb28\x9f%\x04G~n\xfa\x80\xcd\x1b0T\xae\xe3>\xb6\xa4\xa3\x96\xb6\xfdJ\xbb(s\xb2'
    expected_result = '1c4da77eb2389f2504477e6efa80cd1b3054aee33eb6a4a396b6fd4abb2873b2'
    assert parse_value(bytes_value, '.0.txSet.previousLedgerHash') == expected_result
Esempio n. 3
0
def test_parse_value_int_payment_amount_default():
    from xdrparser.parser import parse_value
    assert parse_value(60000000, '.0.txSet.txs.8.tx.operations.0.body.paymentOp.amount') == Decimal(600)
Esempio n. 4
0
def test_parse_value_int_other():
    from xdrparser.parser import parse_value
    assert parse_value(1000000, '.0.ledgerSeq') == 1000000
Esempio n. 5
0
def test_parse_value_int_starting_balance_less_than_1():
    from xdrparser.parser import parse_value
    assert parse_value(200, '.0.txSet.txs.0.tx.operations.0.body.createAccountOp.startingBalance') == \
           Decimal((0, (0, 0, 2), -3))
Esempio n. 6
0
def test_parse_value_int_starting_balance_not_raw_amount():
    from xdrparser.parser import parse_value
    assert parse_value(20000000, '.0.txSet.txs.0.tx.operations.0.body.createAccountOp.startingBalance',
                       False) == Decimal(200)
Esempio n. 7
0
def test_parse_value_bytes_signature():
    from xdrparser.parser import parse_value
    signature = b'r\xc9\xd5\x8d\x16\x9c\x0e\t&\xf97\x08\xa8\x98i\xc4\x95\xab\xaf\xbc\x82Q\xad\xef,\x1d\xf2\xd2mS\xbau\x07\xd1\xacw\x97\xee-\xeb\x96\xc8\xaaX\x13\x87Zb\xc2\xc02i\xd1\x82\xd9\x00c\x90-Q\xc2l\xa3\n'
    expected_result = 'csnVjRacDgkm+TcIqJhpxJWrr7yCUa3vLB3y0m1TunUH0ax3l+4t65bIqlgTh1piwsAyadGC2QBjkC1RwmyjCg=='
    assert parse_value(signature, '.0.txSet.txs.0.signatures.0.signature') == expected_result
Esempio n. 8
0
def test_parse_value_bytes_hint():
    from xdrparser.parser import parse_value
    expected_result = 'G______________________________________________F5MME____'
    assert parse_value(b'\xbdc\t^', '.0.txSet.txs.0.signatures.0.hint') == expected_result
Esempio n. 9
0
def test_parse_value_bytes_account():
    from xdrparser.parser import parse_value
    bytes_value = b'\x0e\xb4\xc8\x9e$1\r\xdc\x9e\xa0(kH?\xfar\xd5}A\xa7$\x84"\xdcn4`j\xbdc\t^'
    expected_result = 'GAHLJSE6EQYQ3XE6UAUGWSB77JZNK7KBU4SIIIW4NY2GA2V5MMEV4LRB'
    assert parse_value(bytes_value, '.0.txSet.txs.0.tx.sourceAccount.ed25519') == expected_result