Exemplo n.º 1
0
def test_xrp_public_key_signature():
    private_key = RippleKey()
    key = RippleKey(public_key=private_key.to_public())
    data = {'Account': key.to_account()}

    with pytest.raises(AssertionError):
        key.sign_tx(data)
Exemplo n.º 2
0
    async def sign_and_submit(self, tx: dict, key: RippleKey) -> dict:
        """
        Signs, serializes and submits the transaction using provided key
        """
        tx = deepcopy(tx)

        if 'SigningPubKey' not in tx:
            tx['SigningPubKey'] = key.to_public()

        if 'Sequence' not in tx:
            info = await self.account_info(tx['Account'],
                                           ledger_index='current')
            tx['Sequence'] = info['account_data']['Sequence']

        tx['TxnSignature'] = key.sign_tx(tx)
        tx_blob = binascii.hexlify(serializer.serialize(tx)).decode()
        return await self.submit(tx_blob)
Exemplo n.º 3
0
def test_xrp_key_to_public():
    key = RippleKey(private_key='shHM53KPZ87Gwdqarm1bAmPeXg8Tn')
    assert key.to_public() == (
        b'\x03\xfa%\xb6\x8d\xa6\xffh2\xe4F/\xdf\xb9\xa2\xaa\xa5\x88\x88\xc0'
        b'\xed\x17(_\xfe\x92\xe4F^\x0cnx*')