Пример #1
0
 def test_from_xdr_muxed(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     destination2 = "GBL3NR5XNBNFAYVQMZ7R6RMUKLMGRUHNIYDYMEUPANQV6OROQXSDZYHV"
     send_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     dest_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     send_max = "3.0070000"
     dest_amount = "3.1415000"
     path = [
         Asset("USD", "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"),
         Asset("EUR", "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"),
     ]
     origin_xdr_obj = PathPaymentStrictReceive(
         destination, send_asset, send_max, dest_asset, dest_amount, path, source
     ).to_xdr_object()
     restore_op = PathPaymentStrictReceive.from_xdr_object(origin_xdr_obj)
     assert restore_op.to_xdr_object().to_xdr() == origin_xdr_obj.to_xdr()
     assert (
         restore_op._destination_muxed.to_xdr()
         == Keypair.from_public_key(destination).xdr_muxed_account().to_xdr()
     )
     restore_op.destination = destination2
     assert restore_op._destination_muxed is None
     assert restore_op.destination == destination2
 def test_from_xdr_obj_muxed_account(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = (
         "MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY"
     )
     send_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     dest_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     send_max = "3.0070000"
     dest_amount = "3.1415000"
     path = [
         Asset("USD", "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"),
         Asset("EUR", "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"),
     ]
     origin_xdr_obj = PathPaymentStrictReceive(
         destination, send_asset, send_max, dest_asset, dest_amount, path, source
     ).to_xdr_object()
     op = Operation.from_xdr_object(origin_xdr_obj)
     assert isinstance(op, PathPaymentStrictReceive)
     assert op.source == source
     assert op.destination == destination
     assert op.send_asset == send_asset
     assert op.dest_asset == dest_asset
     assert op.send_max == "3.007"
     assert op.dest_amount == "3.1415"
     assert op.path == path
 def test_from_xdr_obj(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     send_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     dest_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7"
     )
     send_max = "3.0070000"
     dest_amount = "3.1415000"
     path = [
         Asset("USD", "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"),
         Asset("EUR", "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"),
     ]
     origin_xdr_obj = PathPaymentStrictReceive(
         destination, send_asset, send_max, dest_asset, dest_amount, path, source
     ).to_xdr_object()
     op = Operation.from_xdr_object(origin_xdr_obj)
     assert isinstance(op, PathPaymentStrictReceive)
     assert op.source == source
     assert op.destination == destination
     assert op.send_asset == send_asset
     assert op.dest_asset == dest_asset
     assert op.send_max == "3.007"
     assert op.dest_amount == "3.1415"
     assert op.path == path
Пример #4
0
 def test_to_xdr_obj(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ"
     send_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     dest_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     send_max = "3.0070000"
     dest_amount = "3.1415000"
     path = [
         Asset("USD",
               "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"),
         Asset("EUR",
               "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"),
     ]
     op = PathPaymentStrictReceive(destination, send_asset, send_max,
                                   dest_asset, dest_amount, path, source)
     assert (
         op.to_xdr_object().to_xdr() ==
         "AAAAAQAAAADX7fRsY6KTqIc8EIDyr8M9gxGPW6ODnZoZDgo6l1ymwwAAAAIAAAABVVNEAAAAAADNTrgPO19O0EsnYjSc333yWGLKEVxLyu1kfKjCKOz9ewAAAAABytTwAAAAAImbKEDtVjbFbdxfFLI5dfefG6I4jSaU5MVuzd3JYOXvAAAAAVVTRAAAAAAAzU64DztfTtBLJ2I0nN998lhiyhFcS8rtZHyowijs/XsAAAAAAd9a2AAAAAIAAAABVVNEAAAAAABCzwVZeQ9sO2TeFRIN8Lslyqt9wttPtKGKNeiBvzI69wAAAAFFVVIAAAAAAObbxW5I9YIF6lfUJkfp3sADdrm5wJmdBv78Py6kKta1"
     )
Пример #5
0
 def test_to_xdr_obj_with_invalid_destination_raise(self):
     source = "GDL635DMMORJHKEHHQIIB4VPYM6YGEMPLORYHHM2DEHAUOUXLSTMHQDV"
     destination = "GCEZW"
     send_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     dest_asset = Asset(
         "USD", "GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7")
     send_max = "3.0070000"
     dest_amount = "3.1415000"
     path = [
         Asset("USD",
               "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB"),
         Asset("EUR",
               "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL"),
     ]
     with pytest.raises(Ed25519PublicKeyInvalidError):
         PathPaymentStrictReceive(destination, send_asset, send_max,
                                  dest_asset, dest_amount, path, source)