def test_from_xdr_object_alphanum12(self): code = "Banana" issuer = "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY" type = "credit_alphanum12" asset_code = kuknos_xdr.AssetCode12( bytearray(code, "ascii") + b"\x00" * (12 - len(code))) asset = kuknos_xdr.AssetAlphaNum12( asset_code=asset_code, issuer=Keypair.from_public_key(issuer).xdr_account_id(), ) xdr = kuknos_xdr.Asset( type=kuknos_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
def test_from_xdr_object_native(self): xdr_type = kuknos_xdr.AssetType.ASSET_TYPE_NATIVE xdr = kuknos_xdr.Asset(type=xdr_type) asset = Asset.from_xdr_object(xdr) assert asset.is_native()