Ejemplo n.º 1
0
    def test_from_xdr_object_alphanum12(self):
        code = "Banana"
        issuer = "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY"
        type = "credit_alphanum12"

        x = Xdr.nullclass()
        x.assetCode = bytearray(code, "ascii") + b"\x00" * 6
        x.issuer = Keypair.from_public_key(issuer).xdr_account_id()
        xdr_type = Xdr.const.ASSET_TYPE_CREDIT_ALPHANUM12
        xdr = Xdr.types.Asset(type=xdr_type, alphaNum12=x)

        asset = Asset.from_xdr_object(xdr)
        assert asset.code == code
        assert asset.issuer == issuer
        assert asset.type == type
Ejemplo n.º 2
0
 def test_from_xdr_object_alphanum12(self):
     code = "Banana"
     issuer = "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY"
     type = "credit_alphanum12"
     asset_code = stellar_xdr.AssetCode12(
         bytearray(code, "ascii") + b"\x00" * (12 - len(code)))
     asset = stellar_xdr.AssetAlphaNum12(
         asset_code=asset_code,
         issuer=Keypair.from_public_key(issuer).xdr_account_id(),
     )
     xdr = stellar_xdr.Asset(
         type=stellar_xdr.AssetType.ASSET_TYPE_CREDIT_ALPHANUM12,
         alpha_num12=asset)
     asset = Asset.from_xdr_object(xdr)
     assert asset.code == code
     assert asset.issuer == issuer
     assert asset.type == type
Ejemplo n.º 3
0
    def test_from_xdr_object_native(self):
        xdr_type = Xdr.const.ASSET_TYPE_NATIVE
        xdr = Xdr.types.Asset(type=xdr_type)

        asset = Asset.from_xdr_object(xdr)
        assert asset.is_native()
Ejemplo n.º 4
0
    def test_from_xdr_object_native(self):
        xdr_type = stellar_xdr.AssetType.ASSET_TYPE_NATIVE
        xdr = stellar_xdr.Asset(type=xdr_type)

        asset = Asset.from_xdr_object(xdr)
        assert asset.is_native()